/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── VARIABLES ── */
:root {
  --bg:       #0d0b08;
  --paper:    #ede4cc;
  --sepia:    #8a7250;
  --aged:     #c4a870;
  --green:    #5a7a3a;
  --green-lt: #7aaa50;
  --green-dk: #3a5228;
}

/* ── UTILITY ── */
.sp { font-family: 'Special Elite', Georgia, serif; text-transform: uppercase; }

/* ── BASE ── */
body {
  font-family: 'Libre Baskerville', Georgia, serif;
  background: var(--bg);
  color: var(--aged);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ── BACKGROUND ── */
.bg-fixed {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background-color: #0d0b08;
  /* Base gradient + colour blooms */
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(83, 26, 0, 0.2), 40%, transparent 80%),
    radial-gradient(ellipse 80% 60% at 80% 20%, rgba(42,64,24,0.3), 40%, transparent 80%),
    radial-gradient(ellipse 100% 80% at 50% 50%, rgb(19, 12, 1) 0%, #1f1203 50%, #020100 100%);
}

.bg-fixed::before,
.bg-fixed::after { content: ''; position: absolute; inset: 0; }

/* Noise layer 1 — pure b/w grain, color-dodge blend */
.bg-fixed::before {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2Ij48ZmlsdGVyIGlkPSJuIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC43NSIgbnVtT2N0YXZlcz0iNCIgc3RpdGNoVGlsZXM9InN0aXRjaCIvPjxmZUNvbG9yTWF0cml4IHR5cGU9InNhdHVyYXRlIiB2YWx1ZXM9IjAiLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgZmlsdGVyPSJ1cmwoI24pIiBvcGFjaXR5PSIwLjkiLz48L3N2Zz4=");
  background-size: 256px 256px;
  background-repeat: repeat;
  mix-blend-mode: color-dodge;
  opacity: 0.33;
}

/* Noise layer 2 — inverted pure b/w grain, color-burn blend */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2Ij48ZmlsdGVyIGlkPSJuIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC43NSIgbnVtT2N0YXZlcz0iNCIgc3RpdGNoVGlsZXM9InN0aXRjaCIvPjxmZUNvbG9yTWF0cml4IHR5cGU9InNhdHVyYXRlIiB2YWx1ZXM9IjAiLz48ZmVDb21wb25lbnRUcmFuc2Zlcj48ZmVGdW5jUiB0eXBlPSJsaW5lYXIiIHNsb3BlPSItMSIgaW50ZXJjZXB0PSIxIi8+PGZlRnVuY0cgdHlwZT0ibGluZWFyIiBzbG9wZT0iLTEiIGludGVyY2VwdD0iMSIvPjxmZUZ1bmNCIHR5cGU9ImxpbmVhciIgc2xvcGU9Ii0xIiBpbnRlcmNlcHQ9IjEiLz48L2ZlQ29tcG9uZW50VHJhbnNmZXI+PC9maWx0ZXI+PHJlY3Qgd2lkdGg9IjI1NiIgaGVpZ2h0PSIyNTYiIGZpbHRlcj0idXJsKCNuKSIgb3BhY2l0eT0iMC45Ii8+PC9zdmc+");
  background-size: 256px 256px;
  background-repeat: repeat;
  mix-blend-mode: color-burn;
  opacity: 0.33;
}

/* Dot grids + vignette */
.bg-fixed::after {
  background-image:
    radial-gradient(ellipse 100% 100% at 50% 50%, transparent 35%, rgba(0,0,0,0.88) 100%),
    radial-gradient(circle, rgba(180,148,80,0.09) 1px, transparent 1px),
    radial-gradient(circle, rgba(90,122,58,0.09)  1.5px, transparent 1.5px);
  background-size:
    100% 100%,
    22px 22px,
    38px 38px;
  background-position:
    0 0,
    0 0,
    11px 11px;
}

/* ── PIXEL SNOW ── */
.pixel-snow {
  position: fixed;
  inset: 0;
  z-index: 2;
  mix-blend-mode: overlay;
  pointer-events: none;
  overflow: hidden;
  height: 100dvh;
}

/* Disable blend mode on mobile, use transparency instead */
.pixel-snow.mobile {
  mix-blend-mode: normal;
}

.snowflake {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 1px #ffffff;
  animation: fall linear infinite;
  will-change: transform;
}

/* More transparent snowflakes on mobile */
.pixel-snow.mobile .snowflake {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 1px rgba(255, 255, 255, 0.1);
}

@keyframes fall {
  0% {
    transform: translateY(-10vh) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) translateX(var(--drift));
    opacity: 0;
  }
}


/* ── TOP NAV ── */
.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4rem;
  height: 60px;
  background: rgba(13,11,8,0.9);
  border-bottom: 1px solid rgba(90,122,58,0.25);
}

.topbar-brand, .topbar-right { font-size: 0.65rem; letter-spacing: 0.5em; color: var(--aged); }

.topbar-brand::before, .topbar-right::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--green-lt);
  vertical-align: middle;
  margin-bottom: 1px;
}

.topbar-brand::before { margin-right: 0.8rem; }
.topbar-right::after  { margin-left:  0.8rem; }

.topbar-nav {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.topbar-nav li { white-space: nowrap; }
.topbar-nav a { font-size: 0.75rem; letter-spacing: 0.35em; color: rgba(196,168,112,0.55); text-decoration: none; transition: color 0.2s; }
.topbar-nav a:hover { color: rgba(196,168,112,0.8); }

/* Shared na state — used by topbar links and page nav buttons */
.na { color: var(--green-lt) !important; pointer-events: none; cursor: default; transition: none !important; }

/* Topbar active state — highlighted but still clickable to swap subnav */
.topbar-active { color: rgba(122,170,80,0.6) !important; transition: none !important; }
.topbar-active:hover { color: var(--green-lt) !important; }

/* ── TOPBAR INVERT TOGGLE ── */
.topbar-invert-li { list-style: none; }

.topbar-invert-toggle {
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  color: rgba(196,168,112,0.75);
  background: rgba(90,122,58,0.12);
  border: 1px solid var(--green);
  padding: 0.3em 0.9em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  font-family: 'Special Elite', Georgia, serif;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: normal;
  /* Lock to the width of "LIGHT" (5 chars) so switching to "DARK" (4 chars) never shifts layout */
  min-width: calc(5ch + 5 * 0.3em + 2 * 0.9em + 2px);
  text-align: center;
  padding: 0.38em 0.9em 0.22em;
  text-indent: 0.15em;
}

.topbar-invert-toggle:hover {
  color: rgba(196,168,112,1);
  border: 1px solid var(--green-lt);
}

.topbar-invert-toggle.active {
  color: rgba(196,168,112,0.45);
  border-color: var(--green-dk);
  background: rgba(90,122,58,0.10);
}

.topbar-invert-toggle.active:hover {
  color: rgba(196,168,112,0.65);
  border-color: var(--green);
  background: rgba(90,122,58,0.18);
}

/* ── SUB NAV ── */
.subnav {
  position: relative;
  z-index: 29;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  opacity: 1;
  background: rgba(8,6,3,0.95);
  border-bottom: 1px solid rgba(90,122,58,0.18);
  pointer-events: auto;
}

/* subnav is always open — .subnav-open kept for compatibility */

.subnav::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, transparent, rgba(90,122,58,0.04) 50%, transparent);
  pointer-events: none;
}

.subnav-tab {
  font-size: 0.52rem;
  letter-spacing: 0.38em;
  color: rgba(196,168,112,0.55);
  text-decoration: none;
  padding: 0 1.6rem;
  height: 100%;
  display: flex;
  align-items: center;
  position: relative;
  transition: color 0.2s;
  white-space: nowrap;
}

.subnav-tab + .subnav-tab::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: rgba(90,122,58,0);
  transition: background 0.15s ease;
}

.subnav-tab + .subnav-tab-started::before {
  background: rgba(90,122,58,0.18);
}

.subnav-tab:hover { color: rgba(196,168,112,0.8); }

.subnav-tab.subnav-active {
  color: var(--green-lt);
  pointer-events: none;
}

.subnav-tab.subnav-active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1.6rem;
  right: 1.6rem;
  height: 2px;
  background: var(--green);
}

/* ── SUBNAV TERMINAL RETYPE ANIMATION ── */

/* Content wrapper — flex row holding all tab links */
.subnav-content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

/* Selection highlight overlay — JS-positioned over the actual text width */
.subnav-highlight {
  position: absolute;
  pointer-events: none;
  background: var(--green-lt);
  opacity: 0.22;
  clip-path: inset(0 100% 0 0); /* animated by JS rAF */
  z-index: 2;
}

/* Solid block cursor — JS positions left/top */
.subnav-cursor {
  position: absolute;
  width: 7px;
  height: 1.1em;
  background: var(--green-lt);
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  transform: translateY(-50%);
}

.subnav-cursor.subnav-cursor-on {
  opacity: 1;
}


@media (max-width: 700px) {
  .subnav.subnav-open { height: auto; padding: 0.3rem 0; flex-wrap: wrap; }
  .subnav-tab { font-size: 0.5rem; padding: 0.3rem 1rem; height: auto; }
}

/* ── FOOTER ── */
.footbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3rem;
  height: 52px;
  background: rgba(6,5,3,0.95);
  border-top: 1px solid rgba(90,122,58,0.15);
}

.footbar-text { font-size: 0.62rem; letter-spacing: 0.3em; color: rgba(196,168,112,0.28); }

.footbar-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(90,122,58,0.35);
}

.footbar-dot::before,
.footbar-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 28px;
  height: 1px;
  background: rgba(90,122,58,0.35);
}

.footbar-dot::before { right: calc(100% + 6px); }
.footbar-dot::after  { left:  calc(100% + 6px); }

/* ── FOOTNOTE BAR ── */
.footnote-bar { position: fixed; inset: auto 0 0; z-index: 40; }

.footnote-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.65rem;
  color: rgba(196,168,112,0.5);
  letter-spacing: 0.2em;
  padding: 0 0.4rem;
  flex-shrink: 0;
  transition: color 0.2s;
}
.footnote-close:hover { color: var(--green-lt); }

/* Push page content up so footnote bar doesn't overlap it — set dynamically by JS */
body.footnote-hidden { padding-bottom: 0; }

.footnote-inner {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0 4rem;
  height: 38px;
  background: rgba(5,4,2,0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.footnote-asterisk { font-size: 0.65rem; color: var(--green-lt); flex-shrink: 0; }
.footnote-text { font-style: italic; font-size: 0.6rem; color: rgba(196,168,112,0.5); letter-spacing: 0.02em; }
.footnote-text strong { font-style: normal; color: rgba(196,168,112,0.6); font-weight: 400; }

/* ── PAGE HERO (shared by page## files) ── */
.page-hero {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 1.75rem 2rem 1.5rem;
  border-bottom: 1px solid rgba(90,122,58,0.2);
  background: rgba(10,8,4,0.5);
}

.page-hero-eyebrow {
  font-size: 0.6rem;
  letter-spacing: 0.5em;
  color: var(--green-lt);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.page-hero-eyebrow::before,
.page-hero-eyebrow::after { content: ''; width: 28px; height: 1px; background: var(--green); }

.page-hero-number {
  font-size: clamp(1.6rem,3.5vw,2.8rem);
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--paper);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  margin-bottom: 0.6rem;
}

.page-hero-title { font-style: italic; font-size: clamp(0.85rem,1.5vw,1rem); color: rgba(196,168,112,0.55); }

/* ── PAGE MAIN & CARD (shared by page## files) ── */
main { position: relative; z-index: 10; max-width: 100%; width: 100%; margin: 0 auto; padding: 3rem 1.5rem 0; flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; }

.page-card {
  max-width: 720px;
  width: 100%;
  background: var(--paper);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.45), 0 12px 40px rgba(0,0,0,0.3);
  animation: riseIn 0.7s cubic-bezier(0.16,1,0.3,1) both 0.1s;
  opacity: 0;
}

.page-card-accent, .page-card-bottom { height: 4px; background: linear-gradient(to right, var(--green-dk), var(--green-lt), var(--green-dk)); }

.page-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(transparent 0px, transparent 27px, rgba(180,160,120,0.13) 27px, rgba(180,160,120,0.13) 28px);
  pointer-events: none;
  z-index: 0;
}

.page-card::after {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 3.5rem;
  width: 1px;
  background: rgba(139,26,26,0.18);
  z-index: 1;
}

.page-card-inner { position: relative; z-index: 2; padding: 1.8rem 2rem 1.8rem 4.5rem; }

.page-card-inner img {
  width: 100%;
  display: block;
  border: 1px solid rgba(196,168,112,0.2);
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  filter: contrast(1.05) sepia(0.06);
  transition: filter 0.3s;
}

.page-card-inner img:hover { filter: contrast(1.08) sepia(0); }

/* ── PAGE NAV (shared by page## files) ── */
.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 720px;
  padding: 1.95rem 0; /* matches scale-bar vertical padding above and below */
}

.page-nav-spacer {
  flex: 1;
  height: 2rem; /* matches scale-bar implicit height */
}

.page-nav-btn {
  font-family: 'Special Elite', Georgia, serif;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  color: rgba(196,168,112,0.75);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  padding: 0.38em 0.9em 0.22em;
  background: rgba(90,122,58,0.12);
  border: 1px solid var(--green);
  white-space: nowrap;
  line-height: normal;
  /* Lock to consistent width so prev/next never shift layout */
  min-width: calc(7ch + 7 * 0.3em + 2 * 0.9em + 2px);
  text-indent: 0.15em;
}

.page-nav-btn:hover {
  color: rgba(196,168,112,1);
  border-color: var(--green-lt);
}

/* Disabled / boundary state — mirrors topbar-invert-toggle.active */
.page-nav-btn.na {
  color: rgba(196,168,112,0.2) !important;
  border-color: rgba(138,114,80,0.35) !important;
  background: rgba(138,114,80,0.06) !important;
  pointer-events: none;
  cursor: default;
  transition: none !important;
}

/* ── PAGE NAV: DARK (inverted) MODE COLOURS ── */
body.inverted-mode .page-nav-btn {
  color: rgba(196,168,112,0.45);
  border-color: var(--green-dk);
  background: rgba(138,114,80,0.10);
}

body.inverted-mode .page-nav-btn:hover {
  color: rgba(196,168,112,0.65);
  border-color: var(--green);
  background: rgba(138,114,80,0.18);
}

/* Disabled state in dark mode — softer amber fade */
body.inverted-mode .page-nav-btn.na {
  color: rgba(196,168,112,0.2) !important;
  border-color: rgba(138,114,80,0.35) !important;
  background: rgba(138,114,80,0.06) !important;
}

.page-nav-btn::before, .page-nav-btn::after { display: none; }
.page-nav-btn.prev::before { content: '←'; display: inline; font-size: 1em; line-height: 1; }
.page-nav-btn.next::after  { content: '→'; display: inline; font-size: 1em; line-height: 1; }

.page-nav-centre { color: var(--sepia); cursor: default; padding-top: 0.16em; }
body.inverted-mode .page-nav-centre { color: rgba(196,168,112,0.45); }

/* ── COMMENTS (hidden until enabled) ── */


/* ── SCALE BAR ── */
.scale-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.95rem 2rem;
  width: 100%;
  max-width: 720px;
}

.scale-bar-label,
.scale-bar-value {
  font-size: 0.70rem;
  letter-spacing: 0.35em;
  color: rgba(196,168,112,0.5);
  flex-shrink: 0;
  white-space: nowrap;
  min-width: 2.5rem;
}

.scale-bar-value { text-align: right; }

.scale-bar-input {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 2px;
  background: rgba(90,122,58,0.25);
  border-radius: 0;
  outline: none;
  cursor: pointer;
}

.scale-bar-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  background: var(--green-lt);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.scale-bar-input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: var(--green-lt);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.scale-bar-input:hover::-webkit-slider-thumb { background: var(--green); transform: scale(1.3); }
.scale-bar-input:hover::-moz-range-thumb { background: var(--green); transform: scale(1.3); }

/* ── INVERTED STATE ── */
/* All inversion changes are instant — no transitions. filter and box-shadow
   must land in the same paint frame so the counter-inversion never flickers.
   The .no-invert-transition guard is a JS-applied safeguard for page load. */
.page-card, .issue, .note, .char-card, .short,
.page-card-accent, .page-card-bottom,
.issue-accent, .issue-bottom,
.note-accent, .note-bottom,
.char-accent, .char-bottom {
  transition: none;
}

/* Apply filter to card background and content, but exclude green accent bars */
.page-card.inverted {
  background: #ede4cc54;
  filter: invert(100%) saturate(40%) hue-rotate(170deg);
  box-shadow: 0 4px 24px rgba(255,255,255,0.45), 0 12px 40px rgba(255,255,255,0.3);
}

/* Counter-invert green bars - need to counter ALL filters */
.page-card.inverted .page-card-accent,
.page-card.inverted .page-card-bottom {
  filter: invert(100%) saturate(250%) hue-rotate(190deg);
}

/* Counter-invert image shadows */
.page-card.inverted .page-card-inner img {
  box-shadow: 0 2px 10px rgba(255,255,255,0.12);
}

.issue.inverted {
  background: #ede4cc54;
  filter: invert(100%) saturate(40%) hue-rotate(160deg);
  box-shadow: 0 4px 24px rgba(255,255,255,0.45), 0 12px 40px rgba(255,255,255,0.3);
}

/* Counter-invert green bars - need to counter ALL filters */
.issue.inverted .issue-accent,
.issue.inverted .issue-bottom {
  filter: invert(100%) saturate(250%) hue-rotate(190deg);
}

/* Counter-invert image shadow */
.issue.inverted .issue-page img {
  box-shadow: 0 2px 10px rgba(255,255,255,0.12);
}

.note.inverted {
  background: #ede4cc54;
  filter: invert(100%) saturate(40%) hue-rotate(170deg);
  box-shadow: 0 4px 24px rgba(255,255,255,0.45), 0 12px 40px rgba(255,255,255,0.3);
}

/* Counter-invert green bars - need to counter ALL filters */
.note.inverted .note-accent,
.note.inverted .note-bottom {
  filter: invert(100%) saturate(250%) hue-rotate(190deg);
}

.char-card.inverted {
  background: #ede4cc54;
  filter: invert(100%) saturate(40%) hue-rotate(170deg);
  box-shadow: 0 4px 24px rgba(255,255,255,0.45), 0 12px 40px rgba(255,255,255,0.3);
}

/* Counter-invert green bars - need to counter ALL filters */
.char-card.inverted .char-accent,
.char-card.inverted .char-bottom {
  filter: invert(100%) saturate(250%) hue-rotate(190deg);
}

/* ── ANIMATIONS ── */
@keyframes riseIn  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* ── RESPONSIVE ── */
@media (max-width: 960px) {
  .topbar { padding: 0 1.5rem; }
  .topbar-brand, .topbar-right { font-size: 0.58rem; letter-spacing: 0.3em; }
  .footbar { padding-inline: 2.5rem; }
  .footnote-inner { padding-inline: 1.5rem; }
}

/* Two-row topbar — brand + right side by side on top, nav below */
@media (max-width: 700px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    height: auto;
    padding: 0.5rem 1.25rem;
    gap: 0.35rem 0;
  }

  .topbar-brand {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.55rem;
    letter-spacing: 0.25em;
  }

  .topbar-right {
    grid-column: 2;
    grid-row: 1;
    font-size: 0.55rem;
    letter-spacing: 0.25em;
  }

  .topbar-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    position: static;
    transform: none;
    gap: 1.5rem;
    justify-content: center;
  }

  .topbar-nav a { font-size: 0.62rem; letter-spacing: 0.2em; }
}

@media (max-width: 850px) {
  .scale-bar { display: none; }
  .footbar { padding-inline: 1.5rem; height: 44px; }
  .footbar-text { font-size: 0.65rem; letter-spacing: 0.2em; }
  .footnote-inner { padding-inline: 1.25rem; height: auto; min-height: 34px; padding-block: 0.4rem; flex-wrap: wrap; gap: 0.5rem; }
  .footnote-text { font-size: 0.55rem; line-height: 1.5; }
  main { padding-inline: 1rem; }
  .page-card-inner { padding: 1.25rem; }
  .page-card::after { display: none; }
  .footbar-dot::before, .footbar-dot::after { display: none; }
}

@media (max-width: 380px) {
  .topbar-brand, .topbar-right { font-size: 0; letter-spacing: 0; }
  .topbar-brand::before, .topbar-right::after { font-size: 0.7rem; }
  .topbar-nav { gap: 1rem; }
}