/* =====================================================
   INDEX.CSS — Baha Tan Oral Unified Portfolio
   ===================================================== */

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

html {
    scroll-behavior: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- TOKENS (Dynamic, driven by JS randomizer) ---- */
:root {
    /* Set defaults to avoid flash */
    --bg-color: #0d0d0d;
    --text-color: #f0f0f0;
    --accent-color: #ff004c;
    --font-current: 'Syne', sans-serif;
    
    --spacing: 0px;
    --skew: 0deg;
    --blur: 0px;
    --scale-y: 1;
    --weight: 400;
    --transform-case: uppercase;
    --text-stroke: none;
    --text-fill: currentColor;
    --font-project-title: var(--font-current);
    --line-color: color-mix(in srgb, var(--text-color) 10%, transparent);
    --line-strong: color-mix(in srgb, var(--text-color) 20%, transparent);
    --surface-soft: color-mix(in srgb, var(--text-color) 4%, transparent);
    --surface-hover: color-mix(in srgb, var(--text-color) 6%, transparent);
    
    --font-scale-d: 8vw;
    --font-scale-m: 15vw;

    --font-m: 'Space Mono', monospace;

    --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-flow: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- BASE ---- */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-current);
    min-height: 100vh;
    cursor: none;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

a { color: inherit; text-decoration: none; cursor: none; }
button { font-family: inherit; background: none; border: none; cursor: none; }
ul { list-style: none; }

/* ---- CODE-GENERATED ATMOSPHERE ---- */
.noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0.72;
    background:
        radial-gradient(circle at 22% 18%, color-mix(in srgb, var(--accent-color) 22%, transparent) 0, transparent 30vw),
        radial-gradient(circle at 76% 74%, color-mix(in srgb, var(--text-color) 10%, transparent) 0, transparent 34vw),
        linear-gradient(115deg, transparent 0%, color-mix(in srgb, var(--text-color) 3%, transparent) 42%, transparent 68%);
    mix-blend-mode: screen;
    transition: background 0.6s ease, opacity 0.6s ease;
}

.noise::before,
.noise::after {
    content: '';
    position: absolute;
    inset: 0;
}

.noise::before {
    opacity: 0.28;
    background:
        linear-gradient(color-mix(in srgb, var(--text-color) 4%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--text-color) 3%, transparent) 1px, transparent 1px);
    background-size: 96px 96px;
    mask-image: radial-gradient(circle at 50% 45%, black, transparent 72%);
}

.noise::after {
    opacity: 0.36;
    background:
        radial-gradient(ellipse at center, transparent 0%, transparent 48%, rgba(0,0,0,0.36) 100%),
        linear-gradient(to bottom, color-mix(in srgb, var(--text-color) 4%, transparent), transparent 28%, transparent 72%, color-mix(in srgb, var(--text-color) 2%, transparent));
    mix-blend-mode: normal;
}

/* ---- 3D WIREFRAME CANVAS ---- */
#canvas-layer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

#canvas-layer.faded {
    opacity: 0.15;
}

/* ---- HUD CORNER BRACKETS (from index.html) ---- */
.viewport-hud {
    position: fixed;
    top: 20px; bottom: 20px; left: 20px; right: 20px;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.viewport-hud::before,
.viewport-hud::after,
.hud-inner::before,
.hud-inner::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--text-color);
    border-style: solid;
    opacity: 0.45;
    transition: border-color 0.4s ease, opacity 0.5s ease;
}

.viewport-hud::before { top: 0; left: 0; border-width: 1px 0 0 1px; }
.viewport-hud::after  { top: 0; right: 0; border-width: 1px 1px 0 0; }
.hud-inner { width: 100%; height: 100%; position: relative; }
.hud-inner::before { bottom: 0; left: 0; border-width: 0 0 1px 1px; position: absolute; }
.hud-inner::after  { bottom: 0; right: 0; border-width: 0 1px 1px 0; position: absolute; }

/* ---- CUSTOM CURSOR (from index.html) ---- */
#cursor {
    position: fixed;
    top: 0; left: 0;
    width: 16px; height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    mix-blend-mode: exclusion;
    transition: width 0.3s ease, height 0.3s ease, background-color 0.6s;
}

#cursor.expand { width: 44px; height: 44px; }

#cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 46px;
    height: 46px;
    border: 1px solid color-mix(in srgb, var(--text-color) 24%, transparent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.25s var(--ease-flow), height 0.25s var(--ease-flow), border-color 0.6s;
}

body.cursor-hover #cursor-ring {
    width: 64px;
    height: 64px;
    border-color: color-mix(in srgb, var(--text-color) 46%, transparent);
}

body.cursor-hover #cursor {
    width: 24px;
    height: 24px;
}



/* ====================================================
   LANDING SECTION
   ==================================================== */
#landing {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 10;
    transform-style: preserve-3d;
    will-change: transform;
    opacity: 1;
    transition: opacity 0.8s ease;
}

/* ---- ART TEXT — name display (from index.html) ---- */
.art-text {
    font-family: var(--font-current);
    color: var(--text-color);
    font-size: clamp(2rem, var(--font-scale-d), 10rem);
    max-width: 90vw;
    text-align: center;
    line-height: 0.85;
    white-space: nowrap;
    letter-spacing: var(--spacing);
    font-weight: var(--weight);
    filter: blur(var(--blur));
    transform: skewX(var(--skew)) scaleY(var(--scale-y));
    text-transform: var(--transform-case);
    -webkit-text-stroke: var(--text-stroke);
    -webkit-text-fill-color: var(--text-fill);
    transition: 
        transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.5s ease,
        letter-spacing 0.5s ease,
        color 0.5s ease,
        -webkit-text-stroke 0.5s ease,
        -webkit-text-fill-color 0.5s ease;
    mix-blend-mode: normal; 
    will-change: transform, letter-spacing;
    animation: heroTitleIn 1s 0.18s var(--ease-flow) forwards;
}

/* Meta info bar — bottom of landing */
.meta-info {
    position: absolute;
    bottom: 40px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 4vw;
    font-family: var(--font-m);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--text-color);
    opacity: 0.5;
    text-transform: uppercase;
    font-weight: 400;
    pointer-events: none;
    transition: color 0.6s;
}

#role-text {
    text-align: right;
    border-bottom: 1px solid var(--text-color);
    padding-bottom: 4px;
    transition: border-color 0.6s;
}

/* Scroll indicator */
.scroll-invite {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: var(--font-m);
    font-size: 9px;
    letter-spacing: 0.16em;
    color: var(--text-color);
    opacity: 0.8;
    font-weight: 700;
    text-transform: uppercase;
    animation: fadeInUp 1s forwards 1.2s;
    pointer-events: none;
    z-index: 15;
    transition: color 0.6s;
}

.scroll-arrow {
    animation: scrollBob 1.8s ease-in-out infinite;
}

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

@keyframes fadeInUp {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 0.8; transform: translateX(-50%) translateY(0); }
}

@keyframes heroTitleIn {
    from {
        transform: translateY(34px) skewX(var(--skew)) scaleY(var(--scale-y));
    }
    to {
        transform: translateY(0) skewX(var(--skew)) scaleY(var(--scale-y));
    }
}

.flow-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity 0.75s var(--ease-flow),
        transform 0.75s var(--ease-flow),
        border-color 0.25s ease,
        background-color 0.6s;
    transition-delay: var(--flow-delay, 0ms);
}

.flow-reveal.flow-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ====================================================
   STICKY NAVIGATION (Always Visible)
   ==================================================== */
#sticky-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 500;
    height: 56px;
    border-bottom: 1px solid var(--line-color);
}

#sticky-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--bg-color);
    opacity: 0.92;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background-color 0.6s;
    z-index: -1;
}

.sticky-nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    gap: 20px;
}

.sticky-name {
    font-family: var(--font-current);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0;
    color: var(--text-color);
    flex-shrink: 0;
    transition: color 0.6s, font-family 0.6s;
}

.sticky-links {
    display: flex;
    gap: 28px;
}

.sticky-link {
    font-family: var(--font-m);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.6s;
}

.sticky-link:hover { opacity: 1; }

.sticky-social {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.sticky-social-link {
    color: var(--text-color);
    opacity: 0.5;
    display: flex;
    align-items: center;
    transition: opacity 0.2s ease, color 0.6s;
}

.sticky-social-link:hover { color: var(--accent-color); opacity: 1; }

.sticky-cv {
    font-family: var(--font-m);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border: 1px solid var(--line-strong);
    padding: 4px 10px;
    transition: border-color 0.2s ease, color 0.6s;
}

.sticky-cv:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* ====================================================
   PORTFOLIO MAIN
   ==================================================== */
#portfolio {
    position: relative;
    z-index: 10;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
}

/* ---- SECTION STRUCTURE ---- */
.portfolio-section {
    padding-top: 100px;
    padding-bottom: 20px;
    scroll-margin-top: 76px;
}

.portfolio-section + .portfolio-section {
    padding-top: 90px;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 36px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line-color);
}

.section-slug {
    font-family: var(--font-m);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-color);
    opacity: 0.8;
    transition: color 0.6s;
}

.section-count {
    font-family: var(--font-m);
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--text-color);
    opacity: 0.4;
}

/* ====================================================
   CARD GRID
   ==================================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

/* ---- INDIVIDUAL CARD ---- */
.project-card {
    position: relative;
    cursor: none;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--surface-soft);
    transition:
        opacity 0.75s var(--ease-flow),
        transform 0.45s var(--ease-flow),
        border-color 0.25s ease,
        background-color 0.35s ease;
    will-change: transform;
}

.project-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-6px);
    background: var(--surface-soft);
}

.project-card:focus-visible,
.course-card:focus-visible,
.modal-link:focus-visible,
.sticky-link:focus-visible,
.footer-link:focus-visible,
.about-cv-link:focus-visible,
.theme-dice-btn:focus-visible,
.modal-close-btn:focus-visible {
    outline: 1px solid var(--accent-color);
    outline-offset: 4px;
}

/* 16:9 image container */
.card-image {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform 0.5s ease, filter 0.3s ease;
    filter: brightness(0.7) grayscale(0.5);
}

.project-card:hover .card-image img {
    transform: scale(1.065);
    filter: brightness(0.9) grayscale(0);
}

/* Hover overlay */
.card-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    padding: 16px;
}

.project-card:hover .card-image-overlay {
    opacity: 1;
}

.card-overlay-text {
    font-family: var(--font-m);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-color);
    opacity: 0.9;
}

/* Card metadata below the image */
.card-meta {
    padding: 14px 16px 16px;
}

.card-tag-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 6px;
}

.card-tag {
    font-family: var(--font-m);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-color);
    opacity: 0.8;
}

.card-title {
    font-family: var(--font-m);
    font-weight: 700;
    font-size: clamp(14px, 1.2vw, 16px);
    letter-spacing: 0.05em;
    line-height: 1.2;
    color: var(--text-color);
    margin-bottom: 4px;
    transition: color 0.6s;
}

.card-role {
    font-family: var(--font-m);
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--text-color);
    opacity: 0.6;
    text-transform: uppercase;
}

/* No-image fallback */
.card-image-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image-placeholder span {
    font-family: var(--font-m);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-color);
    opacity: 0.4;
    text-transform: uppercase;
}

/* ====================================================
   TEACHING SECTION
   ==================================================== */
.course-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1px;
    background: var(--line-color);
}

.course-card {
    background: var(--bg-color);
    padding: 24px;
    transition:
        opacity 0.75s var(--ease-flow),
        transform 0.45s var(--ease-flow),
        background 0.2s,
        background-color 0.6s;
    cursor: none;
}

.course-card:hover {
    background: var(--surface-soft);
    transform: translateY(-4px);
}

.course-code {
    font-family: var(--font-m);
    font-size: 10px;
    color: var(--accent-color);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    text-transform: uppercase;
    transition: color 0.6s;
}

.course-name {
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
    color: var(--text-color);
    transition: color 0.6s;
}

.course-term {
    font-family: var(--font-m);
    font-size: 10px;
    color: var(--text-color);
    opacity: 0.5;
    letter-spacing: 0.06em;
}


/* ====================================================
   ABOUT SECTION
   ==================================================== */
.about-section { padding-top: 100px; padding-bottom: 120px; }

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
}

.about-main {
    position: relative;
}

.about-text {
    font-family: var(--font-m);
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-color);
    opacity: 0.8;
    transition: color 0.6s;
    margin-bottom: 24px;
}

.analog-photo-container {
    position: absolute;
    top: -20px;
    right: 40px;
    width: 220px;
    padding: 10px 10px 30px;
    background: #e8e8e8;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    transform: rotate(6deg) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
}

#about-text-hover:hover + .analog-photo-container,
.analog-photo-container:hover {
    opacity: 1;
    transform: rotate(-2deg) scale(1);
    pointer-events: all;
}

.analog-photo-container img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    filter: grayscale(1) contrast(1.1);
    transition: filter 0.5s;
}

.analog-photo-container:hover img {
    filter: grayscale(0) contrast(1);
}

.about-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.about-h3 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 16px;
    transition: color 0.6s, font-family 0.6s;
}

.about-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.about-list li {
    font-family: var(--font-m);
    font-size: 11px;
    color: var(--text-color);
    opacity: 0.7;
    letter-spacing: 0.05em;
    position: relative;
    padding-left: 12px;
}

.about-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
}

.about-p {
    font-family: var(--font-m);
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 12px;
}

.about-cv-link {
    font-family: var(--font-m);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-color);
    display: inline-block;
    margin-top: 12px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--accent-color);
    transition: opacity 0.2s;
}

.about-cv-link:hover { opacity: 0.7; }


/* ====================================================
   FOOTER
   ==================================================== */
.site-footer {
    position: relative;
    z-index: 100;
    border-top: 1px solid var(--line-color);
    margin-top: 80px;
    background-color: color-mix(in srgb, var(--bg-color) 94%, black);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    isolation: isolate;
}

.site-footer::before {
    content: none;
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    opacity: 1;
    transform: none;
}

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

.footer-name {
    font-family: var(--font-current);
    font-weight: 700;
    font-size: 13px;
    color: var(--text-color);
    opacity: 0.8;
    transition: color 0.6s, font-family 0.6s;
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-link {
    font-family: var(--font-m);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0.5;
    transition: color 0.6s, opacity 0.2s ease;
}

.footer-link:hover { color: var(--accent-color); opacity: 1; }

/* ====================================================
   SIDE DRAWER MODAL (from trial1.css)
   ==================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: min(660px, 100vw); /* Ensure preview stays on the left */
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.modal-hover-preview {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: scale(0.95);
    pointer-events: none;
}

.modal-hover-preview.active {
    opacity: 1;
    transform: scale(1);
}

.work-modal {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(660px, 100vw);
    background: var(--bg-color);
    z-index: 2001;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-out), background-color 0.6s;
    border-left: 1px solid var(--line-color);
}

.work-modal::-webkit-scrollbar {
    width: 6px;
}
.work-modal::-webkit-scrollbar-track {
    background: transparent;
}
.work-modal::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 4px;
}
.work-modal::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--text-color) 40%, transparent);
}

.work-modal.active {
    transform: translateX(0);
}

.modal-close-btn {
    position: sticky;
    top: 1.5rem;
    float: right;
    margin: 1.5rem 1.5rem 0 0;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--line-strong);
    color: var(--text-color);
    font-family: var(--font-m);
    font-size: 14px;
    cursor: none;
    z-index: 10;
    transition: border-color 0.2s, color 0.6s;
}

.modal-close-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.work-modal-inner {
    padding: 2rem;
    clear: both;
}

.modal-hero-img {
    width: 100%;
    max-height: 40vh;
    object-fit: cover;
    object-position: center;
    margin-bottom: 2rem;
}

.modal-tag {
    font-family: var(--font-m);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--accent-color);
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    transition: color 0.6s;
}

.modal-title {
    font-family: var(--font-project-title);
    font-size: clamp(2rem, 4vw, 2.8rem);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    color: var(--text-color);
    line-height: 1.1;
    letter-spacing: 0.02em;
    transition: color 0.6s, font-family 0.6s;
}

.modal-role {
    font-family: var(--font-m);
    font-size: 11px;
    color: var(--text-color);
    opacity: 0.6;
    margin-bottom: 2rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.modal-desc {
    font-family: var(--font-m);
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 2rem;
}

.modal-section-title {
    font-family: var(--font-m);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0.46;
    margin-bottom: 12px;
}

.modal-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 2rem;
}

.modal-skill {
    font-family: var(--font-m);
    font-size: 9px;
    padding: 4px 10px;
    border: 1px solid color-mix(in srgb, var(--text-color) 15%, transparent);
    color: var(--text-color);
    opacity: 0.7;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.modal-skill:hover {
    transform: scale(1.05);
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: var(--surface-hover);
    opacity: 1;
}

.modal-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 2rem;
}

.modal-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line-color);
    font-family: var(--font-m);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0.8;
    transition: color 0.6s, opacity 0.2s;
}

.modal-link:first-child {
    border-top: 1px solid var(--line-color);
}

.modal-link:hover {
    color: var(--accent-color);
    opacity: 1;
}

.modal-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 2rem;
}

.modal-gallery a {
    position: relative;
    display: block;
    overflow: hidden;
    color: inherit;
    cursor: none;
}

.modal-gallery a::after {
    content: 'Open gallery';
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 7px;
    background: color-mix(in srgb, var(--bg-color) 82%, black);
    border: 1px solid var(--line-strong);
    color: var(--text-color);
    font-family: var(--font-m);
    font-size: 8px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease, color 0.6s;
}

.modal-gallery a:hover::after,
.modal-gallery a:focus-visible::after {
    opacity: 0.86;
    transform: translateY(0);
}

.modal-gallery img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    opacity: 0.8;
    display: block;
    transition: opacity 0.2s, transform 0.35s var(--ease-flow);
}

.modal-gallery a:hover img,
.modal-gallery a:focus-visible img {
    opacity: 1;
    transform: scale(1.04);
}

/* ====================================================
   LEGACY POPUP
   ==================================================== */
.legacy-popup {
    position: fixed;
    bottom: 0px;
    right: 0px;
    background: var(--bg-color);
    border-top: 1px solid var(--line-color);
    border-left: 1px solid var(--line-color);
    padding: 16px 20px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transform: translateY(150%);
    opacity: 0;
    transition: transform 0.5s var(--ease-out), opacity 0.5s ease, background-color 0.6s;
    pointer-events: none;
}

.legacy-popup.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.legacy-popup-title {
    font-family: var(--font-m);
    font-size: 9px;
    color: var(--text-color);
    opacity: 0.5;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.legacy-popup-link {
    font-family: var(--font-current);
    font-size: 14px;
    color: var(--text-color);
    transition: color 0.3s;
    text-transform: uppercase;
}

.legacy-popup-link:hover {
    color: var(--accent-color);
}


/* ====================================================
   RESPONSIVE
   ==================================================== */
.mobile-break { display: none; }

@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .mobile-break { display: block; }

    .art-text {
        font-size: clamp(2.5rem, 15vw, 6rem);
        line-height: 0.9;
    }

    .viewport-hud { display: none; }
    #cursor { display: none; }

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

    #portfolio { padding: 0 20px; }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .about-details {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .sticky-nav-inner { padding: 0 20px; }
    .sticky-links { gap: 16px; }
    .sticky-social { display: none; }

    .footer-inner { flex-direction: column; align-items: flex-start; gap: 16px; padding: 24px 20px; }
    .footer-links { gap: 16px; }

    .work-modal-inner { padding: 2rem 20px; }
    .modal-gallery { grid-template-columns: 1fr; }
    .modal-backdrop { padding-right: 0; }
    .modal-hover-preview { display: none; }

}

@media (max-width: 480px) {
    .sticky-links { display: none; }
    .portfolio-section { padding-top: 64px; }
    .about-section { padding-top: 64px; padding-bottom: 40px; }
}
/* Dice Container - Top Right Box */
.dice-container {
    position: fixed;
    top: 0px;
    right: 0px;
    width: 160px;
    height: 56px; /* Match sticky nav height */
    background: var(--bg-color);
    border-bottom: 1px solid var(--line-color);
    border-left: 1px solid var(--line-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.6s;
}



.dice-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-dice-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.3s, transform 0.3s;
}

.theme-dice-btn:hover {
    opacity: 1;
    transform: scale(1.1) rotate(15deg);
}

.dice-icon {
    width: 24px;
    height: 24px;
    filter: invert(1);
    mix-blend-mode: exclusion;
}

.dice-result-text {
    font-family: 'Space Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
    opacity: 0.9;
    display: inline-block;
    width: 36px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: opacity 0.3s, transform 0.3s, color 0.3s;
}

.dice-result-text.active {
    opacity: 1;
    transform: scale(1.08);
}

.mobile-section-shortcuts {
    display: none;
}

@media (max-width: 768px) {
    .meta-info {
        display: none;
    }

    .scroll-invite {
        bottom: 38px;
    }

    .sticky-links,
    .sticky-social,
    .dice-controls,
    .legacy-popup,
    #cursor-ring {
        display: none;
    }

    .dice-container {
        top: 56px;
        left: 0;
        right: 0;
        width: 100%;
        height: 34px;
        padding: 0 16px;
        justify-content: center;
        background: color-mix(in srgb, var(--bg-color) 94%, black);
        border-left: 0;
        border-top: 1px solid var(--line-color);
    }

    .mobile-section-shortcuts {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 20px;
        width: 100%;
        min-width: 0;
    }

    .mobile-section-shortcuts a {
        font-family: var(--font-m);
        font-size: 9px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-color);
        opacity: 0.66;
        white-space: nowrap;
    }

    .mobile-section-shortcuts a:hover {
        color: var(--accent-color);
        opacity: 1;
    }
}

@media (max-width: 430px) {
    .sticky-nav-inner {
        padding-left: 16px;
        padding-right: 12px;
    }

    .sticky-name {
        font-size: 14px;
    }

    .dice-container {
        padding: 0 10px;
    }

    .mobile-section-shortcuts {
        gap: 14px;
    }

    .mobile-section-shortcuts a {
        font-size: 8px;
        letter-spacing: 0.06em;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }

    #canvas-layer {
        opacity: 0.18;
    }

    .project-card:hover,
    .course-card:hover,
    .modal-skill:hover,
    .modal-gallery a:hover img {
        transform: none;
    }
}
