/* ============================================
   annual.quest -- Styles
   Dark-academia + HUD-overlay aesthetic
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #1C1714;
    color: #C9B99A;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 17px;
    line-height: 1.75;
    overflow-x: hidden;
}

/* ---------- Film Grain Overlay ---------- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    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)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---------- Vignette Overlay ---------- */
#vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(28, 23, 20, 0.15) 100%);
}

/* ---------- Per-Chapter Vignette ---------- */
.chapter-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(28, 23, 20, 0.15) 100%);
    z-index: 2;
}

/* ---------- HUD Annotation Layer ---------- */
#hud-annotations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    transition: opacity 1s ease-out 0.5s;
}

#hud-annotations.visible {
    opacity: 1;
}

#hud-annotations svg {
    width: 100%;
    height: 100%;
}

/* ---------- HUD Frame ---------- */
#hud-frame {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

#hud-frame.visible {
    opacity: 1;
}

/* HUD Border Lines - animated drawing effect */
.hud-border {
    position: absolute;
    background-color: #D4A55A;
    opacity: 0.25;
    transform: scaleX(0);
    transition: transform 1.2s ease-out;
}

#hud-frame.visible .hud-border {
    transform: scaleX(1);
}

.hud-border-top {
    top: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    transform-origin: left center;
}

.hud-border-bottom {
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    transform-origin: right center;
}

.hud-border-left {
    left: 0;
    top: 16px;
    bottom: 16px;
    width: 1px;
    transform: scaleY(0);
    transform-origin: top center;
    transition: transform 1.2s ease-out;
}

#hud-frame.visible .hud-border-left {
    transform: scaleY(1);
}

.hud-border-right {
    right: 0;
    top: 16px;
    bottom: 16px;
    width: 1px;
    transform: scaleY(0);
    transform-origin: bottom center;
    transition: transform 1.2s ease-out;
}

#hud-frame.visible .hud-border-right {
    transform: scaleY(1);
}

/* HUD Corner Brackets */
.hud-corner {
    position: absolute;
    width: 16px;
    height: 16px;
}

.hud-corner::before,
.hud-corner::after {
    content: '';
    position: absolute;
    background-color: #D4A55A;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.hud-corner::before {
    width: 16px;
    height: 1px;
}

.hud-corner::after {
    width: 1px;
    height: 16px;
}

.hud-corner-tl {
    top: 0;
    left: 0;
}
.hud-corner-tl::before { top: 0; left: 0; }
.hud-corner-tl::after { top: 0; left: 0; }

.hud-corner-tr {
    top: 0;
    right: 0;
}
.hud-corner-tr::before { top: 0; right: 0; }
.hud-corner-tr::after { top: 0; right: 0; }

.hud-corner-bl {
    bottom: 0;
    left: 0;
}
.hud-corner-bl::before { bottom: 0; left: 0; }
.hud-corner-bl::after { bottom: 0; left: 0; }

.hud-corner-br {
    bottom: 0;
    right: 0;
}
.hud-corner-br::before { bottom: 0; right: 0; }
.hud-corner-br::after { bottom: 0; right: 0; }

/* HUD Crosshair */
.hud-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    opacity: 0;
    transition: opacity 0.6s ease-out 0.5s;
}

#hud-frame.visible .hud-crosshair {
    opacity: 1;
}

.crosshair-h,
.crosshair-v {
    position: absolute;
    background-color: #D4A55A;
    opacity: 0.2;
}

.crosshair-h {
    width: 80px;
    height: 1px;
    top: 50%;
    left: 0;
}

.crosshair-v {
    width: 1px;
    height: 80px;
    top: 0;
    left: 50%;
}

/* HUD Readouts */
.hud-readout {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #D4A55A;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.hud-readout-tl {
    top: 24px;
    left: 24px;
}

.hud-readout-tr {
    top: 24px;
    right: 24px;
}

.hud-readout-bl {
    bottom: 24px;
    left: 24px;
}

.hud-readout-br {
    bottom: 24px;
    right: 24px;
}

/* ---------- Chapter Navigation Pips ---------- */
#chapter-nav {
    position: fixed;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: all;
}

.nav-pip {
    width: 10px;
    height: 10px;
    border: 1px solid #D4A55A;
    background: transparent;
    cursor: pointer;
    transform: rotate(45deg);
    transition: background-color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
    padding: 0;
    outline: none;
    opacity: 0.5;
}

.nav-pip:hover {
    opacity: 0.8;
    border-color: #E8764B;
}

.nav-pip.active {
    background-color: #D4A55A;
    opacity: 1;
}

/* ---------- Chapters ---------- */
.chapter {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.5s ease-out, filter 0.5s ease-out;
    will-change: transform, filter;
}

.chapter.zoom-out {
    transform: scale(1.04);
    filter: blur(4px);
}

.chapter.zoom-in {
    transform: scale(0.96);
    filter: blur(4px);
}

.chapter.zoom-in.active {
    transform: scale(1);
    filter: blur(0px);
}

.chapter-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 48px;
    position: relative;
    z-index: 3;
}

/* ---------- Chapter Headers ---------- */
.chapter-header {
    margin-bottom: 64px;
    position: relative;
}

.chapter-number {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #E8764B;
    opacity: 0.6;
    display: block;
    margin-bottom: 12px;
}

.chapter-title {
    font-family: 'Darker Grotesque', sans-serif;
    font-weight: 700;
    font-size: 56px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #F2E6D0;
    line-height: 1.1;
}

/* ---------- Hero (Chapter 1) ---------- */
#chapter-0 {
    background-color: #1C1714;
}

.compass-rose {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vh;
    height: 80vh;
    max-width: 700px;
    max-height: 700px;
    opacity: 0;
    transition: opacity 0.8s ease-out;
    pointer-events: none;
    z-index: 1;
}

.compass-rose.visible {
    opacity: 0.15;
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.hero-title {
    font-family: 'Darker Grotesque', sans-serif;
    font-weight: 700;
    font-size: 72px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #F2E6D0;
    line-height: 1.1;
    opacity: 0;
}

.hero-title.visible {
    opacity: 1;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: scale(1.2);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.hero-title .char.visible {
    opacity: 1;
    transform: scale(1);
}

.hero-subtitle {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    font-size: 28px;
    color: #D4A55A;
    letter-spacing: 0.02em;
    margin-top: 24px;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.hero-subtitle.visible {
    opacity: 1;
}

/* ---------- Dossier Panels ---------- */
.dossier-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.dossier-grid-reverse {
    grid-template-columns: 1fr 2fr;
}

.dossier-grid-three {
    grid-template-columns: 1fr 1fr 1fr;
}

.dossier-panel {
    position: relative;
    border: 1px solid rgba(196, 149, 106, 0.4);
    padding: 32px;
    transition: border-color 0.2s ease, background-color 0.3s ease;
}

.dossier-panel:hover {
    border-color: rgba(196, 149, 106, 0.8);
    background-color: #352E28;
}

.dossier-panel:hover .panel-corner::before {
    width: 20px;
}

.dossier-panel:hover .panel-corner::after {
    height: 20px;
}

.panel-full {
    grid-column: 1 / -1;
}

/* Panel Corner Brackets */
.panel-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.panel-corner::before,
.panel-corner::after {
    content: '';
    position: absolute;
    background-color: #C4956A;
    opacity: 0.6;
    transition: width 0.2s ease, height 0.2s ease;
}

.panel-corner::before {
    height: 1px;
    width: 16px;
}

.panel-corner::after {
    width: 1px;
    height: 16px;
}

.panel-corner-tl { top: -1px; left: -1px; }
.panel-corner-tl::before { top: 0; left: 0; }
.panel-corner-tl::after { top: 0; left: 0; }

.panel-corner-tr { top: -1px; right: -1px; }
.panel-corner-tr::before { top: 0; right: 0; }
.panel-corner-tr::after { top: 0; right: 0; }

.panel-corner-bl { bottom: -1px; left: -1px; }
.panel-corner-bl::before { bottom: 0; left: 0; }
.panel-corner-bl::after { bottom: 0; left: 0; }

.panel-corner-br { bottom: -1px; right: -1px; }
.panel-corner-br::before { bottom: 0; right: 0; }
.panel-corner-br::after { bottom: 0; right: 0; }

/* Circuit Trace Decorations */
.circuit-trace {
    position: absolute;
    height: 1px;
    opacity: 0.25;
}

.circuit-trace.trace-top {
    top: -1px;
    left: 40px;
    width: calc(100% - 80px);
    background: linear-gradient(
        to right,
        transparent 0%,
        #C4956A 10%,
        #C4956A 12%,
        transparent 12.5%,
        transparent 15%,
        #C4956A 15.5%,
        #C4956A 45%,
        transparent 45.5%,
        transparent 48%,
        #C4956A 48.5%,
        #C4956A 50%,
        transparent 50.5%,
        transparent 70%,
        #C4956A 70.5%,
        #C4956A 90%,
        transparent 100%
    );
}

.circuit-trace.trace-bottom {
    bottom: -1px;
    left: 60px;
    width: calc(100% - 120px);
    background: linear-gradient(
        to right,
        transparent 0%,
        #C4956A 5%,
        #C4956A 30%,
        transparent 30.5%,
        transparent 35%,
        #C4956A 35.5%,
        #C4956A 38%,
        transparent 38.5%,
        transparent 60%,
        #C4956A 60.5%,
        #C4956A 85%,
        transparent 100%
    );
}

/* Circuit trace nodes (circular dots at turns) */
.circuit-trace::before,
.circuit-trace::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #C4956A;
    top: -1.5px;
    opacity: 0.35;
}

.circuit-trace.trace-top::before { left: 12%; }
.circuit-trace.trace-top::after { left: 50%; }
.circuit-trace.trace-bottom::before { left: 30%; }
.circuit-trace.trace-bottom::after { left: 60%; }

/* Panel Content */
.panel-heading {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: 28px;
    color: #D4A55A;
    letter-spacing: 0.02em;
    margin-bottom: 16px;
}

.panel-body {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 17px;
    line-height: 1.75;
    color: #C9B99A;
}

.panel-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #D4A55A;
    opacity: 0.6;
    display: block;
    margin-top: 20px;
}

.panel-label:first-of-type {
    margin-top: 0;
}

.panel-value {
    font-family: 'Darker Grotesque', sans-serif;
    font-weight: 700;
    font-size: 48px;
    color: #F2E6D0;
    display: block;
    line-height: 1.2;
    letter-spacing: 0.04em;
}

/* ---------- Pull Quote ---------- */
.pull-quote {
    margin-top: 48px;
    padding: 24px 40px;
    position: relative;
    text-align: center;
}

.pull-quote::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background-color: #D4A55A;
    opacity: 0.3;
}

.pull-quote-text {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    font-weight: 400;
    font-size: 28px;
    color: #D4A55A;
    letter-spacing: 0.02em;
    line-height: 1.5;
}

/* ---------- Crosshair Motifs ---------- */
.crosshair-motif {
    position: absolute;
    width: 80px;
    height: 80px;
    pointer-events: none;
    z-index: 1;
}

.crosshair-motif-right {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

.crosshair-motif-left {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
}

.cross-h,
.cross-v {
    position: absolute;
    background-color: #D4A55A;
    opacity: 0.15;
}

.cross-h {
    width: 40px;
    height: 1px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.cross-v {
    width: 1px;
    height: 40px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ---------- Lens Flare ---------- */
.lens-flare {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 5;
}

.hex {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 1px solid #D4A55A;
    opacity: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    transform: scale(0.8);
}

.hex.visible {
    transform: scale(1);
}

.hex.visible.pulse {
    animation-name: hexPulse;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

.hex-1 {
    top: -60px;
    left: -30px;
    width: 50px;
    height: 50px;
    animation-duration: 3s;
}

.hex-2 {
    top: -20px;
    left: 10px;
    width: 35px;
    height: 35px;
    animation-duration: 2.5s;
}

.hex-3 {
    top: 10px;
    left: 40px;
    width: 28px;
    height: 28px;
    animation-duration: 3.5s;
}

.hex-4 {
    top: 30px;
    left: 65px;
    width: 22px;
    height: 22px;
    animation-duration: 2.8s;
}

.hex-5 {
    top: 45px;
    left: 82px;
    width: 18px;
    height: 18px;
    animation-duration: 4s;
}

@keyframes hexPulse {
    0%, 100% {
        opacity: 0.2;
        box-shadow: 0 0 10px rgba(212, 165, 90, 0.05);
        border-color: #D4A55A;
    }
    50% {
        opacity: 0.4;
        box-shadow: 0 0 20px rgba(212, 165, 90, 0.12);
        border-color: #FFF3E0;
    }
}

/* ---------- Geometric Motifs ---------- */
.geometric-motif {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.clock-motif {
    width: 200px;
    height: 200px;
}

.clock-motif-wrap {
    bottom: 60px;
    right: 80px;
}

.sundial-motif {
    bottom: 40px;
    left: 80px;
}

.sundial-motif svg {
    width: 180px;
    height: 180px;
}

.bookspines-motif {
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
}

.bookspines-motif svg {
    width: 300px;
    height: 120px;
}

/* ---------- Closing Sequence ---------- */
.closing-message {
    text-align: center;
    margin-top: 80px;
    opacity: 0;
    transition: opacity 1s ease-out;
}

.closing-message.visible {
    opacity: 1;
}

.closing-text {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    font-size: 28px;
    color: #FFF3E0;
    letter-spacing: 0.02em;
}

/* Closing vignette effect -- shrinks visible area */
.closing-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    background: radial-gradient(ellipse at center, transparent 20%, #1C1714 60%);
    transition: opacity 2s ease-in;
}

.closing-vignette.active {
    opacity: 1;
}

/* Closing spin for compass rose */
.chapter-final.closing .chapter-inner {
    transition: opacity 1.5s ease-out;
}

#compass-rose.closing-spin {
    transition: transform 3s ease-in-out, opacity 3s ease-in-out;
    transform: translate(-50%, -50%) rotate(360deg);
    opacity: 0.25;
}

/* ---------- Scroll-linked background shift ---------- */
.chapter:nth-child(odd of .chapter) {
    background-color: #1C1714;
}

.chapter:nth-child(even of .chapter) {
    background-color: #2A2320;
}

/* ---------- Crosshair motifs at grid intersections ---------- */
.chapter-inner::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 40px;
    height: 1px;
    background-color: #D4A55A;
    opacity: 0.12;
}

.chapter-inner::after {
    content: '';
    position: absolute;
    top: calc(50% - 20px);
    left: 20px;
    width: 1px;
    height: 40px;
    background-color: #D4A55A;
    opacity: 0.12;
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 768px) {
    .hero-title {
        font-size: 42px;
    }

    .hero-subtitle {
        font-size: 20px;
    }

    .chapter-title {
        font-size: 36px;
    }

    .chapter-inner {
        padding: 60px 24px;
    }

    .dossier-grid,
    .dossier-grid-reverse {
        grid-template-columns: 1fr;
    }

    .dossier-grid-three {
        grid-template-columns: 1fr;
    }

    .panel-heading {
        font-size: 22px;
    }

    .panel-value {
        font-size: 36px;
    }

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

    #chapter-nav {
        right: 16px;
    }

    .hud-readout {
        font-size: 9px;
    }

    .hud-readout-tl {
        top: 20px;
        left: 16px;
    }

    .hud-readout-tr {
        top: 20px;
        right: 16px;
    }

    .hud-readout-bl {
        bottom: 20px;
        left: 16px;
    }

    .hud-readout-br {
        bottom: 20px;
        right: 16px;
    }

    .compass-rose {
        width: 90vw;
        height: 90vw;
    }

    .geometric-motif {
        display: none;
    }

    .crosshair-motif {
        display: none;
    }

    #hud-annotations {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 32px;
    }

    .chapter-title {
        font-size: 28px;
    }

    .panel-body {
        font-size: 15px;
    }

    .pull-quote-text {
        font-size: 18px;
    }
}
