:root {
    --color-bg-abyss: #08090b;
    --color-bg-card: #0d0f12;
    --color-ivy-green: #091b13;
    --color-oxblood: #4a0e17;
    --color-gold: #c5a059;
    --color-gold-bright: #dfbd76;
    --color-gold-muted: rgba(197, 160, 89, 0.35);
    --color-parchment: #e5dfc5;
    --color-marble: #8c877d;
    --color-void: #020304;
    --font-epigraph: "Cinzel Decorative", "Cinzel", serif;
    --font-academic: "EB Garamond", Georgia, serif;
    --font-agent: "JetBrains Mono", monospace;
    --gh-font-heading: var(--font-epigraph);
    --gh-font-body: var(--font-academic);
    --content-width: 1180px;
}

* { box-sizing: border-box; }

html { background: var(--color-void); scroll-behavior: smooth; }

body {
    min-height: 100vh;
    margin: 0;
    background-color: var(--color-bg-abyss);
    background-image:
        radial-gradient(circle at 50% -10%, rgba(9, 27, 19, 0.78), transparent 52%),
        linear-gradient(rgba(8, 9, 11, 0.965), rgba(8, 9, 11, 0.965)),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.24'/%3E%3C/svg%3E");
    color: var(--color-parchment);
    font: 18px/1.75 var(--font-academic);
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--color-oxblood); color: var(--color-parchment); }
a { color: inherit; text-decoration-color: var(--color-gold-muted); text-underline-offset: 0.2em; }
a:hover { color: var(--color-gold-bright); }
img { display: block; max-width: 100%; height: auto; }

.skip-link {
    position: fixed;
    z-index: 100;
    top: 0;
    left: 1rem;
    padding: 0.7rem 1rem;
    transform: translateY(-120%);
    background: var(--color-parchment);
    color: var(--color-void);
    font: 0.72rem var(--font-agent);
}
.skip-link:focus { transform: translateY(0); }

.site-frame { position: fixed; z-index: 20; inset: 10px; border: 1px solid rgba(197,160,89,.12); pointer-events: none; }
.site-frame::before, .site-frame::after { content: ""; position: absolute; width: 26px; height: 26px; border-color: var(--color-gold-muted); }
.site-frame::before { top: -1px; left: -1px; border-top: 1px solid; border-left: 1px solid; }
.site-frame::after { right: -1px; bottom: -1px; border-right: 1px solid; border-bottom: 1px solid; }

.site-header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(calc(100% - 3rem), var(--content-width));
    min-height: 84px;
    margin: 0 auto;
    border-bottom: 1px solid var(--color-gold-muted);
}
.site-mark { display: flex; align-items: center; gap: 1rem; color: var(--color-parchment); text-decoration: none; }
.site-monogram { color: var(--color-gold); font: 700 .78rem/1 var(--font-epigraph); letter-spacing: .18em; }
.site-name { color: var(--color-marble); font: .64rem var(--font-agent); letter-spacing: .18em; text-transform: uppercase; }
.site-nav { display: flex; gap: clamp(1rem, 3vw, 2.6rem); }
.site-nav a { color: var(--color-marble); font: .61rem var(--font-agent); letter-spacing: .15em; text-decoration: none; text-transform: uppercase; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--color-gold); }

.site-footer {
    display: flex;
    justify-content: center;
    gap: 1.3rem;
    width: min(calc(100% - 3rem), var(--content-width));
    margin: 5rem auto 0;
    padding: 1.5rem 0 2.5rem;
    border-top: 1px solid var(--color-gold-muted);
    color: var(--color-marble);
    font: .58rem var(--font-agent);
    letter-spacing: .13em;
    text-align: center;
    text-transform: uppercase;
}
.footer-glyph { color: var(--color-gold); }

.heading-epigraph { margin: 0; color: var(--color-gold); font-family: var(--font-epigraph); font-weight: 400; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow { margin: 0 0 1rem; color: var(--color-marble); font: .62rem var(--font-agent); letter-spacing: .24em; text-transform: uppercase; }
.border-masonic { border: 1px solid var(--color-gold-muted); outline: 1px solid rgba(197,160,89,.09); outline-offset: 4px; border-radius: 0; }
.font-mono { font-family: var(--font-agent); }

/* The Gate */
.gate { position: relative; display: grid; place-items: center; min-height: calc(100vh - 84px); padding: 5rem 1.5rem 7rem; overflow: hidden; text-align: center; }
.geometry-field { position: absolute; width: min(70vw, 800px); aspect-ratio: 1; border: 1px solid rgba(197,160,89,.035); transform: rotate(45deg); pointer-events: none; }
.geometry-field::before, .geometry-field::after { content: ""; position: absolute; inset: 13%; border: 1px solid rgba(197,160,89,.035); border-radius: 50%; }
.geometry-field::after { inset: 29%; border-radius: 0; }
.crest { position: relative; width: 150px; margin-bottom: 2rem; filter: drop-shadow(0 0 24px rgba(197,160,89,.08)); }
.crest svg { display: block; fill: none; stroke: var(--color-gold); stroke-width: .8; }
.crest .crest-dashed { stroke-dasharray: 2 5; }
.crest-aperture { color: inherit; text-decoration: none; }
.crest-aperture::after { content: ""; position: absolute; inset: 38%; border: 1px solid transparent; border-radius: 50%; transition: border-color .25s, box-shadow .25s; }
.crest-aperture:hover::after, .crest-aperture:focus-visible::after { border-color: var(--color-gold-bright); box-shadow: 0 0 22px rgba(197,160,89,.3); }
.aperture-label { position: absolute; top: 57%; left: 50%; color: transparent; font: .42rem var(--font-agent); letter-spacing: .14em; transform: translate(-50%, -50%); transition: color .25s; }
.crest-aperture:hover .aperture-label, .crest-aperture:focus-visible .aperture-label { color: var(--color-gold-bright); }
.institute-title { position: relative; max-width: 980px; font-size: clamp(2rem, 5.4vw, 5rem); line-height: 1.18; text-shadow: 0 2px 30px #000; }
.motto { position: relative; margin: 1.7rem 0 0; color: var(--color-marble); font-size: clamp(.7rem, 1.4vw, .9rem); letter-spacing: .16em; text-transform: uppercase; }
.motto span { margin: 0 .7em; color: var(--color-oxblood); }
.sigil-rule { position: relative; display: flex; align-items: center; width: min(570px, 80vw); margin: 2.8rem 0; color: var(--color-gold); font-size: .7rem; }
.sigil-rule i { flex: 1; height: 1px; margin: 0 1rem; background: var(--color-gold-muted); }
.preamble { position: relative; max-width: 690px; margin: 0; color: #bcb6a2; font-size: 1.15rem; }
.portal-doors { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; width: min(810px, 100%); margin-top: 3.5rem; }
.doorway { position: relative; display: grid; min-height: 170px; padding: 1.7rem; border: 1px solid var(--color-gold-muted); background: linear-gradient(145deg, rgba(197,160,89,.045), transparent 55%); color: var(--color-parchment); text-align: left; text-decoration: none; transition: border-color .2s, background-color .2s, transform .2s; }
.doorway::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(197,160,89,.08); }
.doorway:hover, .doorway:focus-visible { border-color: var(--color-gold); background-color: rgba(197,160,89,.045); color: var(--color-parchment); transform: translateY(-2px); }
.doorway-restricted { background: linear-gradient(145deg, rgba(74,14,23,.23), transparent 60%); }
.door-number { color: var(--color-gold); font: .65rem var(--font-agent); letter-spacing: .16em; }
.door-title { align-self: end; font-family: var(--font-epigraph); font-size: 1rem; letter-spacing: .08em; text-transform: uppercase; }
.door-note { color: var(--color-marble); font: .55rem var(--font-agent); letter-spacing: .12em; text-transform: uppercase; }

/* Dispatch registry */
.dispatches-header { width: min(calc(100% - 3rem), var(--content-width)); margin: 0 auto; padding: 5.5rem 0 3rem; text-align: center; }
.classification-strip { display: flex; justify-content: space-between; margin-bottom: 4rem; padding: .6rem 1rem; border-top: 1px solid var(--color-gold-muted); border-bottom: 1px solid var(--color-gold-muted); color: var(--color-marble); font: .55rem var(--font-agent); letter-spacing: .14em; text-transform: uppercase; }
.dispatches-header h1 { font-size: clamp(1.6rem, 4vw, 3.25rem); }
.archive-description { max-width: 620px; margin: 1.2rem auto 2rem; color: var(--color-marble); font-size: 1.08rem; }
.masonic-rule { width: 150px; height: 5px; margin: 0 auto; border-top: 1px solid var(--color-gold); border-bottom: 1px solid var(--color-gold-muted); }
.dispatches-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; width: min(calc(100% - 3rem), var(--content-width)); margin: 0 auto; }
.dispatch-record { display: flex; flex-direction: column; min-height: 330px; padding: clamp(1.5rem, 3vw, 2.3rem); background: rgba(13,15,18,.7); }
.record-meta { display: flex; justify-content: space-between; color: var(--color-marble); font: .56rem var(--font-agent); letter-spacing: .11em; text-transform: uppercase; }
.record-title { margin: 2.2rem 0 1rem; font-family: var(--font-epigraph); font-size: clamp(1.15rem, 2.3vw, 1.6rem); font-weight: 400; letter-spacing: .05em; line-height: 1.35; }
.record-title a { text-decoration: none; }
.record-excerpt { margin: 0 0 2rem; color: #aca796; line-height: 1.6; }
.record-footer { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(197,160,89,.18); }
.primary-tag, .read-link { color: var(--color-gold); font: .55rem var(--font-agent); letter-spacing: .12em; text-transform: uppercase; }
.read-link { text-align: right; text-decoration: none; }
.empty-registry { grid-column: 1/-1; padding: 4rem; text-align: center; }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; width: min(calc(100% - 3rem), var(--content-width)); margin: 3.5rem auto 0; padding-top: 1.5rem; border-top: 1px solid var(--color-gold-muted); font: .58rem var(--font-agent); letter-spacing: .12em; text-transform: uppercase; }
.pagination a { text-decoration: none; }
.older-posts { text-align: right; }
.page-number { color: var(--color-marble); }

/* Portal */
.sanctum { display: grid; place-items: center; min-height: calc(100vh - 84px); padding: 5rem 1.5rem; }
.gatekeeper-card { width: min(680px, 100%); padding: clamp(2rem, 6vw, 4rem); background: linear-gradient(145deg, rgba(9,27,19,.35), rgba(2,3,4,.88)); }
.cryptic-header { text-align: center; }
.illuminati-glyph { display: grid; place-items: center; width: 90px; aspect-ratio: 1; margin: 0 auto 2rem; border: 1px solid var(--color-gold-muted); color: var(--color-gold); font-size: 1.3rem; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.illuminati-glyph span { margin-top: 36%; }
.cryptic-header h1 { font-size: clamp(1.35rem, 4vw, 2.2rem); line-height: 1.35; }
.sub-alert { color: #9f5360; font: .57rem var(--font-agent); letter-spacing: .2em; text-transform: uppercase; }
.access-ledger { margin: 3rem 0 1.5rem; border-top: 1px solid var(--color-gold-muted); }
.access-ledger div { display: grid; grid-template-columns: 140px 1fr; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid rgba(197,160,89,.16); }
.access-ledger span { color: var(--color-marble); font: .55rem var(--font-agent); letter-spacing: .11em; text-transform: uppercase; }
.access-ledger strong { overflow-wrap: anywhere; color: var(--color-parchment); font: 400 .66rem var(--font-agent); }
.gate-notice { color: var(--color-marble); font-size: .95rem; }
.btn-masonic { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border: 1px solid var(--color-gold); background: rgba(197,160,89,.05); color: var(--color-gold); font: .62rem var(--font-agent); letter-spacing: .18em; text-decoration: none; text-transform: uppercase; }
.btn-masonic:hover, .btn-masonic:focus-visible { background: var(--color-gold); color: var(--color-void); }
.btn-full { width: 100%; margin-top: 1.8rem; }
.terminal-feed { margin-top: 2.5rem; padding: 1rem; border-left: 2px solid var(--color-oxblood); background: var(--color-void); color: #777e76; font: .55rem/1.7 var(--font-agent); letter-spacing: .06em; }
.terminal-feed span { color: var(--color-gold); }

/* The Lodge */
.lodge-landing { align-items: start; }
.lodge-shell { position: relative; width: min(980px, 100%); padding: clamp(2rem, 5vw, 4rem); overflow: hidden; background: linear-gradient(145deg, rgba(9,27,19,.45), rgba(2,3,4,.92) 62%); }
.lodge-shell::before { content: "LODGE / PRIVATE"; position: absolute; top: 1.25rem; right: -2.6rem; width: 160px; padding: .3rem 0; border-top: 1px solid rgba(197,160,89,.2); border-bottom: 1px solid rgba(197,160,89,.2); color: rgba(197,160,89,.45); font: .43rem var(--font-agent); letter-spacing: .16em; text-align: center; transform: rotate(45deg); }
.lodge-header { max-width: 720px; margin: 0 auto; }
.lodge-glyph { width: 78px; margin-bottom: 1.5rem; }
.lodge-header h1 { font-size: clamp(2rem, 6vw, 4.2rem); }
.lodge-declaration { max-width: 650px; margin: 1.2rem auto 0; color: #bbb5a1; font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.55; }
.lodge-status { display: grid; grid-template-columns: repeat(3, 1fr); margin: 3rem 0; border-top: 1px solid var(--color-gold-muted); border-left: 1px solid var(--color-gold-muted); }
.lodge-status div { min-width: 0; padding: .85rem 1rem; border-right: 1px solid var(--color-gold-muted); border-bottom: 1px solid var(--color-gold-muted); }
.lodge-status span { display: block; margin-bottom: .25rem; color: var(--color-marble); font: .5rem var(--font-agent); letter-spacing: .13em; text-transform: uppercase; }
.lodge-status strong { display: block; overflow-wrap: anywhere; font: 400 .61rem var(--font-agent); letter-spacing: .04em; }
.status-online { color: #9bbda7; }
.status-online i { display: inline-block; width: 6px; height: 6px; margin-right: .45rem; border-radius: 50%; background: #79a98a; box-shadow: 0 0 10px rgba(121,169,138,.55); animation: apparatus-pulse 2.4s steps(2, end) infinite; }
.status-delay-one i { animation-delay: .55s; }
.status-delay-two i { animation-delay: 1.1s; }
@keyframes apparatus-pulse {
    0%, 42% { opacity: 1; box-shadow: 0 0 10px rgba(121,169,138,.65); }
    43%, 58% { opacity: .2; box-shadow: none; }
    59%, 100% { opacity: 1; box-shadow: 0 0 10px rgba(121,169,138,.65); }
}
.lodge-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.lodge-introduction > p:first-child { margin-top: 0; color: var(--color-parchment); font-size: 1.08rem; }
.lodge-introduction > p:nth-child(2) { color: var(--color-marble); font-size: .94rem; }
.lodge-entry { margin-top: 2rem; }
.lodge-access-note { margin: .8rem 0 0; color: #777e76; font: .5rem/1.6 var(--font-agent); letter-spacing: .04em; text-transform: uppercase; }
.lodge-catalogue { border-top: 1px solid var(--color-gold-muted); }
.catalogue-heading { margin: 0; padding: .75rem 0; border-bottom: 1px solid rgba(197,160,89,.16); color: var(--color-gold); font: .52rem var(--font-agent); letter-spacing: .15em; text-transform: uppercase; }
.lodge-catalogue ol { margin: 0; padding: 0; list-style: none; }
.lodge-catalogue li { display: grid; grid-template-columns: 34px 1fr; gap: .8rem; padding: .9rem 0; border-bottom: 1px solid rgba(197,160,89,.13); }
.lodge-catalogue li > span { color: var(--color-oxblood); font: 700 .65rem var(--font-epigraph); }
.lodge-catalogue strong { display: block; color: var(--color-parchment); font: 400 .68rem var(--font-epigraph); letter-spacing: .06em; text-transform: uppercase; }
.lodge-catalogue small { display: block; margin-top: .18rem; color: var(--color-marble); font: .53rem/1.45 var(--font-agent); letter-spacing: .03em; }
.collection-aperture { display: block; color: inherit; text-decoration: none; }
.collection-aperture strong::after { content: " ↗"; color: var(--color-gold); font-family: var(--font-agent); font-size: .72em; }
.collection-aperture:hover strong, .collection-aperture:focus-visible strong { color: var(--color-gold-bright); }
.collection-aperture:focus-visible { outline: 1px solid var(--color-gold-bright); outline-offset: 5px; }
.lodge-shell .terminal-feed { margin-top: 3rem; }

/* Auxiliary apparatus: a deliberately anachronistic C64-style BASIC terminal. */
.apparatus-terminal { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--color-gold-muted); }
.gated-apparatus[hidden] { display: none; }
.apparatus-label { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; color: var(--color-marble); font: .5rem var(--font-agent); letter-spacing: .15em; text-transform: uppercase; }
.apparatus-label-hint { color: var(--color-gold); }
.c64-case { padding: clamp(.8rem, 2.5vw, 1.5rem); border: 1px solid #716757; border-radius: 8px 8px 18px 18px; background: linear-gradient(155deg, #a99d84, #827761 70%, #635a49); box-shadow: 0 18px 38px rgba(0,0,0,.46), inset 0 1px rgba(255,255,255,.28); }
.c64-bezel { padding: clamp(.65rem, 2vw, 1rem); border-radius: 7px; background: #2b282b; box-shadow: inset 0 0 0 1px #151416, inset 0 0 18px #000; }
.c64-screen { min-height: 390px; max-height: min(62vh, 540px); overflow-y: auto; padding: clamp(1.15rem, 4vw, 2.2rem); border-radius: 12px / 18px; background: #4037a3; color: #a9a3ff; box-shadow: inset 0 0 35px rgba(4,1,47,.8), 0 0 9px rgba(126,116,255,.25); font: clamp(.72rem, 1.8vw, .96rem)/1.42 var(--font-agent); letter-spacing: .035em; text-transform: uppercase; text-shadow: 0 0 5px rgba(189,184,255,.55); cursor: text; scrollbar-color: #756dcc #30298a; }
.c64-output > div { margin-bottom: 1.25em; white-space: pre-wrap; overflow-wrap: anywhere; }
.c64-output .c64-echo { margin-bottom: .25em; }
.c64-prompt { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: .6rem; }
.c64-prompt label { white-space: nowrap; }
.c64-prompt input { min-width: 0; padding: 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; outline: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: uppercase; caret-color: #d7d3ff; text-shadow: inherit; }
.c64-prompt input:focus { border-bottom-color: rgba(169,163,255,.45); }
.c64-plate { display: flex; align-items: baseline; gap: .7rem; margin: .8rem .15rem 0; color: #302c27; font: .55rem var(--font-agent); letter-spacing: .1em; text-transform: uppercase; }
.c64-plate strong { font: 700 .7rem var(--font-epigraph); letter-spacing: .06em; }
.c64-plate span { color: #514a3e; }
.c64-plate b { margin-left: auto; color: #5b2a37; font-size: 1rem; }
.apparatus-help { margin: .9rem 0 0; color: #777e76; font: .52rem/1.65 var(--font-agent); letter-spacing: .035em; }
.apparatus-help kbd { padding: .1rem .25rem; border: 1px solid rgba(197,160,89,.24); border-radius: 2px; color: var(--color-gold); font: inherit; }

/* Apple IIgs GS/OS-inspired Finder desktop and archive puzzle. */
.apple-apparatus { margin-top: 4.5rem; }
.gs-frame { overflow: hidden; border: 3px solid #111; background: #fff; color: #000; font: 700 clamp(.62rem, 1.4vw, .78rem)/1.2 "Courier New", monospace; box-shadow: 0 18px 38px rgba(0,0,0,.5); image-rendering: pixelated; }
.gs-menu { display: flex; align-items: center; gap: clamp(.35rem, 1.7vw, 1rem); height: 27px; padding: 0 .55rem; border-bottom: 2px solid #111; background: #fff; white-space: nowrap; }
.gs-menu button { padding: 0; border: 0; background: transparent; color: #000; font: inherit; cursor: pointer; }
.gs-menu button:hover, .gs-menu button:focus-visible { background: #111; color: #fff; outline: 0; }
.gs-rainbow { display: grid; width: 17px; height: 17px; grid-template-rows: repeat(5, 1fr); }
.gs-rainbow i:nth-child(1) { background: #40a85b; }.gs-rainbow i:nth-child(2) { background: #e5c52e; }.gs-rainbow i:nth-child(3) { background: #e6832f; }.gs-rainbow i:nth-child(4) { background: #d14747; }.gs-rainbow i:nth-child(5) { background: #6555a6; }
.gs-clock { margin-left: auto; }
.gs-desktop { position: relative; min-height: 550px; overflow: hidden; background-color: #8887e6; background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.19) 0 1px, transparent 1px 3px); }
.gs-desk-icons { position: absolute; z-index: 2; top: 28px; right: 17px; display: grid; gap: 1.25rem; width: 85px; }
.gs-icon { display: grid; justify-items: center; gap: .2rem; min-width: 65px; padding: .25rem; border: 1px solid transparent; background: transparent; color: #000; font: inherit; text-shadow: 1px 1px #fff; cursor: default; }
.gs-icon:hover, .gs-icon:focus-visible { border: 1px dotted #111; outline: 0; background: rgba(255,255,255,.26); }
.gs-icon > span { display: grid; place-items: center; width: 34px; height: 31px; border: 2px solid #111; background: #ddd; font-size: 1.25rem; text-shadow: none; }
.gs-disk > span { height: 19px; border-radius: 2px; background: linear-gradient(#eee 0 30%, #777 31% 45%, #bbb 46%); box-shadow: 3px 3px 0 #555; }
.gs-trash { margin-top: 10rem; }
.gs-trash > span { height: 39px; background: repeating-linear-gradient(90deg, #fff 0 4px, #111 4px 6px); }
.gs-window { position: absolute; z-index: 3; border: 2px solid #111; background: #fff; box-shadow: 4px 4px 0 rgba(0,0,0,.45); }
.gs-catalog { top: 58px; left: 5%; width: min(70%, 560px); min-height: 320px; }
.gs-titlebar { position: relative; display: grid; grid-template-columns: 24px 1fr 24px; align-items: center; height: 24px; border-bottom: 2px solid #111; background: repeating-linear-gradient(0deg, #fff 0 2px, #111 2px 3px); text-align: center; }
.gs-titlebar strong { grid-column: 2; justify-self: center; padding: 1px .55rem; background: #fff; }
.gs-titlebar > button, .gs-titlebar > span { grid-column: 1; grid-row: 1; width: 13px; height: 13px; margin-left: 5px; padding: 0; border: 1px solid #111; background: #fff; }
.gs-window-info { padding: .3rem .75rem; border-bottom: 1px solid #111; text-align: center; }
.gs-file-grid { display: grid; grid-template-columns: repeat(4, minmax(68px, 1fr)); gap: 1.15rem .5rem; padding: 1.4rem 1.6rem 2.5rem; }
.gs-document > span { position: relative; width: 27px; height: 34px; background: #fff; font-size: 1rem; }
.gs-vault > span { background: repeating-linear-gradient(45deg, #111 0 2px, #fff 2px 4px); color: #fff; }
.gs-secret > span { background: #fff; }
.gs-scrollbar { position: absolute; top: 24px; right: 0; bottom: 0; display: grid; grid-template-rows: 18px 1fr 18px; width: 17px; border-left: 1px solid #111; background: repeating-linear-gradient(45deg,#fff 0 2px,#bbb 2px 4px); text-align: center; }
.gs-scrollbar i { display: grid; place-items: center; border-bottom: 1px solid #111; background: #fff; font-style: normal; font-size: .55rem; }
.gs-viewer { z-index: 5; top: 205px; left: 22%; width: min(58%, 460px); min-height: 225px; }
.gs-viewer-body { min-height: 190px; padding: 1.1rem; white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 400; line-height: 1.45; }
.gs-dialog { position: absolute; z-index: 7; top: 175px; left: 50%; width: min(360px, calc(100% - 2rem)); padding: 0 1.25rem 1rem; border: 3px double #111; background: #fff; box-shadow: 6px 6px 0 rgba(0,0,0,.45); transform: translateX(-50%); }
.gs-dialog .gs-titlebar { margin: 0 -1.25rem 1rem; }
.gs-dialog input { width: 100%; padding: .35rem; border: 2px solid #111; background: #fff; color: #000; font: inherit; text-transform: uppercase; }
.gs-dialog-status { min-height: 1.2em; margin: .5rem 0; }
.gs-dialog > div { display: flex; justify-content: flex-end; gap: .65rem; }
.gs-dialog > div button { padding: .3rem .8rem; border: 2px solid #111; border-radius: 6px; background: #fff; color: #000; font: inherit; box-shadow: inset 0 0 0 1px #fff; }
.gs-command { display: flex; gap: .6rem; padding: .35rem .55rem; border-top: 2px solid #111; background: #fff; }
.gs-command input { min-width: 0; flex: 1; border: 0; border-bottom: 1px solid #111; outline: 0; background: #fff; color: #000; font: inherit; text-transform: uppercase; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gs-frame [hidden] { display: none !important; }

/* Treatises and regular pages */
.academic-treatise { width: min(calc(100% - 3rem), 880px); margin: 0 auto; padding-top: 5rem; }
.treatise-header { text-align: center; }
.treatise-seal { display: grid; place-items: center; width: 86px; aspect-ratio: 1; margin: 0 auto 2rem; border: 3px double var(--color-gold-muted); border-radius: 50%; color: var(--color-gold); font: 700 .66rem var(--font-epigraph); letter-spacing: .13em; }
.treatise-title { font-size: clamp(1.8rem, 5vw, 3.7rem); line-height: 1.25; }
.treatise-abstract { max-width: 660px; margin: 1.5rem auto 0; color: var(--color-marble); font-size: 1.15rem; font-style: italic; }
.treatise-provenance { display: grid; grid-template-columns: repeat(2, 1fr); margin: 3rem 0 4rem; border-top: 1px solid var(--color-gold-muted); border-left: 1px solid var(--color-gold-muted); text-align: left; }
.treatise-provenance div { min-width: 0; padding: 1rem; border-right: 1px solid var(--color-gold-muted); border-bottom: 1px solid var(--color-gold-muted); }
.treatise-provenance dt { color: var(--color-marble); font: .52rem var(--font-agent); letter-spacing: .13em; text-transform: uppercase; }
.treatise-provenance dd { margin: .35rem 0 0; overflow-wrap: anywhere; font-size: .88rem; }
.treatise-feature { width: min(1100px, calc(100vw - 3rem)); margin: 0 50% 4rem; transform: translateX(-50%); }
.treatise-feature img { width: 100%; border: 1px solid var(--color-gold-muted); filter: saturate(.72) contrast(1.08); }
.treatise-feature figcaption { margin-top: .7rem; color: var(--color-marble); font: .56rem var(--font-agent); letter-spacing: .08em; text-align: center; }
.treatise-body { font-size: clamp(1.05rem, 2vw, 1.2rem); }
.treatise-body > * { margin: 0 0 1.5em; }
.treatise-body h2, .treatise-body h3, .treatise-body h4 { margin-top: 2em; color: var(--color-gold); font-family: var(--font-epigraph); font-weight: 400; line-height: 1.35; }
.treatise-body h2 { padding-bottom: .5rem; border-bottom: 1px solid var(--color-gold-muted); font-size: 1.55rem; letter-spacing: .06em; }
.treatise-body h3 { font-size: 1.25rem; }
.treatise-body blockquote { margin-left: 0; padding: .2rem 0 .2rem 1.5rem; border-left: 2px solid var(--color-oxblood); color: #bbb5a1; font-style: italic; }
.treatise-body pre { overflow-x: auto; padding: 1.25rem; border: 1px solid rgba(197,160,89,.16); background: var(--color-void); font: .75rem/1.65 var(--font-agent); }
.treatise-body code { font-family: var(--font-agent); font-size: .8em; }
.treatise-body :not(pre) > code { padding: .1em .3em; background: var(--color-void); color: var(--color-gold-bright); }
.treatise-body hr { height: 5px; margin: 3rem auto; border: 0; border-top: 1px solid var(--color-gold); border-bottom: 1px solid var(--color-gold-muted); }
.treatise-body table { width: 100%; border-collapse: collapse; font-size: .9em; }
.treatise-body th, .treatise-body td { padding: .6rem .8rem; border: 1px solid var(--color-gold-muted); text-align: left; }
.treatise-body th { color: var(--color-gold); font: .65rem var(--font-agent); letter-spacing: .08em; text-transform: uppercase; }
.kg-width-wide { width: min(1100px, calc(100vw - 3rem)); margin-right: 50%; margin-left: 50%; transform: translateX(-50%); }
.kg-width-full { width: 100vw; margin-right: 50%; margin-left: 50%; transform: translateX(-50%); }
.kg-image-card img { margin-right: auto; margin-left: auto; }
.kg-card figcaption { color: var(--color-marble); font: .58rem var(--font-agent); text-align: center; }
.treatise-footer { margin-top: 5rem; }
.endorsement-box { padding: 2rem; color: var(--color-marble); font-size: .9rem; text-align: center; }
.seal-imprint { margin-top: 1.5rem; color: var(--color-gold); font: .55rem var(--font-agent); letter-spacing: .18em; text-transform: uppercase; }
.return-link { display: block; margin-top: 2rem; color: var(--color-marble); font: .56rem var(--font-agent); letter-spacing: .11em; text-decoration: none; text-transform: uppercase; }
.academic-page { max-width: 780px; }
.academic-page .treatise-header { margin-bottom: 4rem; }

:focus-visible { outline: 1px solid var(--color-gold-bright); outline-offset: 4px; }

@media (prefers-reduced-motion: reduce) {
    .status-online i { animation: none; }
}

@media (max-width: 760px) {
    body { font-size: 17px; }
    .site-header { align-items: flex-start; flex-direction: column; justify-content: center; gap: .8rem; padding: 1rem 0; }
    .site-name { display: none; }
    .site-nav { width: 100%; justify-content: space-between; }
    .gate, .sanctum { min-height: calc(100vh - 100px); }
    .portal-doors, .dispatches-grid { grid-template-columns: 1fr; }
    .lodge-body, .lodge-status { grid-template-columns: 1fr; }
    .classification-strip { align-items: center; flex-direction: column; gap: .6rem; }
    .treatise-provenance { grid-template-columns: 1fr; }
    .record-meta { gap: .7rem; }
    .site-footer { align-items: center; flex-direction: column; gap: .5rem; }
}

@media (max-width: 480px) {
    .site-frame { inset: 5px; }
    .site-header, .dispatches-header, .dispatches-grid, .pagination, .academic-treatise { width: min(calc(100% - 2rem), var(--content-width)); }
    .site-nav a { font-size: .54rem; }
    .gate { padding-right: 1rem; padding-left: 1rem; }
    .institute-title { letter-spacing: .08em; }
    .motto span { margin: 0 .25em; }
    .record-footer { align-items: flex-start; flex-direction: column; }
    .read-link { text-align: left; }
    .access-ledger div { grid-template-columns: 1fr; gap: .35rem; }
    .apparatus-label { align-items: flex-start; flex-direction: column; gap: .35rem; }
    .c64-screen { min-height: 340px; padding: 1rem; font-size: .66rem; }
    .c64-plate span { display: none; }
    .gs-desktop { min-height: 520px; }
    .gs-menu { gap: .35rem; font-size: .55rem; }
    .gs-catalog { left: 4%; width: 72%; }
    .gs-file-grid { grid-template-columns: repeat(2, minmax(62px, 1fr)); padding: 1rem 1.25rem 2rem; }
    .gs-viewer { top: 225px; left: 8%; width: 80%; }
    .gs-command { align-items: flex-start; flex-direction: column; gap: .2rem; }
    .gs-command input { width: 100%; }
    .pagination { grid-template-columns: 1fr 1fr; }
    .page-number { grid-column: 1/-1; grid-row: 1; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media print {
    body { background: #fff; color: #111; }
    .site-frame, .site-header, .site-footer, .return-link { display: none; }
    .academic-treatise { width: 100%; padding: 0; }
    .heading-epigraph, .treatise-body h2, .treatise-body h3 { color: #111; }
}
