/* holos.works — Holographic Plate at Rest
 * Palette:
 *   #08101C Plate Substrate
 *   #0F1B30 Reference Beam Shadow
 *   #E8E2D0 Vellum Moon
 *   #7FE8FF Cyan Spectrum 487nm
 *   #C9A6FF Violet Spectrum 405nm
 *   #FFD18A Amber Spectrum 589nm
 *   #FF7AA2 Reconstruction Pink
 */

:root {
    --plate-substrate: #08101C;
    --reference-shadow: #0F1B30;
    --vellum-moon: #E8E2D0;
    --cyan-487: #7FE8FF;
    --violet-405: #C9A6FF;
    --amber-589: #FFD18A;
    --recon-pink: #FF7AA2;

    --hex-width: clamp(96px, 11vw, 168px);
    --hex-row-step: calc(var(--hex-width) * 0.866);
    --hex-half: calc(var(--hex-width) * 0.5);

    --ease-optical: cubic-bezier(0.22, 0.61, 0.36, 1);
    --dur-slow: 1400ms;
    --dur-mid: 980ms;
    --dur-fast: 720ms;

    --hex-clip: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

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

html, body {
    background: var(--plate-substrate);
    color: var(--vellum-moon);
    font-family: "Public Sans", "Inter", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.72;
    overflow-x: hidden;
    min-height: 100vh;
}

body {
    position: relative;
    background:
        radial-gradient(ellipse at 18% 12%, rgba(127, 232, 255, 0.06), transparent 55%),
        radial-gradient(ellipse at 82% 88%, rgba(201, 166, 255, 0.05), transparent 60%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 209, 138, 0.025), transparent 70%),
        var(--plate-substrate);
}

/* === Substrate stratum: parallax z = -120 === */
.substrate-stratum {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    transform: translateZ(0);
}

#noise-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.04;
    mix-blend-mode: screen;
}

.substrate-hex-field {
    position: absolute;
    inset: -10vh -10vw;
    background-image:
        radial-gradient(circle at 50% 50%, rgba(127, 232, 255, 0.18) 0.5px, transparent 1.5px);
    background-size: 48px 48px;
    opacity: 0.5;
    will-change: transform;
}

/* === Reconstruction stratum: parallax z = +60 === */
.reconstruction-stratum {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
}

.ghost-hex {
    position: absolute;
    width: calc(var(--hex-width) * 0.78);
    height: calc(var(--hex-width) * 0.9);
    clip-path: var(--hex-clip);
    background: linear-gradient(72deg, rgba(255, 122, 162, 0.18), rgba(201, 166, 255, 0.12), rgba(127, 232, 255, 0.10));
    border: 1px solid rgba(255, 122, 162, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(232, 226, 208, 0.55);
    font-family: "Vollkorn", serif;
    font-size: 0.95rem;
    font-style: italic;
    letter-spacing: 0.04em;
    will-change: transform, opacity;
    animation: ghost-drift 32s var(--ease-optical) infinite alternate;
}

.ghost-hex[data-ghost="1"] { top: 14%; left: 8%;  animation-delay:   0s; }
.ghost-hex[data-ghost="2"] { top: 32%; right: 11%; animation-delay:  -8s; }
.ghost-hex[data-ghost="3"] { top: 58%; left: 22%; animation-delay: -16s; }
.ghost-hex[data-ghost="4"] { top: 76%; right: 18%; animation-delay:  -4s; }
.ghost-hex[data-ghost="5"] { top: 88%; left: 46%; animation-delay: -22s; }

@keyframes ghost-drift {
    0%   { transform: translate(0, 0) rotate(0deg); opacity: 0.42; }
    50%  { transform: translate(28px, -22px) rotate(0.6deg); opacity: 0.66; }
    100% { transform: translate(-22px, 32px) rotate(-0.4deg); opacity: 0.5; }
}

/* === Specimen stratum (z = 0) === */
.specimen-stratum {
    position: relative;
    z-index: 2;
    padding: 0;
    max-width: 100%;
}

/* === Navigation: single hex that blows up into seven === */
.nav-cell {
    position: fixed;
    top: 28px;
    left: 28px;
    z-index: 50;
    width: 96px;
    height: 110px;
    pointer-events: auto;
}

.nav-shell {
    position: absolute;
    inset: 0;
    clip-path: var(--hex-clip);
    background: linear-gradient(140deg, var(--reference-shadow), #131F38);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity var(--dur-mid) var(--ease-optical);
    border: 1px solid rgba(127, 232, 255, 0.25);
}

.nav-shell::before {
    content: "";
    position: absolute;
    inset: 1px;
    clip-path: var(--hex-clip);
    background:
        radial-gradient(circle at 30% 30%, rgba(127, 232, 255, 0.22), transparent 60%),
        radial-gradient(circle at 70% 75%, rgba(201, 166, 255, 0.18), transparent 60%);
    pointer-events: none;
}

.nav-label {
    position: relative;
    color: var(--vellum-moon);
    font-family: "Vollkorn", serif;
    font-size: 1.08rem;
    letter-spacing: 0.02em;
    z-index: 2;
}

.nav-blowup {
    position: absolute;
    inset: -120px -120px -120px -120px;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--dur-mid) var(--ease-optical);
}

.nav-cell.is-open .nav-shell {
    opacity: 0;
}

.nav-cell.is-open .nav-blowup {
    opacity: 1;
    pointer-events: auto;
}

.nav-mini {
    position: absolute;
    width: 78px;
    height: 90px;
    clip-path: var(--hex-clip);
    background: linear-gradient(140deg, #0E1A30, #15243F);
    border: 1px solid rgba(127, 232, 255, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vellum-moon);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    text-decoration: none;
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
    transition:
        transform var(--dur-mid) var(--ease-optical),
        opacity var(--dur-mid) var(--ease-optical),
        background var(--dur-fast) var(--ease-optical);
}

.nav-mini:hover {
    background: linear-gradient(140deg, #1B2B49, #233763);
    color: var(--amber-589);
}

.nav-cell.is-open .nav-mini {
    opacity: 1;
}

/* Seven hexagons: center + 6 around (pointy-top) */
.nav-cell.is-open .nav-mini[data-mini="1"] { transform: translate(-50%, -50%) scale(1); top: 50%; left: 50%; }
.nav-cell.is-open .nav-mini[data-mini="2"] { transform: translate(-50%, -50%) scale(1); top: 50%; left: 14%; }
.nav-cell.is-open .nav-mini[data-mini="3"] { transform: translate(-50%, -50%) scale(1); top: 50%; left: 86%; }
.nav-cell.is-open .nav-mini[data-mini="4"] { transform: translate(-50%, -50%) scale(1); top: 16%; left: 32%; }
.nav-cell.is-open .nav-mini[data-mini="5"] { transform: translate(-50%, -50%) scale(1); top: 16%; left: 68%; }
.nav-cell.is-open .nav-mini[data-mini="6"] { transform: translate(-50%, -50%) scale(1); top: 84%; left: 32%; }
.nav-cell.is-open .nav-mini[data-mini="7"] { transform: translate(-50%, -50%) scale(1); top: 84%; left: 68%; }

/* === Hero === */
.hero {
    position: relative;
    padding: 14vh 8vw 9vh 8vw;
    min-height: 78vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.newton-ring {
    position: absolute;
    width: 720px;
    height: 720px;
    top: 50%;
    right: -120px;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.55;
    background:
        radial-gradient(circle at 52% 48%,
            transparent 0,
            transparent 38px,
            rgba(127, 232, 255, 0.10) 39px,
            rgba(127, 232, 255, 0.10) 40px,
            transparent 41px,
            transparent 78px,
            rgba(127, 232, 255, 0.08) 79px,
            rgba(127, 232, 255, 0.08) 80px,
            transparent 81px,
            transparent 122px,
            rgba(127, 232, 255, 0.06) 123px,
            rgba(127, 232, 255, 0.06) 124px,
            transparent 125px,
            transparent 168px,
            rgba(127, 232, 255, 0.05) 169px,
            rgba(127, 232, 255, 0.05) 170px,
            transparent 171px,
            transparent 218px,
            rgba(127, 232, 255, 0.04) 219px,
            rgba(127, 232, 255, 0.04) 220px,
            transparent 221px,
            transparent 270px,
            rgba(127, 232, 255, 0.03) 271px,
            rgba(127, 232, 255, 0.03) 272px,
            transparent 273px,
            transparent 326px,
            rgba(127, 232, 255, 0.025) 327px,
            rgba(127, 232, 255, 0.025) 328px,
            transparent 329px);
    animation: ring-drift 240s linear infinite;
}

@keyframes ring-drift {
    0%   { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

.hero-title {
    font-family: "Vollkorn", serif;
    font-weight: 600;
    font-size: clamp(2.4rem, 6.4vw, 6.2rem);
    line-height: 1.05;
    letter-spacing: -0.008em;
    font-feature-settings: "liga", "dlig", "ss01";
    color: var(--vellum-moon);
    position: relative;
    z-index: 2;
}

.display-line {
    display: block;
}

.gradient-line {
    background: linear-gradient(72deg, var(--cyan-487) 0%, var(--amber-589) 50%, var(--violet-405) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-style: italic;
}

.hero-meta {
    margin-top: 2.4rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: baseline;
    position: relative;
    z-index: 2;
}

.hero-sub {
    margin-top: 2.4rem;
    max-width: 640px;
    font-family: "Public Sans", "Inter", sans-serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.72;
    color: var(--vellum-moon);
    opacity: 0.78;
    position: relative;
    z-index: 2;
    transition: font-variation-settings var(--dur-fast) var(--ease-optical);
    font-variation-settings: 'wght' 400;
}

.hero-sub:hover {
    font-variation-settings: 'wght' 460;
}

.mono {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.78rem;
    font-weight: 300;
    color: var(--cyan-487);
    opacity: 0.62;
    letter-spacing: 0.02em;
}

/* === Section markers === */
.honeycomb-section {
    position: relative;
    padding: 6vh 4vw 10vh 4vw;
}

.section-marker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0 auto 4vh auto;
    max-width: 90vw;
    padding-left: 2vw;
}

.section-marker h2 {
    font-family: "Vollkorn", serif;
    font-weight: 500;
    font-size: clamp(1.6rem, 3.2vw, 2.8rem);
    color: var(--vellum-moon);
    letter-spacing: -0.005em;
    font-feature-settings: "liga", "dlig", "ss01";
}

.section-marker .mono {
    font-size: 0.74rem;
}

/* === Honeycomb grid === */
.honeycomb {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-width: 100vw;
    padding: 1rem 0;
}

.hex-cell {
    position: relative;
    width: var(--hex-width);
    height: calc(var(--hex-width) * 1.1547);
    flex-shrink: 0;
    margin: 0;
    cursor: default;
    transition: transform var(--dur-mid) var(--ease-optical);
    transform-style: preserve-3d;
    will-change: transform;
}

/* Honeycomb interlock: every other cell shifts vertically using nth-child of grouping */
.hex-cell:nth-child(even) {
    margin-top: calc(var(--hex-row-step) - var(--hex-width) * 1.1547);
    margin-bottom: calc(var(--hex-row-step) - var(--hex-width) * 1.1547);
}

.hex-cell::before {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: var(--hex-clip);
    background: linear-gradient(140deg, var(--reference-shadow) 0%, #122039 100%);
    border: 1px solid rgba(127, 232, 255, 0.18);
    transition: background var(--dur-fast) var(--ease-optical);
    z-index: 0;
}

.hex-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: var(--hex-clip);
    padding: 6px;
    background: linear-gradient(72deg,
        var(--cyan-487) 0%,
        var(--amber-589) 50%,
        var(--violet-405) 100%);
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease-optical);
    z-index: 1;
    -webkit-mask:
        linear-gradient(#000, #000) content-box,
        linear-gradient(#000, #000);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
}

.hex-cell.proximity-near::after {
    opacity: 0.55;
    animation: hue-rotate-spectrum 8s linear infinite;
}

.hex-cell.proximity-mid::after {
    opacity: 0.28;
}

@keyframes hue-rotate-spectrum {
    0%   { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.hex-cell-inner {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100%;
    clip-path: var(--hex-clip);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14% 12%;
    text-align: center;
    overflow: hidden;
}

.hex-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.42;
    pointer-events: none;
}

.constellation {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease-optical);
    z-index: 2;
}

.hex-cell:hover .constellation {
    opacity: 0.85;
}

.hex-content {
    position: relative;
    z-index: 4;
    color: var(--vellum-moon);
}

.hex-content .display {
    font-family: "Vollkorn", serif;
    font-weight: 600;
    font-size: clamp(1.0rem, 1.5vw, 1.6rem);
    line-height: 1.1;
    color: var(--vellum-moon);
    font-feature-settings: "liga", "dlig", "ss01";
    letter-spacing: -0.008em;
}

.hex-content .display.italic {
    font-style: italic;
    color: var(--amber-589);
}

.hex-content .body {
    font-family: "Public Sans", sans-serif;
    font-weight: 400;
    font-size: 0.62rem;
    line-height: 1.45;
    color: var(--vellum-moon);
    transition: font-variation-settings var(--dur-fast) var(--ease-optical);
    font-variation-settings: 'wght' 400;
}

.hex-cell:hover .hex-content .body {
    font-variation-settings: 'wght' 540;
}

.hex-content .label {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.56rem;
    color: var(--cyan-487);
    opacity: 0.62;
    letter-spacing: 0.04em;
    margin-top: 0.4em;
    text-transform: lowercase;
}

.hex-content .title {
    font-family: "Vollkorn", serif;
    font-weight: 600;
    font-size: 0.86rem;
    line-height: 1.15;
    color: var(--vellum-moon);
    font-feature-settings: "liga", "dlig", "ss01";
    margin-bottom: 0.3em;
}

.hex-content .citation {
    font-family: "Public Sans", sans-serif;
    font-size: 0.58rem;
    line-height: 1.35;
    color: var(--vellum-moon);
}

.hex-content .citation em {
    color: var(--amber-589);
    font-style: italic;
}

.hex-content .citation strong {
    color: var(--vellum-moon);
    font-weight: 600;
    font-family: "Vollkorn", serif;
    font-feature-settings: "liga", "dlig", "ss01";
}

.hex-content .open-link {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.56rem;
    color: var(--cyan-487);
    text-decoration: none;
    margin-top: 0.4em;
    opacity: 0.7;
    transition: color var(--dur-fast) var(--ease-optical), opacity var(--dur-fast) var(--ease-optical);
}

.hex-cell:hover .hex-content .open-link {
    color: var(--amber-589);
    opacity: 1;
}

/* Beam-splitter cells */
.hex-cell[data-beam] .hex-content .fragment {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85rem;
    color: var(--vellum-moon);
    letter-spacing: 0.06em;
}

.hex-cell[data-beam] .hex-content .fragment-label {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.5rem;
    color: var(--cyan-487);
    opacity: 0.55;
    margin-top: 0.4em;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.hex-cell[data-ghost-cell] {
    background: transparent;
}

.hex-cell[data-ghost-cell]::before {
    background: linear-gradient(140deg, rgba(255, 122, 162, 0.10), rgba(201, 166, 255, 0.06));
    border-color: rgba(255, 122, 162, 0.42);
}

.hex-cell[data-ghost-cell] .hex-content .display {
    color: var(--recon-pink);
    font-style: italic;
}

/* Reading thread */
.reading-thread {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    width: 100%;
    height: 100%;
}

.reading-thread path {
    fill: none;
    stroke: var(--amber-589);
    stroke-width: 1;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    opacity: 0.42;
    transition: stroke-dashoffset 1800ms var(--ease-optical);
}

.reading-thread.is-drawn path {
    stroke-dashoffset: 0;
}

/* Beam instruction */
.beam-instruction {
    text-align: center;
    margin-top: 4vh;
    opacity: 0.7;
}

/* Thesis spine */
.thesis-spine {
    text-align: center;
    padding: 8vh 4vw 6vh 4vw;
    border-top: 1px solid rgba(127, 232, 255, 0.12);
    margin-top: 6vh;
}

.thesis-spine .mono {
    font-size: 0.72rem;
    font-style: italic;
    opacity: 0.7;
}

/* Cursor beam */
.cursor-beam {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle at center,
        rgba(255, 209, 138, 0.10) 0%,
        rgba(127, 232, 255, 0.06) 40%,
        transparent 70%);
    pointer-events: none;
    z-index: 4;
    transform: translate(-50%, -50%);
    transition: opacity var(--dur-mid) var(--ease-optical);
    opacity: 0;
    mix-blend-mode: screen;
}

body.has-cursor .cursor-beam {
    opacity: 1;
}

/* Scatter state on beam-splitter section */
.honeycomb.is-scattering .hex-cell:not(.is-hovered) {
    transform: translate(var(--scatter-x, 0), var(--scatter-y, 0)) rotate(var(--scatter-r, 0deg));
    transition: transform 720ms var(--ease-optical);
}

.honeycomb.is-scattering .hex-cell.is-hovered {
    transform: scale(1.08);
    z-index: 12;
}

.honeycomb.is-scattering .hex-cell.is-hovered::before {
    background: linear-gradient(140deg, #1B2B49 0%, #243A66 100%);
    border-color: var(--violet-405);
}

/* Section snap-in */
.honeycomb-section {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity var(--dur-slow) var(--ease-optical),
        transform var(--dur-slow) var(--ease-optical);
}

.honeycomb-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Mobile compression: 3 across, geometry preserved === */
@media (max-width: 720px) {
    :root {
        --hex-width: clamp(72px, 26vw, 112px);
    }

    .hero {
        padding: 12vh 6vw 6vh 6vw;
        min-height: 60vh;
    }

    .nav-cell {
        width: 72px;
        height: 84px;
        top: 16px;
        left: 16px;
    }

    .nav-blowup {
        inset: -90px;
    }

    .nav-mini {
        width: 56px;
        height: 64px;
    }

    .newton-ring {
        width: 460px;
        height: 460px;
        opacity: 0.35;
    }

    .section-marker {
        padding-left: 1vw;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .hex-cell,
    .ghost-hex,
    .newton-ring,
    .substrate-hex-field,
    .reading-thread path,
    .nav-mini {
        animation: none !important;
        transition: none !important;
    }

    .hex-cell.proximity-near::after {
        animation: none;
        filter: hue-rotate(45deg);
        opacity: 0.32;
    }
}
