/* The Reading Room — a Classics / Academic / Poetic theme.
   Parchment, ink, oxblood, antique gold. Serif throughout. */

:root {
  --parchment: #f4edda;
  --parchment-deep: #ece1c4;
  --card: #faf5e6;
  --ink: #2b2118;
  --ink-soft: #5a4a38;
  --muted: #8a755c;
  --oxblood: #6b1f1f;
  --oxblood-deep: #521616;
  --gold: #b08d3e;
  --gold-soft: #d3b96a;
  --rule: #d8c79b;
  --shadow: rgba(43, 33, 24, 0.14);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.65;
  background-color: var(--parchment);
  /* subtle paper texture: warm vignettes + faint laid lines */
  background-image:
    radial-gradient(ellipse at 15% 5%, rgba(176, 141, 62, 0.08), transparent 55%),
    radial-gradient(ellipse at 85% 95%, rgba(107, 31, 31, 0.06), transparent 55%),
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(43, 33, 24, 0.014) 4px);
  min-height: 100vh;
}

h1, h2, h3, .motto, .book-title, .clock-time {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

h1 { font-size: 2rem; margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.6rem; margin: 0 0 0.6rem; }
h3 { font-size: 1.3rem; }

a { color: var(--oxblood); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--oxblood-deep); }

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ---------------- Bookplate header ---------------- */

.bookplate {
  border-bottom: 3px double var(--gold);
  background: linear-gradient(to bottom, rgba(176, 141, 62, 0.10), transparent);
  margin-bottom: 1.5rem;
}
.plate-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.4rem 1rem 1rem;
  text-align: center;
}
.motto {
  font-size: 1.9rem;
  font-style: italic;
  letter-spacing: 0.04em;
  color: var(--oxblood);
}
.motto-sub {
  font-size: 0.85rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.15rem;
}
.topnav { margin-top: 0.9rem; font-size: 1.02rem; }
.topnav a { text-decoration: none; padding: 0.35rem 0.2rem; }
.topnav a:hover { text-decoration: underline; }
.nav-sep { color: var(--gold); margin: 0 0.5rem; }
.reader-link { font-style: italic; }

/* ---------------- Cards ---------------- */

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: 0 2px 10px var(--shadow);
  padding: 1.4rem 1.25rem;
  margin-bottom: 1.25rem;
}

.kicker {
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.4rem;
  font-weight: 600;
}

.lede { font-size: 1.15rem; color: var(--ink-soft); font-style: italic; }
.muted { color: var(--muted); }
.fineprint { font-size: 0.95rem; color: var(--muted); font-style: italic; }

.ornament {
  text-align: center;
  color: var(--gold);
  margin: 1.4rem 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.ornament::before, .ornament::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--rule);
}
footer .ornament { margin: 2rem auto 0.6rem; max-width: 680px; padding: 0 1rem; }
.colophon { text-align: center; color: var(--muted); font-style: italic; font-size: 0.95rem; margin: 0 0 2rem; }

/* ---------------- Buttons & forms ---------------- */

.btn {
  display: inline-block;
  width: 100%;
  min-height: 52px;
  padding: 0.85rem 1.2rem;
  margin-top: 1rem;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
  color: var(--parchment);
  background: linear-gradient(to bottom, var(--oxblood), var(--oxblood-deep));
  border: 1px solid var(--oxblood-deep);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 6px var(--shadow);
}
.btn:hover { color: #fff8e7; filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: var(--oxblood);
  border: 1px solid var(--oxblood);
  box-shadow: none;
}
.btn-ghost:hover { color: var(--oxblood-deep); background: rgba(107, 31, 31, 0.06); }

.btn-giant {
  font-size: 1.7rem;
  min-height: 76px;
  margin-top: 0.75rem;
}

.btn-small {
  width: auto;
  min-height: 48px;
  font-size: 1.08rem;
  padding: 0.6rem 1rem;
  margin-top: 0;
}

.text-link { font-style: italic; }

.stack-form .field { margin-bottom: 1.1rem; }
label, legend {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
fieldset.field { border: none; padding: 0; margin: 0 0 1.1rem; }

input[type="text"], input[type="number"], input[type="password"], textarea {
  width: 100%;
  font-family: "EB Garamond", serif;
  font-size: 1.1rem;
  color: var(--ink);
  background: var(--parchment);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.7rem 0.85rem;
  min-height: 52px;
}
textarea { line-height: 1.6; resize: vertical; }
input:focus, textarea:focus {
  outline: 2px solid var(--gold-soft);
  border-color: var(--gold);
  background: #fbf6e9;
}
.passcode-input { text-align: center; letter-spacing: 0.2em; max-width: 320px; margin: 0 auto 1rem; }

.radio-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.radio-pill { margin: 0; cursor: pointer; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill span {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  min-height: 52px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: transparent;
}
.radio-pill input:checked + span {
  background: var(--oxblood);
  border-color: var(--oxblood-deep);
  color: var(--parchment);
}
.radio-pill input:focus-visible + span { outline: 2px solid var(--gold-soft); }

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

.save-hint {
  display: block;
  min-height: 1.4em;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* ---------------- Flashes ---------------- */

.flashes p {
  background: rgba(176, 141, 62, 0.16);
  border-left: 3px solid var(--gold);
  padding: 0.8rem 1rem;
  border-radius: 0 6px 6px 0;
  font-style: italic;
}

/* ---------------- Identity gate ---------------- */

.gate { text-align: center; padding-top: 1rem; }
.gate h1 { font-size: 2.4rem; font-style: italic; }
.gate-form { max-width: 420px; margin: 1.5rem auto 0; }

/* ---------------- Dashboard ---------------- */

.clocks {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}
.clock-city {
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.clock-time {
  font-size: 1.7rem;
  color: var(--oxblood);
  font-variant-numeric: tabular-nums;
}
.clock-divider { color: var(--gold); font-size: 1.3rem; }
.clock-note {
  grid-column: 1 / -1;
  margin: 0.4rem 0 0;
  font-style: italic;
  color: var(--muted);
  font-size: 0.98rem;
}

.book-title { font-size: 2.1rem; margin: 0; }
.book-title a { color: var(--ink); text-decoration: none; }
.book-title a:hover { color: var(--oxblood); text-decoration: underline; }
.book-author { font-style: italic; color: var(--ink-soft); margin: 0.2rem 0; font-size: 1.2rem; }
.book-meta { color: var(--muted); font-size: 1rem; margin: 0.2rem 0 0; }

.progress-duo { margin: 1.2rem 0 0.4rem; display: grid; gap: 0.9rem; }
.reader-progress-head {
  display: flex; justify-content: space-between;
  font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 1.1rem;
  margin-bottom: 0.25rem;
}
.bar {
  height: 10px;
  background: var(--parchment-deep);
  border: 1px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--gold-soft), var(--gold));
  border-radius: 999px;
  transition: width 0.6s ease;
}

.essay-status { margin-top: 1rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.essay-status .kicker { margin: 0; }
.essay-chip {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.2rem 0.9rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
}
.essay-chip.done { border-color: var(--gold); color: var(--oxblood); }

.turn-card .turn-line { font-size: 1.25rem; }
.turn-card .turn-line strong { color: var(--oxblood); }

.plain-list { list-style: none; padding: 0; margin: 0.6rem 0; }
.plain-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1.1rem;
}
.plain-list li:last-child { border-bottom: none; }

.empty-shelf { text-align: center; }
.empty-shelf h1 { font-style: italic; }

/* ---------------- Tabs ---------------- */

.tabs { display: none; }
body.has-tabs .tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 1.2rem;
  border-bottom: 2px solid var(--rule);
}
.tab {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 0.55rem 1rem 0.45rem;
  cursor: pointer;
}
.tab:hover { color: var(--oxblood); }
.tab.is-active {
  color: var(--oxblood);
  border-bottom-color: var(--oxblood);
}
.tab:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
body.has-tabs .tab-panel { display: none; }
body.has-tabs .tab-panel.is-active { display: block; }

/* ---------------- Chapters ---------------- */

.section-title {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.4rem;
  margin-bottom: 0.4rem;
}
.rule-note { color: var(--muted); font-style: italic; font-size: 1.02rem; }

.chapter-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.chapter {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.8rem;
  background: rgba(244, 237, 218, 0.45);
}
.chapter-done { opacity: 0.92; }
.chapter-locked { opacity: 0.62; background: rgba(236, 225, 196, 0.4); }

.chapter-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.chapter-numeral {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--oxblood);
  min-width: 3.2rem;
}
.chapter-checks { display: flex; gap: 0.5rem; margin-right: auto; }
.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--parchment);
}
.check.on {
  background: var(--oxblood);
  border-color: var(--oxblood-deep);
  color: var(--parchment);
}
.chapter-action { margin: 0; }

.chapter-note {
  margin: 0.6rem 0 0;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.marginalia { margin-top: 0.8rem; }
.marginalia label {
  font-size: 1rem;
  font-style: italic;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

/* ---------------- Essays ---------------- */

.essay-prompt { text-align: center; border-color: var(--gold); }
.essay-prompt h2 { font-style: italic; color: var(--oxblood); }

.essay-body { font-size: 1.15rem; }
.essay-body p { margin: 0 0 1rem; text-align: justify; hyphens: auto; }
.dropcap > p:first-child::first-letter {
  font-family: "Cormorant Garamond", serif;
  font-size: 3.4em;
  font-weight: 700;
  float: left;
  line-height: 0.85;
  padding: 0.06em 0.12em 0 0;
  color: var(--oxblood);
}

.essay-byline {
  font-style: italic;
  color: var(--oxblood);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.35rem;
}

/* ---------------- Library ---------------- */

.library-head { text-align: center; }
.library-book { margin-bottom: 1.5rem; }
.essay-duo { display: grid; gap: 1.5rem; }
@media (min-width: 720px) {
  .essay-duo { grid-template-columns: 1fr 1fr; }
  .essay-duo .essay-col + .essay-col {
    border-left: 1px solid var(--rule);
    padding-left: 1.5rem;
  }
}

/* ---------------- Wider screens ---------------- */

@media (min-width: 720px) {
  body { font-size: 1.2rem; }
  h1 { font-size: 2.3rem; }
  .motto { font-size: 2.3rem; }
  .card { padding: 1.8rem 2rem; }
  .btn { width: auto; min-width: 260px; }
  .chapter-action { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
}

/* ---------------- Book covers & web lookup ---------------- */

.book-hero {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  margin: 0.4rem 0 1rem;
}

.book-hero-text { min-width: 0; }

.cover {
  width: 104px;
  flex: none;
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--shadow);
  border: 1px solid var(--rule);
}

.cover-small { width: 76px; }

.lookup-row { display: flex; gap: 0.6rem; align-items: stretch; }
.lookup-row input { flex: 1; min-width: 0; }
.lookup-row .btn { flex: none; }

.lookup-results {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.result-card {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--parchment);
}

.result-cover {
  width: 54px;
  flex: none;
  border-radius: 3px;
  box-shadow: 0 1px 4px var(--shadow);
}

.result-cover.cover-missing {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--parchment-deep);
  color: var(--muted);
  box-shadow: none;
}

.result-info { min-width: 0; }
.result-title { margin: 0; font-size: 1.1rem; line-height: 1.3; }
.result-author { margin: 0.15rem 0 0.55rem; color: var(--ink-soft); font-size: 1rem; }
.result-info .btn { min-width: 0; width: auto; }

.cover-preview { margin-bottom: 0.4rem; }
.cover-preview img {
  width: 104px;
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--shadow);
  border: 1px solid var(--rule);
}
