/* MoneyLab: paper and ink. Book covers carry the colour; one deep library green for actions. */
:root {
  --paper: #f5f4ef;
  --paper-deep: #ebe9e1;
  --card: #fbfaf7;
  --ink: #1c211e;
  --ink-soft: #424a45;
  --muted: #59615b;
  --rule: #d6d3c8;
  --green: #1f4d3a;
  --green-hover: #173b2c;
  --green-tint: #e2e9e1;
  --sans: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--sans); font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
::selection { background: var(--green-tint); }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.skip-link { position: absolute; left: 12px; top: -100px; z-index: 100; padding: 12px 16px; background: var(--ink); color: var(--paper); }
.skip-link:focus { top: 12px; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.header-row { display: flex; align-items: center; gap: 24px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; font-weight: 700; font-size: 20px; letter-spacing: -0.03em; }
.brand-mark { position: relative; width: 34px; height: 34px; border: 1.5px solid var(--ink); border-radius: 8px; display: grid; place-items: center; padding-right: 6px; font-size: 19px; line-height: 1; }
.brand-mark i { position: absolute; right: 4px; bottom: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.main-nav { margin-left: auto; display: flex; gap: 8px; }
.main-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-weight: 500; font-size: 15px; text-decoration: none; color: var(--ink-soft); border-radius: 6px; }
.main-nav a:hover { color: var(--ink); background: var(--paper-deep); }

.disclosure-banner { background: var(--green-tint); border-bottom: 1px solid var(--rule); padding: 10px 0; font-size: 14px; line-height: 1.5; color: var(--ink); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 48px; align-items: center; padding-top: 72px; padding-bottom: 64px; }
.hero h1 { font-size: clamp(36px, 5vw, 58px); line-height: 1.06; letter-spacing: -0.035em; max-width: 14ch; }
.hero-lead { font-family: var(--serif); font-size: 19px; line-height: 1.6; color: var(--ink-soft); max-width: 52ch; margin-top: 22px; }
.primary-cta { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; margin-top: 30px; padding: 0 22px; border-radius: 6px; background: var(--green); color: #fff; font-weight: 600; text-decoration: none; transition: background .15s; }
.primary-cta:hover { background: var(--green-hover); }

.hero-shelf { display: flex; align-items: flex-end; justify-content: center; padding: 12px 0 18px; border-bottom: 6px solid var(--paper-deep); }
.hero-shelf .cover { flex: none; width: 150px; height: 222px; }
.hero-shelf .cover + .cover { margin-left: -18px; }
.hero-shelf .cover-title { font-size: 19px; }
.shelf-back { transform: rotate(-3deg); transform-origin: bottom right; }
.shelf-mid { height: 206px !important; z-index: 1; }
.shelf-front { width: 168px !important; height: 248px !important; z-index: 2; }

/* Book covers: illustrative, typographic */
.cover { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 22px 18px 18px 22px; border-radius: 2px 5px 5px 2px; box-shadow: inset 6px 0 0 rgba(0,0,0,.08), 0 1px 1px rgba(0,0,0,.08), 0 10px 22px rgba(28,33,30,.16); overflow: hidden; }
.cover::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.35); }
.cover-title { font-family: var(--sans); font-weight: 700; font-size: 24px; line-height: 1.08; letter-spacing: -0.03em; }
.cover-by { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.cover-amber { background: #efe0c4; color: #2b2a22; }
.cover-coral { background: #e38f78; color: #331f19; }
.cover-cobalt { background: #a9c0d6; color: #172f45; }
.cover-sage { background: #c6d7bd; color: #22402d; }
.cover-ochre { background: #d9b45a; color: #2e2410; }
.cover-olive { background: #b9c590; color: #263518; }
.cover-rose { background: #eeb9b5; color: #5a2f38; }
.cover-sand { background: #d8c6a8; color: #3d3222; }

/* Library */
.library { padding-top: 64px; padding-bottom: 72px; border-top: 1px solid var(--rule); scroll-margin-top: 8px; }
.library-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 48px; align-items: end; }
.library-head h2, .about h2 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.1; }
.library-head p { font-family: var(--serif); font-size: 18px; color: var(--ink-soft); max-width: 46ch; }
.library-head a { color: var(--green); text-underline-offset: 3px; }
.topic-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.filter-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); color: var(--ink); font-size: 15px; font-weight: 500; transition: border-color .15s, background .15s; }
.filter-btn span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.filter-btn:hover { border-color: var(--ink-soft); }
.filter-btn.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter-btn.active span { color: #c9cec9; }
.results-text { margin: 16px 0 8px; font-size: 14px; color: var(--muted); }

.book-list { border-top: 1px solid var(--rule); }
.book { display: grid; grid-template-columns: 128px minmax(0, 1fr) auto; gap: 32px; align-items: start; padding: 36px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 16px; }
.book > .cover { width: 128px; height: 188px; padding: 14px 12px 12px 16px; }
.book > .cover .cover-title { font-size: 17px; }
.book > .cover .cover-by { font-size: 12px; }
.book-body { max-width: 62ch; }
.book-meta { font-size: 13px; font-weight: 500; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.start-here { display: inline-block; padding: 3px 9px; border-radius: 4px; background: var(--green); color: #fff; font-size: 12px; font-weight: 600; }
.book h3 { font-size: 24px; line-height: 1.2; margin-top: 8px; }
.book-author { font-size: 15px; color: var(--ink-soft); margin-top: 2px; }
.book-summary { font-family: var(--serif); font-size: 17px; line-height: 1.65; color: var(--ink); margin-top: 14px; }
.book-idea, .book-fit { font-size: 15px; line-height: 1.55; color: var(--ink-soft); margin-top: 12px; }
.book-idea strong, .book-fit strong { color: var(--ink); font-weight: 600; }
.book-featured { grid-template-columns: 176px minmax(0, 1fr) auto; }
.book-featured > .cover { width: 176px; height: 258px; padding: 20px 16px 16px 20px; }
.book-featured > .cover .cover-title { font-size: 23px; }
.book-featured h3 { font-size: 30px; }

.buy-link { display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 18px; border-radius: 6px; background: var(--green); color: #fff; font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .15s; }
.buy-link:hover { background: var(--green-hover); }
.buy-link .arrow { font-size: 17px; line-height: 1; }
.paid-marker { padding: 1px 6px; border: 1px solid rgba(255,255,255,.6); border-radius: 3px; font-size: 12px; font-weight: 600; line-height: 1.4; }
.books-empty { padding: 48px 0; color: var(--muted); text-align: center; }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 24px 48px; padding-top: 64px; padding-bottom: 80px; border-top: 1px solid var(--rule); scroll-margin-top: 8px; }
.about-copy { display: grid; gap: 16px; font-family: var(--serif); font-size: 18px; line-height: 1.65; color: var(--ink-soft); max-width: 60ch; }

/* Footer */
.footer { background: var(--paper-deep); border-top: 1px solid var(--rule); padding: 24px 0 32px; }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; font-size: 14px; color: var(--ink-soft); text-underline-offset: 3px; }
.footer-links a:hover { color: var(--ink); }
.footer-note p { margin-top: 12px; font-size: 13px; line-height: 1.6; color: var(--muted); max-width: 80ch; }

/* Cookie banner */
.consent-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--ink); color: var(--paper); padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -8px 24px rgba(0,0,0,.18); }
.consent-row { display: flex; align-items: center; gap: 24px; padding-top: 16px; padding-bottom: 16px; }
.consent-row p { flex: 1; font-size: 14px; line-height: 1.55; }
.consent-row a { color: inherit; text-underline-offset: 3px; }
.consent-actions { display: flex; gap: 10px; }
.consent-btn { min-width: 104px; min-height: 44px; padding: 0 18px; border-radius: 6px; border: 1px solid #6b736d; background: transparent; color: var(--paper); font-size: 15px; font-weight: 600; }
.consent-btn:hover { border-color: var(--paper); }
.consent-accept { background: var(--paper); border-color: var(--paper); color: var(--ink); }

/* Privacy page */
.legal { max-width: 760px; padding-top: 64px; padding-bottom: 96px; }
.legal-date { font-size: 14px; color: var(--muted); }
.legal h1 { font-size: clamp(34px, 5vw, 48px); line-height: 1.1; margin: 8px 0 20px; }
.legal h2 { font-size: 22px; margin: 40px 0 10px; scroll-margin-top: 16px; }
.legal p { font-family: var(--serif); font-size: 17px; line-height: 1.7; color: var(--ink-soft); margin-bottom: 14px; }
.legal .legal-lead { font-size: 19px; color: var(--ink); }
.legal a { color: var(--green); text-underline-offset: 3px; }
.legal code { font-size: 14px; background: var(--paper-deep); padding: 1px 5px; border-radius: 3px; }
.legal .consent-btn { background: var(--green); border-color: var(--green); color: #fff; }

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 48px; gap: 36px; }
  .hero-shelf { justify-content: flex-start; }
  .library-head, .about { grid-template-columns: minmax(0, 1fr); }
  .book, .book-featured { grid-template-columns: 96px minmax(0, 1fr); gap: 16px 20px; }
  .book > .cover, .book-featured > .cover { width: 96px; height: 141px; padding: 10px 9px 9px 12px; }
  .book > .cover .cover-title, .book-featured > .cover .cover-title { font-size: 13px; }
  .book > .cover .cover-by, .book-featured > .cover .cover-by { display: none; }
  .book > .buy-link { grid-column: 1 / -1; justify-content: center; }
  .book-featured h3, .book h3 { font-size: 22px; }
}
@media (max-width: 560px) {
  .header-row { min-height: 64px; }
  .main-nav a { padding: 0 8px; }
  .hero h1 { font-size: 34px; }
  .hero-lead { font-size: 17px; }
  .hero-shelf .cover { width: 108px; height: 160px; padding: 12px 10px 10px 14px; }
  .shelf-mid { height: 148px !important; }
  .shelf-front { width: 120px !important; height: 178px !important; }
  .hero-shelf .cover + .cover { margin-left: -10px; }
  .hero-shelf .cover-title { font-size: 14px; }
  .hero-shelf .cover-by { font-size: 12px; }
  .book { padding: 28px 0; }
  .book, .book-featured { grid-template-columns: 72px minmax(0, 1fr); row-gap: 4px; }
  .book > .cover, .book-featured > .cover { width: 72px; height: 106px; grid-row: 1 / span 3; margin-bottom: 8px; }
  .book > .cover .cover-title, .book-featured > .cover .cover-title { font-size: 11px; letter-spacing: -0.01em; }
  .book-body { display: contents; }
  .book-body > .book-meta, .book-body > h3, .book-body > .book-author { grid-column: 2; }
  .book-body > .book-summary, .book-body > .book-idea, .book-body > .book-fit { grid-column: 1 / -1; }
  .book-meta { align-self: end; }
  .book h3 { margin-top: 0; }
  .book-summary { margin-top: 8px; font-size: 16px; }
  .book-idea, .book-fit { margin-top: 8px; }
  .book > .buy-link { margin-top: 12px; }
  .consent-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .consent-actions > .consent-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
