/* Page frame and section layouts (RTL-first: logical properties throughout). */
*, *::before, *::after { box-sizing: border-box; }

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--cream-dim);
  background:
    radial-gradient(120% 80% at 85% 0%, var(--ink-glow) 0%, var(--ink) 55%, var(--ink-deep) 100%)
    no-repeat var(--ink-deep);
  -webkit-font-smoothing: antialiased;
}

/* Film grain from the series, on a fixed layer so scrolling never repaints it. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  background: url("../img/grain.png");
  opacity: 0.05;
  mix-blend-mode: overlay;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  color: var(--cream);
  text-wrap: balance;
}

p { margin: 0; }
p, li { text-wrap: pretty; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 6px; }
main:focus, section:focus { outline: none; }

.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.narrow { --container: 760px; }

main > section { padding-block: var(--space-section); scroll-margin-top: var(--header-h); }

.section-title { font-size: var(--step-3); }
.section-head { max-width: 40rem; display: grid; gap: 1rem; }
.section-intro { font-size: var(--step-1); }

/* Hero: text at the start (right), arch portrait at the end. */
.hero { padding-block: clamp(1.5rem, 0.5rem + 4vw, 4.5rem) clamp(3rem, 2rem + 4vw, 5.5rem); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(2rem, 1rem + 4vw, 5rem);
}
.hero-copy { display: grid; gap: 1.4rem; justify-items: start; }
.hero-title { font-size: var(--step-4); line-height: 1.08; max-width: 13em; }
.accent { color: var(--amber); }
.hero-sub { font-size: var(--step-1); max-width: 32em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block-start: 0.5rem; }
.hero-figure { justify-self: center; display: grid; justify-items: center; }

/* About: title at the start column, Libi's own line as the hero of the section. */
.about-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 2rem clamp(1.5rem, 4vw, 4rem);
}
.about .section-title { grid-column: 1 / span 4; }
.about .libi-quote { grid-column: 5 / span 8; }
.about-body { grid-column: 5 / span 7; font-size: var(--step-1); }

/* Packages climb in reading direction: "how far do you go". */
.pkg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin-block-start: 3rem;
}

/* How: four steps on one rail. */
.steps {
  list-style: none;
  margin: 3rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
  counter-reset: step;
}

/* Why: portrait at the start, the argument at the end. */
.why-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5.5rem);
}
.why-copy { display: grid; gap: 1.5rem; }
.why-body { font-size: var(--step-1); }

/* FAQ: the title stays in view while the answers open. */
.faq-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: start;
  gap: clamp(2rem, 5vw, 5rem);
}
.faq .section-title { position: sticky; top: calc(var(--header-h) + 2rem); }

/* Closing line, then the form right under it. */
main > .closing { padding-block-end: 0; }
.closing-line {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 1.2rem + 4.4vw, 5.1rem);
  line-height: 1.08;
  color: var(--cream);
  max-width: 15ch;
  text-wrap: balance;
}
.lead-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  align-items: start;
  gap: clamp(2rem, 5vw, 5rem);
}
.lead-intro { display: grid; gap: 1rem; position: sticky; top: calc(var(--header-h) + 2rem); }
.lead-subtitle { font-size: var(--step-1); }

/* Thanks, privacy, accessibility. */
.page-simple { padding-block: clamp(3rem, 2rem + 5vw, 7rem); }
.page-title { font-size: var(--step-3); margin-block-end: 1.5rem; }
.page-lede { font-size: var(--step-1); }
.legal p { margin-block-end: 1.1rem; max-width: 68ch; }
.page-simple .btn { margin-block-start: 1.75rem; }

@media (max-width: 999px) {
  .pkg-grid { grid-template-columns: minmax(0, 1fr); max-width: 40rem; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2.75rem; }
}

@media (max-width: 759px) {
  .hero-grid, .why-grid, .faq-grid, .lead-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-figure { order: -1; justify-self: center; }
  .hero-actions .btn { flex: 1 1 auto; }
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .about .section-title, .about .libi-quote, .about-body { grid-column: auto; }
  .steps { grid-template-columns: minmax(0, 1fr); gap: 2.25rem; }
  .faq .section-title, .lead-intro { position: static; }
  main > section { padding-block: clamp(3rem, 2rem + 5vw, 4rem); }
}
