/* Code Café — Issue 01
   A magazine-style stylesheet: newsprint paper, a big serif masthead, hairline rules,
   mono kickers, and a colour story per app. No framework, no build step. */

:root {
  --paper: #f3eee4;
  --paper-2: #ebe4d6;
  --ink: #17130f;
  --ink-2: #4a4239;
  --muted: #7a6f62;
  --rule: #17130f;
  --hair: rgba(23, 19, 15, .18);
  --accent: #b5391c;          /* crema red */
  --accent-ink: #fff8ef;

  --night: #0b1747;           /* Sleep Stop */
  --night-2: #142565;
  --lavender: #b8a6ff;
  --cyan: #7fd5ff;

  --forest: #1f4e31;          /* Garden Track */
  --forest-2: #2d6a43;
  --cream: #f4efe1;
  --rose: #df4579;
  --mint: #b3f0bf;

  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1280px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15120f;
    --paper-2: #1e1a16;
    --ink: #efe7da;
    --ink-2: #cfc5b6;
    --muted: #9b8f80;
    --rule: #efe7da;
    --hair: rgba(239, 231, 218, .18);
    --accent: #ff7a52;
    --accent-ink: #1a0d07;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15120f; --paper-2: #1e1a16; --ink: #efe7da; --ink-2: #cfc5b6; --muted: #9b8f80;
  --rule: #efe7da; --hair: rgba(239, 231, 218, .18); --accent: #ff7a52; --accent-ink: #1a0d07;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(17px, 1.05vw + 12px, 20px);
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Faint paper grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { mix-blend-mode: screen; opacity: .25; } }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .5rem 1rem; z-index: 200; }
.skip:focus { left: 1rem; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Type primitives ---------- */
.kicker {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); font-weight: 500; margin: 0 0 .9rem;
}
.kicker--ink { color: var(--ink); }
.dek { font-family: var(--serif); font-style: italic; font-size: clamp(1.15rem, 1.2vw + .8rem, 1.6rem); line-height: 1.35; color: var(--ink-2); margin: 0; }
.display {
  font-family: var(--display); font-weight: 800; line-height: .92; letter-spacing: -.02em;
  font-variation-settings: "SOFT" 30, "WONK" 0; margin: 0;
}
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.rule--thick { border-top-width: 4px; }
.rule--double { border-top: 4px double var(--rule); }
.smallcaps { font-variant: all-small-caps; letter-spacing: .06em; }
.page-num { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; color: var(--muted); }

/* ---------- Top strip & masthead ---------- */
.strip {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .7rem 0; color: var(--ink-2);
}
.strip span:nth-child(2) { text-align: center; }
@media (max-width: 640px) { .strip span:nth-child(2) { display: none; } }

.masthead { text-align: center; padding: clamp(.5rem, 2vw, 1.5rem) 0 clamp(.6rem, 1.5vw, 1rem); }
.masthead__title {
  font-family: var(--display); font-weight: 900; font-size: clamp(4.2rem, 17vw, 15rem); line-height: .82;
  letter-spacing: -.045em; margin: 0; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.masthead__title a { text-decoration: none; }
.masthead__title em { font-style: italic; font-weight: 400; color: var(--accent); letter-spacing: -.03em; }
.masthead__tag { font-family: var(--serif); font-style: italic; font-size: clamp(1rem, 1vw + .7rem, 1.35rem); margin: .4rem 0 0; color: var(--ink-2); }

/* Inner-page header: a compact masthead */
.topbar { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1rem 0 .8rem; flex-wrap: wrap; }
.topbar__brand { font-family: var(--display); font-weight: 900; font-size: clamp(1.7rem, 3vw, 2.4rem); letter-spacing: -.03em; text-decoration: none; line-height: 1; font-variation-settings: "SOFT" 100, "WONK" 1; }
.topbar__brand em { font-style: italic; font-weight: 400; color: var(--accent); }
.nav { display: flex; gap: clamp(.8rem, 2vw, 1.8rem); font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; flex-wrap: wrap; }
.nav a { text-decoration: none; padding: .2rem 0; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: currentColor; }

/* ---------- Cover ---------- */
.cover { display: grid; grid-template-columns: 1.55fr 1fr; gap: 0; border-bottom: 1px solid var(--rule); }
.cover__lead {
  position: relative; background: var(--night); color: #eef0ff; padding: clamp(1.5rem, 4vw, 3.5rem);
  overflow: hidden; min-height: 560px; display: flex; flex-direction: column; justify-content: flex-end; isolation: isolate;
}
.cover__lead::before { /* night sky */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 8%, #fff8 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 47% 22%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 12%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 82% 30%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90% 8%, #fffa 50%, transparent 51%),
    radial-gradient(1px 1px at 38% 36%, #fff5 50%, transparent 51%),
    radial-gradient(120% 80% at 85% 0%, #2a3d9a 0%, transparent 55%),
    linear-gradient(180deg, #0a1440, #0b1747 60%, #081034);
}
.cover__icon { position: absolute; right: clamp(1rem, 4vw, 3rem); top: clamp(1rem, 4vw, 3rem); width: clamp(120px, 22vw, 260px); border-radius: 22%; box-shadow: 0 30px 80px -20px #000a, 0 0 0 1px #ffffff14; transform: rotate(6deg); }
.cover__lead .kicker { color: var(--lavender); }
.cover__lead h2 { font-size: clamp(2.8rem, 6.4vw, 6rem); color: #fff; max-width: 13ch; }
.cover__lead h2 em { font-style: italic; font-weight: 400; color: var(--lavender); }
.cover__lead .dek { color: #c9cff5; margin-top: 1.2rem; max-width: 34ch; }
.cover__lead .cta-row { margin-top: 1.8rem; }

.cover__side { display: grid; grid-template-rows: auto 1fr auto; border-left: 1px solid var(--rule); }
.coverline { padding: clamp(1.2rem, 2.5vw, 2rem); border-bottom: 1px solid var(--rule); text-decoration: none; display: block; }
.coverline:last-child { border-bottom: 0; }
.coverline h3 { font-family: var(--display); font-weight: 700; font-size: clamp(1.6rem, 2.6vw, 2.4rem); line-height: 1; letter-spacing: -.02em; margin: 0 0 .6rem; }
.coverline p { margin: 0; color: var(--ink-2); }
.coverline--garden { background: var(--forest); color: var(--cream); position: relative; overflow: hidden; }
.coverline--garden .kicker { color: var(--mint); }
.coverline--garden p { color: #dfe8dc; }
.coverline--garden img { width: 92px; border-radius: 22%; float: right; margin: 0 0 .6rem 1rem; box-shadow: 0 10px 30px -10px #0008; }
.coverline--garden:hover { color: var(--cream); }
.coverline--garden:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .12em; }
.coverline--big h3 { font-size: clamp(2.2rem, 4vw, 3.6rem); }
.coverline--big h3 span { color: var(--accent); font-style: italic; font-weight: 400; }
.price-tag {
  display: inline-grid; place-items: center; width: 7.2rem; aspect-ratio: 1; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-family: var(--display); font-weight: 800; text-align: center;
  line-height: 1; transform: rotate(-12deg); font-size: 1.05rem; padding: .6rem; float: right; margin: -.2rem -.2rem .6rem .8rem;
}
.price-tag b { display: block; font-size: 2.2rem; letter-spacing: -.03em; }

@media (max-width: 900px) {
  .cover { grid-template-columns: 1fr; }
  .cover__side { border-left: 0; border-top: 1px solid var(--rule); }
  .cover__lead { min-height: 520px; }
}
@media (max-width: 520px) {
  .cover__icon { width: 110px; }
  .cover__lead { padding-top: 9rem; }
}

/* ---------- Buttons ---------- */
.cta-row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: .55rem; font-family: var(--mono); font-size: .78rem; letter-spacing: .1em;
  text-transform: uppercase; text-decoration: none; padding: .85rem 1.2rem; border: 1.5px solid currentColor; border-radius: 999px;
  transition: transform .15s ease, background .15s ease, color .15s ease; line-height: 1;
}
.btn:hover { transform: translateY(-1px); }
.btn--solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--light { background: #fff; color: var(--night); border-color: #fff; }
.btn--light:hover { background: var(--lavender); border-color: var(--lavender); color: var(--night); }
.btn--ghost-light { color: #fff; }
.btn--ghost-light:hover { color: var(--lavender); }
.btn--garden { background: var(--cream); color: var(--forest); border-color: var(--cream); }
.btn--garden:hover { background: var(--mint); border-color: var(--mint); color: var(--forest); }
.btn svg { width: 1.1em; height: 1.1em; flex: none; }

/* ---------- Contents ---------- */
.contents { display: grid; grid-template-columns: 1fr 2fr; gap: clamp(1.5rem, 4vw, 4rem); padding: clamp(2.5rem, 6vw, 5rem) 0; }
.contents h2 { font-size: clamp(3rem, 7vw, 6rem); }
.contents h2 em { font-style: italic; font-weight: 400; color: var(--accent); }
.toc { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { border-top: 1px solid var(--rule); }
.toc li:last-child { border-bottom: 1px solid var(--rule); }
.toc a { display: grid; grid-template-columns: 3.5rem 1fr auto; gap: 1rem; align-items: baseline; padding: 1.1rem 0; text-decoration: none; }
.toc a:hover .toc__title { color: var(--accent); }
.toc__num { font-family: var(--display); font-weight: 300; font-size: 2rem; line-height: 1; font-style: italic; color: var(--muted); }
.toc__title { font-family: var(--display); font-weight: 700; font-size: clamp(1.3rem, 2vw, 1.8rem); line-height: 1.1; letter-spacing: -.01em; transition: color .15s; }
.toc__desc { display: block; font-family: var(--serif); font-weight: 400; font-size: 1rem; color: var(--ink-2); margin-top: .3rem; letter-spacing: 0; }
.toc__arrow { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
@media (max-width: 760px) { .contents { grid-template-columns: 1fr; } }

/* ---------- Feature spreads (home) ---------- */
.spread { padding: clamp(3rem, 7vw, 6rem) 0; position: relative; }
.spread--night { background: var(--night); color: #e7e9fb; }
.spread--garden { background: var(--forest); color: var(--cream); }
.spread__head { display: grid; grid-template-columns: auto 1fr; gap: clamp(1rem, 3vw, 2.5rem); align-items: end; padding-bottom: 1.5rem; border-bottom: 1px solid currentColor; margin-bottom: 2rem; }
.spread__head img { width: clamp(84px, 11vw, 140px); border-radius: 22%; box-shadow: 0 20px 50px -18px #000c; }
.spread h2 { font-size: clamp(2.8rem, 8vw, 7.5rem); }
.spread--night h2 em { color: var(--lavender); font-style: italic; font-weight: 400; }
.spread--garden h2 em { color: var(--mint); font-style: italic; font-weight: 400; }
.spread--night .kicker { color: var(--lavender); }
.spread--garden .kicker { color: var(--mint); }
.spread--night .dek { color: #c4caf3; }
.spread--garden .dek { color: #dce6d7; }
.spread__grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: start; }
@media (max-width: 860px) { .spread__grid { grid-template-columns: 1fr; } .spread__head { grid-template-columns: 1fr; } }

.columns { column-count: 2; column-gap: 2.2rem; column-rule: 1px solid var(--hair); }
.columns p { margin: 0 0 1em; break-inside: avoid-column; }
@media (max-width: 700px) { .columns { column-count: 1; } }

.dropcap::first-letter {
  font-family: var(--display); font-weight: 900; float: left; font-size: 4.6em; line-height: .8;
  padding: .06em .1em 0 0; color: var(--accent);
}
.spread--night .dropcap::first-letter { color: var(--lavender); }
.spread--garden .dropcap::first-letter { color: var(--mint); }

.pull {
  font-family: var(--display); font-weight: 400; font-style: italic; font-size: clamp(1.6rem, 2.8vw, 2.5rem);
  line-height: 1.12; letter-spacing: -.01em; margin: 0; padding: 1.4rem 0; border-top: 4px solid currentColor; border-bottom: 1px solid currentColor;
}
.pull cite { display: block; font-family: var(--mono); font-style: normal; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; margin-top: 1rem; opacity: .75; }

.spread__aside > * + * { margin-top: 2rem; }

/* Sleep Stop "fade" illustration */
.fade-viz { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 1rem 0; }
.fade-viz span { flex: 1; background: linear-gradient(180deg, var(--cyan), var(--lavender)); border-radius: 3px 3px 0 0; opacity: .9; }
.fade-viz__label { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; opacity: .7; border-top: 1px solid currentColor; padding-top: .5rem; }

/* Screenshot strip */
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(.6rem, 1.5vw, 1.2rem); }
.shots figure { margin: 0; }
.shots img { border-radius: 14px; box-shadow: 0 24px 50px -24px #000b; border: 1px solid #ffffff22; background: #fafaf5; }
.shots figure:nth-child(2) { transform: translateY(2.2rem); }
.shots figcaption { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; margin-top: .6rem; opacity: .8; }

/* ---------- House rules / manifesto ---------- */
.rules { padding: clamp(3rem, 7vw, 6rem) 0; }
.rules__grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 4px solid var(--rule); }
.rules__grid > div { padding: 1.6rem 1.6rem 1.6rem 0; border-right: 1px solid var(--hair); }
.rules__grid > div + div { padding-left: 1.6rem; }
.rules__grid > div:last-child { border-right: 0; }
.rules__grid h3 { font-family: var(--display); font-size: clamp(1.5rem, 2.4vw, 2.1rem); font-weight: 700; line-height: 1.05; margin: .2rem 0 .7rem; letter-spacing: -.01em; }
.rules__grid p { margin: 0; color: var(--ink-2); }
.rules__num { font-family: var(--display); font-style: italic; font-weight: 300; font-size: 3.5rem; line-height: 1; color: var(--accent); }
@media (max-width: 820px) {
  .rules__grid { grid-template-columns: 1fr; }
  .rules__grid > div, .rules__grid > div + div { padding: 1.4rem 0; border-right: 0; border-bottom: 1px solid var(--hair); }
}

/* ---------- Article (app pages) ---------- */
.article-hero { padding: clamp(2rem, 6vw, 5rem) 0 clamp(2rem, 4vw, 3rem); position: relative; overflow: hidden; isolation: isolate; }
.article-hero--night { background: var(--night); color: #eef0ff; }
.article-hero--night::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(1px 1px at 10% 20%, #fff8 50%, transparent 51%), radial-gradient(1.5px 1.5px at 35% 12%, #fff9 50%, transparent 51%), radial-gradient(1px 1px at 60% 28%, #fff6 50%, transparent 51%), radial-gradient(1.5px 1.5px at 85% 15%, #fffa 50%, transparent 51%), radial-gradient(90% 70% at 90% 0%, #2a3d9a 0%, transparent 60%); }
.article-hero--garden { background: var(--forest); color: var(--cream); }
.article-hero--garden::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(80% 70% at 100% 0%, #3d7f55 0%, transparent 60%), repeating-linear-gradient(135deg, transparent 0 22px, #ffffff06 22px 23px); }
.article-hero__grid { display: grid; grid-template-columns: 1fr auto; gap: clamp(1.5rem, 4vw, 4rem); align-items: end; }
.article-hero__icon { width: clamp(140px, 20vw, 260px); border-radius: 22%; box-shadow: 0 30px 70px -20px #000c; transform: rotate(4deg); }
.article-hero h1 { font-size: clamp(3.6rem, 13vw, 10rem); }
.article-hero h1 em { font-style: italic; font-weight: 400; }
.article-hero--night h1 em, .article-hero--night .kicker { color: var(--lavender); }
.article-hero--garden h1 em, .article-hero--garden .kicker { color: var(--mint); }
.article-hero .dek { color: inherit; opacity: .85; margin-top: 1.4rem; max-width: 30ch; }
.article-hero .cta-row { margin-top: 2rem; }
.byline { display: flex; gap: .5rem 1.5rem; flex-wrap: wrap; font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid currentColor; opacity: .85; }
@media (max-width: 700px) { .article-hero__grid { grid-template-columns: 1fr; } .article-hero__icon { order: -1; width: 112px; transform: rotate(3deg); } .byline { line-height: 1.4; } }

.breadcrumbs { font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; padding: .9rem 0; color: var(--muted); }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumbs li + li::before { content: "/"; margin-right: .5rem; opacity: .5; }
.breadcrumbs a { text-decoration: none; }

.article { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(2rem, 5vw, 5rem); padding: clamp(2.5rem, 6vw, 5rem) 0; }
@media (max-width: 960px) { .article { grid-template-columns: 1fr; } }
.article__body > section + section { margin-top: clamp(2.5rem, 5vw, 4rem); }
.article__body h2 { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; letter-spacing: -.02em; margin: 0 0 1.2rem; }
.article__body h2 .sec { display: block; font-family: var(--mono); font-weight: 500; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: .8rem; }
.article__body h3 { font-family: var(--display); font-weight: 700; font-size: 1.4rem; line-height: 1.15; margin: 1.6rem 0 .5rem; }
.article__body p { margin: 0 0 1em; }
.article__body .lede { font-size: 1.18em; line-height: 1.5; }
.article__body ul { padding-left: 1.2rem; }
.article__body li { margin: .35rem 0; }
.article__body li::marker { color: var(--accent); }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 1.5rem 0; }
.modes > div { padding: 1.2rem 1.2rem 1.2rem 0; }
.modes > div + div { padding-left: 1.2rem; border-left: 1px solid var(--hair); }
.modes h3 { margin-top: 0; }
.modes p { font-size: .95em; color: var(--ink-2); margin: 0; }
@media (max-width: 640px) { .modes { grid-template-columns: 1fr; } .modes > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--hair); } }

/* Sleep ladder diagram */
.ladder { list-style: none; padding: 0; margin: 1.6rem 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; counter-reset: rung; }
.ladder li { counter-increment: rung; position: relative; background: var(--night); color: #e7e9fb; padding: .9rem .7rem; font-family: var(--mono); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; min-height: 6.5rem; display: flex; flex-direction: column; justify-content: space-between; }
.ladder li::before { content: "0" counter(rung); font-family: var(--display); font-style: italic; font-size: 1.6rem; letter-spacing: 0; color: var(--lavender); text-transform: none; }
.ladder li:nth-child(1) { background: #3c4fa8; }
.ladder li:nth-child(2) { background: #2f3f90; }
.ladder li:nth-child(3) { background: #233176; }
.ladder li:nth-child(4) { background: #18245f; }
.ladder li:nth-child(5) { background: #0f1a4c; }
.ladder li:nth-child(6) { background: var(--accent); color: var(--accent-ink); }
.ladder li:nth-child(6)::before { color: var(--accent-ink); }
@media (max-width: 640px) { .ladder { grid-template-columns: repeat(2, 1fr); } }

.figure { margin: 1.8rem 0; }
.figure img { border: 1px solid var(--hair); }
.figure figcaption { font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: .6rem; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(.6rem, 2vw, 1.4rem); margin: 1.8rem 0; }
.gallery figure { margin: 0; }
.gallery img { border-radius: 14px; border: 1px solid var(--hair); box-shadow: 0 18px 40px -26px #000a; background: #fafaf5; }
.gallery figcaption { font-family: var(--mono); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: .5rem; }
@media (max-width: 560px) { .gallery { grid-template-columns: repeat(2, 1fr); } }

/* Sidebar */
.sidebar { align-self: start; position: sticky; top: 1.5rem; }
@media (max-width: 960px) { .sidebar { position: static; } }
.factbox { border-top: 4px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 1.2rem 0; }
.factbox h2 { font-family: var(--mono); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 1rem; font-weight: 500; }
.factbox dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem; font-size: .95rem; }
.factbox dt { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: .25rem; }
.factbox dd { margin: 0; }
.sidebar .pull { margin-top: 2rem; font-size: clamp(1.4rem, 2vw, 1.9rem); }
.sidebar .cta-row { margin-top: 1.4rem; }

/* FAQ */
.faq details { border-top: 1px solid var(--rule); padding: 1rem 0; }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 1.25rem; line-height: 1.25; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); font-weight: 400; color: var(--accent); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: .8rem 0 0; color: var(--ink-2); }

/* Next story */
.next { display: grid; grid-template-columns: auto 1fr auto; gap: clamp(1rem, 3vw, 2.5rem); align-items: center; padding: clamp(2rem, 5vw, 3.5rem) 0; border-top: 4px solid var(--rule); text-decoration: none; }
.next img { width: clamp(72px, 9vw, 110px); border-radius: 22%; }
.next h2 { font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 4.5vw, 3.6rem); line-height: 1; letter-spacing: -.02em; margin: 0; }
.next .arrow { font-family: var(--display); font-size: clamp(2rem, 5vw, 4rem); transition: transform .2s; }
.next:hover .arrow { transform: translateX(8px); }
@media (max-width: 560px) { .next { grid-template-columns: auto 1fr; } .next .arrow { display: none; } }

/* ---------- Footer / colophon ---------- */
.colophon { border-top: 4px double var(--rule); padding: clamp(2.5rem, 5vw, 4rem) 0 2rem; margin-top: 0; }
.colophon__grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; }
.colophon h2 { font-family: var(--mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; margin: 0 0 .8rem; color: var(--muted); }
.colophon ul { list-style: none; margin: 0; padding: 0; font-size: .95rem; }
.colophon li { margin: .35rem 0; }
.colophon a { text-decoration: none; }
.colophon a:hover { text-decoration: underline; }
.colophon__brand { font-family: var(--display); font-weight: 900; font-size: 2.6rem; line-height: .9; letter-spacing: -.04em; margin: 0 0 .8rem; font-variation-settings: "SOFT" 100, "WONK" 1; }
.colophon__brand em { font-style: italic; font-weight: 400; color: var(--accent); }
.colophon__fine { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--hair); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 760px) { .colophon__grid { grid-template-columns: 1fr 1fr; } .colophon__grid > :first-child { grid-column: 1 / -1; } }

/* ---------- Ticker ---------- */
.ticker { overflow: hidden; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--ink); color: var(--paper); }
.ticker__track { display: flex; width: max-content; animation: ticker 40s linear infinite; }
.ticker span { font-family: var(--mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; padding: .7rem 1.6rem; white-space: nowrap; }
.ticker span::after { content: "✦"; margin-left: 3.2rem; color: var(--accent); }
@keyframes ticker { to { transform: translateX(-50%); } }

/* Entrance */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
  .rise-2 { animation-delay: .12s; }
  .rise-3 { animation-delay: .24s; }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } }
}

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Per-app accent on the feature pages */
body.page-sleep { --accent: #3b4cc0; }
body.page-garden { --accent: #2d6a43; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.page-sleep { --accent: #a99bff; }
  :root:not([data-theme="light"]) body.page-garden { --accent: #7fd99a; }
}
:root[data-theme="dark"] body.page-sleep { --accent: #a99bff; }
:root[data-theme="dark"] body.page-garden { --accent: #7fd99a; }
