/* ================================================
   LAYOUT — Tonic Desk Marketing Site
   ================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-body);
  letter-spacing: var(--tracking-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* ss01 = stylistic-set 1 alternates; cv11 = single-storey a;
     tnum = tabular numerals so prices line up. */
  font-feature-settings: "ss01", "cv11", "tnum";
  overflow-x: hidden;
}

img, video, svg { display: block; max-width: 100%; }
a { color: var(--brand-emphasis); text-decoration: none; transition: color var(--duration-fast) ease; }
a:hover { color: var(--color-primary-700); }

/* ---- Container ---- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.container--narrow { max-width: var(--content-narrow); }
.container--wide { max-width: var(--content-wide); }

/* ---- Navbar ---- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-xl);
  z-index: 1000;
  transition: background-color var(--duration-normal) ease,
              box-shadow var(--duration-normal) ease,
              backdrop-filter var(--duration-normal) ease;
}

.navbar--transparent {
  background: transparent;
}

.navbar--solid {
  background: color-mix(in oklch, var(--bg-elevated) 92%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow: var(--shadow);
  border-bottom: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
}

.navbar__inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: var(--content-wide);
  margin: 0 auto;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  flex-shrink: 0;
}

.navbar__logo-img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.15));
}

/* Custom Tonic Desk wordmark — two transparent-bg PNG variants. The
   <picture> blocks in the markup both carry .navbar__brand-img; the
   light/dark suffix toggles which one shows per theme. Both PNGs
   have proper alpha so no blend-mode tricks needed. */
.navbar__brand-img {
  height: 32px;
  width: auto;
  max-width: 200px;
  display: block;
  flex-shrink: 0;
}
.navbar__brand-img img {
  height: 32px;
  width: auto;
  display: block;
}
.navbar__brand-img--light { display: block; }
.navbar__brand-img--dark { display: none; }

[data-theme="dark"] .navbar__brand-img--light { display: none; }
[data-theme="dark"] .navbar__brand-img--dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .navbar__brand-img--light { display: none; }
  :root:not([data-theme="light"]) .navbar__brand-img--dark { display: block; }
}

/* Footer is always-dark — single cream-on-transparent wordmark. */
.footer__brand-img {
  height: 32px;
  width: auto;
  max-width: 200px;
  display: block;
}

.navbar__wordmark {
  font-size: var(--font-size-xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  transition: color var(--duration-fast) ease;
}

.navbar--transparent .navbar__wordmark { color: var(--text); }

.navbar__links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  margin-left: var(--space-3xl);
  list-style: none;
}

.navbar__link {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
  white-space: nowrap;
}

.navbar__link:hover { color: var(--text-primary); }
.navbar--transparent .navbar__link { color: var(--text-muted); }
.navbar--transparent .navbar__link:hover { color: var(--text); }

.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-left: auto;
}

/* Mobile menu toggle */
.navbar__toggle {
  display: none;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  position: relative;
}

.navbar__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  margin: 5px auto;
  border-radius: 2px;
  transition: transform var(--duration-normal) var(--ease-out),
              opacity var(--duration-fast) ease;
}

.navbar--transparent .navbar__toggle span { background: var(--text); }

.navbar__toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar__toggle.active span:nth-child(2) { opacity: 0; }
.navbar__toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav panel */
.navbar__mobile {
  display: none;
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-surface);
  padding: var(--space-xl);
  overflow-y: auto;
  z-index: 999;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.navbar__mobile.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.navbar__mobile a {
  display: block;
  padding: var(--space-md) 0;
  font-size: var(--font-size-lg);
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-subtle);
}

/* ---- Sections ---- */
.section {
  padding: var(--space-5xl) 0;
}

.section--hero {
  background: var(--bg-hero);
  padding: calc(var(--navbar-height) + var(--space-5xl)) 0 var(--space-5xl);
  position: relative;
  overflow: hidden;
}

/* Noise grain overlay — atmospheric tooth against the citrus gradient */
.section--hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/></svg>");
  pointer-events: none;
  mix-blend-mode: multiply;
  z-index: 0;
}

/* Dual radial overlays — warm highlight + tonic-tinted depth */
.section--hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 25% 30%, rgba(255, 251, 230, 0.5), transparent 50%),
    radial-gradient(ellipse at 75% 65%, rgba(15, 179, 158, 0.08), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.section--hero > .container { position: relative; z-index: 1; }

/* Effervescent bubbles — white on yellow */
.hero-bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-bubbles span {
  position: absolute;
  width: var(--size, 4px);
  height: var(--size, 4px);
  border-radius: 50%;
  background: rgba(255, 255, 255, var(--alpha, 0.4));
  bottom: -10%;
  animation: bubble-rise var(--dur, 8s) var(--delay, 0s) infinite linear;
  animation-timing-function: ease-out;
}

@keyframes bubble-rise {
  0%   { transform: translateY(0) translateX(0) scale(0.5); opacity: 0; }
  8%   { transform: translateY(-8vh) translateX(calc(var(--drift) * 0.1)) scale(0.8); opacity: var(--alpha, 0.15); }
  50%  { transform: translateY(-50vh) translateX(calc(var(--drift) * 0.6)) scale(1); }
  92%  { transform: translateY(-95vh) translateX(var(--drift)) scale(1.2); opacity: var(--alpha, 0.15); }
  100% { transform: translateY(-105vh) translateX(var(--drift)) scale(1.4); opacity: 0; }
}

/* Bottom edge glow */
.section--hero .hero-edge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.08), transparent);
}

/* ---- Hero Showcase (screenshot + tonic garnish) ---- */
.hero-showcase {
  position: relative;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.hero-showcase__frame {
  position: relative;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  padding: var(--space-3xl) var(--space-xl);
  border-radius: var(--radius-2xl);
}

.hero-garnish {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  height: auto;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.25));
}

/* Lemon wedge — top right, bold and proud */
.hero-garnish--lemon {
  width: 180px;
  top: -50px;
  right: -40px;
  transform: rotate(12deg);
}

/* Ice cube 1 — bottom left, bold */
.hero-garnish--ice1 {
  width: 130px;
  bottom: -35px;
  left: -30px;
  transform: rotate(-8deg);
}

/* Ice cube 2 — bottom right */
.hero-garnish--ice2 {
  width: 100px;
  bottom: -20px;
  right: 60px;
  transform: rotate(35deg);
}

@media (max-width: 768px) {
  .hero-garnish--lemon { width: 100px; top: -30px; right: -15px; }
  .hero-garnish--ice1 { width: 75px; bottom: -20px; left: -10px; }
  .hero-garnish--ice2 { width: 60px; bottom: -10px; right: 20px; }
}

@media (max-width: 480px) {
  .hero-garnish--lemon { width: 70px; top: -20px; right: -5px; }
  .hero-garnish--ice1 { width: 50px; bottom: -12px; left: -5px; }
  .hero-garnish--ice2 { display: none; }
}

/* ---- Hero garnish parallax via scroll-timeline ---- */
/* Modern browsers (Chrome 115+, Safari 17+, Firefox behind flag) drive
   the parallax in CSS off scroll progress — no JS scroll listener needed.
   animations.js falls back to a JS parallax when @supports is false.
   Keyframes preserve each garnish's existing rotation so the rest
   transition cleanly. */
@supports (animation-timeline: scroll()) {
  .hero-garnish--lemon {
    animation: hero-garnish-parallax-lemon linear;
    animation-timeline: scroll();
    animation-range: 0vh 120vh;
  }
  .hero-garnish--ice1 {
    animation: hero-garnish-parallax-ice1 linear;
    animation-timeline: scroll();
    animation-range: 0vh 120vh;
  }
  .hero-garnish--ice2 {
    animation: hero-garnish-parallax-ice2 linear;
    animation-timeline: scroll();
    animation-range: 0vh 120vh;
  }
  @keyframes hero-garnish-parallax-lemon {
    from { transform: rotate(12deg) translateY(0); }
    to   { transform: rotate(28deg) translateY(-180px); }
  }
  @keyframes hero-garnish-parallax-ice1 {
    from { transform: rotate(-8deg) translateY(0); }
    to   { transform: rotate(-14deg) translateY(-100px); }
  }
  @keyframes hero-garnish-parallax-ice2 {
    from { transform: rotate(35deg) translateY(0); }
    to   { transform: rotate(48deg) translateY(-220px); }
  }
}

@media (prefers-reduced-motion: reduce) {
  @supports (animation-timeline: scroll()) {
    .hero-garnish--lemon,
    .hero-garnish--ice1,
    .hero-garnish--ice2 { animation: none; }
  }
}

/* ---- Reveal scale-and-fade polish ---- */
/* The base .reveal in critical.css/utilities.css uses opacity + translateY.
   Layered here, the transform also picks up a subtle scale(0.98) → 1
   for a richer settle. Specificity matches the originals so the
   visible-state transform wins via cascade order. Reduced motion
   handlers in those files (transform: none) still neutralise this. */
.reveal:not(.visible) {
  transform: translateY(20px) scale(0.98);
}
.reveal.visible {
  transform: translateY(0) scale(1);
}
.reveal-stagger:not(.visible) > * {
  transform: translateY(16px) scale(0.985);
}
.reveal-stagger.visible > * {
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .reveal:not(.visible),
  .reveal.visible,
  .reveal-stagger:not(.visible) > *,
  .reveal-stagger.visible > * { transform: none; }
}

/* ---- Section separator — photographic peel curl as a real visual moment ---- */
.section-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-2xl) 0;
}

.section-divider picture {
  display: block;
  width: 240px;
  max-width: 34vw;
}

.section-divider img {
  width: 100%;
  height: auto;
  display: block;
  /* The source photograph has an asymmetric alpha falloff — the right
     edge stays ~30% opaque. CSS drop-shadow would cast a visible
     rectangular shadow from that semi-opaque area rather than tracing
     the peel silhouette, so we lean on the photo's own baked-in
     shadow instead. */
}

.section--muted {
  background: var(--bg-muted);
}

.section--dark {
  background: var(--color-neutral-900);
  color: var(--text-on-dark);
}

.section__header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--space-3xl);
}

.section__eyebrow {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--brand-emphasis);
  margin-bottom: var(--space-md);
}

/* Yellow eyebrows on dark backgrounds only */
.section--dark .section__eyebrow,
.cta-banner .section__eyebrow { color: var(--color-yellow); }

/* Hero has yellow bg — use dark eyebrow in light mode, light in dark mode */
.section--hero .section__eyebrow { color: var(--text); }

.section__title {
  font-size: var(--font-size-4xl);
  font-weight: 800;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-md);
  text-wrap: balance;
}

.section__subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  text-wrap: pretty;
}

/* ---- Grid ---- */
.grid {
  display: grid;
  gap: var(--space-xl);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Footer ---- */
.footer {
  background: var(--color-neutral-900);
  color: var(--text-on-dark);
  padding: var(--space-4xl) 0 var(--space-xl);
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-3xl);
  margin-bottom: var(--space-3xl);
}

.footer__brand-description {
  font-size: var(--font-size-sm);
  color: var(--color-neutral-400);
  line-height: var(--leading-relaxed);
  margin-top: var(--space-md);
  max-width: 300px;
}

.footer__heading {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-neutral-400);
  margin-bottom: var(--space-lg);
}

.footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer__link {
  font-size: var(--font-size-sm);
  color: var(--color-neutral-300);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

.footer__link:hover { color: var(--color-primary-400); }

.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-xl);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: var(--font-size-xs);
  color: var(--color-neutral-400);
}

.footer__bottom a {
  color: var(--color-neutral-400);
  text-decoration: none;
}

.footer__bottom a:hover { color: var(--color-primary-400); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .section__title { font-size: var(--font-size-3xl); }
}

@media (max-width: 768px) {
  .navbar__links,
  .navbar__actions .btn--ghost { display: none; }
  .navbar__toggle { display: block; }

  .container { padding-left: var(--space-md); padding-right: var(--space-md); }

  .grid--2,
  .grid--3,
  .grid--4 { grid-template-columns: 1fr; }

  .section { padding: var(--space-3xl) 0; }
  .section--hero { padding: calc(var(--navbar-height) + var(--space-3xl)) 0 var(--space-3xl); }

  .section__title { font-size: var(--font-size-2xl); }
  .section__subtitle { font-size: var(--font-size-base); }

  .footer__grid { grid-template-columns: 1fr 1fr; gap: var(--space-xl); }
  .footer__bottom { flex-direction: column; gap: var(--space-sm); text-align: center; }
}

@media (max-width: 480px) {
  .footer__grid { grid-template-columns: 1fr; }
  .navbar { padding: 0 var(--space-md); }
}
