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

:root {
    --bg-dark: #050508;
    --bg-card: #0a0a10;
    --bg-surface: #0f0f18;
    --text-primary: #e8e8ef;
    --text-secondary: #9a9aaa;
    --text-muted: #5a5a6a;
    --accent: #4af0c0;
    --accent-dim: #2a9070;
    --accent-glow: rgba(74, 240, 192, 0.4);
    --border: #1a1a2a;
    --border-light: #252535;
}

html {
    font-size: 14px;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* =============================================
   PERSPECTIVE GRID BACKGROUND
   ============================================= */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.grid-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(var(--bg-dark) 0%, transparent 20%),
        linear-gradient(to top, var(--bg-dark) 0%, transparent 30%);
    z-index: 2;
}

.grid-bg::after {
    content: '';
    position: absolute;
    width: 300%;
    height: 300%;
    top: 50%;
    left: -100%;
    background-image:
        linear-gradient(to right, rgba(74, 240, 192, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(74, 240, 192, 0.04) 1px, transparent 1px);
    background-size: 80px 80px;
    transform: perspective(400px) rotateX(65deg);
    transform-origin: center top;
}

/* =============================================
   LAYOUT - WIDE CONTAINER
   ============================================= */
.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    width: 95%;
    margin: 0 auto;
    padding: 2rem 0;
}

/* =============================================
   HEADER
   ============================================= */
.header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.name {
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 0.4rem;
}

.contact {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.contact a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.contact a:hover {
    color: var(--text-primary);
}

.separator {
    margin: 0 0.6rem;
    color: var(--text-muted);
}

/* =============================================
   SECTIONS
   ============================================= */
.section {
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

/* =============================================
   EXPERIENCE - COLLAPSIBLE TWO-COLUMN
   ============================================= */

/* Full-width highlight item (Listabid) */
.exp-item.exp-highlight {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    margin-bottom: 0.5rem;
}

.exp-highlight .exp-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1rem;
    background: linear-gradient(90deg, rgba(74, 240, 192, 0.08) 0%, transparent 60%);
    border-left: 2px solid var(--accent);
    border-radius: 4px;
}

.exp-highlight .exp-date {
    font-size: 0.9rem;
}

.exp-highlight .exp-company {
    font-size: 1rem;
}

.exp-highlight .exp-location {
    font-size: 0.9rem;
}

/* Two-column grid for other experiences */
.exp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 2rem;
}

.exp-column {
    display: flex;
    flex-direction: column;
}

.exp-item {
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.exp-item:last-child {
    border-bottom: none;
}

.exp-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 4px;
}

.exp-item[data-expandable="false"] .exp-row {
    cursor: default;
}

.exp-item[data-expandable="true"] .exp-row:hover {
    background: rgba(74, 240, 192, 0.03);
}

.exp-date {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 400;
    white-space: nowrap;
    margin-right: 1rem;
}

.exp-company {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.exp-location {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}

.exp-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--accent-dim);
    transition: transform 0.3s;
    flex-shrink: 0;
}

.exp-item.expanded .exp-toggle {
    transform: rotate(180deg);
}

.exp-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 0.5rem;
}

.exp-item.expanded .exp-details {
    max-height: 500px;
    padding: 0.4rem 0.5rem 0.8rem 0.5rem;
}

.exp-details ul {
    list-style: none;
}

.exp-details li {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    padding-left: 0.8rem;
    position: relative;
}

.exp-details li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-dim);
    font-size: 0.65rem;
}

/* =============================================
   PROJECTS - MASONRY LAYOUT
   ============================================= */
.projects-masonry {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.3rem;
}

.proj {
    padding: 0.5rem 0.6rem;
    border-radius: 3px;
    background: rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.03);
}

.project-meta {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    margin-bottom: 0.3rem;
}

.project-date {
    font-size: 0.7rem;
    color: var(--accent);
}

.project-link {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
}

.project-link:hover {
    text-decoration: underline;
}

.project-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.project-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 0.4rem;
}

.project-content {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.project-content p {
    margin-bottom: 0.3rem;
}

.project-content ul {
    list-style: none;
    padding: 0;
}

.project-content li {
    margin-bottom: 0.2rem;
    padding-left: 0.9rem;
    position: relative;
}

.project-content li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-dim);
    font-size: 0.65rem;
}

/* =============================================
   AFFECTIVE COMPUTING - Row 1 Left
   ============================================= */
.proj-affective {
    grid-column: 1 / 8;
    grid-row: 1;
    display: flex;
    gap: 1rem;
}

.affective-left {
    flex: 1;
}

.affective-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-top: 0.3rem;
}

.affective-text p {
    margin: 0 0 0.4rem 0;
}

.affective-text p:last-child {
    margin-bottom: 0;
}

.affective-right {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.example-note {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.example-note .emphasis {
    font-weight: 600;
    color: var(--text-secondary);
}

.math-frame {
    position: relative;
    background: linear-gradient(145deg, #0a0a12 0%, #020204 100%);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px;
    overflow: hidden;
}

.math-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
    filter: invert(0.9) hue-rotate(140deg) brightness(0.7) contrast(1.3);
    mix-blend-mode: screen;
    opacity: 0.85;
}

.math-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
        transparent 50%,
        rgba(5, 5, 8, 0.5) 100%
    );
    pointer-events: none;
}

/* =============================================
   PUZZLE GRID - Interlocking Layout
   ============================================= */

/* Row 1: ROAR on right of Affective */
.proj-roar {
    grid-column: 8 / 13;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Row 2: PIAT with image protruding DOWN into row below */
.proj-piat {
    grid-column: 1 / 5;
    grid-row: 2;
    position: relative;
    overflow: visible;
    z-index: 5;
}

.proj-piat .piat-frame {
    float: right;
    width: 130px;
    margin: 0 0 0.5rem 0.8rem;
}

/* Row 2: Silmaril - small, single row */
.proj-silmaril {
    grid-column: 5 / 8;
    grid-row: 2;
}

/* Row 2-3: Dogs spans 2 rows on right */
.proj-dogs {
    grid-column: 8 / 13;
    grid-row: 2 / 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.dogs-content {
    text-align: center;
}

.dog-visual {
    position: relative;
    width: 200px;
    height: 250px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
}

/* Row 3: Verifix left, PASSCORS middle (both share row) */
.proj-verifix {
    grid-column: 1 / 4;
    grid-row: 3;
}

.proj-passcors {
    grid-column: 4 / 8;
    grid-row: 3;
}

/* =============================================
   SILMARIL EMBED
   ============================================= */
.silmaril-preview {
    display: block;
    margin-top: 0.5rem;
}

.silmaril-img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.silmaril-preview:hover .silmaril-img {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(74, 240, 192, 0.2);
}

/* =============================================
   ROAR - Cat with hover effect only
   ============================================= */
.roar-cat-container {
    position: relative;
    width: 180px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.roar-cat {
    width: 170px;
    height: auto;
    filter: drop-shadow(0 15px 35px rgba(0,0,0,0.5));
    transition: transform 0.2s ease-out;
}

.roar-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 220px;
    height: 220px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle,
        rgba(74, 240, 192, 0.15) 0%,
        transparent 70%
    );
    filter: blur(20px);
    pointer-events: none;
    opacity: 0.6;
    transition: transform 0.2s ease-out, opacity 0.3s;
}

.proj-roar:hover .roar-glow {
    opacity: 1;
}

.roar-text {
    text-align: left;
    flex: 1;
}

.roar-text .project-meta {
    justify-content: flex-start;
}

.roar-text .project-name {
    font-size: 0.9rem;
}

.roar-text .project-content {
    font-size: 0.75rem;
}

/* =============================================
   DOG - Emerging effect, hover only
   ============================================= */
.dog-image {
    width: 180px;
    height: auto;
    filter: drop-shadow(0 18px 35px rgba(0,0,0,0.5));
    mask-image: linear-gradient(to bottom,
        black 0%,
        black 60%,
        rgba(0,0,0,0.5) 85%,
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(to bottom,
        black 0%,
        black 60%,
        rgba(0,0,0,0.5) 85%,
        transparent 100%
    );
    transition: transform 0.2s ease-out;
    position: relative;
    z-index: 2;
}

.dogs-logo {
    position: absolute;
    top: 0;
    left: 0;
    width: 55px;
    height: auto;
    z-index: 3;
    opacity: 0.9;
}

.dog-shadow {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 20px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.4) 0%, transparent 70%);
    filter: blur(8px);
    z-index: 1;
    transition: transform 0.2s ease-out;
}

/* =============================================
   PIAT - Frame effect with blend mode
   ============================================= */

/* piat-frame visual styling */
.piat-frame {
    position: relative;
    background: linear-gradient(145deg, #0a0a12 0%, #050508 100%);
    border: 2px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    overflow: hidden;
    transition: transform 0.2s ease-out;
}

.piat-product {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 3px;
    mix-blend-mode: luminosity;
    filter: brightness(0.85) contrast(1.15) saturate(0.3);
    transition: filter 0.3s;
}

.piat-frame:hover .piat-product {
    filter: brightness(0.95) contrast(1.1) saturate(0.5);
}

.piat-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
        transparent 30%,
        rgba(5, 5, 8, 0.6) 70%,
        rgba(5, 5, 8, 0.95) 100%
    );
    pointer-events: none;
}

.piat-logo {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 70px;
    height: auto;
    filter: brightness(1.5) drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    opacity: 0.85;
}

/* =============================================
   HOVER STATES
   ============================================= */
[data-scene] {
    cursor: pointer;
}

[data-scene].hovered .roar-cat,
[data-scene].hovered .dog-image {
    filter: drop-shadow(0 20px 40px rgba(74, 240, 192, 0.2));
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
    .projects-masonry {
        grid-template-columns: 1fr 1fr;
    }

    .proj-affective,
    .proj-piat,
    .proj-dogs {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .proj-roar,
    .proj-verifix,
    .proj-silmaril,
    .proj-passcors {
        grid-column: span 1;
        grid-row: auto;
    }

    .proj-affective {
        flex-direction: column;
    }

    .affective-right {
        width: 100%;
        max-width: 280px;
    }

    .piat-frame {
        position: relative;
        bottom: auto;
        right: auto;
        width: 100%;
        max-width: 200px;
    }

    .proj-piat {
        overflow: hidden;
    }

    .proj-dogs {
        flex-direction: row;
    }

    .dogs-content {
        text-align: left;
    }

    .exp-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .exp-row {
        flex-wrap: wrap;
    }

    .exp-location {
        font-size: 0.75rem;
    }
}

@media (max-width: 600px) {
    .projects-masonry {
        grid-template-columns: 1fr;
    }

    .proj-roar,
    .proj-verifix,
    .proj-silmaril {
        grid-column: 1 / -1;
    }

    .container {
        width: 100%;
        padding: 1.5rem 1rem;
    }

    .proj-dogs {
        flex-direction: column;
        align-items: flex-start;
    }

    .dog-visual {
        width: 100%;
        height: auto;
    }

    .dog-image {
        width: 140px;
    }

    .roar-cat {
        width: 120px;
    }

    .roar-cat-container {
        width: 140px;
        height: 180px;
    }
}
