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

/* ===== THEME ===== */
:root {
    --bg-color: #f0efec;
    --text-color: #141412;
    --text-secondary: #6b6a66;
    --accent-color: #ff4d2e;
    --gradient-start: #de1d08;
    --gradient-middle: #ffb366;
    --gradient-end: #a855f7;
    --nav-bg: #1414124d;
    --nav-text: #fff;
    --surface: #e6e4df;
    --stroke: #14141222;
    /* negative spread keeps the sides clean — shadow lives below the card */
    --card-shadow: 0 24px 48px -20px rgba(20, 20, 18, 0.16), 0 6px 16px -8px rgba(20, 20, 18, 0.06);
    --noise-opacity: 0.03;
    user-select: none;
}

body.dark-theme {
    --bg-color: #121210;
    --text-color: #f2f1ee;
    --text-secondary: #8a8983;
    --nav-bg: #ffffff14;
    --nav-text: #f2f1ee;
    --surface: #1c1c19;
    --stroke: #f2f1ee22;
    --card-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

::selection {
    background: var(--accent-color);
    color: #fff;
}

button:focus {
    outline: none;
}

button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

/* Magnetic elements move via --mx/--my so state classes (e.g. header
   hiding) can still control the transform */
[data-magnetic] {
    transform: translate(var(--mx, 0px), var(--my, 0px));
    transition: transform 0.18s cubic-bezier(0.19, 1, 0.22, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Geist Mono', monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    font-weight: 200;
    position: relative;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.display {
    font-family: 'Archivo', sans-serif;
}

/* Grain */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: var(--noise-opacity);
    pointer-events: none;
    z-index: 500;
}

/* ===== PRELOADER ===== */
.preloader {
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    color: var(--text-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 60px 65px;
    transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
    border-bottom: 1px solid var(--stroke);
}

.preloader.done {
    transform: translateY(-100%);
}

.preloader-counter {
    font-family: 'Archivo', sans-serif;
    font-weight: 800;
    font-size: clamp(100px, 22vw, 320px);
    line-height: 0.85;
    letter-spacing: -0.03em;
}

.preloader-label {
    margin-top: 24px;
    font-size: 13px;
    letter-spacing: 3px;
    opacity: 0.5;
}

/* ===== CUSTOM CURSOR ===== */
.cursor-dot,
.cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 900;
    transform: translate(-50%, -50%);
    visibility: hidden;
}

body.has-cursor .cursor-dot,
body.has-cursor .cursor-ring {
    visibility: visible;
}

/* Crosshair cursor: a plus that folds into an X over interactive elements */
.cursor-dot {
    width: 18px;
    height: 18px;
    background: none;
}

.cursor-dot::before,
.cursor-dot::after {
    content: '';
    position: absolute;
    background: var(--accent-color);
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}

.cursor-dot::before {
    left: 0;
    top: 50%;
    width: 100%;
    height: 2px;
    margin-top: -1px;
}

.cursor-dot::after {
    top: 0;
    left: 50%;
    height: 100%;
    width: 2px;
    margin-left: -1px;
}

.cursor-dot.hovering::before,
.cursor-dot.hovering::after {
    transform: rotate(135deg);
}

.cursor-ring {
    width: 38px;
    height: 38px;
    border: 1px solid var(--text-color);
    opacity: 0.45;
    transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease, background 0.3s ease;
}

.cursor-ring.hovering {
    width: 64px;
    height: 64px;
    opacity: 1;
    border-color: var(--accent-color);
    background: #ff4d2e14;
}

body.has-cursor,
body.has-cursor a,
body.has-cursor button,
body.has-cursor [data-hover] {
    cursor: none;
}

@media (hover: none), (pointer: coarse) {
    .cursor-dot,
    .cursor-ring {
        display: none;
    }
}

/* Scroll progress bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-middle));
    transform-origin: left;
    transform: scaleX(0);
    z-index: 600;
    pointer-events: none;
}

/* ===== FOOTER ===== */
.footer {
    position: relative;
    min-height: 100vh;
    padding: 120px 70px 50px;
    border-top: 1px solid var(--stroke);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    overflow: hidden;
}

.footer-eyebrow {
    font-size: 13px;
    letter-spacing: 3px;
    opacity: 0.7;
    /* auto margins center the CTA block, bottom row pinned below */
    margin-top: auto;
}

.footer-cta {
    background: none;
    border: none;
    cursor: pointer;
    /* nudges the centered block a bit above true center */
    margin-bottom: 9vh;
    font-family: 'Archivo', sans-serif;
    font-size: clamp(56px, 9vw, 150px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 0.95;
    text-transform: uppercase;
    text-align: center;
    color: transparent;
    -webkit-text-stroke: 2px var(--text-color);
    transition: color 0.4s ease;
}

.footer-cta:hover {
    color: var(--text-color);
}

.footer-bottom {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: auto;
    padding-top: 28px;
    border-top: 1px solid var(--stroke);
    font-size: 12px;
    letter-spacing: 2px;
}

.footer-copy {
    opacity: 0.6;
}

.footer-socials {
    display: flex;
    gap: 28px;
}

.footer-socials a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s ease, color 0.3s ease;
}

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

.back-to-top {
    background: none;
    border: none;
    color: var(--text-color);
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    letter-spacing: 2px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.back-to-top:hover {
    opacity: 1;
}

/* ===== FIXED UI ===== */
.theme-toggle {
    position: fixed;
    top: 40px;
    left: 65px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
    cursor: pointer;
    background: color-mix(in srgb, var(--bg-color) 65%, transparent);
    backdrop-filter: blur(14px);
    border: 1px solid var(--stroke);
    border-radius: 100px;
    padding: 10px 18px;
    color: var(--text-color);
    font-family: 'Geist Mono', monospace;
    transition: transform 0.55s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.35s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle.ui-hidden {
    transform: translateY(-180%);
    opacity: 0;
    pointer-events: none;
    transition-delay: 0.05s;
}

.theme-toggle:hover {
    background: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

.toggle-orb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    background: linear-gradient(90deg, currentColor 50%, transparent 50%);
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    flex-shrink: 0;
}

body.dark-theme .toggle-orb {
    transform: rotate(180deg);
}

.toggle-label {
    font-size: 11px;
    letter-spacing: 2px;
    color: currentColor;
}

.contact-btn {
    position: fixed;
    top: 40px;
    right: 65px;
    background: color-mix(in srgb, var(--bg-color) 65%, transparent);
    backdrop-filter: blur(14px);
    border: 1px solid var(--stroke);
    border-radius: 100px;
    padding: 10px 26px;
    color: var(--text-color);
    font-family: 'Geist Mono', monospace;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 2px;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.55s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.35s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.contact-btn.ui-hidden {
    transform: translateY(-180%);
    opacity: 0;
    pointer-events: none;
    transition-delay: 0.1s;
}

.contact-btn:hover {
    background: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

.clock-label {
    position: fixed;
    bottom: 60px;
    right: 65px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    letter-spacing: 2px;
    opacity: 0.7;
    z-index: 100;
    transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.19, 1, 0.22, 1);
}

/* both slide away while the footer is on screen so they never
   overlap the copyright / socials / back-to-top row */
body.footer-visible .clock-label,
body.footer-visible .section-progress {
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
}

.clock-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #3ecf6a;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
}

/* ===== NAV ===== */
.nav {
    position: fixed;
    top: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 100;
    background: color-mix(in srgb, var(--bg-color) 65%, transparent);
    backdrop-filter: blur(14px);
    border: 1px solid var(--stroke);
    border-radius: 100px;
    padding: 5px;
    transition: transform 0.55s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.35s ease, background 0.4s ease, border-color 0.4s ease;
}

.nav.ui-hidden {
    transform: translate(-50%, -180%);
    opacity: 0;
    pointer-events: none;
}

.nav-btn {
    padding: 9px 24px;
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.55;
    font-family: 'Geist Mono', monospace;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: 100px;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.nav-btn:hover {
    opacity: 1;
}

.nav-btn.active {
    background: var(--text-color);
    color: var(--bg-color);
    opacity: 1;
    font-weight: 500;
}

/* Section progress */
.section-progress {
    position: fixed;
    bottom: 60px;
    left: 65px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    letter-spacing: 2px;
    opacity: 0.7;
    z-index: 100;
    transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.19, 1, 0.22, 1);
}

.progress-track {
    width: 120px;
    height: 1px;
    background: var(--stroke);
    position: relative;
    overflow: hidden;
}

.progress-fill {
    position: absolute;
    inset: 0;
    background: var(--accent-color);
    transform-origin: left;
    transform: scaleX(0.333);
    transition: transform 1s cubic-bezier(0.19, 1, 0.22, 1);
}

/* ===== LAYOUT ===== */
.container {
    width: 100%;
    position: relative;
    transition: opacity 0.6s ease, transform 0.6s ease;
    z-index: 1;
}

.container.hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.sections-wrapper {
    width: 100%;
}

.section {
    width: 100%;
    min-height: 100vh;
    position: relative;
    padding: 0 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Ghost section titles (parallax via --par, set on scroll) */
.section-ghost {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + var(--par, 0px)));
    font-family: 'Archivo', sans-serif;
    font-weight: 900;
    font-size: clamp(200px, 38vw, 560px);
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px var(--stroke);
    pointer-events: none;
    white-space: nowrap;
}

/* ===== REVEAL SYSTEM ===== */
.line-mask {
    display: block;
    overflow: hidden;
}

/* Transitions (not animations) so leaving the viewport eases out
   as gracefully as entering eased in */
.line-inner {
    display: inline-block;
    transform: translateY(115%) rotate(2deg);
    transform-origin: left bottom;
    transition: transform 1s cubic-bezier(0.19, 1, 0.22, 1);
    transition-delay: var(--d, 0s);
}

.in-view .line-inner {
    transform: translateY(0) rotate(0deg);
}

@keyframes lineUp {
    to {
        transform: translateY(0) rotate(0deg);
    }
}

.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s cubic-bezier(0.19, 1, 0.22, 1), transform 0.9s cubic-bezier(0.19, 1, 0.22, 1);
    transition-delay: var(--d, 0s);
}

.in-view .reveal {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .line-inner { transform: none; }
    .reveal { opacity: 1; transform: none; }
    .marquee-track { animation: none !important; }
    .badge-svg { animation: none !important; }
}

/* ===== HOME ===== */
.home-section {
    justify-content: flex-start;
    align-items: center;
    /* keep centered content clear of the fixed header and bottom UI */
    padding-top: 120px;
    padding-bottom: 160px;
}

@media (max-height: 950px) {
    .home-section {
        padding-top: 100px;
        padding-bottom: 130px;
    }

    .main-title {
        font-size: clamp(48px, min(11vw, 12.5vh), 170px);
    }

    .home-eyebrow {
        margin-bottom: 16px;
    }

    .home-tagline {
        margin-top: 20px;
    }
}

.portfolio-label {
    position: absolute;
    top: 50%;
    right: 55px;
    font-size: 13px;
    letter-spacing: 3px;
    writing-mode: vertical-rl;
    transform: translateY(-50%);
    opacity: 0.6;
}

.decrypt-text {
    display: inline-block;
}

.home-content {
    position: relative;
    z-index: 2;
}

.home-eyebrow {
    font-size: 13px;
    letter-spacing: 3px;
    margin-bottom: 28px;
    opacity: 0.7;
}

.eyebrow-index {
    color: var(--accent-color);
    margin-right: 10px;
}

.main-title {
    font-family: 'Archivo', sans-serif;
    font-size: clamp(64px, 11vw, 170px);
    line-height: 0.92;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.title-sup {
    font-size: 0.22em;
    font-weight: 500;
    vertical-align: top;
    line-height: 1.6;
    letter-spacing: 0;
}

.line-accent {
    color: var(--accent-color);
}

.line-outline {
    color: transparent;
    -webkit-text-stroke: 2px var(--text-color);
}

.title-dot {
    color: var(--accent-color);
}

.home-tagline {
    margin-top: 36px;
    font-size: 15px;
    line-height: 1.7;
    letter-spacing: 0.5px;
    opacity: 0.75;
}

/* Rotating badge — anchored to the upper right, clear of title,
   tagline, clock and marquee at every viewport */
.rotating-badge {
    position: absolute;
    top: 30%;
    right: 9%;
    width: 130px;
    height: 130px;
    z-index: 3;
}

/* hide once it would crowd the title/tagline */
@media (max-width: 1200px) {
    .rotating-badge {
        display: none;
    }
}

.badge-svg {
    width: 100%;
    height: 100%;
    animation: spin 14s linear infinite;
}

.badge-text {
    font-size: 11.5px;
    letter-spacing: 2.5px;
    fill: var(--text-color);
    font-family: 'Geist Mono', monospace;
}

.badge-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 30px;
    color: var(--accent-color);
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.rotating-badge:hover .badge-arrow {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.2);
}

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

/* Marquee */
.marquee {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    border-top: 1px solid var(--stroke);
    padding: 18px 0;
    background: var(--bg-color);
    transition: background-color 0.4s ease;
}

.marquee-track {
    display: flex;
    white-space: nowrap;
    width: max-content;
    animation: marquee 28s linear infinite;
    font-family: 'Archivo', sans-serif;
    font-weight: 600;
    font-size: 20px;
    letter-spacing: 2px;
    opacity: 0.8;
}

.marquee:hover .marquee-track {
    animation-play-state: paused;
}

@keyframes marquee {
    to { transform: translateX(-50%); }
}

/* ===== ABOUT ===== */
.about-section {
    justify-content: flex-start;
    align-items: flex-start;
}

.about-content {
    width: 100%;
    max-width: 1400px;
    position: relative;
    z-index: 2;
    /* title sits below the header zone, anchored to the section content */
    padding-top: 210px;
    padding-bottom: 90px;
}

.section-title {
    font-family: 'Archivo', sans-serif;
    font-size: clamp(60px, 9vw, 140px);
    font-weight: 800;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    transition: color 0.4s ease;
}

.about-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 80px;
    /* text and image rise together toward the title */
    align-items: start;
    margin-top: 40px;
}

.about-text {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.about-text p {
    font-size: 17px;
    line-height: 1.8;
    opacity: 0.9;
    max-width: 560px;
}

.about-text em {
    font-style: normal;
    color: var(--accent-color);
}

.skill-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.skill-list li {
    border: 1px solid var(--stroke);
    border-radius: 100px;
    padding: 8px 18px;
    font-size: 12px;
    letter-spacing: 2px;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.skill-list li:hover {
    background: var(--text-color);
    color: var(--bg-color);
}

.about-image {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    /* frame rises to roughly half the ABOUT title height */
    margin-top: -110px;
}

.about-image-frame {
    width: 100%;
    max-width: 540px;
    aspect-ratio: 4 / 5;
    background: linear-gradient(160deg, var(--gradient-start), var(--gradient-middle) 60%, var(--gradient-end));
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
}

.about-image-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.14;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.about-image-frame img {
    width: 100%;
    height: auto;
    display: block;
    transform: translateY(1%) scale(1.02);
    transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

.about-image-frame:hover img {
    transform: translateY(0) scale(1.06);
}

.about-image-caption {
    font-size: 11px;
    letter-spacing: 2px;
    opacity: 0.5;
}

/* ===== MY STACK ===== */
.stack-block {
    margin-top: 90px;
}

.stack-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.stack-label {
    font-size: 13px;
    letter-spacing: 3px;
}

.stack-hint {
    font-size: 11px;
    letter-spacing: 2px;
    opacity: 0.45;
}

.stack-list {
    list-style: none;
    border-top: 1px solid var(--stroke);
}

.stack-row {
    position: relative;
    display: grid;
    grid-template-columns: 60px 1fr auto;
    grid-template-areas: "index name tag" "index detail tag";
    align-items: center;
    column-gap: 20px;
    padding: 20px 16px;
    border-bottom: 1px solid var(--stroke);
    cursor: pointer;
    overflow: hidden;
    transition: color 0.55s ease;
}

/* fill sweeps up on hover / tap, content inverts */
.stack-row::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--text-color);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.75s cubic-bezier(0.19, 1, 0.22, 1);
}

.stack-row:hover::before,
.stack-row.open::before {
    transform: scaleY(1);
}

.stack-row:hover,
.stack-row.open {
    color: var(--bg-color);
}

.stack-row > * {
    position: relative;
    z-index: 1;
}

.stack-index {
    grid-area: index;
    font-size: 12px;
    letter-spacing: 1px;
    opacity: 0.5;
}

.stack-name {
    grid-area: name;
    font-family: 'Archivo', sans-serif;
    font-size: clamp(20px, 2.4vw, 32px);
    font-weight: 800;
    letter-spacing: 0.01em;
    transition: transform 0.75s cubic-bezier(0.19, 1, 0.22, 1);
}

.stack-row:hover .stack-name,
.stack-row.open .stack-name {
    transform: translateX(12px);
}

.stack-detail {
    grid-area: detail;
    font-size: 12.5px;
    letter-spacing: 0.5px;
    max-height: 0;
    opacity: 0;
    transform: translateX(-14px);
    transition: max-height 0.7s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.55s ease 0.08s, transform 0.7s cubic-bezier(0.19, 1, 0.22, 1) 0.08s;
}

.stack-row:hover .stack-detail,
.stack-row.open .stack-detail {
    max-height: 44px;
    opacity: 0.75;
    transform: translateX(12px);
}

.stack-tag {
    grid-area: tag;
    font-size: 11px;
    letter-spacing: 2px;
    border: 1px solid currentColor;
    border-radius: 100px;
    padding: 6px 14px;
    opacity: 0.55;
}

@media (max-width: 768px) {
    .stack-block {
        margin-top: 60px;
    }

    .stack-row {
        grid-template-columns: 36px 1fr auto;
        padding: 16px 8px;
        column-gap: 12px;
    }

    .stack-name {
        font-size: 18px;
    }

    .stack-detail {
        font-size: 11px;
    }

    .stack-tag {
        font-size: 9px;
        padding: 4px 10px;
    }
}

/* ===== WORK ===== */
.work-section {
    justify-content: flex-start;
    align-items: flex-start;
    padding: 0 0 0 70px;
    display: flex;
    gap: 0;
}

.work-ghost {
    left: auto;
    right: -4%;
    transform: translateY(calc(-50% + var(--par, 0px)));
    font-size: clamp(240px, 34vw, 520px);
    transition: opacity 0.35s ease;
}

.work-ghost.switching {
    opacity: 0;
}

.work-left {
    flex: 0 0 calc(33.333% - 40px);
    max-width: calc(33.333% - 40px);
    padding-top: 108px;
    padding-right: 60px;
    position: relative;
    z-index: 2;
}

.work-title {
    margin-bottom: 30px;
    font-size: clamp(48px, 6.5vw, 110px);
}

.work-project-title {
    font-family: 'Archivo', sans-serif;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 16px;
    color: var(--accent-color);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.work-description {
    font-size: 15px;
    line-height: 1.7;
    opacity: 0.85;
    min-height: 108px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    /* keep the \n\n line breaks written in projects.js */
    white-space: pre-line;
}

.work-description a {
    color: var(--accent-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: opacity 0.3s ease;
}

.work-description a:hover {
    opacity: 0.7;
}

.work-project-title.switching,
.work-description.switching {
    opacity: 0;
    transform: translateY(12px);
}

.work-description strong {
    font-weight: 600;
    color: var(--accent-color);
}

.work-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
    font-size: 11px;
    letter-spacing: 2px;
    opacity: 0.6;
}

.work-meta-line {
    flex: 1;
    height: 1px;
    background: var(--stroke);
}

.work-right {
    flex: 1;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-right: 70px;
    z-index: 2;
}

/* Carousel row: subtle arrows around the sliding PROJ window,
   centered over the project card */
.project-nav-wrap {
    position: absolute;
    top: 118px;
    /* half of the 70px right padding keeps it centered on the card */
    left: calc(50% - 35px);
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 20;
}

/* Sliding 3-item window: previous / active / next, others hidden */
.project-nav-top {
    position: relative;
    width: 440px;
    height: 30px;
    font-size: 18px;
    letter-spacing: 0.5px;
}

.project-nav-item {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(calc(-50% + var(--off, 0) * 145px));
    color: var(--text-color);
    cursor: pointer;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.4s ease;
}

.project-nav-item::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.project-nav-item.near {
    opacity: 0.3;
    pointer-events: auto;
}

.project-nav-item.near:hover {
    opacity: 0.7;
}

.project-nav-item.active {
    opacity: 1;
    font-weight: 600;
    pointer-events: auto;
}

.project-nav-item.active::after {
    transform: scaleX(1);
}

.project-showcase {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    perspective: 1200px;
}

.projects-slider {
    display: flex;
    width: 100%;
    min-width: 0;
    height: 100%;
    transition: transform 0.9s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    flex: 1;
}

.project-slide {
    min-width: 100%;
    height: 100%;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease, transform 0.9s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    /* top padding clears the carousel row (top 118px + 30px tall) */
    padding: 175px 0 70px;
}

.project-slide.active {
    opacity: 1;
    transform: scale(1);
}

/* Browser-window style project card */
.project-card {
    width: 100%;
    max-width: 860px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.25s ease-out;
    transform-style: preserve-3d;
    will-change: transform;
}

.project-card-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--stroke);
    font-size: 11px;
    letter-spacing: 1.5px;
    flex-shrink: 0;
}

.card-dots {
    display: flex;
    gap: 6px;
}

.card-dots i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--stroke);
}

.card-dots i:first-child {
    background: var(--accent-color);
}

.card-file {
    flex: 1;
    opacity: 0.55;
}

.card-index {
    opacity: 0.4;
}

.project-card-media {
    flex: 1;
    min-height: 0;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    position: relative;
}

.project-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transform: scale(1.01);
    transition: transform 1s cubic-bezier(0.19, 1, 0.22, 1);
}

.project-card:hover .project-image {
    transform: scale(1.06);
}

.project-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 22px;
    letter-spacing: 1px;
    opacity: 0.6;
}

.project-placeholder .placeholder-note {
    font-size: 13px;
    opacity: 0.5;
}

.project-counter {
    position: absolute;
    top: 165px;
    right: 70px;
    font-size: 13px;
    letter-spacing: 2px;
    opacity: 0.6;
    z-index: 20;
}

/* Subtle mini arrows beside the PROJ carousel */
.project-arrow-side {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: opacity 0.3s ease, color 0.3s ease;
    border-radius: 50%;
    flex-shrink: 0;
}

.project-arrow-side:hover:not(:disabled) {
    opacity: 1;
    color: var(--accent-color);
}

.project-arrow-side:disabled {
    opacity: 0.12;
    cursor: not-allowed;
}

/* ===== CONTACT OVERLAY ===== */
.contact-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.contact-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.contact-close {
    position: fixed;
    top: 40px;
    right: 65px;
    background: none;
    border: 1px solid var(--stroke);
    border-radius: 50%;
    width: 52px;
    height: 52px;
    color: var(--text-color);
    font-size: 22px;
    cursor: pointer;
    z-index: 201;
    transition: all 0.3s ease;
    line-height: 1;
}

.contact-close:hover {
    transform: rotate(90deg);
    background: var(--text-color);
    color: var(--bg-color);
}

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

.contact-title {
    font-family: 'Archivo', sans-serif;
    font-size: clamp(60px, 10vw, 150px);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 70px;
    text-transform: uppercase;
}

.contact-title-inner {
    display: inline-block;
    transform: translateY(115%);
}

.contact-overlay.active .contact-title-inner {
    animation: lineUp 1s cubic-bezier(0.19, 1, 0.22, 1) 0.1s forwards;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 36px;
    align-items: center;
}

.contact-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(24px);
}

.contact-overlay.active .contact-item {
    animation: fadeUp 0.8s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.contact-overlay.active .contact-item:nth-child(1) { animation-delay: 0.25s; }
.contact-overlay.active .contact-item:nth-child(2) { animation-delay: 0.35s; }
.contact-overlay.active .contact-item:nth-child(3) { animation-delay: 0.45s; }
.contact-overlay.active .contact-item:nth-child(4) { animation-delay: 0.55s; }

.contact-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.55;
}

.contact-link {
    font-size: 24px;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
}

.contact-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.contact-link:hover::after {
    width: 100%;
}

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

/* ===== ADMIN PANEL ===== */
.admin-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(420px, 100vw);
    background: var(--bg-color);
    border-left: 1px solid var(--stroke);
    z-index: 300;
    overflow-y: auto;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.2);
}

.admin-inner {
    padding: 50px 30px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
}

.admin-close {
    position: absolute;
    top: 18px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 22px;
    cursor: pointer;
}

.admin-title {
    font-family: 'Archivo', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1px;
}

.admin-hint {
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.6;
}

.admin-hint code {
    font-family: inherit;
    font-weight: 600;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.admin-field input,
.admin-field textarea,
#adminOutput {
    font-family: 'Geist Mono', monospace;
    font-size: 13px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--text-color);
    border: 1px solid transparent;
    border-radius: 6px;
    resize: vertical;
}

.admin-field input:focus,
.admin-field textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.admin-actions {
    display: flex;
    gap: 10px;
}

.admin-actions button {
    flex: 1;
    padding: 11px 0;
    font-family: 'Geist Mono', monospace;
    font-size: 12px;
    letter-spacing: 1px;
    cursor: pointer;
    border: 1px solid var(--text-color);
    border-radius: 100px;
    color: var(--bg-color);
    background: var(--text-color);
    transition: background 0.3s ease, color 0.3s ease;
}

.admin-actions button:hover {
    background: none;
    color: var(--text-color);
}

#adminOutput {
    white-space: pre;
    overflow-x: auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .section {
        padding-left: 40px;
        padding-right: 40px;
    }

    .work-section {
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 120px;
    }

    .work-left {
        flex: none;
        max-width: 100%;
        margin-bottom: 40px;
        padding-top: 0;
    }

    .work-right {
        flex: 1;
        width: 100%;
        max-width: 100%;
        height: 55vh;
        padding-right: 0;
    }

    .project-nav-wrap {
        top: 10px;
    }

    .about-image {
        margin-top: 0;
    }

    .project-slide {
        padding: 60px 0 50px;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 50px;
        /* caption must clear the fixed clock in single-column layout */
        padding-bottom: 110px;
    }

    .theme-toggle {
        left: 40px;
    }

    .section-progress {
        left: 40px;
    }

    .contact-btn,
    .portfolio-label,
    .clock-label,
    .project-counter {
        right: 40px;
    }

    .rotating-badge {
        right: 8%;
        bottom: 20%;
        width: 100px;
        height: 100px;
    }

    .section-progress {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: clamp(52px, 14vw, 90px);
    }

    .section-title {
        font-size: clamp(44px, 12vw, 80px);
    }

    .about-text p {
        font-size: 15px;
    }

    .home-tagline {
        font-size: 13px;
    }

    .rotating-badge {
        display: none;
    }

    .clock-label {
        display: none;
    }

    .portfolio-label {
        display: none;
    }

    .contact-title {
        font-size: clamp(44px, 13vw, 100px);
    }

    .contact-link {
        font-size: 17px;
    }

    .marquee-track {
        font-size: 15px;
    }

    .work-left {
        margin-bottom: 8px;
    }

    .work-title {
        font-size: 40px;
        margin-bottom: 14px;
    }

    .work-project-title {
        font-size: 17px;
        margin-bottom: 10px;
    }

    .work-description {
        min-height: 0;
        font-size: 13px;
        line-height: 1.6;
    }

    .work-meta {
        display: none;
    }

    .project-counter {
        display: none;
    }

    .project-nav-wrap {
        position: static;
        transform: none;
        width: 100%;
        margin: 10px 0 4px;
    }

    .project-nav-top {
        flex: 1;
        min-width: 0;
        height: 26px;
        font-size: 14px;
    }

    .project-nav-item {
        transform: translateX(calc(-50% + var(--off, 0) * 100px));
    }

    .work-right {
        flex: 1;
        min-height: 0;
        height: auto;
        margin-bottom: 118px;
    }

    .project-showcase {
        gap: 0;
    }

    .project-slide {
        padding: 8px 0;
    }

    .project-card-bar {
        padding: 10px 14px;
        font-size: 10px;
    }

    .work-section {
        padding-top: 90px;
    }

    .nav {
        top: auto;
        left: 50%;
        transform: translateX(-50%);
        bottom: 68px;
        width: max-content;
    }

    /* nav sits at the bottom on mobile, so it hides downward */
    .nav.ui-hidden {
        transform: translate(-50%, 220%);
    }

    .nav-btn {
        padding: 7px 16px;
        font-size: 13px;
    }

    .footer {
        padding: 90px 24px 170px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
        margin-top: auto;
    }
}
