/* =====================================================
   gamelicense.info — Illuminated Charter Styles
   Palette (exact hex from DESIGN.md)
   --midnight:   #1e1a2e  Deep Ground
   --parchment:  #e8dcc8  Warm Ground
   --gold:       #b8963e  Primary Accent
   --umber:      #2a2420  Text on light
   --ivory:      #f0ebe0  Text on dark
   --brass:      #7a6b4e  Muted ornament
   --wax:        #8b3a3a  Sealing Wax (hover / seal)
   Typography: Libre Baskerville, Cormorant Garamond, DM Sans
   ===================================================== */

:root {
    --midnight: #1e1a2e;
    --parchment: #e8dcc8;
    --gold: #b8963e;
    --umber: #2a2420;
    --ivory: #f0ebe0;
    --brass: #7a6b4e;
    --wax: #8b3a3a;

    --font-display: "Libre Baskerville", "Times New Roman", serif;
    --font-body: "Cormorant Garamond", Georgia, serif;
    --font-accent: "DM Sans", "Inter", "Helvetica Neue", sans-serif;

    --ease-charter: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--umber);
    background: var(--midnight);
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

/* Shared ornamental rule --------------------------------- */
.ornamental-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 56px auto;
    width: 100%;
    max-width: 520px;
    opacity: 0.85;
}
.ornamental-rule .rr-line {
    flex: 1 1 auto;
    height: 1px;
    background: var(--gold);
    opacity: 0.55;
}
.ornamental-rule .rr-diamond {
    color: var(--gold);
    font-size: 0.75rem;
    line-height: 1;
}

.header-rule, .colophon-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 18px auto 0;
    width: 100%;
    max-width: 360px;
}
.header-rule span, .colophon-rule span {
    flex: 1 1 auto;
    height: 1px;
    background: var(--gold);
    opacity: 0.6;
}
.header-rule i, .colophon-rule i {
    font-style: normal;
    color: var(--gold);
    font-size: 0.8rem;
}

/* ============================================================
   Section 1 — The Frontispiece
   ============================================================ */
.frontispiece {
    position: relative;
    height: 100vh;
    min-height: 680px;
    width: 100%;
    background: var(--midnight);
    color: var(--ivory);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.frontispiece-background {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0;
    transition: opacity 2s var(--ease-charter);
}
.frontispiece-background.visible { opacity: 0.85; }
.frontispiece-background svg { width: 100%; height: 100%; }

/* SVG ornamental frame */
.ornament-frame {
    position: absolute;
    top: 5vh;
    left: 5vw;
    right: 5vw;
    bottom: 5vh;
    width: 90vw;
    height: 90vh;
    z-index: 2;
    pointer-events: none;
}

.ornament-frame .frame-line,
.ornament-frame .corner path,
.ornament-frame .mid-ornament line {
    stroke-dasharray: 4000;
    stroke-dashoffset: 4000;
    transition: stroke-dashoffset 1.8s var(--ease-charter);
}
.ornament-frame .corner path {
    stroke-dasharray: 260;
    stroke-dashoffset: 260;
}
.ornament-frame .mid-ornament line {
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
}
.ornament-frame .mid-ornament path,
.ornament-frame .corner circle {
    opacity: 0;
    transition: opacity 600ms var(--ease-charter) 1.3s;
}

.frontispiece.revealed .ornament-frame .frame-line { stroke-dashoffset: 0; }
.frontispiece.revealed .ornament-frame .corner path { stroke-dashoffset: 0; transition-duration: 1.2s; }
.frontispiece.revealed .ornament-frame .mid-ornament line { stroke-dashoffset: 0; transition-delay: 1s; }
.frontispiece.revealed .ornament-frame .mid-ornament path,
.frontispiece.revealed .ornament-frame .corner circle { opacity: 1; }

/* Content */
.frontispiece-content {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 0 10vw;
    max-width: 90vw;
}

.imprint {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 800ms var(--ease-charter), transform 800ms var(--ease-charter);
}
.imprint-top { margin-bottom: 3.5vh; transition-delay: 1.7s; }
.imprint-bottom {
    margin-top: 4vh;
    color: var(--brass);
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: none;
    transition-delay: 2.5s;
}
.frontispiece.revealed .imprint { opacity: 1; transform: translateY(0); }

.hero-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(3rem, 6vw, 5.5rem);
    line-height: 1.05;
    letter-spacing: 0.04em;
    color: var(--ivory);
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 1s var(--ease-charter) 1.9s, transform 1s var(--ease-charter) 1.9s;
}
.hero-title .dot { color: var(--gold); }
.frontispiece.revealed .hero-title { opacity: 1; transform: translateY(0); }

.hero-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 28px auto 26px;
    width: 260px;
    opacity: 0;
    transition: opacity 800ms var(--ease-charter) 2.3s;
}
.hero-rule .rule-line {
    flex: 1 1 auto;
    height: 1px;
    background: var(--gold);
    opacity: 0.7;
}
.hero-rule .rule-diamond { color: var(--gold); font-size: 0.7rem; }
.frontispiece.revealed .hero-rule { opacity: 1; }

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    color: var(--gold);
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 900ms var(--ease-charter) 2.3s, transform 900ms var(--ease-charter) 2.3s;
}
.frontispiece.revealed .hero-subtitle { opacity: 1; transform: translateY(0); }

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 3;
    opacity: 0;
    transition: opacity 1s var(--ease-charter) 3s;
}
.frontispiece.revealed .scroll-indicator { opacity: 1; }
.scroll-line {
    width: 1px;
    height: 54px;
    background: linear-gradient(to bottom, transparent, var(--gold) 40%, var(--gold));
    opacity: 0.75;
}
.scroll-diamond {
    color: var(--gold);
    font-size: 0.7rem;
    animation: diamondFloat 2s var(--ease-charter) infinite;
}
.scroll-caption {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.62rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.6;
    margin-top: 4px;
}
@keyframes diamondFloat {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50%      { transform: translateY(8px); opacity: 0.5; }
}

/* ============================================================
   Section 2 — The Registry
   ============================================================ */
.registry,
.appendix {
    position: relative;
    background: var(--parchment);
    color: var(--umber);
    padding: clamp(80px, 12vh, 140px) clamp(24px, 7vw, 120px);
    min-height: 100vh;
}

/* Background circuit motif — faint */
.registry::before,
.appendix::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.06;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300'><g stroke='%23b8963e' stroke-width='1' fill='none'><path d='M20 40 L80 40 L80 90 L140 90'/><path d='M180 40 L240 40 L240 110 L280 110'/><path d='M20 180 L60 180 L60 240 L120 240'/><path d='M160 200 L220 200 L220 260 L280 260'/><circle cx='80' cy='40' r='3' fill='%23b8963e'/><circle cx='140' cy='90' r='3' fill='%23b8963e'/><circle cx='240' cy='40' r='3' fill='%23b8963e'/><circle cx='280' cy='110' r='3' fill='%23b8963e'/><circle cx='60' cy='180' r='3' fill='%23b8963e'/><circle cx='120' cy='240' r='3' fill='%23b8963e'/><circle cx='220' cy='200' r='3' fill='%23b8963e'/><circle cx='280' cy='260' r='3' fill='%23b8963e'/></g></svg>");
    background-size: 280px 280px;
    background-repeat: repeat;
}

.section-header {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-bottom: clamp(60px, 9vh, 100px);
}
.section-kicker {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--brass);
    margin-bottom: 18px;
}
.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.1rem, 4.2vw, 3.2rem);
    line-height: 1.15;
    letter-spacing: 0.02em;
    color: var(--umber);
}

.staggered-columns {
    position: relative;
    z-index: 2;
    display: grid;
    gap: clamp(48px, 6vw, 96px);
    max-width: 1400px;
    margin: 0 auto;
}

/* Registry 60/40 staggered */
.reg-columns {
    grid-template-columns: 60% 40%;
}
.reg-columns .col-left { padding-right: clamp(0px, 2vw, 48px); }
.reg-columns .col-right {
    padding-top: 120px;
    padding-left: clamp(0px, 2vw, 48px);
    border-left: 1px dotted rgba(184, 150, 62, 0.35);
}

/* Appendix 40/60 inverted */
.app-columns {
    grid-template-columns: 40% 60%;
}
.app-columns .col-left-narrow {
    padding-top: 120px;
    padding-right: clamp(0px, 2vw, 48px);
    border-right: 1px dotted rgba(184, 150, 62, 0.35);
}
.app-columns .col-right-wide {
    padding-left: clamp(0px, 2vw, 48px);
}

/* Block and content */
.block,
.category {
    margin-bottom: 40px;
}
.block-title,
.cat-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.3rem, 2.2vw, 1.7rem);
    line-height: 1.25;
    letter-spacing: 0.02em;
    margin-bottom: 18px;
    color: var(--umber);
}
.block p + p,
.category p + p { margin-top: 18px; }
.block p,
.category p {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--umber);
}
.block p em,
.category p em {
    font-style: italic;
    color: var(--wax);
}

/* Ornamental initial cap (Appendix) */
.cat-cap {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 3em;
    line-height: 0.8;
    float: left;
    margin-right: 10px;
    padding-top: 6px;
    color: var(--gold);
    text-shadow: 2px 2px 0 rgba(122, 107, 78, 0.22);
}

/* Marginalia */
.margin-note {
    position: relative;
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--brass);
    line-height: 1.7;
    padding: 10px 24px 10px 22px;
    margin-bottom: 56px;
    border-left: 1px solid rgba(184, 150, 62, 0.3);
}
.margin-note .mn-bracket {
    position: absolute;
    color: var(--gold);
    font-size: 1.4rem;
    line-height: 1;
    opacity: 0.75;
    font-style: normal;
}
.margin-note .mn-bracket:first-child {
    top: -4px;
    left: -8px;
}
.margin-note .mn-bracket:last-child {
    bottom: -14px;
    right: -4px;
}
.margin-note .mn-label {
    font-family: var(--font-accent);
    font-weight: 500;
    font-style: normal;
    font-size: 0.68rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 10px;
}
.margin-note .mn-body { font-size: 0.95rem; }
.margin-note .mn-body em {
    font-style: italic;
    color: var(--wax);
}

/* Reveal states (Intersection Observer) */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 600ms var(--ease-charter), transform 600ms var(--ease-charter);
    will-change: opacity, transform;
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hover: category title & block title (wax crimson transition) */
.cat-title,
.block-title {
    transition: color 300ms ease;
    cursor: default;
}
.cat-title:hover,
.block-title:hover { color: var(--wax); }
.cat-title:hover .cat-cap { color: var(--wax); }

/* ============================================================
   Section 3 — The Seal Chamber
   ============================================================ */
.seal-chamber {
    position: relative;
    height: 100vh;
    min-height: 720px;
    width: 100%;
    background: var(--midnight);
    color: var(--ivory);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chamber-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.6;
}
.chamber-backdrop svg { width: 100%; height: 100%; }

.circuit-rays {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(95vh, 95vw);
    height: min(95vh, 95vw);
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 0.55;
    pointer-events: none;
}
.circuit-rays .ray {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 2s var(--ease-charter);
}
.circuit-rays .ray-nodes circle {
    opacity: 0;
    transition: opacity 500ms var(--ease-charter);
}
.seal-chamber.active .circuit-rays .ray { stroke-dashoffset: 0; }
.seal-chamber.active .circuit-rays .ray-nodes circle { opacity: 1; }
.seal-chamber.active .circuit-rays .ray:nth-child(1) { transition-delay: 0.4s; }
.seal-chamber.active .circuit-rays .ray:nth-child(2) { transition-delay: 0.55s; }
.seal-chamber.active .circuit-rays .ray:nth-child(3) { transition-delay: 0.7s; }
.seal-chamber.active .circuit-rays .ray:nth-child(4) { transition-delay: 0.85s; }
.seal-chamber.active .circuit-rays .ray:nth-child(5) { transition-delay: 1.0s; }
.seal-chamber.active .circuit-rays .ray:nth-child(6) { transition-delay: 1.15s; }
.seal-chamber.active .circuit-rays .ray:nth-child(7) { transition-delay: 1.3s; }
.seal-chamber.active .circuit-rays .ray:nth-child(8) { transition-delay: 1.45s; }
.seal-chamber.active .circuit-rays .ray:nth-child(9) { transition-delay: 1.6s; }
.seal-chamber.active .circuit-rays .ray:nth-child(10) { transition-delay: 1.75s; }
.seal-chamber.active .circuit-rays .ray:nth-child(11) { transition-delay: 1.9s; }
.seal-chamber.active .circuit-rays .ray:nth-child(12) { transition-delay: 2.05s; }
.seal-chamber.active .circuit-rays .ray-nodes circle { transition-delay: 2.2s; }

/* The seal */
.seal-wrap {
    position: relative;
    z-index: 2;
    width: min(60vh, 60vw);
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wax-seal {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.6)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 1s var(--ease-spring), transform 1s var(--ease-spring);
}
.seal-chamber.active .wax-seal { opacity: 1; transform: scale(1); }

.seal-text-rotate {
    transform-origin: 200px 200px;
    animation: sealRotate 60s linear infinite;
}
@keyframes sealRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Radial principles overlay */
.principles-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.principle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    margin-left: -60px;
    margin-top: -12px;
    text-align: center;
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.62rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0;
    transition: opacity 700ms var(--ease-charter);
}
.principle span {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(30, 26, 46, 0.55);
    border: 1px solid rgba(184, 150, 62, 0.25);
}
.seal-chamber.active .principle.visible { opacity: 1; }

/* Caption on seal chamber */
.chamber-caption {
    position: absolute;
    bottom: 6vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    text-align: center;
    max-width: 520px;
    padding: 0 20px;
    opacity: 0;
    transition: opacity 1s var(--ease-charter) 1.5s;
}
.seal-chamber.active .chamber-caption { opacity: 1; }

.chamber-kicker {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 10px;
}
.chamber-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    color: var(--ivory);
    letter-spacing: 0.03em;
    margin-bottom: 10px;
}
.chamber-sub {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--brass);
    letter-spacing: 0.08em;
}

/* ============================================================
   Colophon (Appendix)
   ============================================================ */
.colophon {
    position: relative;
    z-index: 2;
    max-width: 560px;
    margin: clamp(80px, 12vh, 140px) auto 0;
    text-align: center;
    padding: 40px 20px 60px;
}
.colophon-seal {
    width: 64px;
    height: 64px;
    margin: 20px auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
}
.colophon-domain {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    letter-spacing: 0.08em;
    color: var(--umber);
    margin: 12px 0;
}
.colophon-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--brass);
    margin-top: 10px;
    margin-bottom: 20px;
}
.colophon-mark {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.5em;
    text-transform: uppercase;
    color: var(--gold);
    margin-top: 24px;
}

/* ============================================================
   Responsive adjustments
   ============================================================ */
@media (max-width: 900px) {
    .reg-columns,
    .app-columns {
        grid-template-columns: 1fr;
    }
    .reg-columns .col-right,
    .app-columns .col-left-narrow {
        padding-top: 0;
        border-left: none;
        border-right: none;
    }
    .reg-columns .col-right {
        padding-left: 0;
        border-left: 1px dotted rgba(184, 150, 62, 0.35);
        padding-left: 18px;
    }
    .app-columns .col-left-narrow {
        padding-right: 0;
        border-right: 1px dotted rgba(184, 150, 62, 0.35);
        padding-right: 18px;
    }
    .ornament-frame { top: 3vh; left: 3vw; right: 3vw; bottom: 3vh; width: 94vw; height: 94vh; }
    .principle { font-size: 0.55rem; letter-spacing: 0.2em; }
}

@media (max-width: 600px) {
    .frontispiece-content { padding: 0 6vw; }
    .chamber-caption { bottom: 3vh; }
    .seal-wrap { width: min(80vw, 80vh); }
    .block-title, .cat-title { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .seal-text-rotate { animation: none; }
    .scroll-diamond { animation: none; }
}
