/* The Pursuit Companion · 2027 theme: Volume I, The Expedition
   An explorer's field journal: deep parchment pages, a walnut leather binding,
   sepia ink, saddle-brown actions, olive and rust details, and the twelve months
   as spiral-bound field notebooks whose cover color shows the reading status.
   This file is the journal's whole stylesheet. For another year, copy this
   folder, restyle it, and point index.html at the new folder. */

/* Della Robbia is a commercial typeface and is not on Google Fonts.
   It is used if installed on the reader's device. For hosting, add a web-licensed
   WOFF2 file at fonts/DellaRobbia-Regular.woff2 (see the standalone build). */
@font-face {
  font-family: "Della Robbia";
  src: local("Della Robbia"), local("Della Robbia BT"), local("DellaRobbiaBT-Roman"), url("../../fonts/DellaRobbia-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Volume I, The Expedition: deep parchment pages, walnut leather binding,
     sepia ink, saddle-brown actions, olive and rust details, DKR purple stamps */
  --ink: #D2C4A6;        /* Deep parchment: page */
  --charcoal: #E7DCC6;   /* Journal paper: panels */
  --walnut: #3A2A1E;     /* Walnut leather: header and nav */
  --parchment: #2B2118;  /* Sepia ink: text */
  --gold: #6E4A2A;       /* Saddle brown: actions, links */
  --olive: #6B7040;      /* Olive: progress, in-progress marks */
  --rust: #9A4F2C;       /* Rust: small details */
  --brass: #A27C3C;      /* Brass: rules, stars (decorative) */
  --brass-ink: #6A4E22;  /* Brass-colored text */
  --oxblood: #6B4A2E;    /* Leather brown: completion */
  --stamp-ink: #8B3A22;  /* Rust ink: stamps */
  --sage: #5E5240;       /* Faded ink: muted text */
  --on-gold: #F4ECDD;    /* text on brown */
  --on-accent: #F4ECDD;  /* text on purple */
  --on-leather: #EEE4D0;
  --on-leather-soft: #C6B597;

  --well: #F1E9DA;                          /* input wells */
  --line: rgba(110, 80, 40, 0.26);          /* brown hairline */
  --line-strong: rgba(110, 80, 40, 0.52);
  --parchment-soft: rgba(43, 33, 24, 0.80);
  --gold-wash: rgba(110, 74, 42, 0.10);
  --oxblood-wash: rgba(107, 74, 46, 0.10);

  --display: "IM Fell English", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: "Della Robbia", "Della Robbia BT", Georgia, "Times New Roman", serif;

  --step-hero: clamp(2.4rem, 7vw, 3.6rem);
  --step-1: clamp(1.75rem, 4.6vw, 2.25rem);
  --step-2: 1.4rem;
  --step-3: 1.15rem;
  --text: 1.0625rem;
  --small: 0.875rem;
  --tiny: 0.75rem;

  --radius: 3px;
  --nav-h: 66px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--ink);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(255,248,232,0.4), transparent 60%),
    repeating-radial-gradient(ellipse at 18% 28%, transparent 0 26px, rgba(110,80,40,0.06) 26px 27px),
    repeating-radial-gradient(ellipse at 82% 78%, transparent 0 34px, rgba(107,112,64,0.05) 34px 35px),
    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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.22 0 0 0 0 0.12 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: auto, auto, auto, 160px 160px;
  background-attachment: fixed;
  color: var(--parchment);
  font-family: var(--body);
  font-size: var(--text);
  line-height: 1.6;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 30; background: var(--walnut);
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0; text-wrap: balance; color: var(--parchment); }
h1 { font-size: var(--step-1); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-3); }
p { margin: 0; }
a { color: var(--gold); }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--oxblood); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.gutter {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- Header & navigation ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--walnut);
  border-bottom: 2px solid var(--gold);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding-block: 10px;
}
.brand {
  display: flex; flex-direction: column; gap: 0;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left; min-width: 0;
}
.brand-title { font-family: var(--display); font-size: 1.25rem; line-height: 1.1; color: var(--parchment); white-space: nowrap; }
.brand-sub { font-size: var(--tiny); letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage); white-space: nowrap; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.save-state { font-size: var(--tiny); color: var(--sage); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sage); }
.save-state.saving::before { background: var(--gold); }
.save-state.error { color: var(--parchment); }
.save-state.error::before, .save-state.signin::before { background: #D9785F; }
.save-state.signin { color: var(--parchment); }
.save-state.offline::before { background: transparent; border: 1px solid var(--sage); }
.signin-form { width: 100%; max-width: 420px; display: grid; gap: 12px; text-align: left; }
.code-input { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.signin-note { max-width: 46ch; color: var(--parchment-soft); }
.signin-note b { color: var(--parchment); font-weight: 400; overflow-wrap: anywhere; }

.nav { display: flex; }
.nav button {
  background: none; border: 0; cursor: pointer; color: var(--sage);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 0.7rem; letter-spacing: 0.04em; padding: 8px 4px; flex: 1 1 0; min-width: 0;
}
.nav button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.nav button[aria-current="page"] { color: var(--gold); }
.nav button:hover { color: var(--parchment); }

@media (max-width: 859px) {
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: var(--walnut);
    border-top: 2px solid var(--gold);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: max(4px, env(safe-area-inset-left, 0px));
    padding-right: max(4px, env(safe-area-inset-right, 0px));
  }
  .nav button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  main.with-nav { padding-bottom: calc(var(--nav-h) + 32px + env(safe-area-inset-bottom, 0px)); }
  .save-state .label-long { display: none; }
}
@media (min-width: 860px) {
  .nav { gap: 2px; margin-left: 18px; }
  .nav button { flex-direction: row; gap: 7px; font-size: 0.92rem; padding: 8px 10px; border-bottom: 1px solid transparent; flex: 0 0 auto; }
  .nav button svg { width: 17px; height: 17px; }
  .nav button[aria-current="page"] { border-bottom-color: var(--gold); }
}
@media (max-width: 380px) {
  .brand-sub { display: none; }
}

main { max-width: 1080px; margin: 0 auto; padding-block: 28px 64px; }
.view { animation: rise 0.35s ease-out both; display: grid; gap: 32px; }
.reading { max-width: 760px; margin: 0 auto; width: 100%; }

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

/* ---------- Shared pieces ---------- */
.eyebrow { font-size: var(--tiny); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.muted { color: var(--sage); }
.lede { color: var(--parchment-soft); max-width: 62ch; }
.page-head { display: grid; gap: 8px; }

.rule { display: flex; align-items: center; gap: 12px; color: var(--gold); }
.rule::before, .rule::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong)); }
.rule::after { background: linear-gradient(90deg, var(--line-strong), transparent); }
.rule i { width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid var(--gold); display: block; }

.panel {
  background: var(--charcoal);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px clamp(16px, 4vw, 28px);
  display: grid; gap: 18px;
  min-width: 0;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: var(--step-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius); cursor: pointer; text-decoration: none;
  font-size: 1rem; letter-spacing: 0.03em; line-height: 1.2;
  padding: 12px 20px; min-height: 46px;
  border: 1px solid var(--gold);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-primary { background: var(--gold); color: var(--on-gold); }
.btn-primary:hover { background: #5A3B20; }
.btn-ghost { background: transparent; color: var(--gold); }
.btn-ghost:hover { background: var(--gold-wash); }
.btn-oxblood { background: var(--oxblood); border-color: var(--oxblood); color: var(--on-accent); }
.btn-oxblood:hover { background: #563A22; }
.btn-small { min-height: 36px; padding: 7px 12px; font-size: var(--small); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--gold); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); font-size: var(--small); }
.link-btn:hover { text-decoration-color: var(--gold); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--tiny); letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid rgba(94, 82, 64, 0.5); color: var(--sage);
  white-space: nowrap;
}
.chip.reading { border-color: var(--olive); color: var(--olive); }
.chip.finished { border-color: var(--parchment-soft); color: var(--parchment); }
.chip.want { border-style: dashed; }
.chip.closed { background: var(--oxblood); border-color: var(--oxblood); color: var(--on-accent); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: var(--small); color: var(--sage); border: 1px solid rgba(94,82,64,0.32); background: rgba(255,250,240,0.35); padding: 2px 10px; border-radius: var(--radius); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field-label {
  font-size: var(--tiny); letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage);
}
.input, .textarea {
  width: 100%; background: var(--well); color: var(--parchment);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 12px; font-size: 16px; line-height: 1.5;
  transition: border-color 0.2s;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.input::placeholder, .textarea::placeholder { color: rgba(94,82,64,0.7); font-style: italic; }
.textarea { resize: vertical; min-height: 120px; }
.textarea.tall { min-height: 220px; }
input[type="date"].input { min-height: 46px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.date-row { display: flex; gap: 8px; align-items: stretch; }
.date-row .input { flex: 1; min-width: 0; }
.hint { font-size: var(--small); color: var(--sage); }
.warn { font-size: var(--small); color: var(--gold); }

.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
@media (min-width: 620px) { .segmented { grid-template-columns: repeat(4, 1fr); } }
.segmented button {
  background: var(--well); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 6px; cursor: pointer; color: var(--parchment-soft); font-size: 0.95rem; min-height: 44px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.segmented button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }

/* ---------- Stars ---------- */
.stars-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stars { display: inline-flex; gap: 4px; touch-action: manipulation; border-radius: var(--radius); }
.star { position: relative; width: 34px; height: 34px; cursor: pointer; }
.stars.small .star { width: 15px; height: 15px; cursor: default; }
.stars.small { gap: 2px; }
.star svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.star .base { fill: none; stroke: var(--gold); stroke-width: 1.1; opacity: 0.55; }
.star .fill { position: absolute; inset: 0; overflow: hidden; }
.star .fill svg { width: 34px; height: 34px; fill: var(--gold); }
.stars.small .star .fill svg { width: 15px; height: 15px; }
.star .half { position: absolute; top: 0; bottom: 0; width: 50%; }
.star .half.l { left: 0; } .star .half.r { right: 0; }
.star.pop { animation: pop 0.35s ease-out; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.22); } 100% { transform: scale(1); } }
.stars-value { font-size: var(--small); color: var(--parchment-soft); font-variant-numeric: tabular-nums; }

/* ---------- Welcome ---------- */
.welcome { max-width: 720px; margin: 0 auto; padding-block: 12px 24px; }
.frame {
  position: relative; text-align: center;
  border: 1px solid var(--line-strong);
  outline: 1px solid var(--line); outline-offset: -8px;
  background: var(--charcoal);
  padding: clamp(32px, 7vw, 56px) clamp(18px, 6vw, 56px);
  display: grid; gap: 22px; justify-items: center;
}
.frame .corner { position: absolute; width: 22px; height: 22px; border-color: var(--gold); border-style: solid; }
.frame .c1 { top: 14px; left: 14px; border-width: 1px 0 0 1px; }
.frame .c2 { top: 14px; right: 14px; border-width: 1px 1px 0 0; }
.frame .c3 { bottom: 14px; left: 14px; border-width: 0 0 1px 1px; }
.frame .c4 { bottom: 14px; right: 14px; border-width: 0 1px 1px 0; }
.welcome .kicker { font-family: var(--display); letter-spacing: 0.22em; font-size: clamp(0.85rem, 2.6vw, 1rem); color: var(--gold); }
.welcome h1 { font-size: var(--step-hero); line-height: 1.02; }
.welcome .year { font-family: var(--display); font-style: italic; font-size: 1.3rem; color: var(--parchment-soft); }
.welcome .presented { font-size: var(--tiny); letter-spacing: 0.2em; text-transform: uppercase; color: var(--sage); }
.welcome .intro { text-align: left; display: grid; gap: 14px; max-width: 58ch; color: var(--parchment-soft); }
.welcome .intro .opening { font-family: var(--display); font-size: 1.45rem; color: var(--parchment); }
.welcome .intro .assign { color: var(--parchment); }
.welcome .intro .assign em { font-family: var(--display); font-style: italic; color: var(--gold); font-size: 1.1em; }
.welcome .rule { width: 100%; max-width: 360px; }

/* ---------- Dashboard ---------- */
.ledger {
  display: grid; gap: 18px;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) { .ledger { grid-template-columns: 1.3fr 1fr; align-items: stretch; } }
.progress-card { display: grid; gap: 14px; align-content: start; }
.progress-figure { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.progress-figure .big { font-family: var(--display); font-size: clamp(3rem, 10vw, 4.2rem); line-height: 1; color: var(--parchment); font-variant-numeric: tabular-nums; }
.progress-figure .of { font-family: var(--display); font-style: italic; font-size: 1.3rem; color: var(--parchment-soft); }
.bar { height: 10px; background: var(--well); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--olive), var(--gold)); width: 0; transition: width 0.8s cubic-bezier(.2,.7,.2,1); }
.bar-meta { display: flex; justify-content: space-between; font-size: var(--small); color: var(--sage); font-variant-numeric: tabular-nums; }
.ticks { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.ticks span { height: 6px; border-radius: 1px; background: var(--well); border: 1px solid var(--line); }
.ticks span.on { background: var(--oxblood); border-color: var(--oxblood); }
.ticks span.mid { background: rgba(107,112,64,0.3); border-color: var(--olive); }

.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.figure { padding: 4px 12px; border-left: 1px solid var(--line); display: grid; gap: 2px; align-content: start; min-width: 0; }
.figure:first-child { border-left: 0; padding-left: 0; }
.figure .num { font-family: var(--display); font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.figure .lbl { font-size: var(--tiny); letter-spacing: 0.12em; text-transform: uppercase; color: var(--sage); line-height: 1.35; }
.figure .placeholder { font-family: var(--display); font-size: 2rem; line-height: 1.1; color: var(--sage); }

.notice {
  border: 1px solid var(--line); border-left: 3px solid var(--oxblood);
  background: var(--oxblood-wash); padding: 12px 16px; border-radius: var(--radius);
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  font-size: var(--small);
}
.notice p { min-width: 0; flex: 1 1 260px; }

.case-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .case-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .case-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.case-card {
  position: relative; text-align: left; cursor: pointer;
  background: var(--charcoal); color: var(--parchment);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 14px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 172px; min-width: 0;
  transition: border-color 0.2s, transform 0.2s;
}
/* Field notebooks: a kraft or cloth cover, a spiral along the top, a paper label */
.case-card {
  --cover: #B39A74; --cover-edge: #8F7754;
  background: var(--cover);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.2 0 0 0 0 0.15 0 0 0 0 0.08 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  border: 1px solid var(--cover-edge); border-radius: 2px 6px 6px 2px;
  padding: 26px 14px 14px; margin: 12px 6px 6px 0;
  /* a stack of pages peeking out at the right and bottom */
  box-shadow: 3px 3px 0 -1px #F2EADB, 3px 3px 0 0 rgba(60, 42, 20, 0.45), 6px 6px 0 -1px #EDE3D0, 6px 6px 0 0 rgba(60, 42, 20, 0.3), 0 8px 14px -8px rgba(50, 34, 16, 0.4);
  color: var(--parchment);
}
/* The cover color shows the month's status, from pale kraft to finished leather. */
.case-card.not-started { --cover: #CDBB98; --cover-edge: #A69270; }
.case-card.want { --cover: #B3AC95; --cover-edge: #8A836C; }
.case-card.reading { --cover: #A9A77A; --cover-edge: #7F7D52; }
.case-card.finished { --cover: #C09A73; --cover-edge: #94704C; }
.case-card.closed { --cover: #6E4E33; --cover-edge: #4A3220; }
.case-card.closed .cc-top, .case-card.closed .cc-no { color: #F1E6D2; }
.case-card.closed .mini-stamp { color: #F1E6D2; border-color: #F1E6D2; }
.case-card::before {  /* spiral hooks over the top edge, like a sketchbook */
  content: ""; position: absolute; top: -12px; left: 12px; right: 12px; height: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='26' viewBox='0 0 22 26'%3E%3Cpath d='M9 19 C6.5 12 7.5 4.5 12.5 4.5 C16.5 4.5 17 9 15.6 11.5' fill='none' stroke='%232E241A' stroke-width='2.4' stroke-linecap='round'/%3E%3Ccircle cx='9' cy='20' r='2.7' fill='%232E241A'/%3E%3C/svg%3E");
  background-size: 22px 26px; background-repeat: space no-repeat; background-position: center top;
}
.case-card::after { content: none; }
.case-card:hover { transform: translateY(-2px); }

.nb-label {
  display: grid; gap: 6px; background: #F3EBDC; padding: 10px 12px;
  border: 1px solid rgba(80, 58, 30, 0.35); border-radius: 2px;
  box-shadow: 0 1px 2px rgba(50, 34, 16, 0.18); min-width: 0;
}
.case-card .cc-top { color: #2E2318; }
.case-card .cc-no { color: #2E2318; font-weight: 600; }
.nb-key { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: var(--small); color: var(--sage); }
.nb-key span { display: inline-flex; align-items: center; gap: 6px; }
.nb-key i { width: 14px; height: 18px; border-radius: 1px 3px 3px 1px; border: 1px solid rgba(60, 42, 20, 0.45); display: inline-block; }
.nb-key i.not-started { background: #CDBB98; }
.nb-key i.want { background: #B3AC95; }
.nb-key i.reading { background: #A9A77A; }
.nb-key i.finished { background: #C09A73; }
.nb-key i.closed { background: #6E4E33; }
.case-card .chip { border-color: rgba(43, 33, 24, 0.55); color: #2B2118; background: rgba(243, 235, 220, 0.55); }
.case-card .chip.reading { border-color: var(--olive); color: #3E4222; }
.cc-top { display: flex; justify-content: space-between; gap: 6px; font-size: var(--tiny); letter-spacing: 0.12em; text-transform: uppercase; color: var(--sage); }
.cc-no { color: var(--gold); font-variant-numeric: tabular-nums; }
.cc-title { font-family: var(--display); font-size: 1.28rem; line-height: 1.15; overflow-wrap: anywhere; }
.cc-book { font-size: var(--small); font-style: italic; color: var(--parchment-soft); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-book.none { color: var(--sage); }
.cc-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.mini-stamp {
  font-family: var(--display); font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--stamp-ink); background: transparent; border: 2px solid currentColor; padding: 1px 8px; transform: rotate(-3deg);
  outline: 0;
}

/* ---------- Case files index ---------- */
.brief-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.brief-list li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: var(--parchment-soft); }
.brief-list li::before { content: "✦"; font-family: var(--display); color: var(--gold); font-size: 1.1rem; line-height: 1.5; }
.case-index { display: grid; gap: 12px; }
.case-row {
  display: grid; gap: 10px; grid-template-columns: 1fr; text-align: left; cursor: pointer;
  background: var(--charcoal); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px clamp(14px, 3vw, 22px); color: var(--parchment); transition: border-color 0.2s;
}
.case-row:hover { border-color: var(--line-strong); }
@media (min-width: 720px) { .case-row { grid-template-columns: 120px 1fr auto; align-items: start; gap: 20px; } }
.case-row .when { display: grid; gap: 2px; }
.case-row .when b { font-weight: 400; font-size: var(--tiny); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.case-row .when span { font-family: var(--display); font-style: italic; color: var(--parchment-soft); font-size: 1.05rem; }
.case-row .what { display: grid; gap: 8px; min-width: 0; }
.case-row .what h3 { font-size: 1.4rem; }
.case-row .what p { color: var(--parchment-soft); }
.case-row .state { justify-self: start; }

/* ---------- Case page ---------- */
.dossier-head {
  position: relative; overflow: hidden;
  background: var(--charcoal); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: clamp(22px, 5vw, 36px) clamp(18px, 5vw, 36px);
  display: grid; gap: 14px;
}
.dossier-head::before, .dossier-head::after {
  content: ""; position: absolute; width: 18px; height: 18px; border: 1px solid var(--gold);
}
.dossier-head::before { top: 10px; left: 10px; border-width: 1px 0 0 1px; }
.dossier-head::after { bottom: 10px; right: 10px; border-width: 0 1px 1px 0; }
.dossier-head .meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: var(--tiny); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.dossier-head .meta .dot { width: 4px; height: 4px; background: var(--sage); border-radius: 50%; }
.dossier-head h1 { font-size: clamp(2rem, 6vw, 2.8rem); padding-right: 4px; }
.dossier-head .prompt { font-family: var(--display); font-style: italic; font-size: 1.25rem; line-height: 1.45; color: var(--parchment); max-width: 46ch; }
.dossier-head .dir-label { font-size: var(--tiny); letter-spacing: 0.14em; text-transform: uppercase; color: var(--sage); }

.stamp {
  justify-self: start;
  display: grid; justify-items: center; gap: 2px;
  font-family: var(--display); color: var(--stamp-ink);
  background: transparent; padding: 8px 18px 6px;
  border: 3px double currentColor; border-radius: 4px;
  outline: 0; opacity: 0.92;
  transform: rotate(-5deg);
}
.stamp b { font-weight: 400; font-size: 1.6rem; letter-spacing: 0.16em; line-height: 1.1; }
.stamp small { font-family: var(--body); font-size: var(--tiny); letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85; }
@media (min-width: 620px) { .dossier-head .stamp { position: absolute; top: 26px; right: 26px; } .dossier-head.is-closed h1, .dossier-head.is-closed .meta { padding-right: 190px; } }
.stamp.fresh { animation: stampIn 0.55s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes stampIn { 0% { opacity: 0; transform: rotate(-12deg) scale(1.8); } 100% { opacity: 1; transform: rotate(-5deg) scale(1); } }

.volume-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.volume-tabs button.tab {
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 14px; cursor: pointer; color: var(--parchment-soft); min-height: 40px; max-width: 100%;
  display: inline-flex; gap: 8px; align-items: baseline;
}
.volume-tabs button.tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16ch; font-style: italic; color: var(--sage); font-size: var(--small); }
.volume-tabs button.tab[aria-selected="true"] { border-color: var(--gold); color: var(--gold); background: var(--gold-wash); }

.section-title { display: flex; gap: 10px; align-items: baseline; }
.section-title .num { font-family: var(--display); font-style: italic; color: var(--gold); }

.filed { display: flex; align-items: center; gap: 10px; font-size: var(--small); color: var(--sage); }
.filed .seal {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--oxblood); color: var(--on-accent); font-family: var(--display); font-size: 0.95rem;
  border: 1px solid rgba(232,221,200,0.4);
}
.filed.fresh .seal { animation: pop 0.45s ease-out; }

.closing { text-align: center; justify-items: center; }
.closing p { max-width: 50ch; color: var(--parchment-soft); }

.promo {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 18px clamp(16px, 4vw, 24px); display: grid; gap: 10px;
  background: transparent;
}
.promo h3 { font-size: 1.15rem; color: var(--parchment-soft); }
.promo p { font-size: var(--small); color: var(--sage); max-width: 60ch; }
.promo .config-note { font-size: var(--tiny); color: var(--sage); font-style: italic; }

.pager { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pager button { background: none; border: 0; cursor: pointer; color: var(--sage); display: grid; gap: 0; text-align: left; padding: 6px 0; max-width: 48%; }
.pager button.next { text-align: right; margin-left: auto; }
.pager small { font-size: var(--tiny); letter-spacing: 0.12em; text-transform: uppercase; }
.pager span { font-family: var(--display); font-size: 1.1rem; color: var(--parchment); }
.pager button:hover span { color: var(--gold); }

/* ---------- Reading log ---------- */
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filters button {
  flex: 0 0 auto; background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; color: var(--parchment-soft); font-size: var(--small); min-height: 38px;
}
.filters button[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.filters button b { font-weight: 400; opacity: 0.7; margin-left: 4px; font-variant-numeric: tabular-nums; }
.log { display: grid; gap: 0; border-top: 1px solid var(--line); }
.log-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; text-align: left; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 4px; color: var(--parchment);
}
.log-row:hover { background: var(--gold-wash); }
.log-row .t { font-size: 1.05rem; overflow-wrap: anywhere; min-width: 0; }
.log-row .t i { color: var(--parchment-soft); }
.log-row .a { grid-column: 1; font-size: var(--small); color: var(--sage); }
.log-row .c { grid-column: 1; font-size: var(--tiny); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.log-row .s { grid-column: 2; grid-row: 1 / span 3; display: grid; gap: 6px; justify-items: end; align-content: center; }
.empty { text-align: center; padding: 28px 12px; color: var(--sage); display: grid; gap: 10px; justify-items: center; }
.empty .glyph { font-family: var(--display); font-size: 2rem; color: var(--gold); }

/* ---------- Annual report ---------- */
.report-figures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 0; }
@media (min-width: 720px) { .report-figures { grid-template-columns: repeat(4, 1fr); } }
.report-figures .figure:nth-child(3) { border-left: 0; padding-left: 0; }
@media (min-width: 720px) { .report-figures .figure:nth-child(3) { border-left: 1px solid var(--line); padding-left: 12px; } }

.timeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 6px; position: relative; }
@media (min-width: 760px) { .timeline { grid-template-columns: repeat(12, minmax(0, 1fr)); } }
.tl-node { display: grid; justify-items: center; gap: 6px; background: none; border: 0; cursor: pointer; color: var(--parchment); padding: 4px 0; position: relative; }
.tl-node::before { content: ""; position: absolute; top: 21px; left: -50%; right: 50%; height: 1px; background: var(--line); z-index: 0; }
.tl-node:first-child::before { display: none; }
@media (max-width: 759px) { .tl-node:nth-child(7)::before { display: none; } }
.tl-mark { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--ink); position: relative; z-index: 1; display: grid; place-items: center; font-family: var(--display); font-size: 0.95rem; color: var(--sage); }
.tl-node.progress .tl-mark { border-color: var(--olive); color: var(--olive); background: linear-gradient(90deg, var(--gold-wash) 50%, var(--ink) 50%); color: var(--gold); }
.tl-node.closed .tl-mark { background: var(--oxblood); border-color: rgba(232,221,200,0.45); color: var(--on-accent); }
.tl-node .m { font-size: var(--tiny); letter-spacing: 0.12em; text-transform: uppercase; color: var(--parchment-soft); }
.tl-node .n { font-size: var(--tiny); color: var(--sage); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--small); color: var(--sage); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--line-strong); display: inline-block; }
.legend i.p { border-color: var(--gold); background: var(--gold-wash); }
.legend i.c { background: var(--oxblood); border-color: rgba(232,221,200,0.45); }

.chart { position: relative; }
.chart-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 180px; border-bottom: 1px solid var(--line-strong); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 45px; background-position: 0 0; }
.chart-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.chart-col .v { font-size: var(--tiny); color: var(--parchment-soft); font-variant-numeric: tabular-nums; }
.chart-col .b { width: 70%; max-width: 34px; background: linear-gradient(180deg, var(--gold), #7E6534); border-radius: 2px 2px 0 0; transition: height 0.7s cubic-bezier(.2,.7,.2,1); }
.chart-labels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.chart-labels span { text-align: center; font-size: var(--tiny); color: var(--sage); letter-spacing: 0.04em; }
.chart-empty { position: absolute; inset: 0 0 24px; display: grid; place-items: center; text-align: center; color: var(--sage); font-size: var(--small); padding: 0 12px; }

/* ---------- Dossier ---------- */
.prompts { display: grid; gap: 22px; }
.prompts .field > label { font-family: var(--display); text-transform: none; letter-spacing: 0; font-size: 1.2rem; color: var(--parchment); }
.prompts .num { font-family: var(--display); font-style: italic; color: var(--gold); margin-right: 6px; }

/* ---------- Backup ---------- */
.backup-text { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; min-height: 160px; white-space: pre; overflow: auto; }
.file-pick { position: relative; overflow: hidden; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.error-box { border: 1px solid #9B3A26; background: rgba(155,58,38,0.08); padding: 10px 14px; border-radius: var(--radius); font-size: var(--small); }
details.paste summary { cursor: pointer; color: var(--gold); font-size: var(--small); }
details.paste[open] summary { margin-bottom: 10px; }
.facts { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; color: var(--parchment-soft); }

/* ---------- Dialog & toast ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(40,28,16,0.55); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); animation: fade 0.2s ease-out; }
.dialog { background: var(--charcoal); border: 1px solid var(--line-strong); border-radius: var(--radius); max-width: 460px; width: 100%; padding: 24px; display: grid; gap: 14px; animation: rise 0.25s ease-out; }
.dialog p { color: var(--parchment-soft); }
.dialog .btn-row { justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom, 0px));
  background: var(--walnut); color: var(--on-leather); padding: 10px 18px; border-radius: var(--radius);
  font-size: var(--small); box-shadow: 0 8px 24px rgba(0,0,0,0.4); animation: rise 0.25s ease-out;
  max-width: calc(100% - 32px); text-align: center;
}
@media (min-width: 860px) { .toast { bottom: calc(28px + env(safe-area-inset-bottom, 0px)); } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Leather binding: header and nav ---------- */
.brand-title { color: var(--on-leather); }
.brand-sub { color: var(--on-leather-soft); }
.topbar .save-state, .topbar .save-state.error, .topbar .save-state.signin { color: var(--on-leather-soft); }
.topbar .save-state::before { background: var(--on-leather-soft); }
.topbar .btn-ghost { color: #E2C68C; border-color: rgba(226, 198, 140, 0.6); }
.topbar .btn-ghost:hover { background: rgba(226, 198, 140, 0.12); }
.nav button { color: var(--on-leather-soft); }
.nav button[aria-current="page"], .nav button:hover { color: #E2C68C; }
@media (min-width: 860px) { .nav button[aria-current="page"] { border-bottom-color: #E2C68C; } }
.eyebrow, .welcome .kicker, .section-title .num, .prompts .num, .case-row .when b, .log-row .c, .dossier-head .meta { color: var(--brass-ink); }
.case-card .cc-no { color: #2E2318; }
.rule, .frame .corner, .dossier-head::before, .dossier-head::after { color: var(--brass); border-color: var(--brass); }
.rule i { border-color: var(--brass); }
.star .base { stroke: var(--brass); }
.star .fill svg { fill: var(--brass); }
.bar > span, .chart-col .b { background: linear-gradient(90deg, #8C9160, var(--olive)); }
.brief-list li::before { color: var(--rust); }
.panel { box-shadow: 0 1px 2px rgba(60, 40, 18, 0.10); }

/* Five tabs have to fit across a phone. */
@media (max-width: 859px) { .nav button { letter-spacing: 0; padding-inline: 2px; } }

/* ---------- Book format and pages ---------- */
.segmented.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.formats { display: grid; gap: 10px; }
.fmt-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.fmt-l { font-size: var(--small); color: var(--parchment); }
.fmt-bar { height: 10px; background: var(--well); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.fmt-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #8C9160, var(--olive)); }
.fmt-v { font-size: var(--small); color: var(--sage); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 64px; text-align: right; }
.report-figures.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-figures.two .figure:nth-child(2) { border-left: 1px solid var(--line); padding-left: 12px; }

/* ---------- Official stamps on completed months ---------- */
.seal-svg { display: block; width: 100%; height: auto; color: var(--stamp-ink); overflow: visible; }
.nb-label { position: relative; }
.card-seal {
  position: absolute; right: -14px; bottom: -26px; width: 84px; pointer-events: none;
  transform: rotate(-14deg); opacity: 0.88; mix-blend-mode: multiply;
}
@media (max-width: 639px) { .card-seal { width: 64px; right: -10px; bottom: -22px; } }
.done-note { font-size: var(--tiny); letter-spacing: 0.12em; text-transform: uppercase; color: #F1E6D2; }
.stamp {
  width: 150px; padding: 0; border: 0; outline: 0; background: transparent;
  transform: rotate(-12deg); opacity: 0.9; mix-blend-mode: multiply;
}
@keyframes stampIn { 0% { opacity: 0; transform: rotate(-20deg) scale(1.8); } 100% { opacity: 0.9; transform: rotate(-12deg) scale(1); } }
@media (min-width: 620px) { .dossier-head .stamp { top: 18px; right: 22px; } }
