/* ============================================================
   tsundere.dev — Stellar Navigation Terminal
   Palette: Ethereal Blue / Phosphor Void
   ============================================================ */

@property --heading-weight {
    syntax: '<number>';
    initial-value: 300;
    inherits: false;
}

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

:root {
    --void-black:    #04060F;
    --stellar-dark:  #080D1E;
    --deep-indigo:   #0D1535;
    --night-cobalt:  #111D47;
    --phosphor-blue: #3B82F6;
    --ice-cyan:      #67E8F9;
    --stellar-teal:  #0F9BAF;
    --faded-slate:   #4A5A8A;
    --mist-white:    #C7D2F0;
    --cathode-amber: #F59E0B;
    --star-white:    #EEF2FF;
    --tsundere-red:  #E63757;

    --font-display: 'Big Shoulders Display', sans-serif;
    --font-mono:    'Space Mono', monospace;
    --font-numeric: 'Orbitron', sans-serif;

    --margin-main: 80px;
    --panel-skew: 4deg;
    --panel-overlap: 7vh;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void-black);
    color: var(--mist-white);
    font-family: var(--font-mono);
    overflow-x: hidden;
    position: relative;
}

/* SVG noise texture overlay — CRT phosphor grain */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
}

/* ---- Star Canvas ---- */
#star-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ---- Navigation ---- */
#nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px var(--margin-main);
    border-bottom: 1px solid rgba(59, 130, 246, 0.12);
    background: rgba(4, 6, 15, 0.85);
    backdrop-filter: blur(8px);
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--mist-white);
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-item {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--faded-slate);
    cursor: pointer;
    transition: color 0.3s ease;
}

.nav-item:hover {
    color: var(--cathode-amber);
}

/* ---- Panel Base ---- */
.panel {
    position: relative;
    min-height: 100vh;
    z-index: 1;
    padding: 120px var(--margin-main) 100px;
    overflow: hidden;
}

.panel-inner {
    position: relative;
    z-index: 2;
    max-width: 1400px;
}

/* Clipped panel edges — 4-degree instrument-panel skew */
.panel::before,
.panel::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 80px;
    z-index: 3;
    pointer-events: none;
}

/* ---- Section Headers ---- */
.section-header {
    display: flex;
    align-items: baseline;
    gap: 20px;
    margin-bottom: 60px;
}

.section-num {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--phosphor-blue);
}

.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 48px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--mist-white);
}

/* ============================================================
   PANEL 1 — HERO / STAR NAVIGATION CONSOLE
   ============================================================ */
.panel-hero {
    background-color: var(--void-black);
    clip-path: polygon(0 0, 100% 0, 100% 96%, 0 100%);
    padding-top: 80px;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
}

.hero-title-block {
    position: absolute;
    top: 20%;
    left: var(--margin-main);
    z-index: 5;
}

.hero-label {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--phosphor-blue);
    margin-bottom: 12px;
}

.hero-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 80px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--mist-white);
    line-height: 1;
    margin-bottom: 16px;
}

.hero-slash {
    color: var(--phosphor-blue);
    margin: 0 4px;
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--faded-slate);
}

/* Star map */
.star-map-container {
    position: absolute;
    top: 50%;
    right: var(--margin-main);
    transform: translateY(-50%);
    width: 55%;
    max-width: 800px;
    z-index: 4;
}

#star-map {
    width: 100%;
    height: auto;
    display: block;
}

/* Constellation lines — drawn in via stroke-dashoffset */
.c-line {
    stroke: var(--stellar-teal);
    stroke-width: 0.5;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 1.8s ease forwards;
}

.c-line:nth-child(1)  { animation-delay: 0.0s; }
.c-line:nth-child(2)  { animation-delay: 0.1s; }
.c-line:nth-child(3)  { animation-delay: 0.2s; }
.c-line:nth-child(4)  { animation-delay: 0.3s; }
.c-line:nth-child(5)  { animation-delay: 0.4s; }
.c-line:nth-child(6)  { animation-delay: 0.5s; }
.c-line:nth-child(7)  { animation-delay: 0.6s; }
.c-line:nth-child(8)  { animation-delay: 0.7s; }
.c-line:nth-child(9)  { animation-delay: 0.8s; }
.c-line:nth-child(10) { animation-delay: 0.9s; }
.c-line:nth-child(11) { animation-delay: 1.0s; }
.c-line:nth-child(12) { animation-delay: 1.1s; }

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

/* Star nodes */
.star-ring {
    fill: none;
    stroke: var(--stellar-teal);
    stroke-width: 0.75;
    opacity: 0.2;
    transition: opacity 0.3s ease, stroke 0.3s ease;
}

.star-dot {
    fill: var(--star-white);
    transition: fill 0.3s ease, r 0.3s ease;
}

.star-label {
    font-family: var(--font-mono);
    font-size: 9px;
    fill: var(--faded-slate);
    letter-spacing: 0.06em;
    transition: fill 0.3s ease;
}

.scan-grid line {
    stroke: var(--mist-white);
    stroke-width: 0.5;
}

/* Star node hover */
.star-node {
    cursor: crosshair;
}

.star-node:hover .star-ring {
    opacity: 0.6;
    stroke: var(--ice-cyan);
}

.star-node:hover .star-dot {
    fill: var(--cathode-amber);
}

.star-node:hover .star-label {
    fill: var(--ice-cyan);
}

/* Star tooltip */
.star-tooltip {
    position: fixed;
    z-index: 200;
    background: rgba(8, 13, 30, 0.95);
    border: 1px solid var(--phosphor-blue);
    padding: 10px 16px;
    pointer-events: none;
    min-width: 200px;
}

.star-tooltip.hidden {
    display: none;
}

.tooltip-name {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ice-cyan);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.tooltip-data {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--faded-slate);
    letter-spacing: 0.04em;
}

/* ============================================================
   PANEL 2 — SIGNAL ARRAY
   ============================================================ */
.panel-signal {
    background-color: var(--stellar-dark);
    clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
    margin-top: -var(--panel-overlap);
    padding-top: 140px;
    padding-bottom: 140px;
}

/* Dial cluster — asymmetric absolute-position layout */
.dial-cluster {
    position: relative;
    width: 100%;
    height: 600px;
    perspective: 1000px;
}

.dial-item {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.dial-1 { top: 40px;  left: 80px; }
.dial-2 { top: 200px; left: 320px; }
.dial-3 { top: 60px;  left: 580px; }
.dial-4 { top: 320px; left: 140px; }
.dial-5 { top: 280px; left: 700px; }

.dial-icon {
    width: 64px;
    height: 64px;
    transition: transform 0.4s ease;
}

.dial-icon svg {
    width: 64px;
    height: 64px;
}

.glyph-active {
    transition: opacity 0.6s ease;
}

.glyph-dormant {
    transition: opacity 0.6s ease;
}

.dial-item.active .glyph-dormant {
    opacity: 0;
}

.dial-item.active .glyph-active {
    opacity: 1 !important;
}

.dial-title {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--mist-white);
    text-transform: uppercase;
}

.dial-desc {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    color: var(--faded-slate);
    max-width: 200px;
    line-height: 1.5;
}

.dial-item:hover .dial-title {
    color: var(--cathode-amber);
}

.dial-item:hover .dial-icon {
    transform: scale(1.1);
}

/* ============================================================
   PANEL 3 — TELEMETRY STREAM
   ============================================================ */
.panel-telemetry {
    background-color: var(--deep-indigo);
    clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
    padding-top: 140px;
    padding-bottom: 160px;
    position: relative;
}

/* Teal accent line on diagonal edge */
.panel-telemetry::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--stellar-teal);
    transform: skewY(-4deg);
    transform-origin: top left;
    z-index: 10;
}

.telemetry-heading {
    font-weight: 200;
    font-size: 48px;
    color: rgba(199, 210, 240, 0.6);
}

/* Two-column layout */
.telemetry-columns {
    display: flex;
    gap: 0;
    margin-bottom: 80px;
    align-items: flex-start;
}

.telemetry-col {
    flex: 0 0 380px;
    width: 380px;
}

.telemetry-col:last-child {
    margin-left: 60px;
}

.telemetry-divider {
    flex: 0 0 60px;
    width: 60px;
    display: flex;
    justify-content: center;
    padding-top: 8px;
    position: relative;
}

.telemetry-line {
    width: 1px;
    height: 100%;
    min-height: 200px;
    background: var(--phosphor-blue);
    position: absolute;
    left: 50%;
    top: 0;
}

.telemetry-body {
    font-family: var(--font-mono);
    font-size: 15px;
    letter-spacing: 0.05em;
    color: var(--mist-white);
    line-height: 1.8;
    margin-bottom: 24px;
}

/* Telemetry readouts row */
.telemetry-readouts {
    display: flex;
    align-items: baseline;
    gap: 24px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(59, 130, 246, 0.15);
    padding-top: 40px;
}

.readout-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.readout-value {
    font-family: var(--font-numeric);
    font-size: 36px;
    font-weight: 700;
    color: var(--phosphor-blue);
    letter-spacing: 0.05em;
    line-height: 1;
}

.readout-unit {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--stellar-teal);
    letter-spacing: 0.06em;
}

.readout-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--faded-slate);
    letter-spacing: 0.08em;
}

.readout-sep {
    font-family: var(--font-mono);
    font-size: 24px;
    color: var(--phosphor-blue);
    opacity: 0.4;
    align-self: center;
}

.orbitron {
    font-family: var(--font-numeric) !important;
}

/* ============================================================
   PANEL 4 — ICON MANIFEST / PORTFOLIO
   ============================================================ */
.panel-manifest {
    background-color: var(--night-cobalt);
    clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
    padding-top: 140px;
    padding-bottom: 140px;
    overflow: hidden;
}

/* Horizontal scrolling card track */
.card-track-wrapper {
    overflow: hidden;
    padding-bottom: 20px;
    margin: 0 calc(-1 * var(--margin-main));
    padding-left: var(--margin-main);
}

.card-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 24px;
    padding-right: var(--margin-main);
    scrollbar-width: thin;
    scrollbar-color: var(--faded-slate) transparent;
    -webkit-overflow-scrolling: touch;
}

.card-track::-webkit-scrollbar {
    height: 4px;
}

.card-track::-webkit-scrollbar-track {
    background: transparent;
}

.card-track::-webkit-scrollbar-thumb {
    background: var(--faded-slate);
    border-radius: 2px;
}

/* Project cards */
.project-card {
    flex: 0 0 320px;
    width: 320px;
    min-height: 440px;
    background: var(--deep-indigo);
    scroll-snap-align: start;
    padding: 32px 28px 28px;
    clip-path: polygon(0 8deg, 100% 0%, 100% 100%, 0 100%);
    clip-path: polygon(0 40px, 100% 0, 100% 100%, 0 100%);
    position: relative;
    transition: box-shadow 0.4s ease;
    cursor: pointer;
}

.project-card:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.project-card:hover .card-accent-line {
    background: var(--cathode-amber);
}

.project-card:hover .card-icon svg path,
.project-card:hover .card-icon svg circle,
.project-card:hover .card-icon svg line,
.project-card:hover .card-icon svg rect {
    stroke: var(--phosphor-blue);
}

.card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 20px;
    margin-top: 20px;
}

.card-icon svg {
    width: 48px;
    height: 48px;
}

.card-accent-line {
    width: 32px;
    height: 1px;
    background: var(--faded-slate);
    margin-bottom: 16px;
    transition: background 0.4s ease;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 28px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mist-white);
    margin-bottom: 16px;
    line-height: 1.1;
}

.card-desc {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--faded-slate);
    line-height: 1.7;
    margin-bottom: 24px;
    flex-grow: 1;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.card-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--stellar-teal);
    text-transform: uppercase;
}

.card-slash {
    color: var(--phosphor-blue);
    font-size: 14px;
}

/* ============================================================
   PANEL 5 — CONTACT UPLINK
   ============================================================ */
.panel-uplink {
    background-color: var(--stellar-dark);
    clip-path: polygon(0 4%, 100% 0, 100% 100%, 0 100%);
    padding-top: 140px;
    padding-bottom: 120px;
}

.uplink-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 40px;
    max-width: 600px;
    margin-left: 60px;
}

.uplink-frequency {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.freq-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--faded-slate);
    text-transform: uppercase;
}

.freq-display {
    font-family: var(--font-numeric);
    font-size: 160px;
    font-weight: 700;
    color: var(--phosphor-blue);
    line-height: 0.9;
    letter-spacing: -0.02em;
}

.freq-unit {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--stellar-teal);
}

.uplink-decoded {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.decoded-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--faded-slate);
    text-transform: uppercase;
}

.contact-address {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.06em;
    color: var(--ice-cyan);
}

/* Uplink button — instrument panel style */
.uplink-button {
    display: inline-block;
    padding: 14px 32px;
    background: transparent;
    border: 1px solid var(--phosphor-blue);
    color: var(--mist-white);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    transition: background 0.3s ease, color 0.3s ease, clip-path 0.4s ease;
}

.uplink-button:hover {
    background: var(--phosphor-blue);
    color: var(--void-black);
    clip-path: polygon(0 0, 95% 0, 100% 50%, 95% 100%, 0 100%);
}

.uplink-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--stellar-teal);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.status-text {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--faded-slate);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--void-black);
    padding: 32px var(--margin-main);
    border-top: 1px solid rgba(59, 130, 246, 0.1);
    z-index: 1;
    position: relative;
}

.footer-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-logo {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--mist-white);
}

.footer-sep {
    color: var(--phosphor-blue);
    font-size: 16px;
}

.footer-sector,
.footer-copy {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--faded-slate);
}

/* ============================================================
   BREATHING ANIMATION — Continuous clip-path morph
   ============================================================ */
@keyframes breatheEdge {
    0%, 100% { clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%); }
    50%       { clip-path: polygon(0 4.8%, 100% 0, 100% 95.2%, 0 100%); }
}

.panel-signal {
    animation: breatheEdge 4s ease-in-out infinite;
}

/* ============================================================
   INTERSECTION OBSERVER ENTRY STATES
   ============================================================ */
.section-title {
    transition: font-weight 0.6s ease, --heading-weight 0.8s ease;
}

/* Readout values — before animation triggered */
.readout-value {
    transition: color 0.5s ease;
}

/* ============================================================
   SCROLLBAR GLOBAL
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--void-black);
}

::-webkit-scrollbar-thumb {
    background: var(--faded-slate);
    border-radius: 3px;
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 1100px) {
    :root {
        --margin-main: 40px;
    }

    .hero-name {
        font-size: 56px;
    }

    .star-map-container {
        width: 50%;
        right: 40px;
    }

    .dial-cluster {
        height: 700px;
    }

    .dial-3 { left: 400px; }
    .dial-5 { left: 500px; }

    .telemetry-columns {
        flex-direction: column;
        gap: 32px;
    }

    .telemetry-col {
        flex: none;
        width: 100%;
    }

    .telemetry-col:last-child {
        margin-left: 0;
    }

    .telemetry-divider {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --margin-main: 24px;
    }

    .hero-name {
        font-size: 40px;
    }

    .star-map-container {
        display: none;
    }

    .hero-title-block {
        position: static;
        padding-top: 100px;
    }

    .panel-hero {
        padding-top: 80px;
    }

    .dial-cluster {
        position: static;
        height: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 40px;
    }

    .dial-item {
        position: static;
    }

    .uplink-content {
        margin-left: 0;
    }

    .freq-display {
        font-size: 80px;
    }

    .section-title {
        font-size: 32px;
    }
}
