/* Lantern: one typeface (Newsreader, OFL, self-hosted) and one accent (reading-lamp green).
   Editorial and archival: every entry carries its originating application in the margin, set like a
   classmark on a catalogue card, so provenance is the first thing read. */
@font-face {
  font-family: 'Newsreader';
  src: url('/fonts/newsreader-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Newsreader';
  src: url('/fonts/newsreader-latin-wght-italic.woff2') format('woff2');
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --stock: #edf0ea;     /* page ground: pale celadon card stock */
  --leaf: #fafbf8;      /* entries */
  --ink: #17241f;
  --faded: #56655e;     /* secondary text, still AA on both grounds */
  --rule: #c5cfc8;
  --lamp: #0d6e53;      /* reading-lamp green; the only accent */
  --lamp-ink: #ffffff;  /* text on the lamp */
  --margin: 9.5rem;     /* the provenance column */
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --stock: #0f1714; --leaf: #16211d; --ink: #e5ece8; --faded: #9fb0a8; --rule: #2b3a34; --lamp: #63cfa4; --lamp-ink: #0f1714; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--stock);
  color: var(--ink);
  font-family: 'Newsreader', ui-serif, Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.55;
  font-optical-sizing: auto;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration-color: var(--lamp); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--lamp); color: var(--lamp-ink); padding: 6px 12px; z-index: 2; }
.skip:focus { left: 16px; }

button {
  font: inherit; font-size: 0.95rem; color: var(--ink);
  background: transparent; border: 1px solid var(--ink); border-radius: 2px;
  padding: 6px 14px; min-height: 40px; cursor: pointer;
}
button:hover { background: var(--leaf); }
button[aria-pressed="true"] { background: var(--ink); color: var(--stock); }
button.quiet { border-color: transparent; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; padding-left: 4px; padding-right: 4px; }
button.quiet:hover { background: transparent; text-decoration-color: var(--lamp); }

.masthead, main, .developer-panel, .footer { width: 100%; max-width: 760px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

/* Masthead: the name set large and italic, the purpose beneath in roman. */
.masthead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; padding-top: 36px; padding-bottom: 18px; border-bottom: 1px solid var(--ink); }
.title h1 { margin: 0; font-size: clamp(2.75rem, 9vw, 4rem); line-height: 0.95; font-weight: 500; font-style: italic; letter-spacing: -0.02em; }
.tagline { margin: 6px 0 0; color: var(--faded); font-size: 1rem; }
.session { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 0.95rem; }
.session p { margin: 0; }
.session p:empty { display: none; }
#signin { font-weight: 600; text-decoration-color: var(--lamp); text-decoration-thickness: 2px; }

/* Finder: exact handle lookup and the view shelf. */
.finder { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; padding: 20px 0 8px; }
.lookup { flex: 1 1 320px; min-width: 0; }
.lookup label { display: block; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faded); margin-bottom: 4px; }
.lookup-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--ink); }
.at { align-self: center; color: var(--faded); padding-right: 2px; }
.lookup input { flex: 1 1 auto; min-width: 0; font: inherit; color: var(--ink); background: transparent; border: 0; padding: 6px 4px; }
.lookup input:focus-visible { outline: none; }
.lookup-row:focus-within { border-bottom-color: var(--lamp); box-shadow: 0 1px 0 var(--lamp); }
.lookup-row button { border: 0; border-left: 1px solid var(--rule); border-radius: 0; }
.lookup input[aria-invalid="true"] { color: var(--ink); }
.hint { margin: 4px 0 0; font-size: 0.85rem; font-style: italic; color: var(--faded); }
.shelf { display: flex; gap: 8px; }

#status { margin: 12px 0 0; font-size: 0.9rem; font-style: italic; color: var(--faded); min-height: 1.4em; }
#views:focus { outline: none; }
.view-state { margin: 16px 0; }
.view-state:empty { display: none; }

/* Entries: provenance in the margin, then the record. */
.entries { border-top: 1px solid var(--rule); margin-top: 12px; }
.entry { display: grid; grid-template-columns: var(--margin) minmax(0, 1fr); gap: 0 24px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.entry.tappable { cursor: pointer; }
.entry.tappable:hover .text { text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; }
.provenance { margin: 3px 0 0; padding-right: 12px; border-right: 2px solid var(--lamp); text-align: right; line-height: 1.25; }
.via { display: block; font-size: 0.78rem; font-style: italic; color: var(--faded); }
.origin { display: block; margin-top: 2px; font-size: 0.82rem; font-weight: 650; letter-spacing: 0.16em; text-transform: uppercase; color: var(--lamp); overflow-wrap: anywhere; }
.origin.unrecorded { letter-spacing: 0; text-transform: none; font-weight: 400; font-style: italic; color: var(--faded); }
.entry-body { min-width: 0; }
.byline, .author { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.author-link { border: 0; padding: 0; min-height: 0; font-size: 1.05rem; font-weight: 650; text-align: left; }
.author-link:hover { background: transparent; text-decoration: underline; text-decoration-color: var(--lamp); }
.handle { font-size: 0.92rem; font-style: italic; color: var(--faded); }
.author-unavailable { font-style: italic; color: var(--faded); }
.text { margin: 6px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.15rem; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0; font-size: 0.85rem; color: var(--faded); }
.edited { font-style: italic; }
.meta .read { border: 0; padding: 0 2px; min-height: 32px; font-size: 0.85rem; text-decoration: underline; text-decoration-color: var(--lamp); text-underline-offset: 3px; }
.meta .read:hover { background: transparent; }
.note { margin: 4px 0; font-style: italic; color: var(--faded); }
.entry-unavailable .provenance { border-right-color: var(--rule); }
.entry-unavailable .text { font-style: italic; color: var(--faded); font-size: 1rem; }

/* Threads: replies step inward along the reading column, never the margin. */
.thread .entry .entry-body { border-left: 0 solid var(--rule); }
.thread .depth-1 .entry-body { padding-left: 16px; border-left-width: 1px; }
.thread .depth-2 .entry-body { padding-left: 32px; border-left-width: 1px; }
.thread .depth-3 .entry-body, .thread .depth-4 .entry-body { padding-left: 48px; border-left-width: 1px; }

.view-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-top: 12px; }
.view-head h2, .profile h2 { margin: 0; font-weight: 500; font-style: italic; font-size: 1.9rem; line-height: 1.1; }
.view-head h2:focus, .profile h2:focus { outline: none; }
.profile { padding: 8px 0 4px calc(var(--margin) + 24px); }
.profile h2 .author { display: block; }
.profile h2 .handle { display: block; margin: 4px 0 0; font-size: 1rem; color: var(--faded); }
.profile .note { margin: 10px 0 0; color: var(--faded); }
.profile-kind { margin: 14px 0 0; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faded); }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin-top: 48px; padding-top: 16px; padding-bottom: 40px; border-top: 1px solid var(--ink); font-size: 0.9rem; color: var(--faded); }
.built-on { text-decoration: none; }
.built-on span { font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.82rem; color: var(--ink); }

/* Signed-in actions: quiet, below the record. Follow shows the network's state as a pressed toggle. */
.actions { display: flex; flex-wrap: wrap; gap: 2px 6px; margin: 6px -4px 0; }
.actions button { min-height: 36px; font-size: 0.88rem; }
.relation[aria-pressed="true"] { background: transparent; color: var(--lamp); font-weight: 650; text-decoration-color: var(--lamp); }
.profile .actions { margin-top: 10px; }
.primary { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink); }
.primary:hover { background: var(--lamp); border-color: var(--ink); }

/* The reply editor sits in the reading column under the entry it answers; the report panel closes the page. */
.editor, .report-panel form { display: grid; gap: 8px; }
.editor { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--rule); }
.editor label, .report-panel label { display: grid; gap: 4px; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faded); }
textarea, .report-panel input, select { width: 100%; font: inherit; font-size: 1.05rem; letter-spacing: 0; text-transform: none; color: var(--ink); background: var(--leaf); border: 1px solid var(--rule); border-radius: 2px; padding: 8px 10px; }
textarea { resize: vertical; min-height: 5.5em; }
textarea:focus, .report-panel input:focus, select:focus { border-color: var(--lamp); outline: 2px solid var(--lamp); outline-offset: 0; }
.editor-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 10px; }
.count { margin-right: auto; font-size: 0.85rem; color: var(--faded); font-variant-numeric: tabular-nums; }
.count.over { color: var(--ink); font-weight: 650; text-decoration: underline wavy var(--lamp); text-underline-offset: 4px; }
.form-note { margin: 0; padding: 6px 10px; border-left: 2px solid var(--lamp); font-size: 0.95rem; font-style: italic; }
.report-panel { margin-top: 32px; padding: 16px 0 0; border-top: 1px solid var(--ink); }
.report-panel h2 { margin: 0 0 4px; font-weight: 500; font-style: italic; font-size: 1.4rem; }
.report-panel p { margin: 0 0 12px; color: var(--faded); }

/* For developers: collapsed by default, set like an archival note. */
.developer-panel { margin-top: 40px; }
.developer { border-top: 1px solid var(--rule); padding-top: 10px; font-size: 0.95rem; }
.developer summary { cursor: pointer; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faded); min-height: 32px; }
.developer dl { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: 6px 16px; margin: 12px 0; }
.developer dt { font-style: italic; color: var(--faded); }
.developer dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.developer dd p, .developer ul { margin: 0; }
.developer ul { padding-left: 1.1em; }
.developer code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }
.developer-note { margin: 8px 0; padding-left: 10px; border-left: 2px solid var(--lamp); }

/* Phones: the margin folds into a label line above the byline. */
@media (max-width: 560px) {
  body { font-size: 1.0625rem; }
  .entry { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .provenance { border-right: 0; border-left: 2px solid var(--lamp); padding: 0 0 0 8px; text-align: left; display: flex; align-items: baseline; gap: 6px; }
  .via, .origin { display: inline; margin: 0; }
  .profile { padding-left: 0; }
  .developer dl { grid-template-columns: minmax(0, 1fr); }
  .thread .depth-2 .entry-body { padding-left: 24px; }
  .thread .depth-3 .entry-body, .thread .depth-4 .entry-body { padding-left: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
