/* Athenaeum — pages: reading desk, loans ledger, commonplace, almanac, archives, about, stamps & eggs */

.span-2 { grid-column: span 2; }
@media (max-width: 860px) { .span-2 { grid-column: auto; } }

/* ---------- Reading desk ---------- */
.desk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
@media (max-width: 860px) { .desk-grid { grid-template-columns: 1fr; } }
.meter { position: relative; height: 20px; margin: 1.4rem 0 .4rem; border-radius: 10px; background: rgba(80, 55, 25, .12); border: 1px solid var(--line-strong); }
.meter-fill { display: block; height: 100%; border-radius: 10px; background: var(--brass); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); transition: width 1s var(--ease); }
.meter-pace { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: #9b2a2a; border-radius: 1px; }
.meter-pace::after { content: "pace"; position: absolute; top: -1.2rem; left: 50%; transform: translateX(-50%); font-size: .62rem; color: #9b2a2a; letter-spacing: .1em; }
.meter-text { margin: .4rem 0 0; }
.meter-text b { font-family: var(--display); font-size: 1.2rem; }
.candles { display: flex; align-items: flex-end; gap: 8px; height: 66px; padding-top: 18px; }
.candle { position: relative; display: inline-block; width: 14px; height: 42px; border-radius: 3px 3px 2px 2px; background: linear-gradient(90deg, #e9dcb8, #fbf5e2 45%, #dccb9f); box-shadow: 0 2px 0 #b9a77a; }
.candle:nth-child(2n) { height: 36px; } .candle:nth-child(3n) { height: 46px; }
.candle::before { content: ""; position: absolute; top: -5px; left: 50%; width: 2px; height: 6px; margin-left: -1px; background: #3a2a1a; }
.candle i { position: absolute; left: 50%; top: -22px; width: 11px; height: 18px; margin-left: -5.5px; border-radius: 50% 50% 45% 45% / 62% 62% 38% 38%; background: radial-gradient(circle at 50% 70%, #fff8d0 0 20%, #ffc84a 45%, #ff7a1a 70%, transparent 72%); opacity: 0; transform-origin: 50% 90%; filter: drop-shadow(0 0 6px rgba(255, 180, 60, .8)); }
.candle.lit i { opacity: 1; animation: flame 1.4s ease-in-out infinite alternate; }
.candle:nth-child(2) i { animation-delay: .3s; } .candle:nth-child(3) i { animation-delay: .7s; } .candle:nth-child(4) i { animation-delay: .15s; } .candle:nth-child(5) i { animation-delay: .5s; }
@keyframes flame { 0% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.08, .94) rotate(2deg); } 100% { transform: scale(.94, 1.06) rotate(-1deg); } }
.big-num { margin: .5rem 0 .2rem; }
.big-num b { font: 600 2.2rem var(--display); margin-right: .3rem; }
.heat-wrap { overflow-x: auto; }
.heat { width: 100%; max-width: 760px; height: auto; display: block; }
.heat .ax { font: 10px var(--serif); fill: var(--paper-muted); }
.hm { stroke-width: 1; }
.hm.l0 { fill: rgba(80, 55, 25, .07); stroke: rgba(80, 55, 25, .16); }
.hm.l1 { fill: rgba(125, 60, 25, .3); stroke: rgba(125, 60, 25, .4); }
.hm.l2 { fill: rgba(125, 60, 25, .52); stroke: rgba(125, 60, 25, .6); }
.hm.l3 { fill: rgba(110, 45, 20, .75); stroke: rgba(110, 45, 20, .8); }
.hm.l4 { fill: rgba(80, 30, 15, .95); stroke: rgba(80, 30, 15, 1); }
.hm.today { stroke: #b88c3c; stroke-width: 2.2; }
.now-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 1rem; }
.now-card { display: flex; gap: .9rem; padding: .9rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.mini-cover { flex: none; width: 58px; }
.mini-cover .cover.thumb { width: 58px; }
.now-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.now-title { font-family: var(--display); font-size: 1.05rem; }
.now-log { display: flex; gap: .4rem; margin-top: .3rem; }
.now-log input { width: 5rem; min-height: 2rem; padding: .3em .5em; }
.next-card { display: flex; gap: 1.2rem; align-items: flex-start; }
.next-card .mini-cover { width: 90px; } .next-card .mini-cover .cover.thumb { width: 90px; }
.next-card .mini-cover .gc-title { font-size: .6rem; }
.next-card h3 { margin: .1rem 0; font-size: 1.4rem; }

/* ---------- Loans ---------- */
.loans-grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .loans-grid { grid-template-columns: 1fr; } }
.loan-form { display: flex; flex-direction: column; gap: .8rem; }
.ledger-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; }
.ledger-head .panel-h { margin: 0; }
.ledger-filter { display: inline-flex; align-items: center; gap: .5rem; font-size: .86rem; color: var(--muted); }
.loan-summary { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline; margin: .8rem 0 1rem; font-size: .9rem; color: var(--ink-soft); }
.loan-summary b { font-family: var(--display); font-size: 1.2rem; color: var(--accent); }
.loan-summary .od b { color: var(--accent-2); }
.loan-summary em { flex-basis: 100%; color: var(--muted); }
.ledger-panel .table-wrap { box-shadow: none; background: transparent; border: 0; }
.ledger-table.loans tr.late td { background: rgba(200, 60, 50, .07); }
.ledger-table .od { color: var(--accent-2); font-style: italic; }
.actions { display: flex; gap: .35rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.rubber { display: inline-block; padding: .12em .5em; border: 2px solid currentColor; border-radius: 4px; font: 700 .7rem/1.4 var(--display); letter-spacing: .16em; text-transform: uppercase; transform: rotate(-5deg); white-space: nowrap; filter: url(#inky); }
.rubber.red { color: var(--stamp-red); } .rubber.blue { color: var(--stamp-blue); } .rubber.green { color: var(--stamp-green); } .rubber.amber { color: var(--stamp-amber); }
.modal .rubber.red, .parchment .rubber.red { color: #b3261e; } .modal .rubber.blue, .parchment .rubber.blue { color: #2b4f9a; }
.modal .rubber.green, .parchment .rubber.green { color: #2f7a3a; } .modal .rubber.amber, .parchment .rubber.amber { color: #9a5c08; }
.ledger-empty { margin-top: .5rem; }

/* ---------- Commonplace ---------- */
.quote-tools { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.2rem; }
.quote-tools .search-field { max-width: 520px; }
.spotlight { margin-bottom: 1.6rem; }
.spotlight.flash .qcard { animation: inkIn .7s var(--ease); }
@keyframes inkIn { from { opacity: 0; filter: blur(4px); transform: scale(.98); } }
.qcard { --ink: var(--paper-ink); margin: 0 0 1rem; padding: 1.1rem 1.3rem; break-inside: avoid; border-radius: 8px; background: var(--paper); color: var(--paper-ink); box-shadow: var(--shadow); position: relative; }
.qcard blockquote { margin: 0 0 .6rem; font-style: italic; font-size: 1rem; line-height: 1.6; }
.qcard figcaption { font-size: .84rem; color: var(--paper-muted); }
.qcard .linkish { color: var(--paper-ink); }
.qcard.big { padding: 2rem 2.4rem 1.6rem 4.4rem; max-width: 900px; border: 1px solid rgba(80, 55, 25, .2); }
.qcard.big::before { content: "“"; position: absolute; left: 1rem; top: .2rem; font: 700 5rem/1 var(--display); color: #b88c3c; }
.qcard.big blockquote { font-size: clamp(1.15rem, 2.2vw, 1.55rem); font-family: var(--display); }
@media (max-width: 520px) { .qcard.big { padding: 2.6rem 1.2rem 1.2rem; } .qcard.big::before { top: -.2rem; } }
.quotes-grid { columns: 3 280px; column-gap: 1rem; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 1rem; }
.note-card { padding: 1rem 1.1rem; border-radius: 4px; background: #fff5b8; color: #2d2410; transform: rotate(-.6deg); box-shadow: 0 6px 14px rgba(0, 0, 0, .25); }
.note-card:nth-child(2n) { transform: rotate(.8deg); background: #fde7c8; }
.note-card .linkish { color: #2d2410; font-family: var(--display); font-weight: 600; }
.note-card p { margin: .4rem 0 0; font-size: .9rem; white-space: pre-wrap; }

/* ---------- Almanac ---------- */
.page-head .inline-form { margin: .8rem 0 0; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat-card { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat-card b { font: 600 1.7rem/1.15 var(--display); overflow-wrap: anywhere; }
.stat-card .hint { margin: 0; font-size: .76rem; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
@media (max-width: 860px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-box { margin: 0; }
.chart { width: 100%; height: auto; display: block; filter: url(#roughen); overflow: visible; }
.chart .ax { font: italic 13px var(--serif); fill: var(--paper-muted); }
.chart .val, .chart .lg { font: 600 14px var(--serif); fill: var(--paper-ink); }
.chart .big { font: 700 34px var(--display); fill: var(--paper-ink); }
.sk-grid { stroke: rgba(70, 45, 20, .16); fill: none; stroke-width: 1; }
.sk-axis { stroke: var(--paper-ink); fill: none; stroke-width: 1.6; stroke-linecap: round; }
.sk-fill { fill: url(#hatch); }
.sk-fill.alt { fill: url(#hatch2); }
.hatch-line { stroke: var(--chart-1); stroke-width: 2.4; }
.hatch-line.alt { stroke: var(--chart-2); }
.sk-stroke { stroke: var(--paper-ink); fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.faint { opacity: .4; }
.sk-line { stroke: var(--chart-2); stroke-width: 2.6; fill: none; stroke-linecap: round; }
.sk-dot { fill: var(--chart-1); }
.sk-arc { fill: none; stroke-width: 30; }
.sk-arc.st-read, .sk-key.st-read { stroke: #4c8a49; fill: #4c8a49; } .sk-arc.st-read { fill: none; }
.sk-arc.st-reading, .sk-key.st-reading { stroke: #c98a2e; fill: #c98a2e; } .sk-arc.st-reading { fill: none; }
.sk-arc.st-to-read, .sk-key.st-to-read { stroke: #5874aa; fill: #5874aa; } .sk-arc.st-to-read { fill: none; }
.sk-arc.st-dnf, .sk-key.st-dnf { stroke: #a8564e; fill: #a8564e; } .sk-arc.st-dnf { fill: none; }
.sk-key { stroke: none; }

/* ---------- Archives ---------- */
.archive-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
@media (max-width: 860px) { .archive-grid { grid-template-columns: 1fr; } }
.archive-grid p { margin-top: 0; }
.file-drop { position: relative; display: flex; align-items: center; justify-content: center; padding: 1.1rem; margin: .6rem 0; border: 2px dashed rgba(80, 55, 25, .4); border-radius: 10px; cursor: pointer; text-align: center; color: var(--paper-muted); transition: background .2s, border-color .2s; }
.file-drop:hover, .file-drop:focus-within { background: rgba(255, 255, 255, .45); border-color: #b88c3c; }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.shelf-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.shelf-list li { display: flex; align-items: center; gap: .7rem; }
.brass-plate { flex: 1; padding: 3px; border-radius: 4px; background: var(--brass); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.brass-plate input { width: 100%; min-height: 2.1rem; border: 0; border-radius: 2px; background: rgba(255, 250, 235, .92); color: #2a1d10; font-family: var(--display); letter-spacing: .06em; }
.shelf-list .sub { white-space: nowrap; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } }
.about-text p { line-height: 1.75; max-width: 70ch; }
.dropcap::first-letter { float: left; font: 600 3.6em/.85 var(--display); margin: .08em .1em 0 0; color: #7d2330; }
.tips li { margin: .3rem 0; }
.credits-card .maker { font-size: 1.1rem; }
.link-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.link-list a { display: inline-block; padding: .4rem .9rem; border: 1px solid var(--line-strong); border-radius: 999px; text-decoration: none; }
.link-list a:hover { background: var(--panel-2); }
.more-link { font-weight: 600; }
.noscript { max-width: 600px; margin: 2rem auto 0; padding: 1rem 1.2rem; text-align: center; border-radius: 8px; background: var(--paper); color: var(--paper-ink); font-style: italic; }

/* ---------- Ink stamp ---------- */
.stamp-layer { position: fixed; inset: 0; z-index: 400; pointer-events: none; overflow: hidden; }
.stamp-scene { position: absolute; inset: 0; display: grid; place-items: center; --ink-c: #b3261e; }
.stamp-scene.green { --ink-c: #2f7a3a; } .stamp-scene.blue { --ink-c: #2b4f9a; }
.stamp-tool { grid-area: 1 / 1; position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; transform: translateY(-120vh); animation: toolDrop 1.05s var(--ease) forwards; filter: drop-shadow(0 18px 18px rgba(0, 0, 0, .45)); }
.stamp-knob { width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #c98a52, #6b3a1c 70%); }
.stamp-neck { width: 26px; height: 74px; margin-top: -6px; background: linear-gradient(90deg, #5a2f15, #a2683a 45%, #5a2f15); }
.stamp-base { width: 170px; height: 38px; border-radius: 6px; background: linear-gradient(#e2c171, #a87f30 70%, #333 70%, #1d1d1d); }
@keyframes toolDrop { 0% { transform: translateY(-120vh); } 32% { transform: translateY(-30px); } 40% { transform: translateY(8px) scaleY(.95); } 55% { transform: translateY(0); } 100% { transform: translateY(-120vh); } }
.ink-slip { grid-area: 1 / 1; }
.ink-stamp { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; padding: .25em .75em .3em; border: .14em double var(--ink-c); border-radius: .18em; color: var(--ink-c); font: 800 clamp(2rem, 8vw, 5rem)/1 var(--display); letter-spacing: .14em; text-transform: uppercase; transform: rotate(-12deg); opacity: 0; animation: inkSlam 2.1s .38s forwards;
  background: rgba(250, 244, 228, .94); box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.ink-main, .ink-sub { filter: url(#inky); }
.ink-sub { margin-top: .35em; font-size: .3em; letter-spacing: .24em; }
@keyframes inkSlam { 0% { opacity: 0; transform: rotate(-12deg) scale(1.3); } 6% { opacity: 1; transform: rotate(-12deg) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: rotate(-12deg) scale(1); } }

/* ---------- Easter eggs ---------- */
.shhh { position: fixed; inset: 0; z-index: 450; display: grid; place-items: center; background: rgba(5, 3, 2, .55); animation: fadeIn .3s; }
.shhh[hidden] { display: none; }
.shhh-card { max-width: 360px; margin: 1rem; padding: 1.6rem; text-align: center; border-radius: 14px; background: var(--paper); color: var(--paper-ink); box-shadow: 0 30px 60px rgba(0, 0, 0, .5); animation: modalIn .4s var(--ease); }
.shhh-finger { font-size: 3rem; display: block; }
.shhh-big { font: 700 2.6rem var(--display); margin: .2rem 0; letter-spacing: .1em; }
body.hushed .lamp-glow, body.hushed .case-lamp::after { opacity: .1; }
body.hushed main { filter: brightness(.72) saturate(.8); transition: filter .6s; }
.rain-book { position: fixed; top: -80px; width: 18px; height: 64px; border-radius: 2px; background: linear-gradient(90deg, rgba(0, 0, 0, .3), rgba(255, 255, 255, .15) 30%, transparent 60%), var(--c); box-shadow: inset 0 6px 0 -4px #d9b25a, inset 0 -6px 0 -4px #d9b25a; animation: rain 2.6s ease-in backwards; }
@keyframes rain { from { transform: translateY(0) rotate(0); } to { transform: translateY(120vh) rotate(var(--r, 180deg)); } }

/* ---------- Print area (screen) ---------- */
.print-area { display: none; }

/* ---------- Small screens: keep the masthead on one line ---------- */
@media (max-width: 430px) {
  .masthead-inner { gap: .5rem; }
  .brand { gap: .45rem; min-width: 0; }
  .brand-name { font-size: 1rem; letter-spacing: .06em; }
  .brand-bust { width: 26px; height: 26px; }
  .masthead-tools { gap: .4rem; }
  .theme-pick select { max-width: 7rem; font-size: .78rem; padding-right: 1.4rem; }
  .nav-toggle { width: 40px; height: 40px; }
  .page-head h1 { font-size: 1.9rem; }
  .panel { padding: 1rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *:not(.ink-stamp), *:not(.ink-stamp)::before, *:not(.ink-stamp)::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .stamp-tool { display: none; }
  .ink-stamp { animation: inkFade 1.3s forwards !important; transform: rotate(-12deg); }
  @keyframes inkFade { 0% { opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
  .spine:hover, .spine:focus-visible { transform: none; }
  .lamp-glow { animation: none; }
}
