:root {
  --ink: #090604;
  --red: #7d0f08;
  --red-bright: #c72a16;
  --gold: #d9a23a;
  --gold-light: #ffe9a6;
  --ivory: #f3ead7;
  --muted: #c8b99b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ink); }
body { margin: 0; color: var(--ivory); background: #0b0705; font-family: Georgia, 'Times New Roman', serif; overflow-x: hidden; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.grain { position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .07; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E"); mix-blend-mode: soft-light; }

.site-header { position: fixed; z-index: 100; top: 0; left: 0; right: 0; height: 88px; display: flex; align-items: center; justify-content: space-between; padding: 0 4vw; background: linear-gradient(to bottom, rgba(7,4,2,.88), transparent); }
.site-header--solid { background: rgba(8,5,3,.92); border-bottom: 1px solid rgba(217,162,58,.24); }
.sigil { width: 48px; height: 48px; display: grid; place-items: center; text-decoration: none; transform: rotate(45deg); border: 1px solid var(--gold); background: rgba(84,11,6,.78); box-shadow: inset 0 0 0 4px #140704, 0 0 30px rgba(204,45,22,.22); }
.sigil span { transform: rotate(-45deg); color: var(--gold-light); font-size: 24px; font-weight: 700; }
.nav { display: flex; gap: 28px; align-items: center; }
.nav a { color: var(--ivory); text-decoration: none; text-transform: uppercase; letter-spacing: .2em; font-size: 11px; opacity: .8; }
.nav a:hover { color: var(--gold-light); opacity: 1; }
.menu-button { display: none; color: var(--ivory); border: 1px solid rgba(217,162,58,.5); background: rgba(10,6,4,.7); padding: 10px 14px; font: 700 11px Georgia, serif; letter-spacing: .16em; text-transform: uppercase; }

.hero { min-height: 100svh; position: relative; display: flex; align-items: center; padding: 120px 7vw 80px; background: #190604 url('assets/hero-palace.png') center/cover no-repeat; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(7,3,2,.96) 0%, rgba(7,3,2,.77) 27%, rgba(7,3,2,.15) 56%, rgba(7,3,2,.08) 100%), linear-gradient(0deg, rgba(7,3,2,.76), transparent 40%); }
.hero-veil { position: absolute; z-index: 1; inset: 0; box-shadow: inset 0 0 0 1px rgba(217,162,58,.14), inset 0 -80px 100px #090604; pointer-events: none; }
.hero-copy { position: relative; z-index: 2; width: min(640px, 50vw); }
.eyebrow, .chapter { color: var(--gold-light); font-size: 11px; text-transform: uppercase; letter-spacing: .34em; margin: 0 0 18px; }
.hero h1 { margin: 0; text-transform: uppercase; font-size: clamp(54px, 7.6vw, 116px); line-height: .75; letter-spacing: -.065em; filter: drop-shadow(0 5px 0 #3c0a05) drop-shadow(0 12px 20px #000); }
.hero h1 span { display: block; width: max-content; color: transparent; background: linear-gradient(#fff0b2 4%, #d79e31 42%, #7b3c0b 78%, #ffd96a 94%); background-clip: text; -webkit-background-clip: text; -webkit-text-stroke: 1px #5d2507; text-shadow: 0 1px 0 #ffe8a3; }
.hero h1 span:nth-child(2) { margin-left: 2.5vw; font-size: .82em; }
.hero h1 span:nth-child(3) { margin-left: .6vw; }
.hero-line { margin: 30px 0 0; color: #eadcc0; font-size: clamp(16px, 1.5vw, 22px); line-height: 1.55; font-style: italic; }
.button-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.button-row--center { justify-content: center; }
.dynasty-button { position: relative; min-width: 170px; padding: 15px 25px; display: inline-flex; justify-content: center; align-items: center; text-decoration: none; text-transform: uppercase; letter-spacing: .18em; font-size: 11px; font-weight: 700; color: #241004; background: linear-gradient(180deg, #ffeab0, #c58a24 55%, #8f4e11); clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px); box-shadow: 0 14px 40px rgba(0,0,0,.34); transition: transform .2s ease, filter .2s ease; }
.dynasty-button::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(70,28,3,.52); clip-path: inherit; }
.dynasty-button span { position: relative; }
.dynasty-button:hover { transform: translateY(-3px) rotate(-.5deg); filter: brightness(1.12); }
.dynasty-button--red { color: #ffe6ae; background: linear-gradient(180deg, #b92a19, #741008 65%, #3b0704); }
.dynasty-button--red::before { border-color: rgba(255,220,138,.38); }
.scroll-mark { position: absolute; z-index: 3; right: 4vw; bottom: 36px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--gold-light); text-transform: uppercase; letter-spacing: .24em; font-size: 9px; transform: rotate(90deg); transform-origin: right center; }
.scroll-mark i { width: 54px; height: 1px; background: var(--gold); display: block; }

.legend-panel { position: relative; min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .42fr); gap: 8vw; align-items: center; padding: 120px 9vw; background: #080503 url('assets/lore-archive.png') center/cover fixed no-repeat; isolation: isolate; }
.legend-panel::before { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, rgba(7,4,2,.9), rgba(7,4,2,.64) 55%, rgba(7,4,2,.45)), linear-gradient(0deg, #080503 0%, transparent 22%, transparent 78%, #080503 100%); }
.legend-frame { max-width: 760px; padding: clamp(30px, 5vw, 72px); background: linear-gradient(135deg, rgba(18,9,5,.94), rgba(18,9,5,.72)); border: 1px solid rgba(217,162,58,.42); box-shadow: inset 0 0 0 8px rgba(0,0,0,.2), 0 35px 80px rgba(0,0,0,.45); }
.legend-frame h2, .discipline h2, .story-entry h2 { margin: 0 0 26px; color: var(--ivory); font-size: clamp(34px, 4.5vw, 66px); line-height: .98; font-weight: 500; letter-spacing: -.035em; }
.legend-frame > p:last-of-type, .story-entry p:last-child { color: var(--muted); max-width: 65ch; font-size: 17px; line-height: 1.75; }
.text-link { display: inline-flex; gap: 12px; margin-top: 18px; color: var(--gold-light); text-underline-offset: 7px; }
.seal-note { justify-self: center; width: 230px; aspect-ratio: 1; display: grid; place-content: center; text-align: center; border: 2px solid rgba(232,180,72,.8); outline: 1px solid rgba(232,180,72,.38); outline-offset: 10px; border-radius: 50%; background: radial-gradient(circle, rgba(120,19,10,.92), rgba(24,7,4,.95) 68%); transform: rotate(4deg); box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.seal-note span { color: var(--gold); font-size: 10px; text-transform: uppercase; letter-spacing: .22em; }
.seal-note strong { margin-top: 10px; color: var(--ivory); font-size: 21px; line-height: 1.15; font-weight: 500; }

.discipline { min-height: 90svh; padding: 130px 9vw; background: radial-gradient(circle at 85% 30%, #3f0b06 0%, #120604 32%, #080503 70%); display: grid; grid-template-columns: .8fr 1.2fr; align-items: center; gap: 7vw; }
.discipline-copy { position: sticky; top: 150px; align-self: start; }
.tenets { list-style: none; padding: 0; margin: 0; border-top: 1px solid rgba(217,162,58,.28); }
.tenets li { display: grid; grid-template-columns: 85px 1fr; gap: 22px; align-items: center; padding: 38px 0; border-bottom: 1px solid rgba(217,162,58,.28); }
.tenets li > span { color: var(--gold); font-size: 13px; letter-spacing: .2em; }
.tenets h3 { margin: 0 0 7px; color: var(--gold-light); font-size: 30px; font-weight: 500; }
.tenets p { margin: 0; color: var(--muted); font-size: 16px; }

.code-panel { min-height: 92svh; display: grid; place-items: center; padding: 120px 5vw; background: #120504; background-image: radial-gradient(circle at center, rgba(140,27,12,.48), transparent 42%), repeating-linear-gradient(45deg, transparent 0 18px, rgba(217,162,58,.025) 19px 20px); }
.code-card { width: min(760px, 100%); text-align: center; padding: clamp(42px, 7vw, 80px); border: 1px solid rgba(217,162,58,.5); outline: 1px solid rgba(217,162,58,.2); outline-offset: 10px; background: rgba(8,4,3,.86); box-shadow: 0 30px 90px rgba(0,0,0,.56); }
.code-card h2 { margin: 0 0 30px; color: transparent; background: linear-gradient(#fff0b2, #c68219); background-clip: text; -webkit-background-clip: text; font-size: clamp(60px, 9vw, 110px); letter-spacing: -.06em; }
.address-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .24em; }
.copy-address { width: 100%; display: flex; justify-content: space-between; gap: 20px; padding: 18px 20px; color: var(--ivory); border: 1px solid rgba(217,162,58,.45); background: #140907; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; cursor: pointer; }
.copy-address span { overflow: hidden; text-overflow: ellipsis; }
.copy-address b { color: var(--gold-light); text-transform: uppercase; letter-spacing: .14em; font: 700 10px Georgia, serif; }
.config-hint { margin: 24px 0 0; color: #8f816e; font-size: 12px; }
.config-hint code { color: var(--muted); }

.archive-hero { min-height: 100svh; position: relative; display: flex; align-items: flex-end; padding: 140px 9vw 10vh; background: #100805 url('assets/lore-archive.png') center/cover fixed no-repeat; }
.archive-hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,3,2,.93), rgba(6,3,2,.32)), linear-gradient(0deg, #090503 0%, transparent 45%); }
.archive-intro { position: relative; z-index: 1; max-width: 720px; }
.archive-intro h1 { margin: 0; color: var(--ivory); font-size: clamp(70px, 12vw, 160px); line-height: .75; letter-spacing: -.07em; font-weight: 500; text-shadow: 0 7px 30px #000; }
.archive-intro > p:last-child { max-width: 52ch; margin-top: 34px; color: #dbcdb4; font-size: 18px; line-height: 1.7; }
.story-scroll { padding: 80px 9vw 130px; background: #0a0604; }
.story-entry { display: grid; grid-template-columns: minmax(90px, .25fr) 1fr; gap: 5vw; padding: 90px 0; border-bottom: 1px solid rgba(217,162,58,.2); }
.story-number { color: var(--red-bright); font-size: clamp(70px, 10vw, 150px); line-height: .8; font-style: italic; }
.story-entry > div { max-width: 880px; }
.rules-panel { min-height: 80svh; display: grid; place-content: center; justify-items: center; text-align: center; padding: 100px 5vw; background: radial-gradient(circle, #561009, #140604 48%, #070403 80%); }
.rules-panel blockquote { margin: 16px 0 52px; color: var(--ivory); font-size: clamp(42px, 7vw, 90px); line-height: 1.03; letter-spacing: -.05em; }
footer { min-height: 90px; padding: 28px 4vw; display: flex; gap: 20px; justify-content: space-between; align-items: center; color: #8e806a; background: #050302; border-top: 1px solid rgba(217,162,58,.16); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 800px) {
  .site-header { height: 72px; padding: 0 20px; }
  .sigil { width: 42px; height: 42px; }
  .menu-button { display: block; }
  .nav { position: absolute; top: 66px; right: 18px; display: none; flex-direction: column; align-items: stretch; gap: 0; min-width: 180px; padding: 10px; background: rgba(8,5,3,.96); border: 1px solid rgba(217,162,58,.34); }
  .nav.is-open, .nav--open { display: flex; }
  .nav a { padding: 13px; }
  .hero { min-height: 920px; align-items: flex-end; padding: 100px 24px 130px; background-position: 63% center; }
  .hero::after { background: linear-gradient(0deg, rgba(7,3,2,.98) 4%, rgba(7,3,2,.82) 44%, rgba(7,3,2,.06) 78%); }
  .hero-copy { width: 100%; }
  .hero h1 { font-size: clamp(54px, 18vw, 88px); }
  .hero h1 span:nth-child(2) { margin-left: 10vw; }
  .scroll-mark { display: none; }
  .legend-panel, .discipline { grid-template-columns: 1fr; padding: 100px 24px; }
  .legend-panel { background-attachment: scroll; }
  .legend-frame { padding: 32px 26px; }
  .seal-note { width: 190px; }
  .discipline-copy { position: static; }
  .archive-hero { padding: 120px 24px 70px; background-attachment: scroll; background-position: 62% center; }
  .story-scroll { padding: 30px 24px 80px; }
  .story-entry { grid-template-columns: 55px 1fr; gap: 22px; padding: 70px 0; }
  .story-number { font-size: 60px; }
  .copy-address { text-align: left; }
  footer { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
