/* === CSS Custom Properties === */
:root {
    --bg-primary: #0a0a0f;
    --bg-elevated: #14141f;
    --neon-mint: #00ff9f;
    --neon-magenta: #ff006e;
    --neon-blue: #00b4d8;
    --text-primary: #e8e8f0;
    --text-secondary: #6b6b8d;
    --gold: #ffd700;
    --grid-gap-glow: rgba(0, 255, 159, 0.3);
    --grid-gap-glow-hover: rgba(0, 255, 159, 0.6);
    --signature-gradient: linear-gradient(135deg, #00ff9f 0%, #00b4d8 50%, #ff006e 100%);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.6;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* === Scan Lines Overlay === */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(232, 232, 240, 0.03) 3px,
        rgba(232, 232, 240, 0.03) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* === Vertical Nav Strip === */
#nav-strip {
    position: fixed;
    left: 0;
    top: 0;
    width: 48px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 100;
    background: rgba(10, 10, 15, 0.8);
    border-right: 1px solid rgba(0, 255, 159, 0.1);
}

.nav-icon {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease, filter 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.nav-icon:hover {
    color: var(--neon-mint);
    filter: drop-shadow(0 0 8px rgba(0, 255, 159, 0.5));
}

/* === Scene 1: Hero / Boot Sequence === */
#hero {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 48px;
}

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

#hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 0.04em;
    background: var(--signature-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline;
    line-height: 1.1;
}

#hero-cursor {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--neon-mint);
    animation: blink 1s step-end infinite;
    vertical-align: baseline;
}

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

#hero-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#hero-subtitle.visible {
    opacity: 1;
}

/* === Scene 2-3: Portfolio Grid === */
#grid-section {
    padding-left: 48px;
    min-height: 100vh;
}

#portfolio-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    padding: 2px;
    background: rgba(0, 255, 159, 0.3);
    box-shadow: 0 0 8px var(--grid-gap-glow);
}

.grid-card {
    background: var(--bg-primary);
    padding: clamp(1rem, 3vw, 2.5rem);
    position: relative;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.5s ease, transform 0.5s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.grid-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.grid-card.glow {
    box-shadow: 0 0 16px var(--grid-gap-glow-hover);
}

/* Corner Registration Marks */
.corner-mark {
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: var(--text-secondary);
    border-style: solid;
    border-width: 0;
    transition: border-color 0.3s ease;
}
.corner-mark.tl { top: 6px; left: 6px; border-top-width: 1px; border-left-width: 1px; }
.corner-mark.tr { top: 6px; right: 6px; border-top-width: 1px; border-right-width: 1px; }
.corner-mark.bl { bottom: 6px; left: 6px; border-bottom-width: 1px; border-left-width: 1px; }
.corner-mark.br { bottom: 6px; right: 6px; border-bottom-width: 1px; border-right-width: 1px; }

/* Hero card */
.card-hero {
    grid-column: 1 / 4;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-hero .card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3.5vw, 2.8rem);
    letter-spacing: 0.04em;
    margin-bottom: 1rem;
}

.card-hero .card-body {
    color: var(--text-secondary);
    max-width: 600px;
}

/* Badge cell */
.card-badge {
    grid-column: 4;
    grid-row: 1 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

#circuit-seal {
    animation: seal-rotate 60s linear infinite;
}

@keyframes seal-rotate {
    to { transform: rotate(360deg); }
}

/* Circuit trace animation */
.trace {
    stroke: var(--text-secondary);
    transition: stroke 0.5s ease;
}

.pad {
    fill: var(--text-secondary);
    transition: fill 0.5s ease;
}

@keyframes trace-pulse {
    0%, 100% { stroke: var(--text-secondary); }
    50% { stroke: var(--neon-mint); }
}

@keyframes pad-pulse {
    0%, 100% { fill: var(--text-secondary); }
    50% { fill: var(--neon-mint); }
}

.trace.t1 { animation: trace-pulse 8s ease 0s infinite; }
.trace.t2 { animation: trace-pulse 8s ease 1s infinite; }
.trace.t3 { animation: trace-pulse 8s ease 2s infinite; }
.trace.t4 { animation: trace-pulse 8s ease 3s infinite; }
.trace.t5 { animation: trace-pulse 8s ease 4s infinite; }
.trace.t6 { animation: trace-pulse 8s ease 5s infinite; }
.trace.t7 { animation: trace-pulse 8s ease 6s infinite; }
.trace.t8 { animation: trace-pulse 8s ease 7s infinite; }

/* Category Cards */
.card-category {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.card-category:hover {
    background: var(--bg-elevated);
}

.card-category:hover .corner-mark {
    border-color: var(--text-primary);
}

.card-icon {
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.card-category:hover .card-icon {
    color: var(--neon-mint);
}

.card-category[data-accent="#ff006e"]:hover .card-icon { color: #ff006e; }
.card-category[data-accent="#ffd700"]:hover .card-icon { color: #ffd700; }
.card-category[data-accent="#00ff9f"]:hover .card-icon { color: #00ff9f; }
.card-category[data-accent="#00b4d8"]:hover .card-icon { color: #00b4d8; }

.card-category .card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    letter-spacing: 0.04em;
    transition: text-shadow 0.3s ease;
}

.card-category:hover .card-title {
    text-shadow: 0 0 12px currentColor;
}

.card-data {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

/* Ticker */
.card-ticker {
    grid-column: 1 / 5;
    overflow: hidden;
    padding: clamp(0.75rem, 2vw, 1.5rem);
}

.ticker-wrap {
    overflow: hidden;
    width: 100%;
}

.ticker-content {
    display: inline-flex;
    gap: 3rem;
    white-space: nowrap;
    animation: ticker 60s linear infinite;
}

@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.06em;
}

.ticker-item.verified { color: var(--neon-mint); }
.ticker-item.pending { color: var(--neon-magenta); }
.ticker-item.review { color: var(--neon-blue); }

/* Footer */
.card-footer {
    grid-column: 1 / 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem);
    gap: 2rem;
}

#footer-seal-wrap {
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(var(--bg-primary), var(--bg-primary)) padding-box,
                var(--signature-gradient) border-box;
    animation: border-rotate 4s linear infinite;
    width: 216px;
    height: 216px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes border-rotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

#footer-seal {
    animation: seal-rotate 60s linear infinite;
}

.footer-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    color: var(--text-secondary);
    text-align: center;
}

/* === Responsive === */
@media (max-width: 1024px) {
    #portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .card-hero {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
    }
    .card-badge {
        grid-column: 1 / 3;
        grid-row: auto;
    }
    .card-ticker {
        grid-column: 1 / 3;
    }
    .card-footer {
        grid-column: 1 / 3;
    }
}

@media (max-width: 600px) {
    #nav-strip {
        display: none;
    }
    #hero {
        padding-left: 0;
    }
    #grid-section {
        padding-left: 0;
    }
    #portfolio-grid {
        grid-template-columns: 1fr;
    }
    .card-hero {
        grid-column: 1;
        grid-row: auto;
    }
    .card-badge {
        grid-column: 1;
        grid-row: auto;
    }
    .card-ticker {
        grid-column: 1;
    }
    .card-footer {
        grid-column: 1;
    }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    #hero-cursor { animation: none; opacity: 1; }
    .trace { animation: none; }
    #circuit-seal, #footer-seal { animation: none; }
    .ticker-content { animation: none; }
    #footer-seal-wrap { animation: none; }
    body::after { display: none; }
    .grid-card { opacity: 1; transform: none; transition: none; }
    #hero-subtitle { opacity: 1; transition: none; }
}
