@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

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

:root {
    --void-black: #0a0d0b;
    --phosphor-green: #33ff66;
    --dim-phosphor: #1a5c33;
    --amber: #d4a017;
    --sonar-blue: #0d3b66;
    --bubble-cyan: #17d4c7;
    --archive-gray: #2a2e2b;
    --static-white: #e0ffe6;
    --border-green: #1a3a2a;
}

html {
    scroll-behavior: auto;
}

body {
    background: var(--void-black);
    color: var(--phosphor-green);
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.85rem, 1.2vw, 1.05rem);
    font-weight: 400;
    line-height: 1.75;
    font-feature-settings: "tnum";
    overflow-x: hidden;
}

/* Terminal Frame */
#terminal-frame {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 1px solid var(--dim-phosphor);
    pointer-events: none;
    z-index: 100;
}

#frame-label {
    position: absolute;
    top: 8px;
    left: 12px;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--dim-phosphor);
    letter-spacing: 0.1em;
}

#frame-cursor {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: var(--phosphor-green);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Sections */
.section {
    min-height: 100vh;
    width: 100%;
    position: relative;
    border-bottom: 2px solid var(--border-green);
    display: flex;
    align-items: center;
}

.section-inner {
    max-width: 960px;
    width: 100%;
    margin-left: 8%;
    padding: 3.236rem 1.618rem;
    position: relative;
    z-index: 2;
}

.section-title {
    font-family: 'Jost', sans-serif;
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--phosphor-green);
    margin-bottom: 1.618rem;
}

/* Scan Lines */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--phosphor-green);
    z-index: 5;
}

.scan-line.active {
    animation: scan-across 400ms ease-out forwards;
}

@keyframes scan-across {
    from { width: 0; }
    to { width: 100%; }
}

/* Zoom Focus Animation */
.zoom-target {
    opacity: 0;
    transform: scale(0.85);
    filter: blur(4px);
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 600ms cubic-bezier(0.16, 1, 0.3, 1),
                filter 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.zoom-target.visible {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

/* Boot Sequence */
#boot-sequence {
    background: var(--void-black);
    z-index: 50;
}

#boot-sequence .section-inner {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    min-height: 100vh;
}

#boot-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.85rem, 1.2vw, 1.05rem);
    color: var(--phosphor-green);
    line-height: 2;
    white-space: pre-wrap;
}

#boot-text .prompt {
    color: var(--amber);
}

#boot-text .access-granted {
    color: var(--static-white);
    font-weight: 700;
}

#boot-sequence.fade-out {
    opacity: 0;
    transition: opacity 800ms ease;
    pointer-events: none;
}

/* Bubbles */
#bubbles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(23, 212, 199, 0.31), transparent 60%);
    border: 1px solid rgba(23, 212, 199, 0.15);
    pointer-events: none;
    animation: bubble-ascend var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes bubble-ascend {
    0% {
        transform: translateY(0) translateX(0);
        bottom: -50px;
    }
    25% {
        transform: translateY(-28vh) translateX(15px);
    }
    50% {
        transform: translateY(-55vh) translateX(-10px);
    }
    75% {
        transform: translateY(-83vh) translateX(12px);
    }
    100% {
        transform: translateY(-115vh) translateX(0);
        bottom: -50px;
    }
}

/* Geometric Background Shapes */
#geo-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.geo-shape {
    position: absolute;
    border: 1px solid var(--dim-phosphor);
    opacity: 0.06;
    animation: geo-rotate 60s linear infinite;
}

@keyframes geo-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.geo-shape.geo-triangle {
    width: 0;
    height: 0;
    border: none;
    border-left: var(--size) solid transparent;
    border-right: var(--size) solid transparent;
    border-bottom: calc(var(--size) * 1.732) solid var(--dim-phosphor);
    opacity: 0.05;
}

.geo-shape.geo-hexagon {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: none;
    outline: 1px solid var(--dim-phosphor);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--dim-phosphor);
}

.geo-shape.geo-diamond {
    transform: rotate(45deg);
    animation: geo-rotate-diamond 60s linear infinite;
}

@keyframes geo-rotate-diamond {
    from { transform: rotate(45deg); }
    to { transform: rotate(405deg); }
}

/* License Registry */
#license-registry {
    background: var(--void-black);
}

.registry-entries {
    width: 100%;
}

.registry-row {
    display: flex;
    align-items: center;
    gap: 1.618rem;
    padding: 0.809rem 0;
    border-bottom: 1px solid var(--border-green);
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 1vw, 0.9rem);
}

.registry-row:first-child {
    border-top: 1px solid var(--border-green);
}

.geo-marker {
    display: inline-block;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.geo-marker.triangle {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 14px solid var(--phosphor-green);
}

.geo-marker.hexagon {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 2px solid var(--amber);
    background: transparent;
    box-shadow: inset 0 0 0 2px var(--amber);
}

.geo-marker.circle-marker {
    border-radius: 50%;
    border: 2px solid var(--dim-phosphor);
    position: relative;
}

.geo-marker.circle-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    width: calc(100% + 4px);
    height: 1px;
    background: var(--dim-phosphor);
    transform: rotate(-45deg);
}

.geo-marker.diamond {
    width: 12px;
    height: 12px;
    background: var(--sonar-blue);
    transform: rotate(45deg);
    margin: 0 2px;
}

.reg-id {
    color: var(--amber);
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 90px;
}

.reg-name {
    color: var(--phosphor-green);
    flex: 1;
}

.reg-status {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 90px;
    text-align: right;
}

.reg-status.active { color: var(--phosphor-green); }
.reg-status.pending { color: var(--amber); }
.reg-status.expired { color: var(--dim-phosphor); }
.reg-status.restricted { color: var(--sonar-blue); }

.reg-date {
    color: var(--dim-phosphor);
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    min-width: 80px;
    text-align: right;
}

/* Deep Scan / Sonar */
#deep-scan {
    background: var(--sonar-blue);
}

.sonar-container {
    position: relative;
    width: min(500px, 70vw);
    height: min(500px, 70vw);
    border-radius: 50%;
    overflow: hidden;
    margin-top: 1.618rem;
}

.sonar-ring {
    position: absolute;
    border: 1px solid var(--border-green);
    border-radius: 50%;
}

.ring-1 {
    width: 33.33%;
    height: 33.33%;
    top: 33.33%;
    left: 33.33%;
}

.ring-2 {
    width: 66.66%;
    height: 66.66%;
    top: 16.67%;
    left: 16.67%;
}

.ring-3 {
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.sonar-sweep {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 50%;
    background: conic-gradient(from var(--angle), transparent 0deg, rgba(51, 255, 102, 0.125) 15deg, transparent 30deg);
    animation: sonar-spin 4s linear infinite;
}

@keyframes sonar-spin {
    from { --angle: 0deg; }
    to { --angle: 360deg; }
}

.sonar-label {
    position: absolute;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--amber);
    letter-spacing: 0.1em;
}

.sonar-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--phosphor-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--phosphor-green);
}

/* Archive Core */
#archive-core {
    background: var(--void-black);
}

.archive-columns {
    display: flex;
    gap: 1.618rem;
}

.archive-main {
    flex: 0 0 65%;
}

.archive-main p {
    margin-bottom: 1.618rem;
    color: var(--phosphor-green);
    font-weight: 400;
}

.archive-sidebar {
    flex: 0 0 33%;
    overflow: hidden;
    max-height: 60vh;
    position: relative;
    border-left: 1px solid var(--border-green);
    padding-left: 1.618rem;
}

.diagnostic-scroll {
    animation: diag-scroll 20s linear infinite;
}

@keyframes diag-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.diag-line {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--dim-phosphor);
    padding: 0.4rem 0;
    white-space: nowrap;
}

.diag-ts {
    color: var(--amber);
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 0.7rem;
    margin-right: 0.8rem;
}

/* Transmission End */
#transmission-end {
    background: var(--void-black);
}

.transmission-content {
    font-family: 'IBM Plex Mono', monospace;
}

.end-line {
    color: var(--phosphor-green);
    line-height: 2.5;
}

.end-main {
    font-family: 'Jost', sans-serif;
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--static-white);
    margin-top: 1.618rem;
    line-height: 1.2;
}

.blink-cursor {
    color: var(--phosphor-green);
    font-size: 1.5rem;
    animation: blink 1s step-end infinite;
    display: inline-block;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .section-inner {
        margin-left: 5%;
        padding: 1.618rem 1rem;
    }

    .registry-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .reg-name {
        flex-basis: 100%;
        order: 3;
    }

    .archive-columns {
        flex-direction: column;
    }

    .archive-main {
        flex: 1;
    }

    .archive-sidebar {
        flex: 1;
        border-left: none;
        border-top: 1px solid var(--border-green);
        padding-left: 0;
        padding-top: 1.618rem;
        max-height: 30vh;
    }
}
