/* ============================================================
   bryndeli — base.css
   Design tokens, reset, typography, shared components.
   Loaded on every page.
   ============================================================ */

/* ============= TOKENS ============= */
:root {
  --pine: #2F5D4E;
  --pine-deep: #1F4034;
  --pine-soft: #4A7868;
  --terracotta: #C9614A;
  --terracotta-deep: #A84A35;
  --terracotta-soft: #E08570;
  --oat: #F8EDE0;
  --oat-deep: #EFE2D0;
  --oat-warm: #F2E5D0;
  --honey: #E0B469;
  --bark: #2A2520;
  --bark-soft: #4A423A;
  --rule: rgba(47, 93, 78, 0.14);
  --rule-strong: rgba(47, 93, 78, 0.28);

  --serif: 'Fraunces', 'Charter', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  --container: 1240px;
  --gutter: 32px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --shadow-card: 0 1px 2px rgba(31, 64, 52, 0.04), 0 8px 24px -10px rgba(31, 64, 52, 0.18);
  --shadow-card-strong: 0 6px 16px -8px rgba(31, 64, 52, 0.20), 0 24px 48px -20px rgba(31, 64, 52, 0.30);
  --shadow-card-hover: 0 2px 4px rgba(31, 64, 52, 0.05), 0 14px 32px -12px rgba(31, 64, 52, 0.24);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 32px;
}

/* ============= RESET ============= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  font-family: var(--sans);
  background: var(--oat);
  color: var(--bark);
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Subtle paper grain overlay — keeps the warm "made object" feel */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.45;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.36 0 0 0 0 0.31 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--terracotta); color: var(--oat); }

/* ============= LAYOUT ============= */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
  z-index: 2;
}

/* ============= LINKS ============= */
a.link {
  color: var(--pine);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 100% 1px;
  transition: background-size 0.35s var(--ease);
}
a.link:hover { background-size: 100% 2px; }

/* ============= NAV (sticky, top of every page) =============
   The nav is a direct child of <body> on every page so position:sticky
   tracks the viewport across the whole page. Its own max-width + gutter
   give it the identical box on every route (no .container wrapper needed). */
nav {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(to bottom, var(--oat) 70%, transparent);
  backdrop-filter: blur(0);
  transition: backdrop-filter 0.3s, padding 0.3s;
}
nav.scrolled {
  padding: 18px var(--gutter);
  backdrop-filter: blur(8px);
  background: rgba(248, 237, 224, 0.92);
}

.logo-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: var(--serif);
}
.logo-lockup svg { width: 34px; height: 34px; transition: transform 0.5s var(--ease); flex-shrink: 0; }
.logo-lockup:hover svg { transform: rotate(64deg); }
.logo-lockup .word {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--pine);
}

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
  align-items: center;
  justify-self: center;
}

/* Right-hand action group (Sign in + Book a demo) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
}
.nav-links a {
  color: var(--bark-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.18s;
}
.nav-links a:hover { color: var(--pine); }
.nav-links a[aria-current="page"] {
  color: var(--pine);
  font-weight: 600;
}
.mobile-menu a[aria-current="page"] { color: var(--terracotta); }

/* Back-link variant used on inner pages (about, legal) */
.nav-back {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--bark-soft);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-back:hover { color: var(--pine); }

/* ============= MOBILE MENU ============= */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  align-items: center;
  gap: 8px;
  color: var(--pine);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s;
}
.nav-toggle:hover { background: rgba(47, 93, 78, 0.05); }
.nav-toggle .bars {
  position: relative;
  width: 18px;
  height: 14px;
  flex-shrink: 0;
}
.nav-toggle .bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.6px;
  background: var(--pine);
  border-radius: 2px;
  transform-origin: center;
  transition: top 0.25s var(--ease), bottom 0.25s var(--ease), transform 0.3s var(--ease) 0.05s, opacity 0.15s;
}
.nav-toggle .bars span:nth-child(1) { top: 0; }
.nav-toggle .bars span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.nav-toggle .bars span:nth-child(3) { bottom: 0; }

.nav-toggle[aria-expanded="true"] .bars span {
  /* Speed up the rotation phase, delay it until the bars have re-centered */
  transition: top 0.2s var(--ease), bottom 0.2s var(--ease), transform 0.25s var(--ease) 0.18s, opacity 0.15s;
}
.nav-toggle[aria-expanded="true"] .bars span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .bars span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .bars span:nth-child(3) {
  bottom: 50%;
  transform: translateY(50%) rotate(-45deg);
}

.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--oat);
  z-index: 49;
  padding: 100px 32px 40px;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  overflow-y: auto;
}
.mobile-menu.open {
  display: flex;
  opacity: 1;
}
.mobile-menu a {
  display: block;
  padding: 18px 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--pine-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: color 0.2s;
}
.mobile-menu a:hover, .mobile-menu a:active { color: var(--terracotta); }
.mobile-menu a:last-child { border-bottom: none; margin-top: 24px; }
.mobile-menu .mobile-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--pine);
  color: var(--oat);
  padding: 18px 32px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  border: none;
  text-align: center;
}
.mobile-menu .mobile-cta:hover { color: var(--oat); background: var(--pine-deep); }

/* Lock background scroll while the mobile menu is open. The scroll container on
   mobile is usually <html>, so locking only <body> lets the page (and the sticky
   header) keep scrolling behind the overlay — lock the root element too. */
body.menu-open { overflow: hidden; }
html:has(body.menu-open) { overflow: hidden; }

/* ============= BUTTONS ============= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  background: var(--pine);
  color: var(--oat);
  text-decoration: none;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, box-shadow 0.2s;
  position: relative;
}
.btn:hover {
  background: var(--pine-deep);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -10px rgba(31, 64, 52, 0.4);
}
.btn .arr { transition: transform 0.3s var(--ease); }
.btn:hover .arr { transform: translateX(3px); }

.btn-outline {
  background: transparent;
  color: var(--pine);
  border: 1px solid var(--rule-strong);
}
.btn-outline:hover {
  background: var(--pine);
  color: var(--oat);
  border-color: var(--pine);
}

/* Sign in — bordered pill CTA with a leading user icon */
.btn-signin {
  background: transparent;
  color: var(--pine);
  border: 1px solid var(--rule-strong);
  gap: 8px;
}
.btn-signin:hover {
  background: var(--pine);
  color: var(--oat);
  border-color: var(--pine);
}
.btn-signin svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.btn-large { padding: 18px 32px; font-size: 16px; }

/* ============= EYEBROW LABEL ============= */
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--pine);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 24px;
  font-weight: 500;
}
.section-eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--terracotta);
}

/* ============= REVEAL ON SCROLL ============= */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal.delay-1 { transition-delay: 0.08s; }
.reveal.delay-2 { transition-delay: 0.16s; }
.reveal.delay-3 { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ============= FOOTER ============= */
footer {
  padding: 80px 0 40px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 56px;
  margin-bottom: 56px;
}
.footer-brand .logo-lockup { margin-bottom: 18px; }
.footer-brand p {
  color: var(--bark-soft);
  font-size: 14px;
  max-width: 280px;
  line-height: 1.6;
}
.footer-col h5 {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--pine);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 18px;
  font-weight: 500;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a {
  color: var(--bark-soft);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--pine); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--bark-soft);
  text-transform: uppercase;
  flex-wrap: wrap;
  gap: 12px;
}

/* Compact footer used on inner pages (about, legal) */
footer.page-foot {
  padding: 32px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--bark-soft);
  text-transform: uppercase;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--rule);
  margin-top: 0;
}

/* ============= FOCUS ============= */
:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ============= RESPONSIVE: SHARED ============= */
@media (max-width: 980px) {
  nav { display: flex; justify-content: space-between; }
  .nav-links,
  .nav-actions { display: none; }
  .nav-toggle { display: inline-flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; }
}
@media (max-width: 580px) {
  :root { --gutter: 20px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
}
@media (max-width: 380px) {
  :root { --gutter: 16px; }
}
