/* ==========================================================================
   Variables
   ========================================================================== */
:root {
    /* Colors - Matte Entity */
    --bg-primary: #fcfcfc;
    --bg-secondary: #f2f2f2;
    --text-primary: #111827;
    --text-secondary: #555555; /* Content Layer */
    --border-color: #e0e0e0;
    
    /* Signals & CTA */
    --signal-red: #ff3131; /* Contextual Signal */
    --cta-yellow: #ffc700; /* Unobtrusive CTA */
    
    /* Typography */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-meta: 'Silkscreen', cursive;
    
    /* Grid System */
    --grid-unit: 40px;
    --dot-color: #d1d5db; /* Visible but subtle */
    
    /* Effects */
    --shadow: none;
    --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --focus-ring: 1px solid var(--text-primary);
}

[data-theme="dark"] {
    /* Dark Mode - Inverted Matte */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --text-primary: #fcfcfc;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
    
    --dot-color: #333333;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
html {
    scrollbar-gutter: stable;
    cursor: none; /* Hide default cursor */
}

a, button, [role="button"], input, select, textarea, .clickable {
    cursor: none; /* Hide default cursor on interactive elements */
}

/* Custom Cursor */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 10001; /* Ensure it's above everything including HUD and Holo */
    pointer-events: none;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-primary);
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 1px solid var(--text-primary);
    transition: width 0.2s, height 0.2s, background-color 0.2s;
}

/* Hover State */
body.hovering .cursor-outline {
    width: 60px;
    height: 60px;
    background-color: rgba(128, 128, 128, 0.1);
    border-color: transparent;
}

/* Mobile: Reset cursor */
@media (hover: none) and (pointer: coarse) {
    html, a, button, [role="button"], input, select, textarea, .clickable {
        cursor: auto;
    }
    
    .cursor-dot,
    .cursor-outline {
        display: none;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Accessibility: Focus Styles */
:focus-visible {
    outline: 2px solid var(--signal-red);
    outline-offset: 2px;
}

::selection {
    background: var(--signal-red);
    color: #ffffff;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 0; /* Square for matte look */
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary);
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    background-image: radial-gradient(var(--dot-color) 2px, transparent 2px);
    background-size: var(--grid-unit) var(--grid-unit);
    background-position: 0 0; /* Snap to grid */
    color: var(--text-secondary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0.02em;
}

body.home-layout {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--grid-unit);
    transition: var(--transition-base);
}

.container.shifted {
    justify-content: flex-start;
    padding-left: 10%;
}

/* ==========================================================================
   Profile Card (Matte Entity)
   ========================================================================== */
.card {
    background: var(--bg-secondary);
    border-radius: 2px; /* Sharp, industrial look */
    max-width: 480px;
    width: 100%;
    padding: var(--grid-unit); /* 40px padding */
    box-shadow: none;
    border: 1px solid var(--border-color);
    transition: var(--transition-base);
    position: relative;
}

/* Contextual Signal (Red Indicator) */
.card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20px;
    width: 0;
    height: 2px;
    background: var(--signal-red);
    transition: width 0.3s ease;
    z-index: 10;
}

.card:hover::before {
    width: 40px;
}

.card:hover {
    border-color: #ccc; /* Slight contrast increase */
    transform: none; /* No movement */
}

.card-header {
    text-align: left; /* Industrial style often left-aligned */
    margin-bottom: var(--grid-unit);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.avatar {
    margin: 0 0 20px 0;
    width: 80px;
    height: 80px;
    border-radius: 0; /* Square avatar */
    overflow: hidden;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    border: 1px solid var(--border-color);
}

.avatar svg,
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.name {
    font-family: var(--font-display);
    font-size: 40px; /* Large Display */
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0;
    color: var(--text-primary);
    line-height: 1;
}

.role {
    font-family: var(--font-meta);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.divider {
    height: 1px;
    border: none;
    background: var(--border-color);
    margin: var(--grid-unit) 0;
    background-image: none;
}

.card-content {
    margin-bottom: var(--grid-unit);
}

.info-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    border-bottom: 1px dotted var(--border-color);
    padding-bottom: 4px;
}

.label {
    font-family: var(--font-meta);
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 400;
    min-width: 80px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.value {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    text-align: right;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 0;
    font-weight: 400;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 0; /* Square dot */
    background: var(--signal-red);
    display: inline-block;
    box-shadow: none;
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.card-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Buttons & Links (Unobtrusive CTA)
   ========================================================================== */
.link-button {
    flex: 1;
    min-width: calc(33.333% - 8px);
    padding: 12px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    text-decoration: none;
    color: var(--text-secondary);
    font-family: var(--font-meta);
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.link-button:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

/* Specific CTA style for Works */
.link-button[href="works.html"] {
    border-color: var(--cta-yellow);
    color: var(--text-primary);
}

.link-button[href="works.html"]:hover {
    background: var(--cta-yellow);
    color: #000;
}

.link-button svg {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   Theme Toggle
   ========================================================================== */
.theme-toggle {
    position: fixed;
    top: var(--grid-unit);
    right: var(--grid-unit);
    width: 40px;
    height: 40px;
    border-radius: 2px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-base);
    z-index: 100;
    box-shadow: none;
}

.theme-toggle:hover {
    transform: none;
    border-color: var(--signal-red);
    color: var(--signal-red);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: block;
}

/* Default (Light) */
.theme-toggle .sun-icon {
    display: none;
}

/* ==========================================================================
   Works Panel
   ========================================================================== */
/* Styles moved to works.css */

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes cardEntry {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Playfulness (Glitch & Interactions)
   ========================================================================== */
/* Name Glitch Effect on Hover */
.name {
    position: relative;
}

.name:hover {
    animation: glitch-skew 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    color: var(--text-primary);
}

.name:hover::before,
.name:hover::after {
    content: attr(data-text); /* Requires data-text attribute in HTML if we want text duplication, but simple skew is fine too */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.name:hover::before {
    color: #ff00c1;
    z-index: -1;
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.name:hover::after {
    color: #00fff9;
    z-index: -2;
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    20% { transform: skew(-2deg); }
    40% { transform: skew(2deg); }
    60% { transform: skew(-1deg); }
    80% { transform: skew(1deg); }
    100% { transform: skew(0deg); }
}

/* Age Unit Badge */
#age-display::after {
    content: attr(data-unit);
    font-size: 0.6em;
    margin-left: 4px;
    opacity: 0.5;
    text-transform: uppercase;
    vertical-align: top;
}

#age-display:hover {
    color: var(--signal-red);
}

#age-display.glitch-active {
    animation: glitch-skew 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    color: var(--signal-red);
}

/* ==========================================================================
   HUD / Decorations
   ========================================================================== */
.hud-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
    padding: 20px;
    box-sizing: border-box;
    mix-blend-mode: difference; /* Ensures visibility on both light/dark */
    color: #808080;
}

.hud-item {
    position: absolute;
    font-family: var(--font-meta);
    font-size: 10px;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.6;
}

.hud-item.top-left {
    top: 20px;
    left: 20px;
}

.hud-item.top-right {
    top: 20px;
    right: 20px;
}

.hud-item.bottom-left {
    bottom: 20px;
    left: 20px;
}

.hud-item.bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.hud-item.bottom-right {
    bottom: 20px;
    right: 20px;
}

.hud-label {
    font-weight: 700;
    opacity: 0.5;
}

.hud-indicator {
    width: 6px;
    height: 6px;
    background-color: var(--signal-red);
    border-radius: 50%;
    animation: blink 2s infinite;
}

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

/* Hide HUD on mobile to prevent clutter */
@media (max-width: 600px) {
    .hud-layer {
        display: none;
    }
}

/* ==========================================================================
   Holographic Effect (Balatro Style - Polychrome)
   ========================================================================== */
.card {
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
    will-change: transform, box-shadow;
}

.holo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.5s ease;
    mix-blend-mode: color-dodge;
    background: 
        /* Polychrome Spectrum */
        linear-gradient(
            135deg, 
            rgba(255, 0, 0, 0.5) 0%,
            rgba(255, 154, 0, 0.5) 10%,
            rgba(208, 222, 33, 0.5) 20%,
            rgba(79, 220, 74, 0.5) 30%,
            rgba(63, 218, 216, 0.5) 40%,
            rgba(47, 201, 226, 0.5) 50%,
            rgba(28, 127, 238, 0.5) 60%,
            rgba(95, 21, 242, 0.5) 70%,
            rgba(186, 12, 248, 0.5) 80%,
            rgba(251, 7, 217, 0.5) 90%,
            rgba(255, 0, 0, 0.5) 100%
        ),
        /* Noise Texture */
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.3'/%3E%3C/svg%3E");
    background-size: 300% 300%, 100px 100px;
    background-blend-mode: overlay;
    animation: holo-shift 5s linear infinite;
}

@keyframes holo-shift {
    0% { background-position: 0% 50%, 0 0; }
    50% { background-position: 100% 50%, 0 0; }
    100% { background-position: 0% 50%, 0 0; }
}

.holo-glare {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0.2) 30%,
        transparent 60%
    );
    pointer-events: none;
    z-index: 11;
    opacity: 0;
    mix-blend-mode: overlay;
    transform: translate(-50%, -50%);
    transition: opacity 0.5s ease;
}

/* Controls Container */
.controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition-base);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background-color: rgba(128, 128, 128, 0.1);
}

.control-btn.active {
    color: var(--cta-yellow);
    text-shadow: 0 0 10px var(--cta-yellow);
}

/* Adjust theme toggle position since it's now in .controls */
.theme-toggle {
    position: static; /* Reset absolute positioning */
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 900px) {
    .container.shifted {
        justify-content: center;
        padding-left: 5%;
    }
}

@media (max-width: 600px) {
    .card {
        padding: 20px;
        border-radius: 2px;
    }

    .name {
        font-size: 32px;
    }

    .role {
        font-size: 10px;
    }

    .link-button {
        min-width: 100%;
    }

    .info-item {
        flex-direction: row;
        gap: 8px;
    }

    .label,
    .value {
        text-align: left;
    }
    
    .value {
        text-align: right;
    }

    .container.shifted {
        opacity: 0.5;
    }
}

