/* ============================================
   TANSO.DAY — Retro Sci-Fi Carbon Control Panel
   Fonts: "Zilla Slab" (Google Fonts), "Work Sans" (Google Fonts), "Fira Code" (Google Fonts)
   ============================================ */

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

:root {
    --panel-black: #0a0a0e;
    --screen-white: #e8e0d0;
    --circuit-green: #4ae848;
    --warning-amber: #e8a830;
    --hud-blue: #4a8ae8;
    --shadow-dark: #141418;
    --glow-green: rgba(74, 232, 72, 0.4);
    --glow-amber: rgba(232, 168, 48, 0.4);
    --glow-blue: rgba(74, 138, 232, 0.4);
}

html {
    scroll-behavior: smooth;
}

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

h1, h2, h3, h4 {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
}

.data-font {
    font-family: 'Fira Code', monospace;
}

/* --- HUD Frame Overlay --- */
#hud-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1000;
}

#hud-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hud-bracket,
.hud-dash,
.hud-crosshair,
.hud-arc {
    opacity: 0;
    animation: hudFadeIn 1.5s ease-out forwards;
}

.hud-bracket {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: hudDraw 1.2s ease-out 0.3s forwards;
}

.hud-dash {
    animation-delay: 0.8s;
}

.hud-crosshair {
    animation-delay: 1.2s;
}

.hud-arc {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: hudDraw 0.8s ease-out 1s forwards;
}

@keyframes hudDraw {
    to {
        stroke-dashoffset: 0;
        opacity: 0.6;
    }
}

@keyframes hudFadeIn {
    to {
        opacity: 0.6;
    }
}

/* HUD Labels */
.hud-label {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: var(--screen-white);
    opacity: 0;
    animation: hudLabelIn 0.5s ease-out 1.5s forwards;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.hud-label-tl { top: 30px; left: 40px; }
.hud-label-tr { top: 30px; right: 40px; }
.hud-label-bl { bottom: 30px; left: 40px; }
.hud-label-br { bottom: 30px; right: 40px; }

@keyframes hudLabelIn {
    to { opacity: 0.7; }
}

.hud-data {
    color: var(--screen-white);
    opacity: 0.7;
}

/* --- LED Indicators --- */
.hud-led {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.hud-led-green {
    background: var(--circuit-green);
    box-shadow: 0 0 6px var(--glow-green), 0 0 12px var(--glow-green);
    animation: ledBlink 3s ease-in-out infinite;
}

.hud-led-amber {
    background: var(--warning-amber);
    box-shadow: 0 0 6px var(--glow-amber), 0 0 12px var(--glow-amber);
    animation: ledBlink 4s ease-in-out infinite 0.5s;
}

.hud-led-blue {
    background: var(--hud-blue);
    box-shadow: 0 0 6px var(--glow-blue), 0 0 12px var(--glow-blue);
    animation: ledBlink 3.5s ease-in-out infinite 1s;
}

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

/* --- Circuit Background --- */
#circuit-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cline x1='0' y1='50' x2='80' y2='50' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='120' y1='50' x2='200' y2='50' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='0' y1='150' x2='60' y2='150' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='140' y1='150' x2='200' y2='150' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='50' y1='0' x2='50' y2='30' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='50' y1='70' x2='50' y2='130' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='50' y1='170' x2='50' y2='200' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='150' y1='0' x2='150' y2='40' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='150' y1='60' x2='150' y2='140' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='150' y1='160' x2='150' y2='200' stroke='%234ae848' stroke-width='1'/%3E%3Ccircle cx='80' cy='50' r='4' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Ccircle cx='120' cy='50' r='4' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Ccircle cx='50' cy='30' r='3' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Ccircle cx='50' cy='70' r='3' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Ccircle cx='150' cy='40' r='3' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Ccircle cx='150' cy='60' r='3' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Ccircle cx='60' cy='150' r='4' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Ccircle cx='140' cy='150' r='4' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Crect x='90' y='90' width='20' height='20' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Cpolyline points='80,50 80,100 90,100' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Cpolyline points='120,50 120,100 110,100' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Cpolyline points='100,110 100,150 60,150' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3C/svg%3E");
    opacity: 0;
    animation: circuitFadeIn 2s ease-out 1.8s forwards;
}

@keyframes circuitFadeIn {
    to { opacity: 0.05; }
}

/* --- Hero Section --- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--panel-black);
    overflow: hidden;
}

#hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

#hero-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(48px, 10vw, 120px);
    color: var(--screen-white);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--circuit-green);
    width: 0;
    animation: typeIn 1.5s steps(9, end) 0.5s forwards, blinkCursor 0.7s step-end infinite;
}

@keyframes typeIn {
    to { width: 100%; }
}

@keyframes blinkCursor {
    0%, 100% { border-color: var(--circuit-green); }
    50% { border-color: transparent; }
}

#hero-subtitle {
    font-size: clamp(12px, 1.5vw, 16px);
    color: var(--circuit-green);
    letter-spacing: 0.15em;
    margin-top: 20px;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 2.2s forwards;
}

#hero-leds {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 30px;
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 2.6s forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#scroll-indicator {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--circuit-green);
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 3s forwards, floatBounce 2s ease-in-out 3.6s infinite;
    z-index: 10;
}

@keyframes floatBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* --- Icon Navigation --- */
#icon-nav {
    position: sticky;
    top: 0;
    z-index: 900;
    display: flex;
    justify-content: center;
    gap: 0;
    background: var(--shadow-dark);
    border-bottom: 1px solid rgba(232, 224, 208, 0.1);
    border-top: 1px solid rgba(232, 224, 208, 0.1);
    padding: 0;
}

.nav-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 28px;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    position: relative;
}

.nav-icon::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--circuit-green);
    box-shadow: 0 0 8px var(--glow-green);
    transition: width 0.3s ease;
}

.nav-icon:hover::after,
.nav-icon.active::after {
    width: 60%;
}

.nav-icon:hover {
    background: rgba(74, 232, 72, 0.05);
}

.nav-icon:hover svg {
    stroke: var(--circuit-green);
}

.nav-icon svg {
    transition: stroke 0.3s ease;
}

.nav-label {
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--screen-white);
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.nav-icon:hover .nav-label {
    opacity: 1;
    color: var(--circuit-green);
}

/* --- Content Sections --- */
.content-section {
    position: relative;
    padding: 80px 60px;
    min-height: 80vh;
}

.content-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cline x1='0' y1='50' x2='80' y2='50' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='120' y1='50' x2='200' y2='50' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='0' y1='150' x2='60' y2='150' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='140' y1='150' x2='200' y2='150' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='50' y1='0' x2='50' y2='30' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='50' y1='70' x2='50' y2='130' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='150' y1='0' x2='150' y2='40' stroke='%234ae848' stroke-width='1'/%3E%3Cline x1='150' y1='60' x2='150' y2='140' stroke='%234ae848' stroke-width='1'/%3E%3Ccircle cx='80' cy='50' r='4' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Ccircle cx='120' cy='50' r='4' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3Crect x='90' y='90' width='20' height='20' fill='none' stroke='%234ae848' stroke-width='1'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 50px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(232, 224, 208, 0.1);
}

.section-led-bar {
    display: flex;
    gap: 6px;
}

.section-title {
    font-size: clamp(24px, 4vw, 48px);
    letter-spacing: 0.08em;
    color: var(--screen-white);
    flex: 1;
}

.section-tag {
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--hud-blue);
    opacity: 0.6;
}

/* --- Panel Grid --- */
.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.panel-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

/* --- Tilt Panels --- */
.tilt-panel {
    background: var(--shadow-dark);
    border: 1px solid rgba(232, 224, 208, 0.08);
    padding: 30px;
    position: relative;
    transition: transform 0.1s ease-out, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    perspective: 800px;
}

.tilt-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--circuit-green), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tilt-panel:hover::before {
    opacity: 0.6;
}

.tilt-panel:hover {
    box-shadow: 0 0 20px rgba(74, 232, 72, 0.05), inset 0 0 30px rgba(74, 232, 72, 0.02);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 10px;
    letter-spacing: 2px;
}

.panel-id {
    color: var(--hud-blue);
    opacity: 0.6;
}

.tilt-panel h3 {
    font-size: clamp(18px, 2vw, 24px);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
    color: var(--screen-white);
}

.tilt-panel p {
    color: rgba(232, 224, 208, 0.75);
    margin-bottom: 16px;
    line-height: 1.75;
}

.panel-data {
    display: flex;
    gap: 16px;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--circuit-green);
    padding-top: 12px;
    border-top: 1px solid rgba(232, 224, 208, 0.06);
}

/* --- Carbon Cycle Section --- */
.cycle-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    padding: 40px 0;
}

.cycle-node {
    flex: 0 0 220px;
    text-align: center;
    padding: 24px;
}

.cycle-node h3 {
    font-size: 13px;
    letter-spacing: 2px;
    margin: 12px 0 8px;
    color: var(--circuit-green);
}

.cycle-node p {
    font-size: 13px;
    line-height: 1.6;
    color: rgba(232, 224, 208, 0.65);
    margin-bottom: 12px;
}

.cycle-icon {
    display: flex;
    justify-content: center;
}

.cycle-value {
    display: inline-block;
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--warning-amber);
    padding: 4px 12px;
    border: 1px solid rgba(232, 168, 48, 0.3);
}

.cycle-connector {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.cycle-node-atm .cycle-value { color: var(--circuit-green); border-color: rgba(74, 232, 72, 0.3); }
.cycle-node-bio .cycle-value { color: var(--circuit-green); border-color: rgba(74, 232, 72, 0.3); }
.cycle-node-geo .cycle-value { color: var(--warning-amber); border-color: rgba(232, 168, 48, 0.3); }
.cycle-node-hydro .cycle-value { color: var(--hud-blue); border-color: rgba(74, 138, 232, 0.3); }

/* --- Tech Section --- */
.tech-stat {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tech-bar {
    flex: 1;
    height: 4px;
    background: rgba(232, 224, 208, 0.08);
    position: relative;
    overflow: hidden;
}

.tech-bar-fill {
    height: 100%;
    width: 0;
    background: var(--circuit-green);
    box-shadow: 0 0 8px var(--glow-green);
    transition: width 1.5s ease-out;
}

.tech-stat .data-font {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--circuit-green);
    white-space: nowrap;
}

/* --- Data Dashboard --- */
.data-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.data-card {
    text-align: center;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.data-card-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--hud-blue);
    opacity: 0.7;
}

.data-card-value {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(32px, 4vw, 56px);
    color: var(--screen-white);
    line-height: 1.1;
}

.data-card-unit {
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--circuit-green);
    opacity: 0.7;
}

/* --- Footer --- */
#site-footer {
    padding: 40px 60px;
    border-top: 1px solid rgba(232, 224, 208, 0.08);
    background: var(--shadow-dark);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

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

.footer-logo {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.1em;
    color: var(--screen-white);
}

.footer-tagline {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--hud-blue);
    opacity: 0.5;
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--screen-white);
    opacity: 0.5;
}

.footer-divider {
    opacity: 0.3;
}

/* --- Scroll Reveal --- */
.content-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.content-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-section {
        padding: 50px 24px;
    }

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

    .panel-grid-2 {
        grid-template-columns: 1fr;
    }

    .cycle-diagram {
        flex-direction: column;
        align-items: center;
    }

    .cycle-connector {
        transform: rotate(90deg);
    }

    .cycle-node {
        flex: 0 0 auto;
        width: 100%;
        max-width: 320px;
    }

    #icon-nav {
        gap: 0;
        overflow-x: auto;
    }

    .nav-icon {
        padding: 12px 16px;
    }

    .hud-label {
        font-size: 8px;
    }

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

    .data-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }

    #site-footer {
        padding: 30px 24px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-brand {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .data-dashboard {
        grid-template-columns: 1fr;
    }

    .panel-data {
        flex-wrap: wrap;
        gap: 8px;
    }
}
