:root {
  --ink: #1c231f;
  --ink-soft: #5b6b60;
  --paper: #F4EDE7;
  --card-bg: #ffffff;
  --accent: #2A3C35;
  --accent-soft: #e7e1d3;
  --accent-ink: #F4EDE7;
  --border: #e3ddcd;
  --radius: 14px;
  --radius-lg: 22px;
  --max-width: 1080px;
  --content-width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef1ec;
    --ink-soft: #a9b6ac;
    --paper: #14171a;
    --card-bg: #1b201d;
    --accent: #6fbfa0;
    --accent-soft: #232b26;
    --accent-ink: #0d130f;
    --border: #2b322c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
[hidden] { display: none !important; }

.kicker {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 10px;
  font-weight: 600;
}

.section-title {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 10px;
}

.section-sub {
  color: var(--ink-soft);
  font-size: 16px;
  margin: 0;
  max-width: 56ch;
}

.disclaimer {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 16px;
}

.btn {
  display: inline-block;
  padding: 13px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover { background: var(--accent-soft); }

.btn-small {
  padding: 9px 16px;
  font-size: 13px;
  background: var(--accent);
  color: var(--accent-ink);
}

.link-help {
  align-self: center;
  color: var(--ink);
  text-decoration: underline;
  font-size: 15px;
}

/* -------------------- Announcement bar -------------------- */
.announcement-bar {
  background: var(--accent);
  color: var(--accent-ink);
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 9px 16px;
}
.announcement-bar:empty { display: none; }

/* -------------------- Nav -------------------- */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.nav-logo {
  height: 48px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.nav-link:hover { color: var(--accent); }

/* -------------------- Shared section layout -------------------- */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 20px;
  border-bottom: 1px solid var(--border);
}

/* -------------------- Abstract placeholder shapes -------------------- */
.shape {
  border-radius: 32px 8px 32px 8px;
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-soft) 100%);
  position: relative;
  overflow: hidden;
}
.shape::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.18), transparent 60%);
}
.shape-hero { width: 100%; aspect-ratio: 4 / 3; }
.shape-concept { width: 100%; aspect-ratio: 1 / 1; border-radius: 18px 6px 18px 6px; }
.shape-format { width: 100%; aspect-ratio: 4 / 3; }

/* Real photos (once uploaded via /admin) fill the exact same box as the
   shape they replace, so layout never shifts when one is added. */
.hero-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 32px 8px 32px 8px;
}
.concept-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 18px 6px 18px 6px;
}
.format-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 32px 8px 32px 8px;
}

/* -------------------- Hero -------------------- */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 20px 64px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: center;
}

.hero-title {
  line-height: 1.15;
  font-weight: 800;
  margin: 0 0 16px;
}

.hero-title-line {
  display: block;
  font-size: clamp(28px, 5vw, 52px); /* fallback; script.js sets the real
                                         per-line size from site.json */
}

.hero-sub {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 48ch;
  margin: 0 0 24px;
}

.hero-ctas {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.hero-visual { position: relative; }

.image-caption {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: right;
  margin: 8px 2px 0;
}

/* -------------------- Concepts -------------------- */
.concept-rows {
  display: flex;
  flex-direction: column;
  margin-top: 32px;
}

.concept-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  align-items: center;
  padding: 28px 0;
  border-top: 1px solid var(--border);
}
.concept-row:first-child { border-top: none; }

/* Alignment is a configurable field (concepts.contentAlign in site.json,
   select widget in /admin) — one shared class, not a hardcoded value, so
   it can change without touching code and stays in parity across all 3
   concepts by construction. */
.concept-main.align-left { text-align: left; }
.concept-main.align-left .concept-desc { margin-left: 0; margin-right: auto; }

.concept-main.align-center { text-align: center; }
.concept-main.align-center .concept-desc { margin-left: auto; margin-right: auto; }

.concept-main.align-right { text-align: right; }
.concept-main.align-right .concept-desc { margin-left: auto; margin-right: 0; }

.concept-heading {
  margin: 0 0 8px;
  font-size: 18px;
}

.concept-meta {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13px;
}

.concept-sep {
  color: var(--ink-soft);
  margin: 0 6px;
}

.concept-title {
  font-weight: 700;
}

.concept-desc {
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 44ch;
}

.disclaimer-under-image {
  text-align: left;
  margin-top: 12px;
}

/* -------------------- Format section -------------------- */
.format-section {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 40px;
  align-items: center;
}

/* -------------------- Story -------------------- */
/* Single DOM order (top-text, image, bottom-text) works for both
   layouts: on mobile it just stacks top-to-bottom in that order (see
   the 860px breakpoint below), which happens to be exactly the position
   Marcus wants the photo in (after the title, before the pull-line). On
   desktop, the image spans a left column next to two grid rows (top-text
   / bottom-text) on the right — deliberately only 2 rows, not one per
   text element, because CSS Grid distributes a tall spanning item's
   height very unevenly across many uneven auto-sized rows (this broke
   once already: the short kicker line got stretched into a huge empty
   gap while the rest of the text bunched up below it). Two rows, each
   already reasonably tall on its own, avoids that distortion. */
.story-section {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  column-gap: 40px;
  row-gap: 8px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
}

.story-image-wrap { grid-column: 1; grid-row: 1 / 3; }
.story-top-text { grid-column: 2; grid-row: 1; }
.story-bottom-text { grid-column: 2; grid-row: 2; }

.shape-story { width: 100%; aspect-ratio: 4 / 5; border-radius: 18px 6px 18px 6px; }

.story-image {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 18px 6px 18px 6px;
}

.story-pull-line {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  line-height: 1.3;
  margin: 4px 0 0;
}

#story-body-p1, #story-body-p2 { color: var(--ink-soft); font-size: 16px; margin: 0 0 14px; }
.story-attribution { font-weight: 600; color: var(--ink) !important; }

/* -------------------- Help section -------------------- */
.help-section { max-width: var(--content-width); }
.help-section .btn { margin-top: 8px; }

/* -------------------- FAQ -------------------- */
.faq-section { max-width: var(--content-width); }

.faq-item {
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
.faq-item:first-child { border-top: none; }

.faq-question { font-weight: 700; margin: 0 0 6px; font-size: 16px; }
.faq-answer { margin: 0; color: var(--ink-soft); font-size: 15px; }

/* -------------------- Signup / footer -------------------- */
.signup {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 56px 20px;
}

.signup #signup-form-state,
.signup #signup-success-state {
  max-width: var(--max-width);
  margin: 0 auto;
}

.signup .signup-title {
  font-size: clamp(24px, 3.5vw, 32px);
  margin: 0 0 10px;
  font-weight: 700;
}

.signup .signup-sub {
  opacity: 0.85;
  font-size: 15px;
  margin: 0 0 22px;
  max-width: 640px;
  white-space: pre-line;
}

.email-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hidden-field { display: none; }

#email-input {
  flex: 1 1 260px;
  max-width: 340px;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
  color: var(--accent-ink);
  font-size: 15px;
}
#email-input::placeholder { color: rgba(246,241,233,0.6); }

#email-input:focus {
  outline: 2px solid var(--accent-ink);
  outline-offset: 1px;
}

#submit-btn {
  padding: 13px 22px;
  border-radius: 10px;
  border: none;
  background: var(--accent-ink);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
#submit-btn:disabled { opacity: 0.6; cursor: default; }
#submit-btn:hover:not(:disabled) { filter: brightness(1.05); }

.form-error { color: #ffb4a1; font-size: 14px; margin-top: 12px; white-space: pre-line; }

.footer-bottom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.footer-logo {
  /* No filter/invert here on purpose — that assumed a transparent logo
     file and turned an opaque one into a solid white box instead. This
     logo has its own light background baked in, so it's shown in a
     small rounded card instead of forcing a color transform that only
     works for one specific kind of source file. */
  height: 34px;
  width: auto;
  display: block;
  padding: 6px 10px;
  background: var(--accent-ink);
  border-radius: 8px;
}

.footer-fine-print {
  font-size: 12px;
  opacity: 0.7;
  margin: 0;
  flex: 1 1 auto;
}

.survey-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: underline;
}

/* -------------------- Mobile-first breakpoints -------------------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual { order: -1; max-width: 320px; margin: 0 auto; }
  .format-section { grid-template-columns: 1fr; }
  .format-visual { max-width: 320px; }
  .concept-row { grid-template-columns: 88px 1fr; gap: 16px; }
  /* Sequence label ("01 / Before a meal") and concept name ("RELVO
     BALANCE") sit on one line joined by the — separator on desktop;
     on mobile that line gets long relative to the narrower column, so
     they stack onto their own lines instead and the separator (which
     only makes sense inline) is hidden. */
  .concept-heading .concept-meta,
  .concept-heading .concept-title { display: block; }
  .concept-heading .concept-sep { display: none; }
  .story-section { grid-template-columns: 1fr; row-gap: 10px; }
  /* Without this reset, the explicit grid-column/grid-row assignments
     above would make CSS Grid auto-create a second implicit column
     instead of truly stacking everything — this is what makes the
     single DOM order (top-text, image, bottom-text) actually collapse
     to one column on mobile, which already matches the requested photo
     position (after the title, before the pull-line) with no further
     mobile-specific rules needed. */
  .story-image-wrap, .story-top-text, .story-bottom-text { grid-column: 1; grid-row: auto; }
  .story-image, .shape-story { max-width: 320px; margin: 0 auto; }
}

@media (max-width: 560px) {
  .site-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }
  .nav-logo { margin: 0 auto; }
  .nav-links {
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
    width: 100%;
  }
  .nav-link { font-size: 12px; white-space: nowrap; }
  .nav-links .btn-small { padding: 8px 10px; font-size: 12px; white-space: nowrap; }
  .section { padding: 48px 16px; }
  .hero { padding: 40px 16px 48px; }
  /* Stacking input above button (one full-width box each) made this the
     tallest element on the mobile page. Keeping them side by side in one
     row and shrinking padding/font just enough to fit narrow screens
     gives the same one-line signup box every other tested layout uses. */
  .email-form { flex-wrap: nowrap; gap: 8px; }
  #email-input {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
    padding: 11px 12px;
    font-size: 14px;
  }
  #submit-btn {
    flex: 0 0 auto;
    padding: 11px 16px;
    font-size: 14px;
    white-space: nowrap;
  }
}
