
@font-face { font-family: "Larken"; src: url("/static/fonts/Larken_Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Larken"; src: url("/static/fonts/Larken_Medium.otf") format("opentype"); font-weight: 500; font-display: swap; }

/* Layout: Bone reading floor, a slim app bar, one leading book then a shelf; admin is tables on the same floor. */
:root {
  --surface: #F2F1EC; --surface-raised: #F8F8F4; --surface-sunken: #E2E1D8;
  --line: #E2E1D8; --line-strong: #5C5C5C;
  --ink: #1F1F1F; --ink-muted: #5C5C5C; --ink-faint: #8A8A8A;
  --accent: #7E6026; --button: #1F1F1F; --on-button: #F2F1EC;
  --signal: #B8382C; --focus: #7E6026;
  --oak: #6A4B2F; --stone: #6C5F4B; --juniper: #4F4D30;
  --lead: #353535; --on-lead: #F2F1EC; --on-lead-muted: #B2B2B2;
  --serif: "Larken", "Iowan Old Style", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --tight: "Inter Tight", Inter, system-ui, sans-serif;
  --ease: cubic-bezier(0.22,0.61,0.36,1);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --surface: #2A2A2A; --surface-raised: #353535; --surface-sunken: #1F1F1F;
  --line: #444444; --line-strong: #8A8A8A;
  --ink: #F2F1EC; --ink-muted: #B2B2B2; --ink-faint: #8A8A8A;
  --accent: #DBA135; --button: #F2F1EC; --on-button: #1F1F1F;
  --signal: #E8715E; --focus: #DBA135;
  --oak: #B0875E; --stone: #B7A68A; --juniper: #939062;
  --lead: #1F1F1F; --on-lead: #F2F1EC; --on-lead-muted: #B2B2B2;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --surface: #2A2A2A; --surface-raised: #353535; --surface-sunken: #1F1F1F;
  --line: #444444; --line-strong: #8A8A8A;
  --ink: #F2F1EC; --ink-muted: #B2B2B2; --ink-faint: #8A8A8A;
  --accent: #DBA135; --button: #F2F1EC; --on-button: #1F1F1F;
  --signal: #E8715E; --focus: #DBA135;
  --oak: #B0875E; --stone: #B7A68A; --juniper: #939062;
  --lead: #1F1F1F; --on-lead: #F2F1EC; --on-lead-muted: #B2B2B2;
  color-scheme: dark; }

* { box-sizing: border-box; }
body { background: var(--surface); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.55; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.08; }
h2 { font-size: 28px; line-height: 1.15; }
h3 { font-size: 21px; line-height: 1.2; }
p { margin: 0; }
.muted { color: var(--ink-muted); }
.eyebrow { font-family: var(--tight); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* App bar */
.appbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface-raised); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface-raised); }
.appbar .wrap { display: flex; align-items: center; gap: 20px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand img { height: 26px; width: auto; }
.brand .logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand .logo-light { display: none; } :root:not([data-theme="light"]) .brand .logo-dark { display: block; } }
:root[data-theme="dark"] .brand .logo-light { display: none; } :root[data-theme="dark"] .brand .logo-dark { display: block; }
.brand span { font-family: var(--serif); font-size: 18px; border-left: 1px solid var(--line-strong); padding-left: 12px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav a { text-decoration: none; color: var(--ink); opacity: .78; padding: 6px 12px; border-radius: 999px; transition: background 140ms var(--ease), opacity 140ms var(--ease); }
nav a:hover { opacity: 1; background: color-mix(in srgb, var(--ink) 6%, transparent); }
nav a[aria-current="page"] { opacity: 1; font-weight: 600; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-sunken); display: grid; place-items: center; font-family: var(--tight); font-weight: 600; font-size: 12px; color: var(--ink); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--button); background: var(--button); color: var(--on-button); padding: 10px 20px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; transition: transform 140ms var(--ease), opacity 140ms var(--ease); }
.btn:hover { transform: translateY(-1px); opacity: .9; }
.btn:active { transform: scale(.98); }
.btn.outline { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

main { padding-block: 40px 80px; }
section + section { margin-top: 56px; }
.view[hidden] { display: none; }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; align-items: end; margin-bottom: 40px; }
.hero p.lede { font-size: 18px; color: var(--ink-muted); max-width: 52ch; margin-top: 16px; }
.how { display: grid; gap: 12px; border-left: 1px solid var(--line-strong); padding-left: 24px; }
.how div { display: grid; grid-template-columns: 28px 1fr; gap: 8px; }
.how b { font-family: var(--tight); color: var(--accent); font-weight: 600; }

/* Covers */
.cover { aspect-ratio: 2 / 3; border-radius: 4px 8px 8px 4px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 14% 12% 12%; color: #F2F1EC; box-shadow: inset 6px 0 0 rgba(0,0,0,.18); max-width: 100%; }
.cover .ct { font-family: var(--serif); font-size: clamp(14px, 1.6vw, 20px); line-height: 1.12; }
.cover .ca { font-family: var(--tight); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.cover::after { content: ""; position: absolute; left: 12%; right: 12%; top: 50%; height: 1px; background: currentColor; opacity: .35; }
.c-char { background: #1F1F1F; } .c-oak { background: #6A4B2F; } .c-stone { background: #6C5F4B; } .c-juniper { background: #4F4D30; } .c-600 { background: #444444; }
.c-bone { background: #E2E1D8; color: #1F1F1F; }

/* Lead book */
.lead { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; background: var(--lead); color: var(--on-lead); border-radius: 12px; padding: 32px; align-items: center; }
.lead .muted { color: var(--on-lead-muted); }
.lead .btn { background: #F2F1EC; color: #1F1F1F; border-color: #F2F1EC; }
.lead .eyebrow { color: var(--on-lead-muted); }
.lead h2 { font-size: clamp(28px, 3.4vw, 40px); margin: 8px 0 4px; }
.lead .why { margin: 20px 0 24px; max-width: 58ch; font-size: 16px; }

/* Shelf */
.shelf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 24px; }
.book { display: flex; flex-direction: column; gap: 12px; }
.book .meta { display: grid; gap: 2px; }
.book .t { font-weight: 600; line-height: 1.3; }
.book .a { color: var(--ink-muted); font-size: 14px; }
.book p.blurb { font-size: 14px; color: var(--ink-muted); }
.book .actions { margin-top: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-family: var(--tight); font-size: 12px; font-weight: 600; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); white-space: nowrap; }
.tag.road { border-color: var(--stone); } .tag.shop { border-color: var(--oak); } .tag.owners { border-color: var(--juniper); }
.tag.todo { border-style: dashed; color: var(--signal); border-color: var(--signal); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 24px; }
.chip { border: 1px solid var(--line-strong); background: transparent; padding: 5px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--button); color: var(--on-button); border-color: var(--button); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }

/* Suggestions */
.suggest { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.panel { background: var(--surface-raised); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.list { display: grid; }
.row { display: flex; gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .sub { font-size: 13px; color: var(--ink-muted); }
.count { font-family: var(--tight); font-variant-numeric: tabular-nums; font-weight: 600; }

/* Forms */
.field { display: grid; gap: 6px; }
.field label, .field legend { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--ink-muted); font-weight: 400; }
input[type=text], input[type=url], input[type=datetime-local], textarea, select { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; width: 100%; }
textarea { min-height: 96px; resize: vertical; }
fieldset { border: 0; margin: 0; padding: 0; }
.options { display: flex; gap: 8px; flex-wrap: wrap; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.opt span { display: inline-block; border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 16px; font-size: 14px; }
.opt input:checked + span { background: var(--button); color: var(--on-button); border-color: var(--button); }
.opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.form { display: grid; gap: 20px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* Dialog */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; background: var(--surface-raised); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(31,31,31,.6); }
.dlg { padding: 28px; display: grid; gap: 20px; }
.dlg-head { display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: center; }
.dlg-head .cover { padding: 10px 8px; } .dlg-head .cover .ct { font-size: 10px; } .dlg-head .cover .ca { display: none; }

/* My shelf */
.mine { display: grid; gap: 16px; }
.item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 20px; align-items: center; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.item .cover { padding: 8px 6px; } .item .cover .ct { font-size: 9px; } .item .cover .ca { display: none; }
.steps { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.step { font-family: var(--tight); font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-faint); }
.step.done { color: var(--ink); border-color: var(--line-strong); }
.step.now { background: var(--button); color: var(--on-button); border-color: var(--button); }
.empty { padding: 32px; text-align: center; color: var(--ink-muted); border: 1px dashed var(--line-strong); border-radius: 12px; }

/* Admin */
.stats { display: flex; gap: 40px; flex-wrap: wrap; margin: 20px 0 32px; }
.stat .n { font-family: var(--tight); font-size: 40px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .n.gold { color: var(--accent); }
.stat .l { font-size: 13px; color: var(--ink-muted); margin-top: 4px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); }
table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 14px; }
th { text-align: left; font-family: var(--tight); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .sub { font-size: 13px; color: var(--ink-muted); }
td select { width: auto; padding: 6px 10px; font-size: 13px; }
.num { font-family: var(--tight); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }
.subnav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.quote { font-family: var(--serif); font-size: 17px; line-height: 1.4; }
tr.click { cursor: pointer; transition: background 140ms var(--ease); }
tr.click:hover { background: var(--surface); }
.track { display: flex; gap: 3px; margin-top: 6px; }
.track i { height: 4px; flex: 1; border-radius: 2px; background: var(--line); min-width: 18px; }
.track i.on { background: var(--ink); }
.age { font-family: var(--tight); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-muted); }
.age.long { color: var(--signal); }
.person { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.tl:first-child { border-top: 0; }
.tl .cover { padding: 6px 5px; } .tl .cover .ct { font-size: 8px; } .tl .cover .ca { display: none; }
.dates { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.back { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink-muted); font-size: 14px; margin-bottom: 16px; }
.back:hover { color: var(--ink); }
.featured-mark { font-family: var(--tight); font-size: 12px; font-weight: 600; color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); background: var(--button); color: var(--on-button); padding: 10px 20px; border-radius: 999px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 220ms var(--ease), transform 220ms var(--ease); z-index: 20; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  .hero, .suggest { grid-template-columns: 1fr; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead { grid-template-columns: 1fr; } .lead .cover { max-width: 180px; }
}
@media (max-width: 520px) {
  .item { grid-template-columns: 48px minmax(0, 1fr); } .item > :last-child { grid-column: 1 / -1; }
  .appbar .wrap { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* App additions */
.wrap { width: 100%; }
.signin { max-width: 560px; margin: 8vh auto 0; display: grid; gap: 18px; }
.signin .btn { justify-self: start; }
.small { font-size: 13px; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink-muted); cursor: pointer; font-size: 13px; text-decoration: underline; }
.who form { margin: 0; }
img.avatar { object-fit: cover; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.toast.show { animation: toast-out 220ms var(--ease) 3.2s forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(-50%) translateY(20px); } }
.flash-error { color: var(--signal); }
.inline-form { display: inline; margin: 0; }
.row form { margin: 0; }
.panel h3 + p { margin-top: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--ink-muted); }
.kv dd { margin: 0; }
.notes { font-size: 14px; color: var(--ink-muted); margin-top: 8px; }
.wantlunch { display: grid; gap: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
a { color: var(--ink); text-underline-offset: 2px; }
a.btn, a.chip, a.tag, .back { text-decoration: none; }
a.chip { color: var(--ink); display: inline-flex; align-items: center; }
a.chip[aria-pressed="true"] { color: var(--on-button); }
a.btn { color: var(--on-button); }
a.btn.outline { color: var(--ink); }
.lead a.btn { color: #1F1F1F; }
.mine + section { margin-top: 56px; }
@media (max-width: 640px) {
  .brand span { display: none; }
  .appbar nav { order: 3; flex-basis: 100%; }
  .who > span:not(.avatar) { display: none; }
  .who { margin-left: auto; }
}
.why-block { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-block: 28px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px 40px; align-items: baseline; margin-bottom: 40px; }
.why-block h2 { font-size: 24px; }
.why-block p { font-size: 17px; line-height: 1.6; max-width: 62ch; }
.hero { margin-bottom: 32px; }
@media (max-width: 860px) { .why-block { grid-template-columns: 1fr; } }
.dlg-about { display: grid; gap: 6px; font-size: 14px; }
