:root {
  --surface: #fffdf7;
  --ink: #1c1a18;
  --muted: #635d55;
  --rule: #d9d2c6;
  --gold: #f1d18c;
  --chrome: #131312;
  --ui: system-ui, sans-serif;
  --zoom: 1;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #090909; font-family: Georgia, serif; }
:focus-visible { outline: 3px solid #b9822e; outline-offset: 3px; }
.lok-wrap { height: 100vh; height: 100dvh; overflow: auto; scroll-padding-top: var(--header-height, 115px); }
.lok-wrap:fullscreen, .lok-wrap.lok-expanded { width: 100%; height: 100%; background: #090909; }
.lok-wrap.lok-expanded { position: fixed; inset: 0; z-index: 10; }
.lok-wrap[data-theme="night"] {
  --surface: #171716;
  --ink: #f4ede2;
  --muted: #c2b8aa;
  --rule: #494239;
}
.lok-reader-header {
  position: sticky;
  z-index: 5;
  top: 0;
  padding: 0 12px;
  background: var(--chrome);
  color: #fff;
  border-bottom: 1px solid #3b3326;
  font: 600 .86rem var(--ui);
}
.lok-toolbar, .lok-page-tools, .lok-tools { display: flex; align-items: center; gap: 6px; }
.lok-toolbar { max-width: var(--paper); margin: auto; justify-content: space-between; flex-wrap: wrap; padding: 9px 0; }
.lok-tools { flex-wrap: wrap; }
.lok-reader-header button, .lok-reader-header select {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #51493c;
  border-radius: 7px;
  background: #22211f;
  color: #fff;
  font: inherit;
}
.lok-reader-header button { cursor: pointer; }
.lok-reader-header button:hover, .lok-reader-header button[aria-pressed="true"] { background: #443521; }
.lok-reader-header button:disabled { opacity: .45; cursor: default; }
.lok-home { padding: 8px 4px; color: var(--gold); text-decoration: none; }
.lok-page-tools { justify-content: center; padding: 0 0 8px; }
.lok-page-tools label { display: flex; align-items: center; gap: 6px; }
.lok-status { position: fixed; z-index: 6; bottom: 16px; right: 16px; margin: 0; padding: 10px 14px; border-radius: 8px; background: var(--gold); color: #19140c; font: 600 .9rem var(--ui); }

.lok-paper { width: calc(100% / max(1, var(--zoom))); max-width: var(--paper); margin: 20px auto 40px; color: var(--ink); zoom: var(--zoom); overflow-wrap: anywhere; }
.lok-paper a { color: inherit; }
.lok-cover, .lok-page { background: var(--surface); }
.lok-cover { padding: 28px 20px 24px; border-top: 5px solid var(--accent); border-radius: 12px 12px 0 0; text-align: center; }
.lok-brand, .lok-cat, .lok-section { font: 750 .75rem var(--ui); letter-spacing: .13em; text-transform: uppercase; }
.lok-title { margin: 7px 0 10px; font-size: clamp(2.5rem, 7vw, 5.75rem); line-height: .99; }
.lok-cover time, .lok-meta, .lok-page-head, .lok-page-no { color: var(--muted); font: 600 .8rem var(--ui); }
.lok-archive { margin: 18px auto 0; max-width: 580px; font: 600 .85rem var(--ui); }
.lok-archive summary { display: list-item; width: fit-content; border: 1px solid var(--rule); border-radius: 6px; margin: auto; padding: 8px 12px; cursor: pointer; }
.lok-archive ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; margin: 12px 0 0; padding: 0; max-height: 12rem; overflow: auto; }
.lok-archive a { display: block; padding: 6px 9px; border-radius: 5px; border: 1px solid var(--rule); text-decoration: none; }
.lok-archive a[aria-current="page"] { background: var(--gold); color: #19140c; }

.lok-page { padding: 22px clamp(16px, 4vw, 54px) 28px; }
.lok-page + .lok-page { margin-top: 18px; border-radius: 8px; }
.lok-page-head, .lok-page-no { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: space-between; padding: 8px 0; border-block: 1px solid var(--rule); }
.lok-page-no { justify-content: center; margin-top: 24px; }
.lok-lead { margin: 20px 0 24px; padding-bottom: 22px; border-bottom: 3px double var(--rule); }
.lok-story h2 { margin: 7px 0; font-size: clamp(1.28rem, 2.3vw, 1.8rem); line-height: 1.13; }
.lok-story h2 a { text-decoration: none; }
.lok-story h2 a:hover, .lok-archive a:hover { text-decoration: underline; }
.lok-lead-story h2 { font-size: clamp(1.9rem, 5vw, 3.75rem); line-height: 1.04; }
.lok-compact h2 { font-size: 1.18rem; }
.lok-meta { margin: 8px 0; }
.lok-excerpt, .lok-lead-body { line-height: 1.65; }
.lok-lead-body { font-size: 1.0625rem; }
.lok-article { max-width: min(var(--paper), 880px); }
.lok-article .lok-page { border-top: 5px solid var(--accent); border-radius: 12px; }
.lok-article-head { margin: 4px 0 22px; }
.lok-article .lok-title { font-size: clamp(1.95rem, 5.5vw, 3.75rem); line-height: 1.08; }
.lok-story-image, .lok-ad-image { display: block; max-width: 100%; height: auto; margin: 0 auto 14px; border-radius: 6px; }
.lok-story-image { width: 100%; max-height: 620px; object-fit: contain; }
.lok-lead-body :is(img, figure, video, iframe, svg) { max-width: 100% !important; }
.lok-lead-body :is(img, video) { height: auto !important; }
.lok-lead-body figure { width: auto !important; margin: 1em 0 !important; float: none !important; }
.lok-lead-body :is(.alignleft,.alignright,.aligncenter) { float: none !important; margin-inline: auto !important; }
.lok-lead-body table, .lok-lead-body pre { display: block; max-width: 100%; overflow: auto; }
.lok-read { display: inline-block; padding: 8px 13px; border: 1px solid var(--rule); border-radius: 7px; font: 700 .8rem var(--ui); text-decoration: none; }
.lok-read:hover { background: var(--gold); color: #19140c; }
.lok-grid { column-count: var(--columns); column-gap: 26px; column-rule: 1px solid var(--rule); }
.lok-grid .lok-story, .lok-ad { break-inside: avoid; margin-bottom: 20px; }
.lok-section { break-after: avoid; padding-bottom: 8px; border-bottom: 1px solid var(--rule); margin: 0 0 12px; }
.lok-ad { border: 1px solid var(--rule); border-radius: 8px; padding: 14px; margin-top: 18px; text-align: center; font-family: var(--ui); }
.lok-ad-label { margin-bottom: 10px; color: var(--muted); font-size: .7rem; letter-spacing: .11em; }
.lok-empty { background: var(--surface); text-align: center; padding: 24px; margin: 0; }

@media (max-width: 940px) { .lok-grid { column-count: min(2, var(--columns)); } }
@media (max-width: 640px) {
  .lok-paper { margin-top: 0; }
  .lok-grid { column-count: 1; }
  .lok-cover, .lok-article .lok-page { border-radius: 0; }
  .lok-story-image { max-height: none; }
}
@media print {
  body, .lok-wrap, .lok-wrap.lok-expanded { background: #fff; height: auto; overflow: visible; position: static; }
  .lok-wrap[data-theme], .lok-wrap { --surface: #fff; --ink: #000; --muted: #444; --rule: #aaa; }
  .lok-reader-header, .lok-archive, .lok-status { display: none !important; }
  .lok-paper { width: 100%; max-width: none; margin: 0; zoom: 1; }
  .lok-page + .lok-page { margin: 0; break-before: page; }
  .lok-cover, .lok-page { padding-inline: 0; }
  @page { margin: 10mm; }
}
@media screen {
  .lok-paper[data-edition] > .lok-page {
    min-height: max(0px, (100dvh - var(--header-height, 115px)) / var(--zoom));
  }
}

/* Keep legacy edition previews compact. The standalone article uses its own layout. */
.lok-paper[data-edition] .lok-lead-story > .lok-lead-body { display: none; }
.lok-lead-story .lok-excerpt { max-width: 70ch; font-size: 1.075rem; color: var(--muted); }
.lok-lead-story .lok-read { background: var(--gold); color: #19140c; border-color: #b9822e; }
.lok-lead-story .lok-read:hover { background: #e7bd70; }
