@font-face {
  font-family: "Archive Myeongjo";
  src: url("assets/fonts/archive-korean.woff2?v=atlas") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Archive Garamond";
  src: url("assets/fonts/archive-garamond.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --night: #111420;
  --ink: #1b2030;
  --leaf: #242a3c;
  --paper: #f3eff6;
  --silver: #c1c5d4;
  --muted: #a3a9bd;
  --iris: #d0bee8;
  --brass: #d8c596;
  --rule: #414659;
  --faint-rule: #323849;
  --serif: "Archive Myeongjo", "Noto Serif KR", "Batang", Georgia, serif;
  --display: "Archive Garamond", "Archive Myeongjo", Georgia, serif;
  --gutter: clamp(1rem, 4.3vw, 4.75rem);
  --width: 85rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font: 400 1rem/1.85 var(--serif);
  overflow-wrap: anywhere;
  word-break: keep-all;
  -webkit-text-size-adjust: 100%;
}
body.intro-open, body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; max-width: 100%; }
h1, h2, h3, p, dl, dd, ol { margin: 0; }
::selection { background: #625779; color: #fff; }
:focus-visible { outline: 3px solid #f4dfa4; outline-offset: 4px; }
main:focus { outline: 0; }

.site-header, .hero, .shell, .page-footer {
  width: min(var(--width), calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
}
.site-header {
  min-height: 5.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
}
.brand { display: inline-flex; align-items: center; gap: .9rem; width: fit-content; }
.brand-sigil {
  display: grid;
  width: 2.6rem;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid #938565;
  border-radius: 50%;
  color: var(--brass);
  font: 1.65rem/1 var(--display);
  box-shadow: inset 0 0 0 4px var(--night), inset 0 0 0 5px #514c45;
}
.brand-name { font: 500 1.85rem/.95 var(--display); letter-spacing: .08em; }
.brand-name small {
  display: block;
  margin-top: .34rem;
  color: var(--muted);
  font: 600 .75rem/1.1 var(--display);
  letter-spacing: .1em;
}
.top-nav { display: flex; align-items: center; gap: clamp(1.35rem, 2.6vw, 3rem); }
.top-nav a { padding: .65rem 0; color: var(--silver); font-size: .94rem; white-space: nowrap; }
.top-nav a:hover, .top-nav a[aria-current] { color: var(--brass); }
.header-end {
  justify-self: end;
  color: var(--brass);
  font: 600 .95rem/1.3 var(--display);
  letter-spacing: .09em;
  white-space: nowrap;
}
.header-end::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  margin: 0 .7rem .26em 0;
  display: inline-block;
  background: #797257;
}

/* The first spread. The illustration forms the entire facing leaf. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, .98fr) minmax(0, 1.02fr);
  position: relative;
  isolation: isolate;
  min-height: clamp(28rem, 38vw, 36rem);
  margin-top: .5rem;
  border: 1px solid #666071;
  border-radius: 4px 9px 7px 3px;
  background: var(--ink);
  box-shadow: 0 2px 0 #212537, 0 3px 0 #79707a, 0 6px 0 #272b3b,
              0 7px 0 #504958, 0 18px 38px -20px #000c;
}
.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  min-width: 0;
  padding: clamp(2.3rem, 3.7vw, 4.6rem) clamp(2rem, 4.25vw, 4.8rem);
  background: linear-gradient(90deg, #272b40, #232a3d 22%, #1e2537 91%, #171c2a);
  border-radius: 3px 0 0 3px;
}
.hero-copy::before {
  content: "";
  position: absolute;
  inset: .7rem auto .7rem .7rem;
  border-left: 1px solid #8d819145;
}
.hero-copy::after {
  content: "";
  position: absolute;
  top: -1px;
  right: clamp(1.4rem, 3.1vw, 3.5rem);
  width: 1.2rem;
  height: clamp(2.25rem, 4vw, 3.6rem);
  background: linear-gradient(90deg, #7b668f, #b8a3ca 19%, #8a759e 32%, #a08bb4 89%, #6e5c84);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}
.eyebrow, .section-kicker, .modal-eyebrow {
  color: var(--brass);
  font: 600 .84rem/1.5 var(--display);
  letter-spacing: .12em;
}
.hero h1 {
  margin: clamp(1rem, 2.1vw, 2rem) 0 1.1rem;
  font-size: clamp(3rem, 5.4vw, 5.6rem);
  font-weight: 500;
  line-height: 1.19;
  letter-spacing: -.075em;
}
.hero h1 em { font-style: normal; font-weight: inherit; color: inherit; }
.lead { color: var(--silver); font-size: clamp(1rem, 1.21vw, 1.18rem); line-height: 1.92; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem 1.4rem; margin-top: 1.7rem; }
.btn-primary, .btn-plain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  font-size: .94rem;
  font-weight: 600;
}
.btn-primary { padding: .56rem 1.25rem; color: #221e30; border: 1px solid #e3d6ee; border-radius: 3px; background: #ddcfe9; }
.btn-primary:hover { background: #f0e4f8; }
.btn-plain { color: var(--paper); text-decoration: underline; text-underline-offset: .35em; text-decoration-color: #8c849e; }
.btn-plain:hover { text-decoration-color: var(--paper); }
.hero-actions a > span, .profile-invite button > span { display: none; }
.hero-footnote {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  margin-top: clamp(1.8rem, 3.4vw, 3.7rem);
  color: var(--muted);
  font: 600 .77rem/1.35 var(--display);
  letter-spacing: .06em;
}
.hero-footnote::before { content: ""; width: 1.6rem; height: 1px; flex: none; background: #827c8a; }
.hero-footnote::after { content: "ARCHIVE / 001"; margin-left: auto; font-variant-numeric: lining-nums; white-space: nowrap; }
.hero-art { display: grid; min-width: 0; }
.portrait-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  height: 100%;
  padding: clamp(1.6rem, 2.9vw, 3rem);
  border: 0;
  border-radius: 0 8px 6px 0;
  background: #332c45;
  text-align: left;
}
.portrait-card:focus-visible { outline-offset: -6px; }
.portrait-image, .modal-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% 35%;
}
.portrait-image { z-index: -3; }
.portrait-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: .65rem;
  border: 1px solid #f4e1c65c;
  pointer-events: none;
}
.portrait-card::after {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background: linear-gradient(90deg, #14142385, transparent 8%),
              linear-gradient(0deg, #131522f5, #141222a3 14%, transparent 39%);
  pointer-events: none;
}
.portrait-label { color: #fff7fd; }
.portrait-label small, .visual-caption small { display: block; color: #f2dbab; font: 600 .8rem/1.4 var(--display); letter-spacing: .13em; }
.portrait-label strong { display: block; margin-top: .25rem; font-size: clamp(1.9rem, 3vw, 3.1rem); font-weight: 500; line-height: 1.25; }
.portrait-hint { border-bottom: 1px solid #dbd0d4a3; color: #f4eaf3; font-size: .84rem; padding-bottom: .14rem; }
.portrait-card:hover .portrait-hint { border-color: #fff; }
.portrait-missing, .modal-image-fallback {
  position: absolute;
  inset: 0;
  z-index: -3;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #363248;
  color: var(--iris);
  text-align: center;
}
.portrait-missing b, .modal-image-fallback b { font: 4rem/1.2 var(--display); }
img.is-missing { opacity: 0; }
img.is-missing + .portrait-missing, img.is-missing + .modal-image-fallback { display: flex; }

/* The index stays with the reader once the frontispiece scrolls away. */
.shell {
  display: grid;
  grid-template-columns: clamp(10rem, 15.5vw, 14.7rem) minmax(0, 1fr);
  gap: clamp(2.7rem, 5.7vw, 6.25rem);
  align-items: start;
  margin-top: clamp(3.8rem, 6.2vw, 7.1rem);
}
.rail { position: sticky; top: 1.8rem; min-width: 0; }
.rail-inner { border-top: 1px solid var(--brass); }
.rail-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: 3.3rem;
  color: var(--brass);
  font: 600 .86rem/1.5 var(--display);
  letter-spacing: .07em;
  cursor: pointer;
}
.rail-caption::marker { content: ""; }
.rail-caption::-webkit-details-marker { display: none; }
.rail-caption::after {
  content: "";
  width: .48rem;
  height: .48rem;
  margin-right: .3rem;
  border-right: 1px solid;
  border-bottom: 1px solid;
  transform: rotate(45deg);
}
.rail-inner[open] > .rail-caption::after { transform: rotate(225deg); }
.rail-links { display: grid; }
.rail-link {
  display: flex;
  align-items: baseline;
  gap: .78rem;
  min-height: 2.82rem;
  padding: .53rem .56rem;
  border-left: 2px solid transparent;
  color: var(--silver);
  font-size: .95rem;
}
.rail-link span { color: var(--muted); font: 500 .9rem/1.4 var(--display); font-variant-numeric: lining-nums; }
.rail-link:hover { color: var(--paper); background: #202536; }
.rail-link[aria-current] { background: #28283b; border-left-color: var(--iris); color: #f6eefa; }
.rail-link[aria-current] span { color: var(--iris); }
.rail-children {
  display: grid;
  margin: 0 0 .35rem 1.32rem;
  border-left: 1px solid var(--rule);
}
.rail-sub {
  min-height: 2.15rem;
  padding: .28rem .7rem;
  color: var(--muted);
  font-size: .89rem;
}
.rail-group:has(.rail-sub[aria-current]) > .rail-link { color: var(--iris); }
.rail-btm {
  margin-top: 1.5rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--faint-rule);
  color: var(--muted);
  font: 600 .75rem/1.5 var(--display);
  letter-spacing: .055em;
}
.rail-btm svg { display: block; margin: 0 0 .65rem -.35rem; }
.archive-pages { min-width: 0; }
.section { padding-bottom: clamp(3.4rem, 5.6vw, 5.5rem); }
.section + .section { padding-top: clamp(2.2rem, 3.2vw, 3.4rem); border-top: 1px solid var(--rule); }
.section-header { display: flex; align-items: start; justify-content: space-between; gap: 1.3rem; }
.section-title, .profile-invite h2, .modal-title {
  font-size: clamp(2rem, 3.1vw, 3.25rem);
  font-weight: 500;
  line-height: 1.38;
  letter-spacing: -.065em;
  text-wrap: balance;
}
.section-title { margin-top: .46rem; }
.section-aside, .art-coord, .art-label, .modal-footer-note {
  color: var(--muted);
  font: 600 .8rem/1.4 var(--display);
  letter-spacing: .075em;
}
.section-aside { flex: none; margin-top: .16rem; white-space: nowrap; }
.section-intro {
  max-width: 49rem;
  margin-top: 1rem;
  color: var(--silver);
  font-size: clamp(1rem, 1.15vw, 1.13rem);
  line-height: 1.95;
}
.lore-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: clamp(1rem, 2.3vw, 2.25rem); margin-top: 2.15rem; }
.lore-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem 0 0;
  border-top: 1px solid #80778d;
}
.number { color: var(--brass); font: 500 1.55rem/1.5 var(--display); }
.symbol { position: absolute; top: 1.08rem; right: .1rem; color: var(--iris); font-size: 1.2rem; }
.lore-card h3, .tower h3 { margin-top: .58rem; font-size: clamp(1.2rem, 1.65vw, 1.55rem); font-weight: 600; line-height: 1.55; letter-spacing: -.045em; }
.lore-card p { margin: .5rem 0 1rem; color: var(--silver); }
.lore-card .en { margin-top: auto; color: var(--muted); font: 600 .77rem/1.5 var(--display); letter-spacing: .055em; }
.quote-band {
  border-left: 2px solid #b19cbf;
  margin-top: 2.3rem;
  padding: 1.35rem clamp(1.15rem, 2.3vw, 2.4rem);
  background: #222335;
}
.quote-band p { color: #eee5f4; font-size: clamp(1.05rem, 1.45vw, 1.3rem); line-height: 1.85; }
.quote-band span { display: block; margin-top: .58rem; color: var(--muted); font-size: .88rem; }

/* Reference leaves keep detailed entries available beside the main narrative. */
.entry-link {
  text-decoration: underline;
  text-decoration-color: #79718c;
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
}
.entry-link:hover { color: var(--brass); text-decoration-color: currentColor; }
.reference-section { margin-top: clamp(2.35rem, 4vw, 3.8rem); }
.reference-title {
  margin-bottom: 1rem;
  font-size: clamp(1.45rem, 2.25vw, 2rem);
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: -.05em;
}
.reference-intro, .reference-body p, .society-spread p { max-width: 48rem; color: var(--silver); }
.reference-entry { border-top: 1px solid var(--rule); }
.reference-entry:last-child { border-bottom: 1px solid var(--rule); }
.reference-entry > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.2rem;
  padding: .75rem .25rem;
  color: var(--paper);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.reference-entry > summary::-webkit-details-marker { display: none; }
.reference-entry > summary::after {
  content: "";
  flex: none;
  width: .55rem;
  height: .55rem;
  margin: -.25rem .35rem 0 0;
  border-right: 1px solid var(--brass);
  border-bottom: 1px solid var(--brass);
  transform: rotate(45deg);
}
.reference-entry[open] > summary::after { margin-top: .25rem; transform: rotate(225deg); }
.reference-entry[open] > summary, .reference-entry > summary:hover { color: var(--brass); }
.reference-body { padding: .15rem .25rem 1.35rem; }
.reference-body p + h4 { margin-top: 1rem; }
.reference-body strong { color: var(--paper); }
.reference-body h4, .society-spread h4 {
  margin: 0 0 .4rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.65;
}
.reference-list { display: grid; }
.reference-list > div {
  display: grid;
  grid-template-columns: minmax(7rem, .43fr) minmax(0, 1.45fr);
  gap: .2rem 1.25rem;
  align-items: baseline;
  padding: .75rem 0;
  border-bottom: 1px solid var(--faint-rule);
}
.reference-list dt, .floor-register dt, .rank-register dt { color: var(--brass); font-weight: 600; }
.reference-list dd, .floor-register dd, .rank-register dd { color: var(--silver); }
.paired-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(1.25rem, 3vw, 2.5rem); }
.paired-list > div { display: block; padding: .5rem 0 .8rem; }
.paired-list dd { margin-top: .18rem; }
.reference-body p + dl { margin-top: .55rem; }
.reference-body dl + h4, .reference-body dl + p, .reference-body ol + p { margin-top: 1rem; }
.circle-register {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 0 1rem;
  padding: 0;
  list-style: none;
}
.circle-register li { display: flex; gap: .5rem; align-items: baseline; padding: .5rem 0; border-bottom: 1px solid var(--faint-rule); }
.circle-register span { flex: none; color: var(--brass); font-size: .94rem; }
.society-spread {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(1.4rem, 3.2vw, 3rem);
  align-items: start;
  padding: .35rem 0 1.65rem;
}
.society-spread p + p { margin-top: .65rem; }
.currency-ledger { padding: 1rem 1.15rem; background: #232636; border-left: 2px solid #95866b; }
.currency-ledger table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; text-align: left; }
.currency-ledger caption { padding-bottom: .45rem; color: var(--brass); font-weight: 600; text-align: left; }
.currency-ledger th, .currency-ledger td { padding: .38rem 0; border-bottom: 1px solid var(--rule); }
.currency-ledger thead th { color: var(--muted); font-size: .9rem; font-weight: 500; }
.currency-ledger th[scope="row"] { font-weight: 500; }
.currency-ledger th + th, .currency-ledger td { text-align: right; }
.currency-ledger p { margin-top: .8rem; line-height: 1.75; }
.tower-notes { margin-top: 1.3rem; }
.forest-register {
  --plate-gap: clamp(1rem, 2.5vw, 2.25rem);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.8rem var(--plate-gap);
  margin: 1.45rem 0 1.85rem;
}
.forest-register figure { min-width: 0; margin: 0; }
.forest-art {
  display: block;
  border: 1px solid var(--rule);
  background: var(--ink);
  cursor: zoom-in;
}
.forest-art:hover, .forest-art:focus-visible { border-color: var(--brass); }
.forest-art img { width: 100%; height: auto; }
.forest-register figcaption { padding-top: .7rem; }
.forest-register h4 { margin: 0 0 .28rem; color: var(--brass); font-size: 1.2rem; font-weight: 600; line-height: 1.55; }
.forest-register p { color: var(--silver); }
@media (min-width: 43.01rem) {
  .forest-register figure:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--plate-gap);
    align-items: center;
    border-top: 1px solid var(--faint-rule);
    padding-top: 1.45rem;
  }
  .forest-register figure:last-child:nth-child(odd) figcaption { padding: 0; }
}
.rank-register, .floor-register { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.45rem; }
.rank-register > div, .floor-register > div {
  display: grid;
  grid-template-columns: 4.25rem minmax(0,1fr);
  gap: .55rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--faint-rule);
}

/* A continuous date column keeps the six entries in reading order. */
.timeline { --year-width: 6.6rem; --year-gap: 2.25rem; position: relative; margin-top: 2rem; }
.timeline::before { content: ""; position: absolute; inset: 1.6rem auto 1.6rem calc(var(--year-width) + .3rem); width: 1px; background: #69647c; }
.time-entry {
  position: relative;
  display: grid;
  grid-template-columns: var(--year-width) minmax(0,1fr);
  gap: .2rem var(--year-gap);
  padding: .9rem 0 1rem;
}
.time-entry::before {
  content: "";
  position: absolute;
  left: calc(var(--year-width) + .09rem);
  top: 1.6rem;
  width: .49rem;
  height: .49rem;
  border: 1px solid #b9a8c9;
  border-radius: 50%;
  background: var(--night);
}
.time-entry :is(time, .era-label) { grid-row: span 2; padding-top: .12rem; color: var(--brass); font: 600 1.05rem/1.75 var(--display); font-variant-numeric: lining-nums; letter-spacing: .025em; }
.time-entry h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.5; letter-spacing: -.035em; }
.time-entry p { color: var(--silver); }
.time-entry.current::before { background: var(--iris); box-shadow: 0 0 0 3px var(--night), 0 0 0 4px #726783; }
.time-entry.current h3 { color: var(--iris); }

.tower-grid {
  display: grid;
  grid-template-columns: minmax(0,.92fr) repeat(2,minmax(0,1fr));
  column-gap: clamp(1rem, 2.1vw, 2rem);
  margin-top: 2rem;
}
.tower { display: grid; grid-template-columns: 2.2rem 1fr; column-gap: .65rem; align-content: center; padding: 1.05rem 0; border-top: 1px solid var(--rule); }
.tower-mark {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font: 1.3rem/1 var(--display);
}
.tower h3 { margin: -.05rem 0 0; font-size: 1.22rem; }
.tower p { margin-top: .28rem; color: var(--silver); font-size: 1rem; line-height: 1.7; }
.tower-place {
  grid-column: 2;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  margin-top: .4rem;
  color: var(--brass);
  font-size: .94rem;
  text-decoration: underline;
  text-decoration-color: #867b61;
  text-underline-offset: .25em;
}
.tower-place:hover { text-decoration-color: currentColor; }
.tower-register > div { padding-inline: .65rem; border-inline-start: 2px solid transparent; scroll-margin-top: .5rem; }
.tower-register > div:target { background: var(--ink); border-inline-start-color: var(--iris); }
.tower-register > div:target dt { color: var(--iris); }
.tower.ink {
  grid-row: span 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: clamp(1.1rem, 2vw, 2.4rem);
  border: 1px solid #64566e;
  background: radial-gradient(ellipse at 15% 12%, #51435d, transparent 65%), #292638;
}
.tower.ink .tower-mark { width: 3.6rem; height: 3.6rem; margin-bottom: auto; font-size: 2.25rem; }
.tower.ink h3 { margin-top: 2.1rem; font-size: 1.7rem; }
.tower.ink::after { content: "TOWER MASTER · IRAEL"; margin-top: 1.25rem; color: #d9c7e3; font: 600 .78rem/1.4 var(--display); letter-spacing: .065em; }
.c-purple { color: #d3b5eb; } .c-white { color: #e9e6e3; } .c-red { color: #e69b97; }
.c-blue { color: #a0c6e6; } .c-green { color: #b6cdaa; } .c-yellow { color: #dbca92; } .c-lilac { color: #c7addb; }
.tower-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem 1.4rem;
  margin-top: 1.5rem;
  padding: 1rem 0;
  border-block: 1px solid var(--rule);
  color: var(--silver);
}
.tower-footer strong { color: var(--brass); }
.tower-footer span:last-child { color: var(--muted); font: 600 .82rem/1.5 var(--display); letter-spacing: .06em; }

.blacktower-layout { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.16fr); gap: clamp(1.4rem, 2.7vw, 3rem); margin-top: 2rem; }
.tower-art {
  position: relative;
  display: grid;
  min-height: 24rem;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background-color: #23243a;
  background-image: linear-gradient(#cfbfdb0b 1px, transparent 1px),
                    linear-gradient(90deg, #cfbfdb0b 1px, transparent 1px),
                    radial-gradient(ellipse at 50% 50%, #54425e, #252739 74%);
  background-size: 1.4rem 1.4rem, 1.4rem 1.4rem, 100% 100%;
  border: 1px solid #5b5668;
}
.tower-art::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 75%;
  aspect-ratio: 1;
  border: 1px solid #cbbcc559;
  border-radius: 50%;
  box-shadow: 0 0 0 1.6rem #cbbcc50a;
}
.tower-illustration { position: relative; width: 175px; height: 295px; filter: drop-shadow(0 16px 21px #0d101ac2); }
.tower-illustration .spire {
  position: absolute;
  bottom: 0; left: 25px;
  width: 126px; height: 238px;
  background: linear-gradient(90deg, #241c26, #544158 52%, #1a161e);
  clip-path: polygon(48% 0, 53% 0, 57% 13%, 70% 22%, 73% 100%, 24% 100%, 27% 22%, 43% 13%);
  border-bottom: 3px solid #a98bb4;
}
.tower-illustration .roof {
  position: absolute;
  inset: 7px 0 auto;
  height: 89px;
  background: linear-gradient(105deg, #5b4865, #2f273b 66%);
  clip-path: polygon(50% 0, 88% 100%, 12% 100%);
}
.tower-illustration .window {
  position: absolute;
  left: 76px; top: 106px;
  width: 23px; height: 55px;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(#e1c8f1, #896ba0);
  box-shadow: 0 0 28px #a67bc4, 0 83px 0 -5px #9878b0, 0 143px 0 -5px #9878b0;
}
.tower-illustration .base {
  position: absolute;
  bottom: 0; left: 0;
  width: 175px; height: 47px;
  background: #312838;
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
}
.art-coord, .art-label { position: absolute; inset-inline: 1.1rem; color: #c9bbcf; }
.art-coord { top: 1rem; text-align: right; }
.art-label { bottom: 1rem; }
.blacktower-copy h3 { font-size: clamp(1.35rem, 2.05vw, 2rem); font-weight: 500; line-height: 1.55; letter-spacing: -.05em; margin: .45rem 0 .9rem; }
.blacktower-copy > p { color: var(--silver); margin-top: .62rem; }
.facts { margin-top: 1.35rem; border-top: 1px solid var(--rule); }
.fact { display: grid; grid-template-columns: 4.75rem minmax(0,1fr); gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--faint-rule); }
.fact dt, .bio-line dt { color: var(--brass); }
.fact dd, .bio-line dd { color: var(--silver); }
.floor-title { margin: 2.15rem 0 .75rem; font-size: 1.18rem; font-weight: 600; }
.floor-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-block: 1px solid var(--rule); }
.floor { padding: .85rem clamp(.7rem,1.35vw,1.4rem); }
.floor + .floor { border-left: 1px solid var(--faint-rule); }
.floor strong { color: var(--brass); font: 500 1.68rem/1.2 var(--display); }
.floor p { margin-top: .3rem; font-size: .94rem; color: var(--silver); }
.floor.featured { background: #2a293c; }

.profile-invite {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(2.15rem, 3.7vw, 3.8rem);
  border: 1px solid #595467;
  background: #242538;
}
.profile-invite::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 35%;
  background: linear-gradient(90deg, #242538, #242538bf 17%, #24253828 63%),
              url("assets/irael-profile.webp") center 36% / cover;
}
.profile-invite h2 { margin: .8rem 0; max-width: 67%; font-size: clamp(1.8rem, 2.65vw, 2.7rem); }
.profile-invite p { max-width: min(54%, 26rem); color: #d6d4df; }
.profile-invite button { margin-top: 1.35rem; }
.page-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .55rem 1rem;
  border-top: 1px solid var(--rule);
  margin-top: clamp(3.5rem, 6.4vw, 7rem);
  padding-block: 1.65rem 2rem;
  color: var(--muted);
  font-size: .88rem;
}
.page-footer strong { color: var(--brass); font: 500 1.2rem/1.4 var(--display); letter-spacing: .045em; }

/* Native dialog keeps the open dossier and its tab controls in focus. */
.modal-layer {
  --dossier-height: min(47rem, calc(100vh - 3rem));
  --dossier-height: min(47rem, calc(100dvh - 3rem));
  position: fixed;
  inset: 0;
  width: min(68rem, calc(100% - 3rem));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: visible;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid #877a90;
  box-shadow: 0 24px 85px #080b15b8;
}
.modal-layer::backdrop { background: #090b16cb; backdrop-filter: blur(5px); }
.modal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,.84fr) minmax(0,1.16fr);
  grid-template-rows: minmax(0,1fr);
  height: var(--dossier-height);
}
.modal-close {
  position: absolute;
  z-index: 3;
  top: .85rem; right: .85rem;
  display: grid;
  place-items: center;
  width: 2.8rem; height: 2.8rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #8a8096;
  background: #252633;
  font: 400 1.65rem/1 var(--display);
  color: var(--paper);
}
.modal-close:hover { background: #3f3a50; }
.modal-visual {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  align-items: end;
  min-height: 0;
  background: #393249;
}
.modal-visual img { z-index: -3; object-position: 51% 32%; }
.modal-visual::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(0deg, #161724f2 0%, #17172483 20%, transparent 53%);
}
.visual-caption { padding: clamp(1.5rem, 2.8vw, 3rem); }
.visual-caption h2 { margin: .35rem 0; font-size: clamp(2rem,3.5vw,3.25rem); font-weight: 500; line-height: 1.3; letter-spacing: -.05em; }
.visual-caption p { color: #e1dae6; font-size: .97rem; }
.modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(2rem, 3.3vw, 3.4rem);
  scrollbar-color: #756e82 var(--ink);
}
.modal-eyebrow { padding-right: 2rem; }
.modal-title { margin: .6rem 0 1.1rem; font-size: clamp(1.75rem, 2.65vw, 2.6rem); }
.tab-row { display: flex; align-items: stretch; flex-wrap: wrap; gap: .1rem 1.1rem; border-bottom: 1px solid var(--rule); }
.tab {
  min-height: 2.85rem;
  padding: .3rem .05rem .55rem;
  color: var(--silver);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: .94rem;
  white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--brass); border-bottom-color: var(--brass); }
.tab:hover { color: var(--paper); }
.tab-panel { margin-top: 1.35rem; }
.tab-panel p { color: var(--silver); }
.tab-panel h3 { margin: 1.35rem 0 .43rem; font-size: 1.21rem; font-weight: 600; line-height: 1.55; }
.tab-panel > :first-child { margin-top: 0; }
.bio-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 1.15rem; margin-top: 1.25rem; }
.bio-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .55rem; padding: .55rem 0; border-bottom: 1px solid var(--faint-rule); font-size: .95rem; }
.bio-line dt { min-width: 2.6rem; }
.soft-quote { margin-top: 1.3rem; padding: .95rem 1.1rem; border-left: 2px solid var(--iris); background: #2a293c; color: #ece1f0; }
.record-list { margin: 1rem 0; padding: 0; list-style: none; }
.record-list li { display: grid; grid-template-columns: 3.2rem minmax(0,1fr); gap: .75rem; padding: .62rem 0; border-bottom: 1px solid var(--faint-rule); color: var(--silver); }
.record-list b { color: var(--brass); font: 600 1.12rem/1.65 var(--display); font-variant-numeric: lining-nums; }
.magic-item { padding: 1rem 0; border-bottom: 1px solid var(--faint-rule); }
.magic-item strong { display: block; font-size: 1.1rem; font-weight: 600; }
.magic-item em { display: inline-block; color: var(--brass); font: 500 1.06rem/1.45 var(--display); }
.magic-item p { margin-top: .24rem; }
.modal-footer-note { margin-top: 1.65rem; }

/* A single entrance sequence. Chapters remain visible at every scroll position. */
.entrance {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
}
.entrance-light { position: absolute; inset: 0; z-index: -2; background: #131522; }
.door {
  position: absolute;
  z-index: -1;
  inset-block: 0;
  width: 50.15%;
  overflow: hidden;
  border: 1px solid #91837c;
  background: repeating-linear-gradient(90deg, #a294a408 0 1px, transparent 1px 4px), #26283b;
  box-shadow: inset 0 0 0 .5rem #242537, inset 0 0 0 calc(.5rem + 1px) #655a65;
}
.door::before {
  content: "";
  position: absolute;
  inset: clamp(1rem,3.1vw,3.5rem);
  border: 1px solid #8e7c796e;
  border-radius: 45% 45% 2px 2px / 12% 12% 2px 2px;
}
.door.left { left: 0; }
.door.right { right: 0; }
.door-handle { position: absolute; top: 52%; width: .35rem; height: 3rem; border-radius: 1rem; background: #ac9879; }
.door.left .door-handle { right: 1.15rem; }
.door.right .door-handle { left: 1.15rem; }
.entrance-center { text-align: center; padding: 1.5rem 2.3rem; background: #242538f2; border-block: 1px solid #96837082; }
.entry-seal { color: var(--brass); font: 2rem/1.1 var(--display); }
.entrance-center h2 { font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 500; letter-spacing: -.065em; margin: .55rem 0 0; line-height: 1.35; }
.entrance-center p { color: var(--brass); font: 600 .84rem/1.5 var(--display); letter-spacing: .14em; margin: .45rem 0 .8rem; }
.entry-button { min-height: 2.75rem; padding: .4rem .85rem; border: 1px solid #a49480; background: transparent; color: var(--paper); font-size: .94rem; }
.entrance.is-opening { pointer-events: none; }
.entrance.is-opening .door.left { transform: translateX(-101%); }
.entrance.is-opening .door.right { transform: translateX(101%); }
.entrance.is-opening .entrance-center, .entrance.is-opening .entrance-light { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .door { transition: transform .72s cubic-bezier(.57,.11,.21,1); }
  .entrance-center { transition: opacity .23s ease-out; }
  .entrance-light { transition: opacity .55s ease-out; }
  .btn-primary, .rail-link, .top-nav a { transition: background-color .16s, color .16s; }
}

@media (min-width: 77rem) {
  .time-entry { grid-template-columns: var(--year-width) minmax(8.5rem,.66fr) minmax(0,1.5fr); }
  .time-entry :is(time, .era-label) { grid-row: auto; }
  .time-entry p { align-self: center; }
}

@media (max-width: 64rem) {
  .site-header { min-height: 5rem; gap: 1rem; }
  .hero { grid-template-columns: minmax(0,1fr) minmax(0,.96fr); min-height: 26rem; }
  .hero-copy { padding: 2.25rem 1.9rem; }
  .hero-footnote { align-items: start; flex-wrap: wrap; row-gap: .35rem; }
  .hero-footnote::before { display: none; }
  .portrait-card { grid-template-columns: 1fr; align-content: end; gap: .7rem; }
  .portrait-hint { justify-self: start; }
  .shell { grid-template-columns: 10rem minmax(0,1fr); column-gap: 2.3rem; }
  .section-aside { font-size: .75rem; }
  .blacktower-layout { grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 1.35rem; }
}

@media (min-width: 54.01rem) {
  .rail-inner[open] { max-height: calc(100dvh - 3.5rem); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
}

@media (max-width: 54rem) {
  html { scroll-padding-top: 4.15rem; }
  .shell { display: block; margin-top: 2.5rem; }
  .rail { z-index: 5; top: 0; margin: 0 0 2rem; }
  .rail-inner { background: #1b2030; border: 1px solid var(--rule); border-top-color: #928675; }
  .rail-inner[open] { max-height: 80vh; max-height: 80dvh; overflow-y: auto; box-shadow: 0 12px 28px -18px #000; }
  .rail-caption { min-height: 3rem; padding: .55rem 1rem; }
  .rail-links { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .1rem .5rem; padding: 0 .45rem .4rem; }
  .rail-children { margin-left: .85rem; }
  .rail-btm { margin: 0 .9rem; padding: .6rem 0; font-size: .75rem; line-height: 1.35; }
  .rail-btm svg { float: left; margin: 0 .5rem 0 -.2rem; width: 2.85rem; height: 2.85rem; }
  .section-header { gap: .9rem; }
  .profile-invite { padding: 2rem; }
}

@media (max-width: 43rem) {
  .society-spread, .paired-list, .rank-register, .forest-register { grid-template-columns: 1fr; }
  .circle-register { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .society-spread { gap: 1rem; }
  :root { --gutter: clamp(.85rem, 3.8vw, 1.4rem); }
  .site-header { grid-template-columns: minmax(0,1fr) auto; gap: .45rem .75rem; padding-block: .9rem .55rem; }
  .brand-sigil { width: 2.18rem; font-size: 1.4rem; }
  .brand { gap: .65rem; }
  .brand-name { font-size: 1.58rem; }
  .brand-name small { margin-top: .22rem; }
  .header-end { grid-row: 1; grid-column: 2; }
  .header-end::before { width: 1rem; }
  .top-nav { grid-row: 2; grid-column: 1 / -1; gap: 1.15rem; justify-content: space-between; border-top: 1px solid var(--faint-rule); margin-top: .32rem; }
  .top-nav a { font-size: .9rem; padding: .48rem 0 .1rem; }
  .hero { grid-template-columns: 1fr; margin-top: .3rem; }
  .hero-copy { padding: clamp(1.65rem,6.2vw,2.45rem); border-radius: 3px 7px 0 0; }
  .hero-copy::after { height: 2.48rem; width: 1rem; right: 1.25rem; }
  .eyebrow { max-width: calc(100% - 1.3rem); }
  .hero h1 { font-size: clamp(2.95rem,11vw,4.3rem); margin: .68rem 0 .73rem; line-height: 1.13; }
  .lead { font-size: 1rem; line-height: 1.8; }
  .hero-actions { margin-top: 1rem; gap: .4rem 1.1rem; }
  .hero-footnote { margin-top: 1.35rem; }
  .hero-art { aspect-ratio: 1.54; }
  .portrait-card { grid-template-columns: minmax(0,1fr) auto; align-content: end; align-items: end; gap: .5rem; border-radius: 0 0 6px 2px; padding: 1.25rem; }
  .portrait-image { object-position: 52% 37%; }
  .portrait-label small { font-size: .75rem; }
  .portrait-label strong { font-size: 1.85rem; }
  .portrait-hint { font-size: .8rem; }
  .shell { margin-top: 1.6rem; }
  .rail { margin-bottom: 1.65rem; }
  .section-title { font-size: clamp(1.8rem,6.2vw,2.35rem); }
  .section-header { display: block; }
  .section-aside { display: block; margin-top: .47rem; }
  .lore-grid { margin-top: 1.4rem; }
  .blacktower-layout { grid-template-columns: 1fr; }
  .tower-art { min-height: 21.5rem; }
  .tower-illustration { transform: scale(.86); }
  .tower-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 1.05rem; }
  .tower.ink { grid-column: 1 / -1; grid-row: auto; display: grid; grid-template-columns: 3.7rem minmax(0,1fr); gap: .25rem 1rem; margin-bottom: 1rem; padding: 1.1rem 1.2rem; }
  .tower.ink .tower-mark { align-self: center; grid-row: span 3; }
  .tower.ink h3 { margin: 0; font-size: 1.35rem; }
  .tower.ink p { margin: 0; }
  .tower.ink::after { grid-column: 2; margin: .25rem 0 0; }
  .floor-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .floor:nth-child(3) { border-left: 0; }
  .floor:nth-child(n+3) { border-top: 1px solid var(--faint-rule); }
  .profile-invite { padding: 0 1.35rem 1.65rem; }
  .profile-invite::before {
    position: relative;
    display: block;
    inset: auto;
    width: calc(100% + 2.7rem);
    height: clamp(8rem,33vw,13rem);
    margin: 0 -1.35rem 1.25rem;
    background: linear-gradient(0deg, #242538 0%, transparent 28%), url("assets/irael-profile.webp") center 31% / cover;
  }
  .profile-invite h2, .profile-invite p { max-width: 100%; }
  .modal-layer {
    --dossier-height: min(49rem, calc(100vh - 1.1rem));
    --dossier-height: min(49rem, calc(100dvh - 1.1rem));
    width: calc(100% - 1.1rem);
  }
  .modal { grid-template-columns: 1fr; grid-template-rows: clamp(6rem,22vh,11rem) minmax(0,1fr); }
  .modal-close { top: .55rem; right: .55rem; }
  .modal-visual img { object-position: center 34%; }
  .modal-visual::after { background: linear-gradient(90deg, #161724d9, #1717245e 45%, transparent 76%); }
  .visual-caption { padding: .9rem 1.15rem; }
  .visual-caption h2 { font-size: 1.55rem; margin: .1rem 0; }
  .visual-caption p { font-size: .86rem; }
  .modal-body { padding: 1.2rem; }
  .modal-title { margin: .35rem 0 .65rem; }
  .tab-row { gap: 0 .85rem; }
  .tab { font-size: .9rem; }
}
@media (max-width: 34rem) {
  .reference-list > div { display: block; }
  .reference-list dd { margin-top: .22rem; }
  .floor-register { grid-template-columns: 1fr; }
  .lore-grid { grid-template-columns: 1fr; gap: 1.1rem; }
  .lore-card { display: grid; grid-template-columns: 2.45rem minmax(0,1fr) 1.35rem; column-gap: .5rem; align-items: baseline; padding-top: .8rem; }
  .lore-card .number { grid-column: 1; grid-row: 1; }
  .lore-card .symbol { display: block; position: static; grid-column: 3; grid-row: 1; }
  .lore-card h3 { grid-column: 2; grid-row: 1; margin: 0; }
  .lore-card p, .lore-card .en { grid-column: 2 / -1; }
  .lore-card p { margin: .35rem 0 .55rem; }
  .timeline { --year-width: 4.8rem; --year-gap: 1.45rem; }
  .time-entry :is(time, .era-label) { font-size: .91rem; }
  .tower { grid-template-columns: 1fr; }
  .tower:not(.ink) .tower-mark { grid-row: auto; margin-bottom: .55rem; }
  .tower:not(.ink) .tower-place { grid-column: 1; }
  .bio-grid { column-gap: .6rem; }
}
@media (max-width: 23rem) {
  .hero-copy { padding: 1.3rem; }
  .hero-actions { gap: .2rem .88rem; }
  .hero-actions .btn-primary { padding-inline: .85rem; }
  .portrait-card { grid-template-columns: 1fr; gap: .35rem; }
  .portrait-hint { justify-self: start; }
  .tab-row { gap: 0 .55rem; }
  .modal-body { padding: 1rem; }
}
@media (max-height: 31rem) and (max-width: 43rem) {
  .modal { grid-template-rows: 5.2rem minmax(0,1fr); }
  .visual-caption { padding-block: .4rem; }
}
