/* Dark theme (default) */
:root {
    --c-bg-rgb: 19 19 19;
    --c-surface-rgb: 19 19 19;
    --c-surface-container: #201f1f;
    --c-surface-container-low: #1c1b1b;
    --c-surface-container-high: #2a2a2a;
    --c-surface-container-highest-rgb: 53 53 52;
    --c-surface-container-lowest: #0e0e0e;
    --c-surface-bright: #3a3939;
    --c-on-surface: #e5e2e1;
    --c-on-surface-variant-rgb: 186 201 204;
    --c-outline-variant-rgb: 59 73 76;
    --c-outline: #849396;
    --c-primary-rgb: 195 245 255;
    --c-on-primary: #00363d;
    --c-secondary-container: #474746;
    --c-on-secondary-container: #b7b5b4;
    --c-inverse-surface: #e5e2e1;
    --c-inverse-on-surface: #313030;
    --c-tertiary-rgb: 255 234 192;
    --c-tertiary-fixed-dim: #f3bf26;
}

/* Light theme */
html.light {
    --c-bg-rgb: 255 255 255;
    --c-surface-rgb: 248 248 248;
    --c-surface-container: #e8e8e8;
    --c-surface-container-low: #efefef;
    --c-surface-container-high: #d8d8d8;
    --c-surface-container-highest-rgb: 210 210 210;
    --c-surface-container-lowest: #f4f4f4;
    --c-surface-bright: #ffffff;
    --c-on-surface: #131313;
    --c-on-surface-variant-rgb: 59 84 87;
    --c-outline-variant-rgb: 160 175 178;
    --c-outline: #5a7074;
    --c-primary-rgb: 0 104 117;
    --c-on-primary: #ffffff;
    --c-secondary-container: #e0e0e0;
    --c-on-secondary-container: #303030;
    --c-inverse-surface: #313030;
    --c-inverse-on-surface: #f0eded;
    --c-tertiary-rgb: 122 85 0;
    --c-tertiary-fixed-dim: #7a5500;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

body {
    background-color: rgb(var(--c-bg-rgb));
    color: var(--c-on-surface);
}

nav {
    background-color: rgb(var(--c-bg-rgb) / 0.7) !important;
}

.mono-border {
    border: 1px solid rgba(59, 73, 76, 0.15);
}

.scanline {
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 218, 243, 0.03) 50%);
    background-size: 100% 4px;
}

/* Grid background texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgb(var(--c-outline-variant-rgb) / 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgb(var(--c-outline-variant-rgb) / 0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

html.light body::before {
    background-image:
        linear-gradient(rgb(var(--c-outline-variant-rgb) / 0.10) 1px, transparent 1px),
        linear-gradient(90deg, rgb(var(--c-outline-variant-rgb) / 0.10) 1px, transparent 1px);
}

main, nav, footer {
    position: relative;
    z-index: 1;
}

/* Primary glow on key text */
.text-primary {
    text-shadow: 0 0 18px rgb(var(--c-primary-rgb) / 0.35);
}

html.light .text-primary {
    text-shadow: none;
}

/* Glow pulse on the status dot */
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 4px 1px rgb(var(--c-primary-rgb) / 0.5); opacity: 1; }
    50% { box-shadow: 0 0 10px 3px rgb(var(--c-primary-rgb) / 0.9); opacity: 0.7; }
}

.animate-pulse {
    animation: glow-pulse 2s ease-in-out infinite !important;
}

/* Hero radial glow */
#work {
    position: relative;
}

section:first-of-type::before {
    content: '';
    position: absolute;
    top: -120px;
    left: -200px;
    width: 700px;
    height: 700px;
    background: radial-gradient(ellipse, rgb(var(--c-primary-rgb) / 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

section:first-of-type > * {
    position: relative;
    z-index: 1;
}

html.light section:first-of-type::before {
    background: radial-gradient(ellipse, rgb(var(--c-primary-rgb) / 0.04) 0%, transparent 70%);
}

/* Card hover glow */
.group:hover .relative.overflow-hidden {
    box-shadow: 0 0 0 1px rgb(var(--c-primary-rgb) / 0.2), 0 8px 32px rgb(var(--c-primary-rgb) / 0.08);
    transition: box-shadow 0.4s ease;
}

/* Project cards hover glow */
.bg-surface-container {
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.bg-surface-container:hover {
    box-shadow: 0 0 0 1px rgb(var(--c-tertiary-rgb) / 0.15), 0 12px 40px rgb(0 0 0 / 0.25);
}

html.light .bg-surface-container:hover {
    box-shadow: 0 0 0 1px rgb(var(--c-tertiary-rgb) / 0.25), 0 8px 24px rgb(0 0 0 / 0.08);
}

/* Stronger CTA scanline */
#contact .scanline {
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 218, 243, 0.04) 50%);
    background-size: 100% 3px;
}

/* CTA ambient glow */
#contact::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 300px;
    background: radial-gradient(ellipse, rgb(var(--c-primary-rgb) / 0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* Underline accent on nav active link */
nav a[href="#work"] {
    text-shadow: 0 0 12px rgb(var(--c-primary-rgb) / 0.6);
}

/* Headline letter spacing tightening + subtle gradient for dark mode */
html:not(.light) h1 .text-primary {
    background: linear-gradient(135deg, rgb(var(--c-primary-rgb)), rgb(var(--c-primary-rgb) / 0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgb(var(--c-primary-rgb) / 0.4));
}

/* Tags glow slightly on hover */
span.border.border-outline-variant\/30 {
    transition: border-color 0.2s ease, color 0.2s ease;
}

span.border.border-outline-variant\/30:hover {
    border-color: rgb(var(--c-primary-rgb) / 0.4);
    color: rgb(var(--c-primary-rgb));
}

/* === SELECTED WORK section === */

/* Faint watermark behind section header */
.section-header { position: relative; overflow: hidden; }
.section-watermark {
    position: absolute;
    right: -8px;
    bottom: -24px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 7rem;
    font-weight: 900;
    letter-spacing: -0.06em;
    line-height: 1;
    color: rgb(var(--c-on-surface-variant-rgb) / 0.04);
    user-select: none;
    pointer-events: none;
    text-transform: uppercase;
    white-space: nowrap;
}
html.light .section-watermark { color: rgb(var(--c-outline-variant-rgb) / 0.12); }

/* Project number badge on image */
.project-num {
    position: absolute;
    top: 10px;
    right: 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: rgb(255 255 255 / 0.55);
    z-index: 3;
    line-height: 1;
}

/* Hover overlay on project images */
.project-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgb(0 0 0 / 0.7) 0%, rgb(0 0 0 / 0.1) 45%, transparent 70%);
    opacity: 0;
    transition: opacity 0.45s ease;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    padding: 14px 16px;
}
.group:hover .project-overlay { opacity: 1; }

.project-overlay-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgb(var(--c-primary-rgb));
    text-shadow: 0 0 12px rgb(var(--c-primary-rgb) / 0.6);
}

/* Stat callout chips */
.project-stat {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.04em;
    color: rgb(var(--c-primary-rgb));
    border-left: 2px solid rgb(var(--c-primary-rgb) / 0.5);
    padding: 5px 10px;
    background: rgb(var(--c-primary-rgb) / 0.05);
    line-height: 1.4;
}
html.light .project-stat {
    background: rgb(var(--c-primary-rgb) / 0.06);
    text-shadow: none;
}

/* SOFIE code terminal placeholder */
.code-terminal {
    background: rgb(var(--c-surface-container-lowest));
    border: 1px solid rgb(var(--c-outline-variant-rgb) / 0.2);
    font-family: 'Space Mono', 'Courier New', monospace;
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
}
.code-terminal::before {
    content: '● ● ●';
    position: absolute;
    top: 10px;
    left: 16px;
    font-size: 0.5rem;
    letter-spacing: 0.25em;
    color: rgb(var(--c-outline-variant-rgb) / 0.5);
}
.code-terminal-body {
    margin-top: 20px;
    font-size: 0.72rem;
    line-height: 1.9;
    color: rgb(var(--c-on-surface-variant-rgb) / 0.7);
}
.code-terminal-body .cmd { color: rgb(var(--c-primary-rgb) / 0.55); }
.code-terminal-body .ok  { color: rgb(var(--c-primary-rgb)); }
.code-terminal-body .dim { color: rgb(var(--c-on-surface-variant-rgb) / 0.35); }
