/* ============================================================================
   The Keeping — site styles ("Marginalia" design language, web edition)
   ----------------------------------------------------------------------------
   This stylesheet is the single source of truth for the marketing + legal site.
   It is a faithful web translation of the LOCKED "Marginalia" design language
   used by the iOS app (see design-language.md in the app pipeline).

   GUIDING PRINCIPLE (from the brand voice): "never perform, never push."
   The site must feel like a quiet, well-made book jacket — generous warm
   whitespace, an editorial serif voice, restraint over hype. If it ever reads
   like a loud SaaS landing page, it is wrong.

   Why the type choices below:
   - Headings use a system serif stack led by `ui-serif` / "New York". On Apple
     devices (the entire audience for an iOS app's landing page) this renders
     Apple's actual New York typeface — the EXACT serif the app itself uses, for
     perfect brand fidelity with zero font downloads, zero flash-of-unstyled-text,
     and zero external dependency. Non-Apple devices fall back to Charter/Georgia,
     both refined literary serifs already installed nearly everywhere.
   - Body copy uses the system sans stack (`-apple-system` / "SF Pro" on Apple),
     mirroring the app's serif-titles / sans-apparatus pairing.

   No build step. No framework. Plain CSS, custom properties for the tokens.
   ========================================================================== */

/* ----------------------------------------------------------------------------
   1. Design tokens  (lifted directly from the Marginalia color + type spec)
   -------------------------------------------------------------------------- */
:root {
  /* --- Light palette (the app's "Light" mode) --- */
  --canvas:        #FAF8F3; /* paper warm-white — the page background          */
  --surface:       #FFFFFF; /* secondary surface (cards/panels)                */
  --hairline:      #ECE7DC; /* hairline rules + card borders                   */
  --ink:           #1F1B16; /* primary ink — warm near-black, never pure #000  */
  --ink-secondary: #6B6358; /* bylines, supporting copy                        */
  --ink-tertiary:  #9B9286; /* metadata, the quietest text                     */
  --well:          #F2EEE5; /* chip / inset well fill                          */

  /* --- The fixed brand accent ---
     Terracotta is THE Keeping's brand identity (the icon color + the launch
     wordmark underline). Per the locked "branded launch" decision it is a FIXED
     identity color — distinct from the user-changeable in-app accent. On the
     web it is the site's single accent: the drop cap, rules, links. Used
     sparingly and never as a fill behind text. */
  --terracotta:    #B5734A;
  --terracotta-deep: #9A5E38; /* a slightly deeper step for link hover/contrast */

  /* --- The four media signal colors (used ONLY as small type signals) ---
     Books terracotta · Films indigo · TV sage · Podcasts heather.
     Meaning is never carried by color alone — every use is paired with a label. */
  --signal-books:    #B5734A;
  --signal-films:    #4A6FA5;
  --signal-tv:       #5E8B7E;
  --signal-podcasts: #9A6BA5;

  /* --- Soft elevation (matches the app's "ultra-soft shadow" spec) --- */
  --shadow-card: 0 1px 8px rgba(31, 27, 22, 0.04);

  /* --- Rhythm --- */
  --measure: 38rem;          /* comfortable reading measure (~66–68 chars)     */
  --radius:  16px;           /* card radius, from the app's 16pt spec          */
  --radius-lg: 20px;         /* larger panels                                   */

  /* --- Type scale (mapped from the app's New York / SF Pro roles) --- */
  --serif: ui-serif, "New York", "Charter", "Iowan Old Style", Georgia,
           "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
           Helvetica, Arial, system-ui, sans-serif;

  color-scheme: light dark;
}

/* --- Dark palette (a true separate WARM palette, not an inversion — exactly as
   the app specifies; elevation by lightening, never by shadow) --- */
@media (prefers-color-scheme: dark) {
  :root {
    --canvas:        #161412; /* warm near-black (deliberately not #000)        */
    --surface:       #211E1A; /* elevation by lightening                        */
    --hairline:      #2E2A25;
    --ink:           #F2EDE4; /* @ ~92% in the app; full here for web contrast  */
    --ink-secondary: #B4AC9E;
    --ink-tertiary:  #807868;
    --well:          #211E1A;

    /* Signal + accent inks lifted/desaturated slightly for dark, per the spec */
    --terracotta:      #C98A60;
    --terracotta-deep: #D69B73;
    --signal-books:    #C98A60;
    --signal-films:    #6E8FC0;
    --signal-tv:       #79A597;
    --signal-podcasts: #B488BE;

    --shadow-card: none; /* the app never uses shadow in dark mode             */
  }
}

/* ----------------------------------------------------------------------------
   2. Reset + base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%; /* respect user font scaling, don't auto-zoom */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;          /* 17px base — the app's Body size            */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Honor users who prefer reduced motion — the app does the same. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--terracotta-deep);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover { color: var(--terracotta); }

/* Visible, on-brand focus ring for keyboard users (accessibility). */
a:focus-visible,
button:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link — first tab stop, hidden until focused. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 0.75rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ----------------------------------------------------------------------------
   3. Typography roles  (the load-bearing principle: "type is the artwork")
   -------------------------------------------------------------------------- */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance; /* avoid orphan words in headings where supported */
}

/* The kicker — small UPPERCASE sans label, the app's "FILM · 2024" device.
   Used to signal a section quietly, never to shout. */
.kicker {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  /* secondary (not tertiary) ink: small uppercase text must clear WCAG AA
     4.5:1 on the warm canvas — tertiary (#9B9286) only reaches ~2.9:1. */
  color: var(--ink-secondary);
  margin: 0 0 0.75rem;
}

/* The takeaway / lede italic serif voice — "these are your words". */
.lede {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--ink-secondary);
  max-width: var(--measure);
  margin: 0;
}

p { max-width: var(--measure); }

/* ----------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 64rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* A narrower column for long-form legal/support reading (book measure). */
.container--prose {
  max-width: 44rem;
}

.section {
  padding-block: clamp(2.25rem, 5vw, 3.25rem);
}

/* Gentle vertical cadence (re-tuned 2026-06-20 — the first pass overshot: big section
   paddings STACK at junctions, which ballooned the chips→beats and card→close gaps to
   ~200px). These are now a SUBTLE lift over the base, not a cavernous break. */
.section--wedge { padding-block: clamp(2.5rem, 5.5vw, 3.75rem); }
.section--close { padding-block: clamp(2.75rem, 6vw, 4.25rem); }

/* A quiet hairline divider, like the app's month-header rule. */
.rule {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin-block: clamp(1.5rem, 3.5vw, 2.25rem);
}

/* ----------------------------------------------------------------------------
   5. Site header (masthead) + footer — the "standard chrome only" surfaces
   -------------------------------------------------------------------------- */
.site-header {
  padding-block: 1.75rem 0;   /* let the hero own the breathing room below the masthead */
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* The wordmark: the drop-cap "K" + "The Keeping", echoing the app icon + launch
   screen. The K carries the terracotta brand color; the rest is ink. */
.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.wordmark__drop {
  color: var(--terracotta);
  font-size: 1.5rem;
  line-height: 1;
}
.wordmark:hover { color: var(--ink); }
.wordmark:hover .wordmark__drop { color: var(--terracotta-deep); }

/* Lightweight top nav to the legal/support pages. */
.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
}
.site-nav a {
  color: var(--ink-secondary);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.site-footer {
  padding-block: 3rem;
  margin-top: clamp(3rem, 8vw, 6rem);
  border-top: 1px solid var(--hairline);
  color: var(--ink-secondary); /* small footer text → keep ≥4.5:1 on canvas */
  font-size: 0.9rem;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.site-footer a { color: var(--ink-secondary); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.site-footer__mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--serif);
  color: var(--ink-secondary);
}
.site-footer__mark .wordmark__drop { font-size: 1.15rem; }
/* Dark mode: at footer scale the drop-cap reads muted on the warm-black canvas — lift it
   to the brighter dark terracotta step so it carries the header K's quiet confidence
   (design sweep 2026-06-20). Light mode is unchanged. */
@media (prefers-color-scheme: dark) {
  .site-footer__mark .wordmark__drop { color: var(--terracotta-deep); }
}

/* ----------------------------------------------------------------------------
   6. Hero
   -------------------------------------------------------------------------- */
.hero {
  /* raised top floor so the icon never crowds the masthead at small/medium widths
     (design review 2026-06-20) */
  padding-block: clamp(5rem, 12vw, 9rem) clamp(2.5rem, 7vw, 5rem);
  text-align: center;
}

/* The app icon — the recognizable product mark, shown as an iOS-style rounded
   tile. A hairline + soft shadow define the tile against the same-color canvas
   (the icon's own background is the warm paper, so the frame does the lifting). */
.hero__icon {
  width: clamp(84px, 18vw, 104px);
  height: auto;
  margin: 0 auto 1.5rem;
  border-radius: 22.5%;          /* iOS squircle approximation */
  border: 1px solid var(--hairline);
  /* softer than before (was 0 6px 22px / 0.10) — closer to the app's "ultra-soft"
     shadow philosophy; still lifts the tile off the same-color canvas, just quietly */
  box-shadow: 0 3px 14px rgba(31, 27, 22, 0.07);
  /* a barely-there entrance, disabled under reduced-motion (see media query) */
  animation: rise 700ms ease both;
}

/* Dark mode: the hairline border is darker than the canvas (invisible) and the
   shadow vanishes on dark — give the warm tile a faint LIGHT edge so the squircle
   reads as intentional, not a hard-pasted rectangle (design review 2026-06-20). */
@media (prefers-color-scheme: dark) {
  .hero__icon {
    border-color: rgba(242, 237, 228, 0.12);
    box-shadow: none;
  }
}

.hero__title {
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  margin: 0 auto;
  max-width: 14ch;
}

/* The tagline — the locked "what it meant to you", italic serif, the payload. */
.hero__tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  color: var(--ink-secondary);
  margin: 1.25rem auto 0;
  max-width: 24ch;
}

/* The one-line value proposition, sans, calm. */
.hero__value {
  font-size: 1.15rem;
  color: var(--ink-secondary);
  margin: 1.75rem auto 0;
  max-width: 46ch;
}

.hero__actions {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------------------------
   7. App Store download badge (placeholder — clearly a TODO until live)
   -------------------------------------------------------------------------- */
/* Apple's OFFICIAL badge is a self-contained SVG (its own black rounded-rect +
   wordmark) — so the link is just a sized, isolated image wrapper, not a drawn button. */
.appstore-badge {
  display: inline-block;
  line-height: 0;            /* remove the inline-image descender gap */
  border-radius: 9px;        /* match the badge artwork's corners for the focus ring */
  transition: opacity 150ms ease;
}
.appstore-badge img { height: 52px; width: auto; display: block; }
.appstore-badge:hover { opacity: 0.92; }
/* Placeholder until launch: no real App Store URL exists until the app is in ASC +
   released. Show Apple's badge UNALTERED (their guidelines say don't modify it — so no
   dimming/recolor); make it inert so a stray tap does nothing, and let the "Coming soon
   to iPhone" note carry the not-yet-available message. At launch: set href to the real
   product URL and remove aria-disabled to activate it. */
.appstore-badge[aria-disabled="true"] { pointer-events: none; }

/* The little "coming soon" note under the badge while the link is a placeholder. */
.badge-note {
  font-size: 0.85rem;
  color: var(--ink-secondary); /* small note text → keep ≥4.5:1 on canvas */
  margin: 0;
}

/* ----------------------------------------------------------------------------
   8. Feature beats  (the quiet "column", echoing the app's single editorial column)
   -------------------------------------------------------------------------- */
.beats {
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
}

.beat {
  display: grid;
  gap: 0.6rem;
  max-width: var(--measure);
  margin-inline: auto;
  /* One calm CENTERED column for the whole page — the hero is centered, so the
     content sections center too (device-QA 2026-06-20, Julian). The earlier
     left "type-spine" rule pulled each beat into a left-aligned aside, which read
     as a center→left→center whiplash; unifying the alignment fixes the flow. */
  text-align: center;
}
.beat p { margin-inline: auto; }   /* center the body block within the measure */
.beat__title {
  font-size: clamp(1.5rem, 3.5vw, 1.9rem);
}
.beat__body {
  color: var(--ink-secondary);
  margin: 0;
}

/* The media-type signal row — four small labelled chips, each in its signal
   color, to make the "all four media types as one archive" wedge tangible.
   Color is paired with a text label, so meaning is never color-alone. */
.signal-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.6rem;          /* row-gap / column-gap — bare items need more separation */
  margin-top: 0.85rem;
  padding: 0;
  list-style: none;
}
/* The app's actual grammar: a TINTED media-type SYMBOL + a label — no pill fill, no
   generic dot. The icon carries the type's signal color; the word carries the meaning. */
.signal-row li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-secondary);
}
.signal-row li svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--signal, var(--ink-tertiary));  /* tint = the type's signal color */
}
.signal-row li.books    { --signal: var(--signal-books); }
.signal-row li.films    { --signal: var(--signal-films); }
.signal-row li.tv       { --signal: var(--signal-tv); }
.signal-row li.podcasts { --signal: var(--signal-podcasts); }

/* ----------------------------------------------------------------------------
   9. A quiet "card" sample — to show, not tell, what an entry feels like.
      This mirrors the app's entry card: kicker / serif title / sans byline /
      italic serif takeaway. It is illustrative, not interactive.
   -------------------------------------------------------------------------- */
.entry-card {
  max-width: var(--measure);
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.4rem 1.5rem;
}
.entry-card__kicker {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  /* The book signal color, deepened to the link-grade terracotta so this small
     uppercase kicker clears WCAG AA 4.5:1 on the white card (the lighter
     #B5734A signal only reaches ~3.8:1 as text). Still unmistakably terracotta;
     the word "Book" carries the meaning, so signal intent is preserved. */
  color: var(--terracotta-deep);
  margin: 0 0 0.5rem;
}
.entry-card__title {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
}
.entry-card__byline {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink-secondary);
  margin: 0.25rem 0 0;
}
.entry-card__takeaway {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink);
  margin: 0.9rem 0 0;
  line-height: 1.5;
}

/* ----------------------------------------------------------------------------
   9b. The real app — actual screenshots, shown as quiet phone screens (rounded
       corners + ultra-soft shadow, no heavy mockup chrome — keeps the calm register).
   -------------------------------------------------------------------------- */
.screens {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(1.5rem, 5vw, 3rem);
  margin-top: 1.75rem;
}
.device {
  margin: 0;
  width: clamp(185px, 40vw, 244px);
}
.device img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: clamp(24px, 6.5vw, 32px);   /* echo the iPhone screen's corners */
  border: 1px solid var(--hairline);
  box-shadow: 0 10px 34px rgba(31, 27, 22, 0.12);
}
.device figcaption {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--ink-secondary);
}
/* Dark mode: the warm screenshot edges blend less, so lift the border like the icon tile. */
@media (prefers-color-scheme: dark) {
  .device img {
    border-color: rgba(242, 237, 228, 0.10);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  }
}

/* ----------------------------------------------------------------------------
   10. Long-form prose (Privacy + Support pages)
   -------------------------------------------------------------------------- */
.page-head {
  padding-block: clamp(3rem, 8vw, 5rem) clamp(1.5rem, 4vw, 2.5rem);
}
.page-head h1 {
  font-size: clamp(2.25rem, 5.5vw, 3.25rem);
}
.page-head .effective {
  color: var(--ink-secondary); /* small date line → keep ≥4.5:1 on canvas */
  font-size: 0.95rem;
  margin-top: 0.75rem;
}

.prose h2 {
  font-size: clamp(1.4rem, 3.5vw, 1.75rem);
  margin-top: 2.5rem;
  margin-bottom: 0.6rem;
}
.prose h3 {
  font-size: 1.2rem;
  margin-top: 1.75rem;
  margin-bottom: 0.4rem;
}
.prose p,
.prose li {
  color: var(--ink-secondary);
}
.prose p { margin-block: 0.75rem; }
.prose ul {
  max-width: var(--measure);
  padding-left: 1.25rem;
  margin-block: 0.75rem;
}
.prose li { margin-block: 0.35rem; }
.prose strong { color: var(--ink); font-weight: 600; }

/* The "Data Not Collected" callout — quietly emphasised, the privacy claim is
   the brand position, so it gets a calm panel rather than a loud banner. */
.callout {
  background: var(--well);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin-block: 1.75rem;
  max-width: var(--measure);
}
.callout p { margin: 0; color: var(--ink); }
.callout strong { color: var(--ink); }

/* A simple contact line for the support page. */
.contact {
  font-size: 1.05rem;
  margin-block: 1rem;
}
.contact a { font-weight: 500; }

/* FAQ — semantic <details>, calm, no chrome theatrics. */
.faq { max-width: var(--measure); margin-block: 1.5rem; }
.faq details {
  border-top: 1px solid var(--hairline);
  padding-block: 0.4rem;
}
.faq details:last-child { border-bottom: 1px solid var(--hairline); }
.faq summary {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink);
  cursor: pointer;
  padding-block: 0.7rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
/* a quiet +/− affordance instead of the default disclosure triangle */
.faq summary::after {
  content: "+";
  color: var(--terracotta);
  font-family: var(--sans);
  font-size: 1.3rem;
  line-height: 1;
  flex: none;
}
.faq details[open] summary::after { content: "\2212"; } /* minus sign */
.faq details > p {
  margin: 0 0 0.9rem;
  color: var(--ink-secondary);
}

/* ----------------------------------------------------------------------------
   11. Small utilities
   -------------------------------------------------------------------------- */
.center { text-align: center; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Respect reduced-motion for the hero icon entrance specifically. */
@media (prefers-reduced-motion: reduce) {
  .hero__icon { animation: none; }
}
