/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --core-dark: #1c0b0b;
    --shadow: #3a0f0f;
    --accent: #8b1a2b;
    --accent-secondary: #a63247;
    --text-primary: #d4a0a0;
    --text-highlight: #e8c8c8;
    --sapwood: #c87d7d;
    --neutral-frame: #2a1515;
    --system-green: #4a6b3a;
    --root-bg: #0e0505;
    --border-color: #2a0a0a;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--core-dark);
    color: var(--text-primary);
    font-family: 'Space Grotesk', 'Noto Sans KR', sans-serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    position: relative;
}

/* === RING ZERO: HERO === */
#ring-zero {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--core-dark);
    overflow: hidden;
}

.hero-container {
    position: relative;
    border: 3px solid var(--border-color);
    padding: clamp(2rem, 5vw, 5rem);
    background: var(--core-dark);
    transform: translateX(-8vw);
    border-radius: 0;
    z-index: 1;
}

.hero-container::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    width: 100%;
    height: 100%;
    background: var(--shadow);
    z-index: -1;
    border-radius: 0;
}

.hero-character {
    font-family: 'Archivo Black', 'Noto Sans KR', sans-serif;
    font-size: clamp(6rem, 18vw, 22rem);
    color: var(--text-highlight);
    line-height: 0.95;
    letter-spacing: -0.02em;
    text-align: center;
}

.hero-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-align: center;
    margin-top: 1.5rem;
}

/* Pulsing hexagon */
.hexagon-pulse {
    position: absolute;
    bottom: 8vh;
    right: 8vw;
    width: 60px;
    height: 60px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: transparent;
    z-index: 2;
}

.hexagon-pulse::before {
    content: '';
    position: absolute;
    inset: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--core-dark);
}

.hexagon-pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--accent);
    animation: pulse-hex 2.5s ease-in-out infinite;
}

@keyframes pulse-hex {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* === LAYER STACK === */
#layer-stack {
    position: relative;
    padding: clamp(4rem, 8vw, 10rem) clamp(1rem, 5vw, 8rem);
}

.layer-panel {
    position: relative;
    max-width: 700px;
    border: 3px solid var(--border-color);
    background: var(--neutral-frame);
    margin-bottom: -50px;
    z-index: 1;
    opacity: 0;
    border-radius: 0;
}

.layer-panel.panel-left {
    margin-right: auto;
    transform: translateX(-80px);
}

.layer-panel.panel-right {
    margin-left: auto;
    transform: translateX(80px);
}

.layer-panel.visible {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 600ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.layer-panel::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 100%;
    height: 100%;
    background: var(--shadow);
    z-index: -1;
    transition: top 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                left 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.layer-panel:hover::after {
    top: 4px;
    left: 4px;
}

.layer-panel:hover {
    transform: translate(6px, 6px);
    transition: transform 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.layer-panel:nth-child(2) { z-index: 2; }
.layer-panel:nth-child(3) { z-index: 3; }
.layer-panel:nth-child(4) { z-index: 4; }

.panel-inner {
    padding: clamp(1.5rem, 3vw, 3rem);
    position: relative;
}

.panel-title-kr {
    font-family: 'Archivo Black', 'Noto Sans KR', sans-serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--text-highlight);
    line-height: 0.95;
    letter-spacing: -0.02em;
}

.panel-title-en {
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    color: var(--text-highlight);
    letter-spacing: -0.02em;
    margin-top: 0.3rem;
}

.panel-subtitle-kr {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 0.8rem;
    margin-bottom: 1.2rem;
}

.panel-body {
    color: var(--text-primary);
    line-height: 1.65;
}

/* Decorative mini rings */
.panel-deco-rings {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.panel-deco-rings span {
    position: absolute;
    border: 2px solid var(--accent);
    border-radius: 50%;
    opacity: 0.4;
}

.panel-deco-rings span:nth-child(1) { width: 12px; height: 12px; }
.panel-deco-rings span:nth-child(2) { width: 24px; height: 24px; }
.panel-deco-rings span:nth-child(3) { width: 36px; height: 36px; }

/* === CROSS-SECTION === */
#cross-section {
    padding: clamp(6rem, 10vw, 12rem) clamp(1rem, 5vw, 6rem);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.section-heading {
    font-family: 'Archivo Black', 'Noto Sans KR', sans-serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--text-highlight);
    letter-spacing: -0.02em;
    margin-bottom: 4rem;
}

.section-heading-en {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--text-primary);
    letter-spacing: 0.01em;
    display: block;
    margin-top: 0.3rem;
    font-weight: 400;
}

.rings-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0 auto;
    width: clamp(280px, 50vw, 500px);
    height: clamp(280px, 50vw, 500px);
}

.ring {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.3);
    transition: transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ring.ring-expanded {
    transform: scale(1) rotate(var(--ring-rotation, 0deg));
}

.ring-7 {
    width: 100%; height: 100%;
    border: 2px solid var(--text-primary);
    --ring-rotation: 30deg;
    opacity: 0.3;
}
.ring-6 {
    width: 85.7%; height: 85.7%;
    border: 2px dashed var(--sapwood);
    --ring-rotation: 25deg;
    opacity: 0.45;
}
.ring-5 {
    width: 71.4%; height: 71.4%;
    border: 2px dotted var(--accent-secondary);
    --ring-rotation: 20deg;
    opacity: 0.55;
}
.ring-4 {
    width: 57.1%; height: 57.1%;
    border: 3px solid var(--accent);
    --ring-rotation: 15deg;
    opacity: 0.7;
}
.ring-3 {
    width: 42.8%; height: 42.8%;
    border: 2px double var(--accent);
    --ring-rotation: 10deg;
    opacity: 0.8;
}
.ring-2 {
    width: 28.5%; height: 28.5%;
    border: 3px solid var(--shadow);
    --ring-rotation: 5deg;
    opacity: 0.9;
}
.ring-1 {
    width: 14.2%; height: 14.2%;
    border: 3px solid var(--shadow);
    background: var(--shadow);
    --ring-rotation: 0deg;
    opacity: 1;
}

.ring-label {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.55rem, 0.7vw, 0.75rem);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    white-space: nowrap;
}

.ring-label-top { top: -1.5em; left: 50%; transform: translateX(-50%); }
.ring-label-right { right: -4em; top: 50%; transform: translateY(-50%); }
.ring-label-bottom { bottom: -1.5em; left: 50%; transform: translateX(-50%); }
.ring-label-left { left: -4em; top: 50%; transform: translateY(-50%); }
.ring-label-center { font-size: clamp(0.5rem, 0.6vw, 0.65rem); }

/* === ROOT NETWORK === */
#root-network {
    background: var(--root-bg);
    padding: clamp(6rem, 10vw, 12rem) clamp(1rem, 5vw, 6rem);
    position: relative;
    border-top: 3px solid var(--border-color);
    border-bottom: 3px solid var(--border-color);
}

.root-svg-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

#root-svg {
    width: 100%;
    height: auto;
}

.root-line {
    stroke: var(--accent);
    stroke-width: 2;
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 800ms ease-out;
}

.root-line.drawn {
    stroke-dashoffset: 0;
}

.root-node {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.6rem, 0.75vw, 0.75rem);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 400ms ease 800ms;
}

.root-line.drawn ~ .root-node,
#root-network.active .root-node {
    opacity: 1;
}

/* === TERMINUS === */
#terminus {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--core-dark);
}

.terminus-container {
    position: relative;
    border: 3px solid var(--border-color);
    padding: clamp(2rem, 5vw, 5rem) clamp(3rem, 8vw, 8rem);
    background: var(--core-dark);
    text-align: center;
    border-radius: 0;
    z-index: 1;
}

.terminus-container::after {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    width: 100%;
    height: 100%;
    background: var(--shadow);
    z-index: -1;
}

.terminus-domain {
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(5rem, 14vw, 16rem);
    color: var(--text-highlight);
    line-height: 0.95;
    letter-spacing: -0.02em;
}

.terminus-korean {
    font-family: 'Space Grotesk', 'Noto Sans KR', sans-serif;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--text-primary);
    margin-top: 1.5rem;
    letter-spacing: 0.01em;
}

/* === HEXAGON DECORATIONS === */
.hex-deco {
    position: fixed;
    width: 40px;
    height: 40px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 2px solid var(--accent);
    z-index: 100;
    pointer-events: none;
    opacity: 0.15;
}

.hex-deco::after {
    content: '';
    position: absolute;
    inset: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--accent);
}

.hex-deco-1 { top: 20vh; left: 3vw; }
.hex-deco-2 { top: 55vh; right: 4vw; left: auto; width: 30px; height: 30px; }
.hex-deco-3 { top: 80vh; left: 6vw; width: 25px; height: 25px; }

/* === RIPPLE === */
.ripple {
    position: fixed;
    border-radius: 50%;
    border: 2px solid var(--accent);
    pointer-events: none;
    z-index: 9999;
    animation: ripple-expand 600ms ease-out forwards;
}

@keyframes ripple-expand {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* === SYSTEM GREEN ACCENTS === */
.layer-panel:nth-child(1) .panel-deco-rings span:nth-child(1) {
    border-color: var(--system-green);
}
.ring-1 {
    box-shadow: inset 0 0 0 2px var(--system-green);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .hero-container {
        transform: translateX(-4vw);
    }

    .layer-panel {
        max-width: 100%;
        margin-bottom: 2rem;
    }

    .layer-panel.panel-left,
    .layer-panel.panel-right {
        transform: translateY(40px);
    }

    .layer-panel.visible {
        transform: translateY(0);
    }

    .layer-panel:hover {
        transform: translateY(0);
    }

    .ring-5, .ring-6, .ring-7 {
        display: none;
    }

    .rings-container {
        width: 250px;
        height: 250px;
    }

    .ring-4 { width: 100%; height: 100%; }
    .ring-3 { width: 75%; height: 75%; }
    .ring-2 { width: 50%; height: 50%; }
    .ring-1 { width: 25%; height: 25%; }

    .terminus-domain {
        word-break: break-all;
    }
}
