/* a6c.quest -- ethereal twilight cartography */

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

:root {
    --bg-primary:    #0a0e1a;   /* Abyssal Ink */
    --bg-secondary:  #151b2e;   /* Twilight Slate */
    --text-primary:  #e2e8f0;   /* Glacier White */
    --text-secondary:#8b95a8;   /* Mist Silver */
    --accent-blue:   #5b8dee;   /* Celestial Blue */
    --accent-lilac:  #a78bfa;   /* Frost Lilac */
    --accent-gold:   #d4a855;   /* Parchment Gold */
    --border:        #1e2740;   /* Ghost Line */

    --fib-1: 21px;
    --fib-2: 34px;
    --fib-3: 55px;
    --fib-4: 89px;
    --fib-5: 144px;
    --fib-6: 233px;

    --cursor-x: 50vw;
    --cursor-y: 50vh;
}

html, body {
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.75;
    letter-spacing: 0.01em;
    min-height: 100vh;
    position: relative;
    background:
        radial-gradient(1200px 800px at 20% 0%, rgba(91,141,238,0.05), transparent 60%),
        radial-gradient(1000px 700px at 90% 30%, rgba(167,139,250,0.04), transparent 60%),
        linear-gradient(180deg, #0c1120 0%, #0a0e1a 40%, #08101e 100%);
    background-attachment: fixed;
}

/* Cursor-reactive luminous fog (lantern) */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(600px circle at var(--cursor-x) var(--cursor-y),
                                rgba(91,141,238,0.06),
                                rgba(167,139,250,0.02) 30%,
                                transparent 60%);
    transition: background 120ms linear;
}

/* Constellation SVG overlay */
.constellation {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.85;
}
.constellation .lines line {
    opacity: 0.4;
    animation: line-pulse 6s ease-in-out infinite;
}
.constellation .lines line:nth-child(2n)  { animation-delay: -1.2s; }
.constellation .lines line:nth-child(3n)  { animation-delay: -2.4s; }
.constellation .lines line:nth-child(4n)  { animation-delay: -3.6s; }
.constellation .lines line:nth-child(5n)  { animation-delay: -4.8s; }
@keyframes line-pulse {
    0%, 100% { opacity: 0.2; }
    50%      { opacity: 0.5; }
}
.constellation .star {
    transform-box: fill-box;
    transform-origin: center;
    animation: star-pulse 6s ease-in-out infinite;
}
.constellation .s1  { animation-duration: 5s;  animation-delay: -0.4s; }
.constellation .s2  { animation-duration: 7s;  animation-delay: -1.1s; }
.constellation .s3  { animation-duration: 4s;  animation-delay: -2.2s; }
.constellation .s4  { animation-duration: 6s;  animation-delay: -3.0s; }
.constellation .s5  { animation-duration: 8s;  animation-delay: -1.6s; }
.constellation .s6  { animation-duration: 5.5s;animation-delay: -2.7s; }
.constellation .s7  { animation-duration: 7.5s;animation-delay: -0.9s; }
.constellation .s8  { animation-duration: 4.5s;animation-delay: -3.4s; }
.constellation .s9  { animation-duration: 6.5s;animation-delay: -1.9s; }
.constellation .s10 { animation-duration: 5s;  animation-delay: -2.8s; }
.constellation .s11 { animation-duration: 7s;  animation-delay: -0.5s; }
.constellation .s12 { animation-duration: 6s;  animation-delay: -3.1s; }
.constellation .s13 { animation-duration: 8s;  animation-delay: -1.4s; }
.constellation .s14 { animation-duration: 5.5s;animation-delay: -2.5s; }
.constellation .s15 { animation-duration: 4.5s;animation-delay: -3.7s; }
.constellation .s16 { animation-duration: 6s;  animation-delay: -0.7s; }
.constellation .s17 { animation-duration: 7s;  animation-delay: -2.0s; }
.constellation .s18 { animation-duration: 5s;  animation-delay: -1.3s; }
@keyframes star-pulse {
    0%, 100% { opacity: 0.2; }
    50%      { opacity: 0.65; }
}

/* Indicator (vertical dots) */
.indicator {
    position: fixed;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.indicator .dot {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.35;
    transition: opacity 400ms ease, background 400ms ease, box-shadow 400ms ease, transform 400ms ease;
}
.indicator .dot.active {
    background: var(--accent-blue);
    opacity: 1;
    box-shadow: 0 0 12px rgba(91,141,238,0.6);
    transform: scale(1.4);
}

/* Layout shell */
main {
    position: relative;
    z-index: 3;
}

/* ---------- THRESHOLD (Hero) ---------- */
.threshold {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--fib-5) 6vw;
    position: relative;
}
.threshold-inner {
    position: relative;
    width: 100%;
    max-width: 1400px;
    text-align: center;
    padding: var(--fib-4) var(--fib-3);
}

.coord-label {
    position: absolute;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    opacity: 0.6;
}
.coord-label.top-left     { top: var(--fib-2); left: var(--fib-2); }
.coord-label.top-right    { top: var(--fib-2); right: var(--fib-2); }
.coord-label.bottom-left  { bottom: var(--fib-2); left: var(--fib-2); }
.coord-label.bottom-right { bottom: var(--fib-2); right: var(--fib-2); }

.hero-title {
    position: relative;
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 300;
    font-size: clamp(3rem, 10vw, 12rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: inline-block;
    margin: 0 auto;
    padding: 0 0.05em;
    transition: text-shadow 1.6s ease-out;
}
.hero-title.glow {
    text-shadow: 0 0 40px rgba(91,141,238,0.3);
}
.hero-title .layer {
    display: block;
}
.hero-title .layer-back,
.hero-title .layer-mid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    user-select: none;
    color: var(--accent-blue);
}
.hero-title .layer-back {
    opacity: 0.06;
    transform: translate(6px, 4px);
    color: var(--accent-lilac);
}
.hero-title .layer-mid {
    opacity: 0.10;
    transform: translate(-3px, -2px);
    color: var(--accent-blue);
}
.hero-title .layer-front {
    position: relative;
    color: var(--text-primary);
}
.hero-title .layer-front .ch {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 200ms ease-out, transform 200ms ease-out;
}
.hero-title .layer-front .ch.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-tagline {
    margin-top: var(--fib-3);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 1.6vw, 1.35rem);
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 1.6s ease-out;
}
.hero-tagline.visible { opacity: 1; }

.scroll-hint {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: var(--fib-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--fib-1);
    color: var(--text-secondary);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 1.6s ease-out 0.6s;
}
.scroll-hint.visible { opacity: 0.7; }
.scroll-hint .line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, var(--text-secondary), transparent);
    animation: hint-drift 3.2s ease-in-out infinite;
}
@keyframes hint-drift {
    0%, 100% { transform: scaleY(0.6); transform-origin: top; opacity: 0.4; }
    50%      { transform: scaleY(1);   transform-origin: top; opacity: 0.9; }
}

/* Fibonacci dot markers in gutter */
.fib-markers {
    position: relative;
    height: 0;
}
.fib-markers .fib-dot {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: var(--y, 0);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-lilac);
    opacity: 0.2;
}

/* ---------- CARTOGRAPHY ---------- */
.cartography {
    min-height: 100vh;
    padding: var(--fib-6) 6vw var(--fib-5);
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
}

.section-head {
    margin-bottom: var(--fib-5);
    max-width: 720px;
}
.section-head-center {
    margin: 0 auto var(--fib-5);
    text-align: center;
}
.section-head .kicker {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent-gold);
    letter-spacing: 0.28em;
    text-transform: lowercase;
    margin-bottom: var(--fib-1);
    opacity: 0.85;
}
.section-head h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.panels {
    display: flex;
    flex-direction: column;
    gap: var(--fib-4);
}

.panel {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 2px;
    padding: var(--fib-3) var(--fib-3);
    max-width: 640px;
    box-shadow:
        0 0 30px rgba(91,141,238,0.03),
        0 0 60px rgba(91,141,238,0.02),
        0 0 120px rgba(91,141,238,0.01);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}
.panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.panel-a { margin-left: 0;      margin-right: auto; margin-top: var(--fib-2); }
.panel-b { margin-left: auto;   margin-right: 8%;   margin-top: var(--fib-3); }
.panel-c { margin-left: 18%;    margin-right: auto; margin-top: var(--fib-2); }
.panel-d { margin-left: auto;   margin-right: auto; margin-top: var(--fib-3); }

.panel h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(1.25rem, 2.4vw, 1.85rem);
    color: var(--text-primary);
    margin-bottom: var(--fib-1);
    letter-spacing: -0.005em;
}
.panel p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.75;
}
.panel em {
    color: var(--accent-gold);
    font-style: italic;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05em;
}

.panel-coord {
    position: absolute;
    left: -8px;
    top: 50%;
    transform: rotate(-90deg) translateX(50%);
    transform-origin: left top;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.18em;
    white-space: nowrap;
    opacity: 0.55;
    pointer-events: none;
}

/* ---------- CONSTELLATION SECTION ---------- */
.constellation-section {
    min-height: 100vh;
    padding: var(--fib-5) 6vw;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.star-field {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 520px;
    margin-top: var(--fib-3);
}

.star-field .tile {
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-secondary);
    letter-spacing: 0.18em;
    text-transform: lowercase;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(21,27,46,0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: 2px;
    transition: color 400ms ease, border-color 400ms ease, box-shadow 400ms ease, transform 400ms ease;
    cursor: default;
    user-select: none;
}
.star-field .tile::before {
    content: attr(data-glyph);
    display: inline-block;
    margin-right: 8px;
    color: var(--accent-blue);
    font-size: 0.95rem;
    transform: translateY(1px);
}
.star-field .tile:hover {
    color: var(--text-primary);
    border-color: rgba(91,141,238,0.4);
    box-shadow: 0 0 24px rgba(91,141,238,0.15);
    transform: translate(-50%, -50%) scale(1.04);
}
.star-field .tile:nth-child(5n)::before { color: var(--accent-lilac); }
.star-field .tile:nth-child(7n)::before { color: var(--accent-gold); }

/* ---------- ARCHIVE ---------- */
.archive {
    min-height: 100vh;
    padding: var(--fib-6) 6vw;
    display: flex;
    align-items: center;
    justify-content: center;
}
.archive-inner {
    max-width: 42ch;
    text-align: left;
    padding: var(--fib-3) 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}
.archive-inner.visible {
    opacity: 1;
    transform: translateY(0);
}
.archive-inner .kicker {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent-gold);
    letter-spacing: 0.28em;
    text-transform: lowercase;
    margin-bottom: var(--fib-1);
    opacity: 0.85;
}
.archive-inner h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    line-height: 1.15;
    margin-bottom: var(--fib-3);
    color: var(--text-primary);
}
.archive-inner p {
    color: var(--text-secondary);
    margin-bottom: var(--fib-2);
}
.archive-inner .signoff {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: var(--accent-gold);
    margin-top: var(--fib-3);
    font-size: 1.1rem;
}

.archive-meta {
    margin-top: var(--fib-4);
    padding-top: var(--fib-2);
    border-top: 1px solid var(--border);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.18em;
    opacity: 0.6;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.archive-meta .dot-sep { color: var(--accent-blue); opacity: 0.6; }

/* ---------- FOOTER ---------- */
.page-footer {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: var(--fib-3) 6vw var(--fib-4);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--fib-2);
    max-width: 1400px;
    margin: 0 auto;
}
.page-footer .brand {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--text-primary);
    letter-spacing: 0.04em;
}
.page-footer .footer-coord {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.22em;
    opacity: 0.6;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .panel-a, .panel-b, .panel-c, .panel-d {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }
    .panel-coord {
        position: static;
        display: block;
        transform: none;
        margin-bottom: 14px;
        opacity: 0.5;
    }
    .indicator { right: 14px; }
    .star-field { height: 90vh; min-height: 600px; }
    .star-field .tile { font-size: 0.7rem; padding: 8px 10px; }
    .coord-label { font-size: 0.65rem; }
}

@media (max-width: 560px) {
    .threshold-inner { padding: var(--fib-3) var(--fib-2); }
    .coord-label.top-left, .coord-label.bottom-left { left: 12px; }
    .coord-label.top-right, .coord-label.bottom-right { right: 12px; }
    .archive-inner { max-width: 100%; }
    .page-footer { flex-direction: column; }
}
