/* ========================================
   gamelicense.info — Candlelit Manuscript
   ======================================== */

/* --- Color Reference ---
   #0E0906 Charred Umber (background deepest)
   #1C120A Smoked Walnut (background primary)
   #2A1B10 Oiled Mahogany (panel background)
   #6B2A15 Wax Seal Dark
   #6B3A1F Sienna Wash
   #8B3A1F Wax Seal
   #8B6914 Edge Marker
   #8B7D6B Muted Leather
   #C4956A Tarnished Brass
   #C9B896 Warm Sandstone
   #D4A76A Molten Wax
   #E8A040 Candle Core
   #E8D5B7 Aged Parchment
   #F5DEB3 Wheat (flame core)
   --- */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    perspective: 1200px;
}

body {
    background-color: #0E0906;
    color: #C9B896;
    font-family: 'Source Sans 3', 'Helvetica', sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.72;
    letter-spacing: 0.01em;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Candlelight Atmospheric Layer --- */
.candlelight-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 800px 800px at 50% 40%, rgba(232, 160, 64, 0.06), transparent),
        radial-gradient(ellipse 400px 400px at 25% 50%, rgba(212, 167, 106, 0.04), transparent),
        radial-gradient(ellipse 400px 400px at 75% 60%, rgba(212, 167, 106, 0.04), transparent),
        radial-gradient(ellipse 1200px 1200px at 50% 100%, #6B3A1F08, transparent);
    animation: candlelightDrift 45s ease-in-out infinite;
    will-change: background-position;
}

@keyframes candlelightDrift {
    0% {
        background-position: 50% 40%, 25% 50%, 75% 60%;
    }
    25% {
        background-position: 48% 45%, 28% 45%, 72% 55%;
    }
    50% {
        background-position: 52% 38%, 22% 55%, 78% 50%;
    }
    75% {
        background-position: 50% 42%, 26% 48%, 74% 62%;
    }
    100% {
        background-position: 50% 40%, 25% 50%, 75% 60%;
    }
}

/* --- Noise Texture Overlay --- */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Manuscript Sections --- */
.manuscript-section {
    position: relative;
    min-height: 100vh;
    padding: 10vh 5vw;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-hero {
    min-height: 110vh;
    padding-top: 15vh;
}

.section-colophon {
    min-height: 80vh;
    padding-bottom: 20vh;
}

/* --- Breathing Space Between Sections --- */
.manuscript-section + .manuscript-section {
    margin-top: 10vh;
}

/* --- HUD Panels --- */
.hud-panel {
    position: sticky;
    top: 10vh;
    background: #2A1B10;
    background: rgba(42, 27, 16, 0.88);
    border: 1px solid #C4956A;
    padding: 48px 44px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transform: perspective(1200px) translateZ(-20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: transform, opacity;
}

.hud-panel.visible {
    opacity: 1;
    transform: perspective(1200px) translateZ(0px);
}

.panel-right {
    width: 48vw;
    margin-left: auto;
    margin-right: 8vw;
}

.panel-left {
    width: 48vw;
    margin-right: auto;
    margin-left: 8vw;
}

.panel-center {
    width: 52vw;
    margin-left: auto;
    margin-right: auto;
}

.panel-wide {
    width: 60vw;
}

/* --- Corner Tick Marks --- */
.corner-mark {
    position: absolute;
    width: 8px;
    height: 8px;
    pointer-events: none;
}

.corner-mark::before,
.corner-mark::after {
    content: '';
    position: absolute;
    background: #C4956A;
    opacity: 0.6;
    transition: opacity 0.4s ease;
}

.hud-panel.visible .corner-mark::before,
.hud-panel.visible .corner-mark::after {
    opacity: 1;
}

/* Top-left */
.corner-tl { top: -1px; left: -1px; }
.corner-tl::before { width: 8px; height: 1px; top: 0; left: 0; }
.corner-tl::after { width: 1px; height: 8px; top: 0; left: 0; }

/* Top-right */
.corner-tr { top: -1px; right: -1px; }
.corner-tr::before { width: 8px; height: 1px; top: 0; right: 0; }
.corner-tr::after { width: 1px; height: 8px; top: 0; right: 0; }

/* Bottom-left */
.corner-bl { bottom: -1px; left: -1px; }
.corner-bl::before { width: 8px; height: 1px; bottom: 0; left: 0; }
.corner-bl::after { width: 1px; height: 8px; bottom: 0; left: 0; }

/* Bottom-right */
.corner-br { bottom: -1px; right: -1px; }
.corner-br::before { width: 8px; height: 1px; bottom: 0; right: 0; }
.corner-br::after { width: 1px; height: 8px; bottom: 0; right: 0; }

/* --- Edge Markers --- */
.edge-marker {
    position: absolute;
    background: #8B6914;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

.hud-panel.visible .edge-marker {
    opacity: 0.5;
}

.edge-right {
    width: 1px;
    height: 60px;
    top: 50%;
    right: -60px;
    transform: translateY(-50%);
}

.edge-left {
    width: 1px;
    height: 60px;
    top: 50%;
    left: -60px;
    transform: translateY(-50%);
}

/* --- Secondary Panels --- */
.secondary-panel {
    position: absolute;
    width: 240px;
    padding: 20px 24px;
    background: #1C120A;
    background: rgba(28, 18, 10, 0.75);
    border: 1px solid rgba(196, 149, 106, 0.3);
    opacity: 0;
    transform: perspective(1200px) translateZ(-10px);
    transition: opacity 0.6s ease-out 0.2s, transform 0.6s ease-out 0.2s;
}

.secondary-panel.visible {
    opacity: 1;
    transform: perspective(1200px) translateZ(0px);
}

.secondary-left {
    left: 8vw;
    top: 20vh;
}

.secondary-right {
    right: 8vw;
    top: 18vh;
}

/* --- Typography --- */
h1 {
    font-family: 'Nunito Sans', 'Helvetica', sans-serif;
    font-weight: 700;
    font-size: 52px;
    line-height: 1.15;
    letter-spacing: 0.02em;
    color: #E8D5B7;
    margin-bottom: 24px;
}

h2 {
    font-family: 'Nunito Sans', 'Helvetica', sans-serif;
    font-weight: 700;
    font-size: 36px;
    line-height: 1.15;
    letter-spacing: 0.02em;
    color: #E8D5B7;
    margin-bottom: 20px;
}

h3 {
    font-family: 'Nunito Sans', 'Helvetica', sans-serif;
    font-weight: 700;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: 0.02em;
    color: #E8D5B7;
    margin-bottom: 10px;
}

p {
    margin-bottom: 16px;
}

p:last-child {
    margin-bottom: 0;
}

.pull-quote {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 26px;
    line-height: 1.55;
    color: #D4A76A;
    margin-bottom: 24px;
    padding-left: 20px;
    border-left: 1px solid rgba(196, 149, 106, 0.4);
}

.hud-label {
    display: block;
    font-family: 'IBM Plex Sans', 'Helvetica', sans-serif;
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8B7D6B;
    opacity: 0.7;
    margin-bottom: 16px;
    font-variant-numeric: tabular-nums;
}

.hud-label-bottom {
    margin-top: 24px;
    margin-bottom: 0;
}

.meta-text {
    font-family: 'IBM Plex Sans', 'Helvetica', sans-serif;
    font-weight: 300;
    font-size: 13px;
    letter-spacing: 0.04em;
    line-height: 1.8;
    color: #8B7D6B;
}

/* --- Taxonomy List --- */
.taxonomy-list {
    margin-top: 24px;
}

.taxonomy-item {
    padding: 14px 0;
    border-top: 1px solid rgba(196, 149, 106, 0.15);
    display: grid;
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
    gap: 4px 0;
}

.taxonomy-item:last-child {
    border-bottom: 1px solid rgba(196, 149, 106, 0.15);
}

.taxonomy-code {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 20px;
    color: #D4A76A;
    grid-row: 1 / 3;
    display: flex;
    align-items: flex-start;
    padding-top: 2px;
}

.taxonomy-label {
    font-family: 'Nunito Sans', 'Helvetica', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #E8D5B7;
    letter-spacing: 0.02em;
}

.taxonomy-desc {
    font-family: 'IBM Plex Sans', 'Helvetica', sans-serif;
    font-weight: 300;
    font-size: 13px;
    color: #8B7D6B;
    letter-spacing: 0.02em;
    line-height: 1.5;
}

/* --- Jurisdiction Grid --- */
.jurisdiction-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 24px;
}

.jurisdiction-item {
    padding: 20px;
    border: 1px solid rgba(196, 149, 106, 0.2);
    background: #1C120A;
    background: rgba(14, 9, 6, 0.4);
}

.jurisdiction-item p {
    font-size: 15px;
    line-height: 1.65;
    color: #C9B896;
}

/* --- Wax Seal Dividers --- */
/* Wax seal uses #8B3A1F to #6B2A15 gradient (defined in SVG) */
.wax-seal {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 8vh auto;
    width: 48px;
    height: 48px;
    position: relative;
    z-index: 3;
    filter: drop-shadow(0 2px 4px rgba(14, 9, 6, 0.6));
    color: #8B3A1F;
    border-color: #6B2A15;
}

.seal-svg {
    width: 48px;
    height: 48px;
}

/* --- Candle Flame Elements --- */
.candle-flame {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}

.flame-hero-left {
    left: 6vw;
    top: 22vh;
}

.flame-hero-right {
    right: 6vw;
    bottom: 30vh;
}

.flame-section-left {
    left: 4vw;
    top: 35vh;
}

.flame-section-right {
    right: 4vw;
    top: 30vh;
}

.flame-colophon {
    position: relative;
    margin: 0 auto 20px auto;
}

.flame-base {
    width: 30px;
    height: 60px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: radial-gradient(ellipse at center 60%, #E8A040, #D4A76A 50%, transparent 75%);
    position: relative;
    filter: blur(1px);
    animation: flameFlicker1 4.2s ease-in-out infinite;
}

.flame-core {
    width: 12px;
    height: 30px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: #F5DEB3;
    mix-blend-mode: screen;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    filter: blur(0.5px);
    animation: flameFlicker2 3.6s ease-in-out infinite;
}

.flame-glow {
    position: absolute;
    top: -20px;
    left: -20px;
    width: 70px;
    height: 100px;
    border-radius: 50%;
    box-shadow: 0 0 40px 20px rgba(232, 160, 64, 0.15);
    pointer-events: none;
    animation: glowPulse 5s ease-in-out infinite;
}

@keyframes flameFlicker1 {
    0%   { transform: scale(1) skewX(0deg); opacity: 0.9; }
    10%  { transform: scale(1.02) skewX(-1deg); opacity: 0.95; }
    20%  { transform: scale(0.98) skewX(2deg); opacity: 0.88; }
    30%  { transform: scale(1.03) skewX(-0.5deg); opacity: 0.92; }
    40%  { transform: scale(0.97) skewX(1.5deg); opacity: 0.86; }
    50%  { transform: scale(1.01) skewX(-2deg); opacity: 0.94; }
    60%  { transform: scale(0.99) skewX(0.5deg); opacity: 0.89; }
    70%  { transform: scale(1.04) skewX(-1.5deg); opacity: 0.93; }
    80%  { transform: scale(0.96) skewX(1deg); opacity: 0.87; }
    90%  { transform: scale(1.02) skewX(-0.5deg); opacity: 0.91; }
    100% { transform: scale(1) skewX(0deg); opacity: 0.9; }
}

@keyframes flameFlicker2 {
    0%   { transform: translateX(-50%) scale(1) skewX(0deg); opacity: 0.85; }
    15%  { transform: translateX(-50%) scale(1.05) skewX(2deg); opacity: 0.9; }
    30%  { transform: translateX(-50%) scale(0.95) skewX(-1deg); opacity: 0.8; }
    45%  { transform: translateX(-50%) scale(1.03) skewX(1.5deg); opacity: 0.92; }
    60%  { transform: translateX(-50%) scale(0.97) skewX(-2deg); opacity: 0.82; }
    75%  { transform: translateX(-50%) scale(1.04) skewX(0.5deg); opacity: 0.88; }
    100% { transform: translateX(-50%) scale(1) skewX(0deg); opacity: 0.85; }
}

@keyframes glowPulse {
    0%   { opacity: 0.6; }
    30%  { opacity: 0.75; }
    50%  { opacity: 0.55; }
    70%  { opacity: 0.8; }
    100% { opacity: 0.6; }
}

/* Different timings for different flames */
.flame-hero-left .flame-base { animation-duration: 4.2s; animation-delay: 0s; }
.flame-hero-left .flame-core { animation-duration: 3.6s; animation-delay: 0.3s; }
.flame-hero-left .flame-glow { animation-duration: 5s; animation-delay: 0.1s; }

.flame-hero-right .flame-base { animation-duration: 4.8s; animation-delay: 0.5s; }
.flame-hero-right .flame-core { animation-duration: 3.9s; animation-delay: 0.7s; }
.flame-hero-right .flame-glow { animation-duration: 5.5s; animation-delay: 0.4s; }

.flame-section-left .flame-base { animation-duration: 4.5s; animation-delay: 1.2s; }
.flame-section-left .flame-core { animation-duration: 3.7s; animation-delay: 0.9s; }
.flame-section-left .flame-glow { animation-duration: 5.3s; animation-delay: 0.6s; }

.flame-section-right .flame-base { animation-duration: 4.1s; animation-delay: 0.8s; }
.flame-section-right .flame-core { animation-duration: 3.4s; animation-delay: 1.1s; }
.flame-section-right .flame-glow { animation-duration: 5.7s; animation-delay: 0.2s; }

.flame-colophon .flame-base { animation-duration: 4.6s; animation-delay: 0.3s; }
.flame-colophon .flame-core { animation-duration: 3.8s; animation-delay: 0.6s; }
.flame-colophon .flame-glow { animation-duration: 5.2s; animation-delay: 0.9s; }

/* --- Colophon --- */
.colophon-content {
    text-align: center;
}

.colophon-content h2 {
    font-size: 28px;
    margin-bottom: 16px;
}

.colophon-content .pull-quote {
    border-left: none;
    padding-left: 0;
    font-size: 22px;
    text-align: center;
}

.colophon-text {
    font-size: 15px;
    color: #8B7D6B;
    line-height: 1.8;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 24px;
}

.colophon-mark {
    font-size: 32px;
    color: #C4956A;
    text-align: center;
    margin-top: 32px;
    margin-bottom: 0;
    opacity: 0.6;
}

/* --- Panel tilt transition --- */
[data-tilt] {
    transition: transform 0.15s ease-out;
}

/* --- Responsive Adjustments --- */
@media (max-width: 900px) {
    .panel-right,
    .panel-left,
    .panel-center,
    .panel-wide {
        width: 85vw;
        margin-left: auto;
        margin-right: auto;
    }

    .secondary-panel {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        width: 85vw;
        margin: 24px auto 0 auto;
    }

    h1 {
        font-size: 38px;
    }

    h2 {
        font-size: 28px;
    }

    .pull-quote {
        font-size: 22px;
    }

    .jurisdiction-grid {
        grid-template-columns: 1fr;
    }

    .edge-marker {
        display: none;
    }

    .candle-flame {
        display: none;
    }

    .flame-colophon {
        display: block;
    }
}

@media (max-width: 600px) {
    .hud-panel {
        padding: 28px 24px;
    }

    h1 {
        font-size: 30px;
    }

    h2 {
        font-size: 24px;
    }

    .pull-quote {
        font-size: 20px;
    }

    body {
        font-size: 16px;
    }
}
