/* ============================================
   digitaltelomere.com - Styles
   Goblincore × Technology | HUD-Overlay Architecture
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-loam: #1e1b17;
    --forest-floor: #2a2621;
    --bark-panel: #3d3730;
    --bone-pale: #e8dcc8;
    --weathered-parchment: #c7bfb3;
    --lichen-green: #7eb89a;
    --russet-fungal: #d4833b;
    --mycelium-violet: #8b6faa;
    --spore-red: #c4453a;
    --panel-bg: rgba(42, 38, 33, 0.72);
    --panel-border: rgba(126, 184, 154, 0.15);
    --panel-border-hover: rgba(126, 184, 154, 0.35);

    --font-display: 'Dela Gothic One', cursive;
    --font-body: 'Work Sans', sans-serif;
    --font-accent: 'Caveat', cursive;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

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

body {
    background-color: var(--deep-loam);
    color: var(--weathered-parchment);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- TERRAIN LAYER --- */
.terrain-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    animation: terrainBreath 12s ease-in-out infinite;
}

@keyframes terrainBreath {
    0%, 100% { filter: brightness(1.0); }
    50% { filter: brightness(1.03); }
}

.terrain-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.mist-band {
    animation: mistPulse 6s ease-in-out infinite;
}

.mist-1 {
    animation-delay: 0s;
}

.mist-2 {
    animation-delay: 3s;
}

@keyframes mistPulse {
    0%, 100% { opacity: 0.04; }
    50% { opacity: 0.08; }
}

/* Scan lines */
.scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.scan-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--lichen-green);
    opacity: 0.04;
    animation: scanDrift linear infinite;
}

@keyframes scanDrift {
    0% { transform: translateY(0); }
    100% { transform: translateY(-100vh); }
}

/* --- HUD LAYER --- */
.hud-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hud-layer.active {
    opacity: 1;
}

/* Corner brackets */
.hud-corner {
    position: absolute;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.hud-corner.visible {
    opacity: 1;
}

.hud-corner-tl { top: 16px; left: 16px; }
.hud-corner-tr { top: 16px; right: 16px; }
.hud-corner-bl { bottom: 16px; left: 16px; }
.hud-corner-br { bottom: 16px; right: 16px; }

/* Scroll depth readout */
.hud-readout {
    position: absolute;
    bottom: 80px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.readout-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--lichen-green);
    opacity: 0.5;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.readout-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--lichen-green);
    opacity: 0.7;
    letter-spacing: 0.06em;
    line-height: 1.3;
}

/* Telomere indicator */
.hud-telomere {
    position: absolute;
    bottom: 24px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.telomere-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--lichen-green);
    opacity: 0.5;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.telomere-bar {
    display: flex;
    gap: 3px;
    align-items: center;
}

.telomere-segment {
    width: 16px;
    height: 10px;
    background-color: var(--lichen-green);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    transition: background-color 0.6s ease, opacity 0.6s ease;
}

.telomere-segment.warning {
    background-color: var(--russet-fungal);
}

.telomere-segment.critical {
    background-color: var(--spore-red);
}

.telomere-segment.depleted {
    opacity: 0.15;
    background-color: var(--bark-panel);
}

/* Section ID */
.hud-section-id {
    position: absolute;
    bottom: 24px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-end;
}

.section-id-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--mycelium-violet);
    opacity: 0.5;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.section-id-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--mycelium-violet);
    opacity: 0.7;
    letter-spacing: 0.06em;
    line-height: 1.3;
}

/* --- RADIAL NAV --- */
.radial-nav {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 60;
}

.radial-trigger {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.radial-trigger:hover {
    border-color: var(--panel-border-hover);
    transform: scale(1.05);
}

.radial-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    margin-top: -100px;
    margin-left: -100px;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.3);
    transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.radial-nav.open .radial-menu {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.radial-threads {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.radial-threads line {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 0.4s ease;
}

.radial-nav.open .radial-threads line {
    stroke-dashoffset: 0;
}

.radial-link {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: var(--font-accent);
    font-size: 0.95rem;
    color: var(--bone-pale);
    transition: color 0.3s ease;
    transform-origin: center center;
}

.radial-link:hover {
    color: var(--lichen-green);
}

.radial-link span {
    white-space: nowrap;
}

/* Position each radial link in a circle */
.radial-link[data-angle="0"]   { transform: translate(-50%, -50%) translate(0, -75px); }
.radial-link[data-angle="60"]  { transform: translate(-50%, -50%) translate(65px, -37px); }
.radial-link[data-angle="120"] { transform: translate(-50%, -50%) translate(65px, 37px); }
.radial-link[data-angle="180"] { transform: translate(-50%, -50%) translate(0, 75px); }
.radial-link[data-angle="240"] { transform: translate(-50%, -50%) translate(-65px, 37px); }
.radial-link[data-angle="300"] { transform: translate(-50%, -50%) translate(-65px, -37px); }

/* --- CONTENT LAYER --- */
.content-layer {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    padding-top: 100vh;
}

/* --- HERO SECTION --- */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -100vh;
    padding: 0 5vw;
}

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

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--bone-pale);
    line-height: 1.1;
    margin-bottom: 0.5em;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.15s ease;
}

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

.hero-tagline {
    font-family: var(--font-accent);
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: var(--lichen-green);
    opacity: 0;
    transition: opacity 0.8s ease;
}

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

.hero-illustration {
    position: absolute;
    width: 60vw;
    max-width: 800px;
    height: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* --- CONTENT SECTIONS --- */
.content-section {
    position: relative;
    padding: 8vh 5vw;
    min-height: 60vh;
}

/* --- CONTENT GRID LAYOUTS --- */
.content-grid {
    display: grid;
    gap: 24px;
    max-width: 1200px;
}

.origin-grid {
    grid-template-columns: 1.6fr 1fr;
    grid-template-rows: auto auto;
    margin-left: 5vw;
}

.origin-grid .panel-large {
    grid-row: 1 / 3;
}

.decay-grid {
    grid-template-columns: 2fr 1fr;
    margin-right: 5vw;
    margin-left: auto;
}

.network-grid {
    grid-template-columns: 1fr 1fr 0.8fr;
    margin-left: 3vw;
}

.growth-grid {
    grid-template-columns: 2fr 1fr;
    margin-right: 8vw;
    margin-left: auto;
}

.entropy-grid {
    grid-template-columns: 1.8fr 1fr;
    grid-template-rows: auto auto;
    margin-left: 6vw;
}

.entropy-grid .panel-wide {
    grid-row: 1 / 3;
}

.renewal-grid {
    grid-template-columns: 2fr 1fr;
    margin-right: 3vw;
    margin-left: auto;
}

/* --- CONTENT PANELS --- */
.content-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    padding: 32px;
    transition: backdrop-filter 0.4s ease, border-color 0.4s ease, transform 0.15s ease;
    position: relative;
}

.content-panel:hover {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-color: var(--panel-border-hover);
}

/* Biological glitch on hover */
.content-panel.glitch-active {
    animation: bioGlitch 0.15s ease;
}

@keyframes bioGlitch {
    0% { transform: skew(0deg, 0deg); filter: hue-rotate(0deg); }
    25% { transform: skew(0.3deg, -0.2deg); filter: hue-rotate(5deg); }
    50% { transform: skew(-0.2deg, 0.3deg); filter: hue-rotate(-3deg); }
    75% { transform: skew(0.1deg, -0.1deg); filter: hue-rotate(2deg); }
    100% { transform: skew(0deg, 0deg); filter: hue-rotate(0deg); }
}

/* Panel fade-in animation */
.panel-fade {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.16, 1.0, 0.3, 1.0), transform 0.6s cubic-bezier(0.16, 1.0, 0.3, 1.0);
}

.panel-fade.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Panel size variants */
.panel-small {
    padding: 24px;
}

.panel-vertical {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- TYPOGRAPHY --- */
.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--bone-pale);
    line-height: 1.15;
    margin-bottom: 0.6em;
}

.panel-subtitle {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: var(--bone-pale);
    margin-bottom: 0.5em;
}

.body-text {
    color: var(--weathered-parchment);
    margin-bottom: 1em;
}

.body-text:last-child {
    margin-bottom: 0;
}

.annotation-text {
    font-family: var(--font-accent);
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    color: var(--lichen-green);
    line-height: 1.5;
}

.mono-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--lichen-green);
    opacity: 0.7;
    letter-spacing: 0.06em;
    line-height: 1.3;
    display: block;
    margin-bottom: 8px;
}

.corrupted {
    color: var(--russet-fungal);
    opacity: 0.6;
}

.corrupted-deep {
    color: var(--spore-red);
    opacity: 0.4;
}

/* --- DATA READOUT --- */
.data-readout {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.data-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--lichen-green);
    opacity: 0.5;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 8px;
}

.data-label:first-child {
    margin-top: 0;
}

.data-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--bone-pale);
    opacity: 0.8;
    letter-spacing: 0.04em;
    line-height: 1.3;
}

/* --- SPECIMEN DISPLAY --- */
.specimen-display {
    background: rgba(30, 27, 23, 0.6);
    border-radius: 3px;
    padding: 20px;
    border-left: 2px solid rgba(139, 111, 170, 0.3);
}

/* --- SECTION DIVIDERS --- */
.section-divider {
    position: relative;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.divider-line {
    position: absolute;
    width: 100%;
    height: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.divider-path {
    stroke-dasharray: 1440;
    stroke-dashoffset: 1440;
    transition: stroke-dashoffset 0.8s ease;
}

.section-divider.in-view .divider-path {
    stroke-dashoffset: 0;
}

.mycelium-growth {
    position: relative;
    width: 300px;
    height: 80px;
    z-index: 1;
}

.mycelium-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s ease 0.4s;
}

.section-divider.in-view .mycelium-path {
    stroke-dashoffset: 0;
}

/* --- BACKGROUND ILLUSTRATIONS --- */
.bg-illustration {
    position: absolute;
    pointer-events: none;
    z-index: -1;
}

.section-bg-illustration {
    width: 60vw;
    max-width: 1000px;
    bottom: -20%;
    right: -5%;
}

.mycelium-bg {
    width: 80vw;
    max-width: 1200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.leaf-illustration {
    width: 30vw;
    max-width: 400px;
    top: 10%;
    left: -5%;
}

.renewal-illustration {
    width: 50vw;
    max-width: 600px;
    top: 50%;
    right: -10%;
    transform: translateY(-50%);
}

/* --- CONTOUR LINES --- */
.contour-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* --- SCROLL TERMINUS --- */
.scroll-terminus {
    padding: 10vh 5vw 15vh;
    text-align: center;
}

.terminus-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--spore-red);
    opacity: 0.5;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr !important;
    }

    .origin-grid,
    .decay-grid,
    .network-grid,
    .growth-grid,
    .entropy-grid,
    .renewal-grid {
        margin-left: 0;
        margin-right: 0;
    }

    .origin-grid .panel-large,
    .entropy-grid .panel-wide {
        grid-row: auto;
    }

    .content-section {
        padding: 6vh 4vw;
    }

    .hero-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    .radial-nav {
        top: 12px;
        right: 12px;
    }

    .hud-corner-tl { top: 8px; left: 8px; }
    .hud-corner-tr { top: 8px; right: 8px; }
    .hud-corner-bl { bottom: 8px; left: 8px; }
    .hud-corner-br { bottom: 8px; right: 8px; }

    .hud-readout { bottom: 70px; left: 12px; }
    .hud-telomere { bottom: 16px; left: 12px; }
    .hud-section-id { bottom: 16px; right: 12px; }

    .bg-illustration {
        display: none;
    }
}

@media (max-width: 600px) {
    .content-panel {
        padding: 20px;
    }

    .panel-small {
        padding: 16px;
    }

    .radial-menu {
        width: 160px;
        height: 160px;
        margin-top: -80px;
        margin-left: -80px;
    }

    .radial-link[data-angle="0"]   { transform: translate(-50%, -50%) translate(0, -60px); }
    .radial-link[data-angle="60"]  { transform: translate(-50%, -50%) translate(52px, -30px); }
    .radial-link[data-angle="120"] { transform: translate(-50%, -50%) translate(52px, 30px); }
    .radial-link[data-angle="180"] { transform: translate(-50%, -50%) translate(0, 60px); }
    .radial-link[data-angle="240"] { transform: translate(-50%, -50%) translate(-52px, 30px); }
    .radial-link[data-angle="300"] { transform: translate(-50%, -50%) translate(-52px, -30px); }
}
