/* Pagestruck site. Tokens match the app (Pagestruck/Theme/AppTheme.swift). */
:root {
  --paper: #F2F5F4;
  --card: #FFFFFF;
  --soft: #E4ECE8;
  --wall: #D8E2D9;
  --line: #D9E2DD;
  --ink: #213B38;
  --muted: #55645F;
  --pine: #24584E;
  --pine-dark: #193F39;
  --gold: #A98540;
  --gold-text: #7A5E24;
  --oak: #C9A67C;
  --display: "New York", ui-serif, "Iowan Old Style", Georgia, serif;
  --text: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --measure: 68ch;
  --page: 1180px;
  --radius: 20px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--text); }
::selection { background: var(--pine); color: #fff; }
a { color: var(--pine); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--pine-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
p { margin: 0 0 1em; }
.wrap { width: min(var(--page), 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 16px; z-index: 10; background: var(--card); padding: 8px 12px; border-radius: 8px; }

/* Header */
.site-head { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; }
.brand svg { flex: 0 0 auto; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; padding: 10px 12px; border-radius: 999px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--soft); }

/* Hero: the shelf itself is the page's opening. */
.hero { position: relative; background: var(--wall); overflow: hidden; }
/* Every band ends on a real oak ledge (src/assets/ledge.webp, cut from the shelf render); the next band carries its shadow. */
.hero::after, .ledge::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; background: url(/assets/ledge.webp) repeat-x left top / auto 14px; z-index: 3; }
.ledge, body:has(.ledge) .site-foot { box-shadow: inset 0 14px 12px -10px rgba(48, 38, 24, 0.38); }
.hero-shelf { width: 100%; height: clamp(520px, 72vw, 860px); object-fit: cover; object-position: 50% 60%; }
.hero-copy { position: absolute; left: 0; right: 0; top: clamp(20px, 5vw, 64px); }
.hero-card { max-width: 560px; background: color-mix(in srgb, var(--paper) 94%, transparent); border-radius: var(--radius); padding: clamp(20px, 3vw, 36px); box-shadow: 0 18px 44px rgba(33, 59, 56, 0.18); }
.hero h1 { font-size: clamp(36px, 5.2vw, 64px); }
.hero .lede { font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); margin: 16px 0 22px; }
.status { font-size: 14px; color: var(--muted); margin: 16px 0 0; text-wrap: pretty; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 650; text-decoration: none; font-size: 16px; }
.btn-primary { background: var(--pine); color: #fff; }
.btn-primary:hover { background: var(--pine-dark); color: #fff; }
.btn-quiet { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-quiet:hover { background: var(--soft); color: var(--ink); }

/* The phone in the reader's hand, held up against the shelf. */
.phone { position: absolute; right: clamp(16px, 6vw, 96px); bottom: -40px; width: clamp(220px, 24vw, 300px); aspect-ratio: 390 / 800; border-radius: 44px; background: #10201d; padding: 11px; box-shadow: 0 30px 60px rgba(17, 30, 28, 0.35); z-index: 4; }
.phone-screen { height: 100%; border-radius: 34px; background: var(--paper); overflow: hidden; display: flex; flex-direction: column; }
.phone-top { padding: 34px 16px 8px; }
.phone-top b { display: block; font-family: var(--display); font-size: 22px; }
.phone-top span { font-size: 12px; color: var(--muted); }
.phone-wall { flex: 1; min-height: 0; position: relative; }
.phone-wall img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 0 0; }
.phone-tabs { position: relative; z-index: 1; margin-top: -52px; display: grid; grid-template-columns: repeat(5, 1fr); margin: 8px 10px 12px; padding: 6px; border-radius: 22px; background: var(--card); box-shadow: 0 4px 14px rgba(33,59,56,.12); }
.phone-tabs span { height: 26px; border-radius: 13px; }
.phone-tabs span:nth-child(3) { background: var(--soft); }

/* Sections run down the page like ledges of one bookcase. */
.ledge { position: relative; padding: clamp(56px, 8vw, 104px) 0; }
/* Wall bands: the render's whitewashed brick at full strength; copy sits on paper panels pinned to it. */
.ledge.wall { background: var(--wall) url(/assets/brick.webp) center top / max(52vw, 370px) auto; }
.wall .copy { background: var(--paper); border-radius: var(--radius); padding: clamp(22px, 3vw, 36px); box-shadow: 0 14px 34px rgba(33, 40, 30, 0.22); }
.wall .sample > .label { justify-self: start; background: var(--paper); border-radius: 999px; padding: 4px 12px; color: var(--ink); }
.ledge-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.ledge-grid.flip > :first-child { order: 2; }
.ledge h2 { font-size: clamp(30px, 3.6vw, 46px); margin-bottom: 16px; }
.ledge p { color: var(--muted); max-width: var(--measure); }
.ledge figure { margin: 0; border-radius: var(--radius); overflow: hidden; box-shadow: 0 16px 36px rgba(33,59,56,0.16); }
.ledge figure.narrow { width: min(380px, 100%); justify-self: center; }
.ledge figcaption { font-size: 13px; color: var(--muted); padding: 10px 14px; background: var(--card); }
.points { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 14px; }
.points li { padding-left: 28px; position: relative; }
.points li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 14px; height: 6px; border-radius: 2px; background: var(--oak); box-shadow: 0 -8px 0 -1px var(--pine); }
.points b { color: var(--ink); }

.sample { display: grid; gap: 12px; }
.session { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: 0 12px 30px rgba(33,59,56,0.12); }
.session .time { font-family: var(--display); font-size: 48px; font-variant-numeric: tabular-nums; }
.session .bar { height: 8px; border-radius: 4px; background: var(--soft); margin: 10px 0 6px; }
.session .bar i { display: block; height: 8px; width: 43%; border-radius: 4px; background: var(--gold); }
.note { display: flex; gap: 12px; font-size: 15px; padding: 10px 0; border-top: 1px solid var(--line); }
.note b { color: var(--gold-text); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.label { font-size: 13px; color: var(--muted); }

.csv { font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace; background: #13201e; color: #d8e6e1; border-radius: var(--radius); padding: 18px; overflow-x: auto; }
.csv .dim { color: #8fa59f; }

.faq-list { display: grid; gap: 10px; max-width: 820px; }
details { background: var(--card); border-radius: 16px; padding: 4px 20px; box-shadow: inset 0 0 0 1px var(--line); }
summary { cursor: pointer; font-weight: 650; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--pine); font-size: 22px; line-height: 1; }
details[open] summary::after { content: "–"; }
details p { color: var(--muted); }

/* Reading pages: FAQ, legal, blog. */
.page { padding: clamp(40px, 6vw, 80px) 0 clamp(56px, 8vw, 96px); }
.page h1 { font-size: clamp(34px, 4.6vw, 54px); margin-bottom: 14px; }
.page .intro { font-size: 19px; color: var(--muted); max-width: var(--measure); margin-bottom: 32px; }
.prose { max-width: var(--measure); }
.prose h2 { font-size: 28px; margin: 40px 0 12px; }
.prose h3 { font-size: 21px; margin: 28px 0 8px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 8px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 16px 0 24px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose code { font: 14px ui-monospace, "SF Mono", Menlo, monospace; background: var(--soft); padding: 1px 5px; border-radius: 5px; }
.meta { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.posts { display: grid; gap: 0; max-width: 860px; }
.post { display: grid; grid-template-columns: 120px 1fr; gap: 20px; padding: 26px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.post:hover h2 { color: var(--pine); }
.post h2 { font-size: 24px; margin-bottom: 6px; }
.post p { color: var(--muted); margin: 0; }
.post time { font-size: 14px; color: var(--muted); padding-top: 6px; font-variant-numeric: tabular-nums; }

.site-foot { background: var(--pine-dark); color: #d9e4df; padding: 48px 0 40px; font-size: 15px; }
.site-foot a { color: #fff; }
.foot-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 0; }

@media (max-width: 820px) {
  .ledge-grid { grid-template-columns: 1fr; }
  .ledge-grid.flip > :first-child { order: 0; }
  .hero { display: flex; flex-direction: column; padding-bottom: 0; }
  .hero-copy { position: relative; top: 0; order: -1; }
  .hero-copy { padding: 16px 0 18px; }
  .hero-card { box-shadow: 0 10px 28px rgba(33, 59, 56, 0.14); padding: 22px 20px; background: var(--paper); }
  .hero-shelf { height: 440px; object-position: 30% 50%; }
  .phone { right: 50%; transform: translateX(50%); bottom: -60px; width: 190px; }
  .post { grid-template-columns: 1fr; gap: 4px; }
  .nav a { padding: 10px 9px; font-size: 14px; }
}
@media (max-width: 480px) { .nav a[href="/#shelf"] { display: none; } }
