/* ============================================================
   Scrannr — Home page styles
   Consumes the locked design tokens from shared.css.
   Brand COLORS are not redefined here.
   ============================================================ */

/* ===== BASE ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

/* Paper grain overlay — monochrome ink noise, sits behind content */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main { position: relative; z-index: 1; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

section[id] { scroll-margin-top: 88px; }

/* ===== SHARED SECTION PRIMITIVES ===== */
.section-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-deep);
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(34px, 4.4vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 500;
  max-width: 680px;}
.section-title em {
  font-style: normal;
  font-weight: 700;
  color: var(--green);
}
.section-lead {
  font-size: 18px;
  color: var(--ink-2);
  max-width: 540px;
  margin-top: 18px;
}
.section-head { margin-bottom: 56px; }

/* ========== HERO ========== */
.hero {
  /* vertical only — longhands so .wrap's horizontal padding is preserved */
  padding-top: 64px;
  padding-bottom: 64px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 72px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}
.eyebrow-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  position: relative;
  flex-shrink: 0;
}
.eyebrow-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(2.2); opacity: 0; }
}

.hero-text { min-width: 0; }

h1 {
  font-family: 'Manrope', sans-serif;
  font-weight: 500;
  font-size: clamp(48px, 6.4vw, 78px);
  line-height: 1.0;
  letter-spacing: -0.028em;
  margin-bottom: 26px;  overflow-wrap: break-word;
}
h1 em {
  font-style: normal;
  font-weight: 700;
  color: var(--green);
}

.subhead {
  font-size: 19px;
  color: var(--ink-2);
  margin-bottom: 38px;
  max-width: 470px;
  line-height: 1.55;
}

/* ========== STORE BUTTONS ========== */
.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px 13px 18px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  min-width: 188px;
}
.store-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: #2a241d;
}
.store-icon {
  width: 26px; height: 26px;
  flex-shrink: 0;
  fill: currentColor;
}
.store-text { display: flex; flex-direction: column; line-height: 1.1; }
.store-pre { font-size: 11px; opacity: 0.72; font-weight: 400; letter-spacing: 0.01em; margin-bottom: 2px; }
.store-name { font-family: 'Manrope', sans-serif; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }

.cta-note {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 8px;
}
.cta-note strong { color: var(--ink-2); font-weight: 600; }

/* ========== HERO VISUAL ========== */
.visual {
  position: relative;
  height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* soft brand-color halo behind the phone */
.hero-halo {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 42% at 62% 38%, rgba(36,107,60,0.16), transparent 70%),
    radial-gradient(34% 36% at 32% 70%, rgba(232,122,59,0.14), transparent 72%);
  filter: blur(6px);
}

.phone {
  width: 286px;
  height: 572px;
  background: var(--ink);
  border-radius: 46px;
  padding: 12px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 2;
  transform: rotate(-2deg);
}
.phone-screen {
  width: 100%;
  height: 100%;
  background: var(--surface);
  border-radius: 36px;
  overflow: hidden;
  position: relative;
}
.phone-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.phone-notch {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  width: 84px; height: 24px;
  background: var(--ink);
  border-radius: var(--r-pill);
  z-index: 3;
}

/* floating decorative score chip overlapping the phone */
.score-chip {
  position: absolute;
  z-index: 3;
  bottom: 8%;
  left: 2%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: float-3 9s ease-in-out infinite;
}
.score-chip-circle {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 17px;
  flex-shrink: 0;
}
.score-chip-text { line-height: 1.15; }
.score-chip-label { font-weight: 600; font-size: 13px; color: var(--green-deep); }
.score-chip-sub { font-size: 11px; color: var(--ink-3); }

/* Floating decorative fruit shapes */
.float {
  position: absolute;
  z-index: 1;
  filter: drop-shadow(0 8px 20px rgba(26,22,18,0.12));
}
.float-apple {
  top: 4%; right: 4%;
  width: 76px; height: 82px;
  animation: float-1 7s ease-in-out infinite;
}
.float-citrus {
  top: 9%; left: 2%;
  width: 66px; height: 66px;
  animation: float-2 8s ease-in-out infinite;
}
.float-grain {
  top: 52%; right: -8px;
  width: 62px; height: 78px;
  animation: float-3 9s ease-in-out infinite;
}
@keyframes float-1 {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-18px) rotate(4deg); }
}
@keyframes float-2 {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-22px) rotate(-10deg); }
}
@keyframes float-3 {
  0%, 100% { transform: translateY(0) rotate(8deg); }
  50% { transform: translateY(-14px) rotate(-2deg); }
}

/* ========== TRUST ROW ========== */
.trust {
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 28px 0;
}
.trust-row {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
}
.trust-item + .trust-item { position: relative; }
.trust-item + .trust-item::before {
  content: "";
  position: absolute;
  left: -10px;            /* half of the 20px grid gap → centered in the gutter */
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}
.trust-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-deep);
  display: flex;
  align-items: center;
  justify-content: center;
}
.trust-icon svg { width: 19px; height: 19px; }

/* ========== FEATURES (BENTO) ========== */
.features { padding: var(--section-y) 0; }

.bento {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: minmax(176px, auto);
  gap: 16px;
}
.feature {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--ring), var(--shadow-md);
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}
.feature:hover {
  transform: translateY(-4px);
  box-shadow: var(--ring), var(--shadow-lg);
}
/* Borderless cards — keep the soft shadow, drop the inset hairline */
.f-score, .f-nutri, .f-ingredient { box-shadow: var(--shadow-md); }
.f-score:hover, .f-nutri:hover, .f-ingredient:hover { box-shadow: var(--shadow-lg); }

.feature-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: var(--green-soft);
  color: var(--green-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.feature-icon svg { width: 24px; height: 24px; }
.f-allergen .feature-icon { background: var(--orange-soft); color: #8a3d12; }

.feature-title {
  font-family: 'Manrope', sans-serif;
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin-bottom: 8px;
}
.feature-desc {
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.55;
  max-width: 40ch;
}

/* Feature media — swap these PNGs for real app screenshots (same filenames) */
.feature-media {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-md);
  background: var(--bg);
}
/* bottom-anchored strips fill the card and sit at the base */
.f-allergen .feature-media,
.f-nutri .feature-media,
.f-ingredient .feature-media,
.f-score .feature-media { margin-top: auto; }

/* Health score: subtle gradient, image stacked below the text */
.f-score {
  background:
    radial-gradient(80% 120% at 100% 0%, var(--green-soft), transparent 60%),
    var(--surface);
}
.feature-media-score {
  flex-shrink: 0;
  width: 184px;
  height: 184px;
  object-fit: cover;
  align-self: center;
}
/* Insights image: scaled down + centered so it doesn't tower over the ingredient card */
.f-nutri .feature-media {
  width: auto;
  max-width: 100%;
  max-height: 200px;
  align-self: center;
}

/* ========== HOW IT WORKS ========== */
.how {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg), var(--bg-alt));
  position: relative;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  position: relative;
}
/* dotted connector behind the 3 cards (desktop) */
.steps::before {
  content: '';
  position: absolute;
  top: 52px;
  left: 16%;
  right: 16%;
  height: 2px;
  background-image: linear-gradient(90deg, var(--green) 40%, transparent 0);
  background-size: 12px 2px;
  background-repeat: repeat-x;
  opacity: 0.4;
  z-index: 0;
}
.step {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--ring), var(--shadow-md);
  padding: 30px 28px 32px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 1;
}
.step:hover {
  transform: translateY(-4px);
  box-shadow: var(--ring), var(--shadow-lg);
}
.step-bignum {
  position: absolute;
  top: -18px; right: 6px;
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 120px;
  line-height: 1;
  color: var(--green);
  opacity: 0.06;  pointer-events: none;
  user-select: none;
}
.step-num {
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  letter-spacing: 0.06em;
  margin-bottom: 30px;
}
.step-icon {
  position: absolute;
  top: 26px; right: 26px;
  width: 56px; height: 56px;
  background: var(--green-soft);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-deep);
}
.step-title {
  font-family: 'Manrope', sans-serif;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
  line-height: 1.15;
}
.step-desc {
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.55;
}

/* ========== FAQ ========== */
.faq {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg), var(--bg-alt));
}
.faq .section-head { text-align: center; }
.faq .section-title { margin: 0 auto; }
.faq-list {
  max-width: var(--maxw-narrow);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.faq-item {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--ring), var(--shadow-sm);
  overflow: hidden;
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  min-height: 44px;
  font-family: 'Manrope', sans-serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-chevron {
  flex-shrink: 0;
  width: 22px; height: 22px;
  color: var(--green);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.js .faq-item.is-closing .faq-chevron {
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); /* exit faster than enter */
}
.faq-item[open] .faq-chevron { transform: rotate(180deg); }
.faq-a {
  padding: 0 24px 22px;
  font-size: 15.5px;
  color: var(--ink-2);
  line-height: 1.6;
  max-width: 62ch;
}

/* ===== FAQ — JS-enhanced expand/collapse (scoped under .js) ===== */
.js .faq-item.is-animating { will-change: height; }      /* promoted only while animating */
.js .faq-item .faq-a {
  transition:
    opacity 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}
.js .faq-item[open] .faq-a { opacity: 1; transform: translateY(0); }
.js .faq-item.is-opening .faq-a { opacity: 0; transform: translateY(6px); }   /* enter start state */
.js .faq-item.is-closing .faq-a {                                             /* exit (faster) */
  transition:
    opacity 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0; transform: translateY(6px);
}

/* ========== FINAL CTA BANNER ========== */
.cta-banner {
  padding: var(--section-y) 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  text-align: center;
}
.cta-banner h2 {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(40px, 5vw, 60px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.04;
  margin-bottom: 16px;}
.cta-banner h2 em {
  font-style: normal;
  font-weight: 700;
  color: var(--green);
}
.cta-banner p {
  font-size: 17px;
  color: var(--ink-2);
  margin-bottom: 34px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.cta-banner .cta-row {
  justify-content: center;
  margin-bottom: 12px;
}

/* ========== ENTRANCE ANIMATIONS ========== */
.fade-in {
  opacity: 0;
  transform: translateY(14px);
  animation: fadeIn 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.18s; }
.delay-3 { animation-delay: 0.32s; }
.delay-4 { animation-delay: 0.46s; }
.delay-5 { animation-delay: 0.6s; }
@keyframes fadeIn {
  to { opacity: 1; transform: translateY(0); }
}

/* Scroll reveal (only active when JS adds .js to <html>) */
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 48px;
    padding-top: 32px;
    padding-bottom: 64px;
    text-align: center;
  }
  .subhead { margin-left: auto; margin-right: auto; }
  .eyebrow { margin-left: auto; margin-right: auto; }
  .cta-row { justify-content: center; }
  .cta-note { text-align: center; }
  .visual { height: 520px; }
  .phone { width: 250px; height: 500px; }

  .bento { grid-template-columns: repeat(2, 1fr); grid-auto-rows: auto; }
  .f-score, .f-allergen, .f-nutri, .f-ingredient { grid-column: span 1; grid-row: auto; }
  .f-score { flex-direction: column; align-items: flex-start; gap: 24px; }
  .f-score .feature-media-score { width: 100%; height: auto; }

  .steps { grid-template-columns: 1fr; }
  .steps::before { display: none; }
  .section-head { margin-bottom: 40px; }

  .trust-row { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .trust-item + .trust-item::before { left: -8px; }      /* half of 16px column gap */
  .trust-item:nth-child(2n+1)::before { display: none; } /* no divider on left-column items (item 3) */
}

@media (max-width: 520px) {
  h1 { font-size: clamp(34px, 9.5vw, 44px); }
  .cta-row { flex-direction: column; align-items: stretch; }
  .store-btn { justify-content: center; min-width: 0; }
  .visual { height: 460px; }
  .phone { width: 224px; height: 448px; transform: rotate(0); }
  .score-chip { left: -2%; bottom: 4%; }
  .float-apple { width: 58px; height: 62px; right: 0; }
  .float-citrus { width: 54px; height: 54px; }
  .float-grain { width: 48px; height: 60px; }

  .bento { grid-template-columns: 1fr; }
  .trust-row { grid-template-columns: 1fr; gap: 0; }
  .trust-item { padding: 18px 0; font-size: 15px; }
  .trust-item + .trust-item::before {              /* vertical divider → full-width horizontal hairline */
    left: 0; right: 0; top: 0;
    bottom: auto; width: auto; height: 1px;
  }
  .trust-item:nth-child(2n+1)::before { display: block; } /* undo tablet's nth-child hide */
  .feature, .step { padding: 24px; }
}

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