/* ========================================
   Global Tone Check - Styles
   Avant-garde HUD Diagnostic Interface
   ======================================== */

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

:root {
    --ocean-deep: #0A1A3A;
    --diagnostic-cyan: #00D4FF;
    --optimist-gold: #FFD23F;
    --alert-pink: #FF3366;
    --marble-white: #E8E4DC;
    --grid-blue: #1A3A5A;
    --scan-green: #39FF8A;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--ocean-deep);
    color: var(--marble-white);
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.75;
    overflow-x: hidden;
}

/* --- Hero Viewport --- */
.hero-viewport {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--ocean-deep);
}

/* --- HUD Rings --- */
.hud-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(80vw, 800px);
    height: min(80vw, 800px);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

.hud-ring {
    fill: none;
    stroke: var(--diagnostic-cyan);
    stroke-width: 1;
    opacity: 0.3;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.hud-ring.active {
    animation: drawRing 1s ease-out forwards;
}

.hud-ring-1.active { animation-delay: 0.5s; }
.hud-ring-2.active { animation-delay: 0.7s; }
.hud-ring-3.active { animation-delay: 0.9s; }

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

.hud-crosshair {
    stroke: var(--diagnostic-cyan);
    stroke-width: 0.5;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hud-crosshair.active {
    opacity: 0.25;
}

.hud-corner-mark {
    fill: none;
    stroke: var(--diagnostic-cyan);
    stroke-width: 1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.hud-corner-mark.active {
    opacity: 0.4;
}

/* --- Scan Line --- */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--diagnostic-cyan);
    opacity: 0;
    z-index: 5;
    transform: translateY(-100%);
    pointer-events: none;
}

.scan-line.sweeping {
    opacity: 0.15;
    animation: scanSweep 3s linear forwards;
}

.scan-line.looping {
    opacity: 0.15;
    animation: scanSweep 3s linear infinite;
    animation-delay: 0s;
}

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

/* --- HUD Readouts --- */
.hud-readout {
    position: absolute;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

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

.hud-readout-tl { top: 30px; left: 30px; }
.hud-readout-tr { top: 30px; right: 30px; text-align: right; align-items: flex-end; }
.hud-readout-bl { bottom: 80px; left: 30px; }
.hud-readout-br { bottom: 80px; right: 30px; text-align: right; align-items: flex-end; }

.hud-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--diagnostic-cyan);
    opacity: 0.6;
    text-transform: uppercase;
}

.hud-value {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--marble-white);
}

/* --- Hero Title --- */
.hero-title-wrap {
    position: relative;
    z-index: 10;
    text-align: center;
    will-change: transform;
}

.hero-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(32px, 6vw, 80px);
    line-height: 1.05;
    color: var(--marble-white);
    letter-spacing: -0.02em;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.title-line {
    display: block;
}

.hero-subtitle {
    font-family: 'Space Mono', monospace;
    font-size: clamp(11px, 1.2vw, 14px);
    letter-spacing: 4px;
    color: var(--diagnostic-cyan);
    text-transform: uppercase;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.6s ease 2s;
}

.hero-subtitle.visible {
    opacity: 0.8;
}

/* Character-by-character rendering */
.char-reveal {
    display: inline-block;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.char-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.char-reveal.space {
    width: 0.3em;
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.scroll-indicator.visible {
    opacity: 0.5;
}

.scroll-text {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 3px;
    color: var(--diagnostic-cyan);
}

.scroll-arrow {
    width: 12px;
    height: 12px;
    border-right: 1px solid var(--diagnostic-cyan);
    border-bottom: 1px solid var(--diagnostic-cyan);
    transform: rotate(45deg);
    animation: pulseArrow 2s ease-in-out infinite;
}

@keyframes pulseArrow {
    0%, 100% { opacity: 0.3; transform: rotate(45deg) translateY(0); }
    50% { opacity: 1; transform: rotate(45deg) translateY(4px); }
}

/* --- Analysis Section --- */
.analysis-section {
    position: relative;
    padding: 100px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 60px;
}

.section-label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 4px;
    color: var(--diagnostic-cyan);
    text-transform: uppercase;
    white-space: nowrap;
}

.section-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--diagnostic-cyan), transparent);
    opacity: 0.3;
}

/* --- HUD Panels --- */
.hud-panel {
    position: relative;
    margin-bottom: 80px;
    padding: 40px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    clip-path: polygon(
        12px 0, calc(100% - 12px) 0,
        100% 12px, 100% calc(100% - 12px),
        calc(100% - 12px) 100%, 12px 100%,
        0 calc(100% - 12px), 0 12px
    );
    background: rgba(10, 26, 58, 0.8);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hud-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 212, 255, 0.02) 2px,
        rgba(0, 212, 255, 0.02) 4px
    );
    pointer-events: none;
    z-index: 0;
}

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

/* Panel Corners */
.panel-corner {
    position: absolute;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    letter-spacing: 1px;
    color: var(--diagnostic-cyan);
    opacity: 0.5;
    z-index: 2;
}

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

/* Panel Scan Line */
.panel-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--diagnostic-cyan);
    opacity: 0;
    transform: translateY(0);
    pointer-events: none;
    z-index: 3;
}

.hud-panel.in-view .panel-scan-line {
    opacity: 0.15;
    animation: panelScan 3s linear infinite;
    animation-delay: 0s;
}

@keyframes panelScan {
    0% { transform: translateY(0); }
    100% { transform: translateY(var(--panel-height, 300px)); }
}

/* Panel Content Layout */
.panel-content {
    display: flex;
    gap: 40px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.crystal-shape-container {
    flex-shrink: 0;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crystal-shape {
    width: 140px;
    height: 140px;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.hud-panel.in-view .crystal-shape {
    opacity: 1;
    transform: scale(1);
}

.crystal-poly {
    fill: none;
    stroke: var(--diagnostic-cyan);
    stroke-width: 1.5;
    opacity: 0.7;
}

.hud-panel[data-dimension="warmth"] .crystal-poly {
    stroke: var(--optimist-gold);
}

.hud-panel[data-dimension="authority"] .crystal-poly {
    stroke: var(--alert-pink);
}

.hud-panel[data-dimension="clarity"] .crystal-poly {
    stroke: var(--scan-green);
}

.hud-panel[data-dimension="empathy"] .crystal-poly {
    stroke: var(--diagnostic-cyan);
}

.panel-text {
    flex: 1;
}

.panel-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: clamp(24px, 3vw, 36px);
    color: var(--marble-white);
    margin-bottom: 16px;
}

.panel-desc {
    color: rgba(232, 228, 220, 0.75);
    margin-bottom: 24px;
    max-width: 600px;
}

/* Metric Bars */
.panel-metric {
    display: flex;
    align-items: center;
    gap: 16px;
}

.metric-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--diagnostic-cyan);
    white-space: nowrap;
}

.metric-bar {
    flex: 1;
    max-width: 300px;
    height: 3px;
    background: rgba(0, 212, 255, 0.15);
    position: relative;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    width: 0%;
    transition: width 1.2s ease-out;
}

.hud-panel[data-dimension="warmth"] .metric-fill { background: var(--optimist-gold); }
.hud-panel[data-dimension="authority"] .metric-fill { background: var(--alert-pink); }
.hud-panel[data-dimension="clarity"] .metric-fill { background: var(--scan-green); }
.hud-panel[data-dimension="empathy"] .metric-fill { background: var(--diagnostic-cyan); }

.hud-panel.in-view .metric-fill {
    width: calc(var(--metric-value, 0) * 1%);
}

.metric-value {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    color: var(--marble-white);
    min-width: 40px;
    text-align: right;
}

/* --- Insights / Marble Section --- */
.insights-section {
    position: relative;
    padding: 100px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.marble-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.marble-panel {
    position: relative;
    padding: 40px 30px;
    overflow: hidden;
    clip-path: inset(100% 0 0 0);
    transition: clip-path 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.marble-panel.revealed {
    clip-path: inset(0 0 0 0);
}

.marble-texture {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(232, 228, 220, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(200, 195, 185, 0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 80%, rgba(220, 215, 205, 0.1) 0%, transparent 45%),
        radial-gradient(ellipse at 40% 30%, rgba(180, 175, 170, 0.06) 0%, transparent 55%),
        linear-gradient(135deg, rgba(232, 228, 220, 0.04) 0%, rgba(26, 58, 90, 0.3) 50%, rgba(232, 228, 220, 0.04) 100%);
    z-index: 0;
}

.marble-content {
    position: relative;
    z-index: 1;
}

.marble-number {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 48px;
    color: var(--optimist-gold);
    opacity: 0.3;
    display: block;
    margin-bottom: 12px;
}

.marble-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: clamp(20px, 2vw, 26px);
    color: var(--marble-white);
    margin-bottom: 12px;
}

.marble-desc {
    color: rgba(232, 228, 220, 0.7);
    font-size: clamp(13px, 1.3vw, 15px);
    line-height: 1.7;
}

/* --- Profile Section --- */
.profile-section {
    position: relative;
    padding: 100px 40px 80px;
    max-width: 1200px;
    margin: 0 auto;
}

.profile-display {
    display: flex;
    gap: 60px;
    align-items: center;
}

.profile-visual {
    flex-shrink: 0;
    width: 360px;
    height: 360px;
}

.composite-shape {
    width: 100%;
    height: 100%;
}

.composite-poly {
    fill: rgba(0, 212, 255, 0.08);
    stroke: var(--diagnostic-cyan);
    stroke-width: 2;
    opacity: 0;
    transition: opacity 0.8s ease, d 1s ease;
}

.composite-poly.visible {
    opacity: 1;
}

.composite-center {
    fill: var(--diagnostic-cyan);
    opacity: 0.6;
}

.composite-axis {
    stroke: var(--grid-blue);
    stroke-width: 1;
    stroke-dasharray: 4, 4;
    opacity: 0.4;
}

.composite-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    fill: var(--diagnostic-cyan);
    opacity: 0.6;
}

.profile-summary {
    flex: 1;
}

.hud-readout-inline {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
}

.hud-readout-inline .hud-label {
    min-width: 120px;
}

.profile-score {
    color: var(--optimist-gold);
    font-size: 16px;
    font-weight: 700;
}

.profile-confidence {
    color: var(--scan-green);
}

.profile-coherence {
    color: var(--scan-green);
}

.profile-description {
    margin-top: 24px;
    color: rgba(232, 228, 220, 0.7);
    line-height: 1.8;
}

.profile-description strong {
    color: var(--optimist-gold);
    font-weight: 600;
}

/* --- Footer --- */
.site-footer {
    padding: 40px;
    border-top: 1px solid rgba(0, 212, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-hud {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-label {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 2px;
    color: var(--marble-white);
}

.footer-divider {
    color: rgba(0, 212, 255, 0.3);
    font-family: 'Space Mono', monospace;
}

.footer-data {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--diagnostic-cyan);
    opacity: 0.6;
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--grid-blue);
}

.status-dot-active {
    background: var(--scan-green);
    box-shadow: 0 0 8px rgba(57, 255, 138, 0.5);
    animation: dotPulse 2s ease-in-out infinite;
}

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

.status-text {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--scan-green);
    opacity: 0.7;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .panel-content {
        flex-direction: column;
        text-align: center;
    }

    .crystal-shape-container {
        width: 120px;
        height: 120px;
    }

    .crystal-shape {
        width: 100px;
        height: 100px;
    }

    .panel-metric {
        flex-direction: column;
        align-items: stretch;
    }

    .metric-bar {
        max-width: 100%;
    }

    .metric-value {
        text-align: center;
    }

    .marble-grid {
        grid-template-columns: 1fr;
    }

    .profile-display {
        flex-direction: column;
        align-items: center;
    }

    .profile-visual {
        width: 280px;
        height: 280px;
    }

    .hud-readout-inline {
        flex-direction: column;
        gap: 4px;
    }

    .site-footer {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .footer-hud {
        flex-wrap: wrap;
        justify-content: center;
    }

    .analysis-section,
    .insights-section,
    .profile-section {
        padding: 60px 20px;
    }

    .hud-panel {
        padding: 30px 20px;
    }
}

@media (max-width: 600px) {
    .hud-readout-tl,
    .hud-readout-tr,
    .hud-readout-bl,
    .hud-readout-br {
        display: none;
    }

    .hud-rings {
        width: 120vw;
        height: 120vw;
    }
}
