/* Fermenta landing page. Loaded only by index.html (and its pre-rendered
   copies); shared tokens, header, footer, FAQ and CTA live in styles.css.

   Motion: one authored moment in the hero (the headline rises, the devices
   settle, flavor chips drift). Below the hero,
   panels open as they scroll in and content reveals once. Everything is
   static under prefers-reduced-motion. */

:root {
  --device-bezel: #1f211d;
  --device-edge: rgba(20, 30, 18, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --device-bezel: #2c2b28;
    --device-edge: rgba(255, 255, 255, 0.1);
  }
}

:root[data-theme="dark"] {
  --device-bezel: #2c2b28;
  --device-edge: rgba(255, 255, 255, 0.1);
}

/* -------------------------------- Devices ---------------------------------- */
/* A bezel around a real light/dark screenshot pair. The screen keeps the
   capture's exact aspect ratio; iPhone frames draw their Dynamic Island,
   which simulator captures leave out. */

.device {
  position: relative;
  width: 100%;
  padding: 3.4%;
  border-radius: 15% / 7%;
  background: var(--device-bezel);
  box-shadow: 0 0 0 1px var(--device-edge), var(--shadow-phone);
}

.device-screen {
  position: relative;
  aspect-ratio: 1206 / 2622;
  overflow: hidden;
  border-radius: 12.5% / 5.8%;
  background: var(--bg);
}

.device-screen img {
  object-fit: cover;
}

.device--iphone .device-screen::after {
  content: "";
  position: absolute;
  top: 1.22%;
  left: 34%;
  width: 32%;
  height: 4.96%;
  border-radius: 999px;
  background: #000;
}

.device--ipad {
  padding: 2.2%;
  border-radius: 5.2% / 7.4%;
}

.device--ipad .device-screen {
  aspect-ratio: 2420 / 1668;
  border-radius: 3.6% / 5.2%;
}

.device--duo {
  padding: 2.4%;
  border-radius: 6% / 8.4%;
}

.device--duo .device-screen {
  aspect-ratio: 2853 / 2007;
  border-radius: 4.2% / 6%;
}

/* ---------------------------------- Hero ----------------------------------- */

.l-hero {
  position: relative;
  padding: clamp(36px, 7vw, 96px) 0 clamp(64px, 9vw, 128px);
  overflow: clip;
}

.l-hero-grid {
  display: grid;
  gap: clamp(48px, 7vw, 72px);
  align-items: center;
}

@media (min-width: 960px) {
  .l-hero-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  }
}

.l-hero-title {
  font-size: clamp(2.7rem, 5.9vw, 5.2rem);
  line-height: 1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.l-hero-lede {
  max-width: 34rem;
  margin-top: clamp(20px, 2.6vw, 28px);
}

.l-hero-cta {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: clamp(28px, 3.4vw, 40px);
}

.l-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 28px;
  list-style: none;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.l-trust li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.l-trust svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

/* The stage: iPad behind, iPhone in front, flavor chips around them. */
.l-hero-stage {
  position: relative;
  width: min(100%, 640px);
  margin-inline: auto;
  padding: 4% 12% 14% 0;
}

.l-stage-ipad,
.l-stage-iphone,
.l-pillar-stage > div {
  transform: translate3d(0, var(--py, 0), 0);
}

.l-stage-iphone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 33%;
}

.l-stage-iphone .device {
  rotate: -3deg;
}

.l-chips {
  position: absolute;
  inset: 0;
  list-style: none;
  pointer-events: none;
}

.chip {
  position: absolute;
  padding: 0.5em 1em;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--divider);
  box-shadow: var(--shadow-md);
  font-size: clamp(0.78rem, 1.2vw, 0.92rem);
  font-weight: 500;
  white-space: nowrap;
  color: var(--text);
}

.chip::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.5em;
  border-radius: 50%;
  vertical-align: 0.05em;
  background: var(--chip-dot, var(--primary));
}

.chip--1 { top: -2%; left: 6%; --chip-dot: #c98a3a; }
.chip--2 { top: 38%; left: -6%; --chip-dot: #b8456a; }
.chip--3 { bottom: 8%; left: 10%; --chip-dot: #e09a5b; }
.chip--4 { top: 6%; right: 2%; --chip-dot: #d6b93c; }
.chip--5 { top: 46%; right: -4%; --chip-dot: #4f9a62; }
.chip--6 { bottom: -2%; right: 30%; --chip-dot: #5a6fb8; }

@media (max-width: 600px) {
  .chip--2,
  .chip--5,
  .chip--6 {
    display: none;
  }
}

/* -------------------------------- Problem ---------------------------------- */

.l-problem {
  padding: clamp(64px, 10vw, 136px) 0;
}

.l-problem-title {
  max-width: 17ch;
  margin-bottom: clamp(36px, 5vw, 64px);
  text-wrap: balance;
}

.l-problem-list {
  list-style: none;
  border-bottom: 1px solid var(--divider);
}

.l-problem-list li {
  display: grid;
  gap: 8px 48px;
  padding: clamp(22px, 3vw, 34px) 0;
  border-top: 1px solid var(--divider);
}

@media (min-width: 820px) {
  .l-problem-list li {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: baseline;
  }
}

.l-problem-q {
  font-family: var(--font-serif);
  font-size: clamp(1.45rem, 2.6vw, 2.05rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.l-problem-a {
  max-width: 44ch;
  font-size: clamp(1rem, 1.3vw, 1.1rem);
  line-height: 1.55;
  color: var(--text-secondary);
}

/* -------------------------------- Pillars ---------------------------------- */

.l-pillars {
  padding-bottom: clamp(64px, 9vw, 120px);
}

.l-pillars .container {
  display: grid;
  gap: clamp(18px, 2.4vw, 28px);
}

.l-pillar {
  --radius: clamp(28px, 4vw, 48px);
  display: grid;
  gap: clamp(40px, 6vw, 64px);
  align-items: center;
  padding: clamp(32px, 6vw, 80px);
  border-radius: var(--radius);
  background: var(--panel, var(--surface));
  overflow: clip;
}

.l-pillar--wheat { --panel: var(--panel-wheat); }
.l-pillar--sage { --panel: var(--panel-sage); }
.l-pillar--berry { --panel: var(--panel-berry); }

@media (min-width: 900px) {
  .l-pillar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .l-pillar--reverse .l-pillar-copy {
    order: 2;
  }
}

.l-pillar-copy {
  max-width: 30rem;
}

.l-pillar-text {
  margin-top: 18px;
  font-size: clamp(1.02rem, 1.4vw, 1.12rem);
  line-height: 1.6;
  color: var(--text-secondary);
}

.l-points {
  margin-top: 26px;
  list-style: none;
}

.l-points li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  line-height: 1.45;
}

.l-points svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--primary);
}

.l-pillar-note {
  margin-top: 20px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.l-pillar-copy .text-link {
  margin-top: 22px;
}

.l-pillar-stage {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 3vw, 28px);
}

.l-pillar-stage > div {
  width: min(100%, 270px);
}

.l-pillar-stage--pair > div {
  width: min(46%, 250px);
}

.l-pillar-stage--pair > div:last-child {
  margin-top: 14%;
}

/* ------------------------------- Devices ----------------------------------- */

.l-devices {
  padding: clamp(40px, 6vw, 72px) 0 clamp(72px, 10vw, 136px);
}

.l-devices-head {
  max-width: 40rem;
  margin: 0 auto clamp(40px, 6vw, 72px);
  text-align: center;
}

.l-devices-head .display-2 {
  text-wrap: balance;
}

.l-devices-head .section-lede {
  margin-top: 18px;
}

.l-devices-row {
  display: grid;
  grid-template-columns: 0.46fr 1.42fr;
  gap: clamp(20px, 3vw, 40px);
  align-items: end;
}

.l-device--wide {
  grid-column: 1 / -1;
}

@media (min-width: 860px) {
  .l-devices-row {
    grid-template-columns: 0.46fr 1.42fr 1.45fr;
  }

  .l-device--wide {
    grid-column: auto;
  }
}

.l-device-name {
  margin-top: 18px;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  text-align: center;
}

/* -------------------------------- Pricing ---------------------------------- */

.l-pricing {
  padding: clamp(56px, 7vw, 88px) 0 clamp(72px, 10vw, 120px);
}

.price-grid {
  display: grid;
  gap: 18px;
  max-width: 940px;
  margin-inline: auto;
}

@media (min-width: 760px) {
  .price-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.price-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: clamp(28px, 4vw, 42px);
  border-radius: 30px;
  background: var(--card);
  border: 1px solid var(--divider);
}

.price-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.price-name svg {
  width: 15px;
  height: 15px;
  color: var(--gold);
}

.price-amount {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 3.2vw, 2.4rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.price-list {
  list-style: none;
}

.price-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--divider);
  line-height: 1.45;
}

.price-list svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--primary);
}

.price-note {
  margin-top: auto;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.price-card--pro {
  background: var(--hero-bg);
  border-color: var(--hero-bg);
  color: var(--hero-fg);
}

.price-card--pro .price-name,
.price-card--pro .price-note {
  color: color-mix(in srgb, var(--hero-fg) 74%, transparent);
}

.price-card--pro .price-name svg,
.price-card--pro .price-list svg {
  color: #e6bb60;
}

.price-card--pro .price-list li {
  border-top-color: color-mix(in srgb, var(--hero-fg) 16%, transparent);
}

.l-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 32px;
  max-width: 940px;
  margin: clamp(36px, 5vw, 56px) auto 0;
  list-style: none;
  font-weight: 500;
}

.l-facts li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.l-facts svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.l-facts-link,
.l-faq-more {
  margin-top: 22px;
  text-align: center;
}

.l-faq {
  max-width: 820px;
  margin-inline: auto;
}

/* --------------------------------- Motion ---------------------------------- */

@keyframes l-rise {
  from {
    opacity: 0;
    transform: translate3d(0, 0.35em, 0);
    clip-path: inset(0 0 100% 0);
  }
  to {
    opacity: 1;
    transform: none;
    clip-path: inset(-0.2em -0.2em -0.4em -0.2em);
  }
}

@keyframes l-fade-up {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
}

@keyframes l-settle {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translate3d(0, 48px, 0) scale(0.95);
  }
}

@keyframes l-settle-phone {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translate3d(14%, 64px, 0) rotate(5deg);
  }
}

@keyframes l-pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

@keyframes l-drift {
  50% {
    translate: 0 -9px;
  }
}

@keyframes l-panel {
  from {
    clip-path: inset(5% 3% round var(--radius));
  }
  to {
    clip-path: inset(0 round var(--radius));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .l-hero-title {
    animation: l-rise 1.1s var(--ease-out) both;
  }

  .l-hero-lede,
  .l-hero-cta,
  .l-trust {
    animation: l-fade-up 0.9s var(--ease-out) both;
  }

  .l-hero-lede { animation-delay: 0.18s; }
  .l-hero-cta { animation-delay: 0.3s; }
  .l-trust { animation-delay: 0.42s; }

  .l-stage-ipad .device {
    animation: l-settle 1.3s 0.15s var(--ease-out) both;
  }

  .l-stage-iphone .device {
    animation: l-settle-phone 1.3s 0.4s var(--ease-out) both;
  }

  .chip {
    animation:
      l-pop 0.7s calc(0.9s + var(--i, 0) * 0.08s) var(--ease-out) both,
      l-drift var(--t, 6s) calc(1.6s + var(--i, 0) * 0.4s) ease-in-out infinite;
  }

  .chip--1 { --i: 0; --t: 6.4s; }
  .chip--2 { --i: 1; --t: 7.2s; }
  .chip--3 { --i: 2; --t: 5.8s; }
  .chip--4 { --i: 3; --t: 6.8s; }
  .chip--5 { --i: 4; --t: 7.6s; }
  .chip--6 { --i: 5; --t: 6.1s; }

  @supports (animation-timeline: view()) {
    .l-pillar {
      animation: l-panel linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 70%;
    }
  }
}
