/*
=====================================================
   GLOBAL VARIABLES & THEME SETTINGS
=====================================================
*/
:root {
    --bg-color: #030303;      /* Deep black background for the cinematic feel */
    --text-color: #E1D9C1;    /* Warm, premium off-white */
    --text-muted: #8f8b80;    /* Warm grey for secondary text (5.9:1 on black) */
    --accent: #E1D9C1;        /* Borders and highlights */
    --hairline: rgba(225, 217, 193, 0.12);
    --todo: #d9a35b;          /* Marks content that still needs filling in */

    --font-heading: 'Syncopate', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/*
=====================================================
   RESET & BASE STYLES
=====================================================
*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 6rem; /* Keeps section titles clear of the fixed header */
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body.loading {
    overflow: hidden;
}

/* The custom cursor replaces the native one only when a precise mouse is present */
html.has-cursor body,
html.has-cursor a,
html.has-cursor button {
    cursor: none;
}

a {
    color: inherit;
}

ol, ul {
    list-style: none;
}

h1, h2, h3 {
    text-wrap: balance;
}

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

:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 6px;
}

.skip-link {
    position: fixed;
    top: -4rem;
    left: 1.5rem;
    z-index: 10001;
    padding: 0.75rem 1.25rem;
    background: var(--accent);
    color: var(--bg-color);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-decoration: none;
}

.skip-link:focus {
    top: 1.5rem;
}

.todo {
    color: var(--todo);
    font-style: italic;
}

/*
=====================================================
   PRELOADER
=====================================================
*/
.preload {
    position: fixed;
    inset: 0;
    background-color: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-out, visibility 1s;
}

.preload.hidden {
    opacity: 0;
    visibility: hidden;
}

.preload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 0 1.5rem;
}

.spinner {
    width: 100px;
    height: 100px;
    border: 2px solid transparent;
    border-top: 2px solid var(--accent);
    border-right: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

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

.enter-button {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: var(--font-heading);
    padding: 1rem 2.5rem;
    font-size: 0.9rem;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.8s var(--ease-out);
    text-transform: uppercase;
    opacity: 0.9;
    animation: buttonPulse 4s infinite alternate;
}

@keyframes buttonPulse {
    0% { box-shadow: 0 0 5px rgba(225, 217, 193, 0.1); }
    100% { box-shadow: 0 0 20px rgba(225, 217, 193, 0.6); }
}

@media (hover: hover) {
    .enter-button:hover {
        background: var(--accent);
        color: #000;
        opacity: 1;
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(225, 217, 193, 0.8);
        letter-spacing: 5px;
    }
}

#loading-text {
    font-family: var(--font-heading);
    color: var(--accent);
    font-size: clamp(0.85rem, 3vw, 1.5rem);
    letter-spacing: 2px;
    border-right: 2px solid var(--accent);
    white-space: nowrap;
    padding-right: 5px;
    min-height: 1.5em;
    animation: blink-caret 1.5s step-end infinite;
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent); }
}

/*
=====================================================
   HEADER NAVIGATION
=====================================================
*/
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    mix-blend-mode: difference; /* Inverts over light imagery */
}

.logo {
    font-family: var(--font-heading);
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    position: relative;
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--text-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s var(--ease-out);
}

.nav a:focus-visible::after {
    transform: scaleX(1);
}

@media (hover: hover) {
    .nav a:hover::after {
        transform: scaleX(1);
    }
}

/* Two-line burger, only visible on small screens */
.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    background: none;
    border: 0;
    position: relative;
    cursor: pointer;
}

.menu-toggle span {
    position: absolute;
    left: 10px;
    right: 10px;
    height: 1px;
    background: var(--text-color);
    transition: transform 0.4s var(--ease-out);
}

.menu-toggle span:first-child { top: 18px; }
.menu-toggle span:last-child { top: 26px; }

.menu-open .menu-toggle span:first-child { transform: translateY(4px) rotate(45deg); }
.menu-open .menu-toggle span:last-child { transform: translateY(-4px) rotate(-45deg); }

/*
=====================================================
   HERO SECTION
=====================================================
*/
.hero {
    height: 100vh;
    height: 100svh; /* Avoids the jump when mobile browser bars show/hide */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-image: url('https://images.unsplash.com/photo-1451187580459-43490279c0fa?auto=format&fit=crop&w=1920&q=70');
    background-size: cover;
    background-position: center;
    z-index: -2;
    will-change: transform;
}

/* Scale/brightness pulse lives on a pseudo-element so it doesn't fight the JS parallax transform */
.hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    animation: pulseBg 20s infinite alternate linear;
}

@keyframes pulseBg {
    0% { transform: scale(1); filter: brightness(0.4) contrast(1.2); }
    100% { transform: scale(1.1); filter: brightness(0.6) contrast(1.1); }
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 0%, #030303 80%);
    z-index: -1;
}

.hero-content {
    position: relative;
    text-align: center;
    padding: 0 1.5rem;
    animation: float 12s ease-in-out infinite;
    z-index: 10;
}

.shockwave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 4px solid var(--accent);
    box-shadow: 0 0 50px var(--accent), inset 0 0 50px var(--accent);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.shockwave.explode {
    animation: blast 4s cubic-bezier(0.1, 1, 0.3, 1) forwards;
}

@keyframes blast {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
        border-width: 10px;
    }
    100% {
        transform: translate(-50%, -50%) scale(5);
        opacity: 0;
        border-width: 1px;
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 6vw, 4.5rem);
    line-height: 1;
    font-weight: 700;
    display: flex;
    flex-direction: column;
}

.hero-title .line {
    display: block;
    background: linear-gradient(90deg, #E1D9C1 0%, #888888 50%, #E1D9C1 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 8s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.hero-subtitle {
    margin-top: 2rem;
    font-size: 1.1rem;
    letter-spacing: 6px;
    color: var(--text-color);
    opacity: 0.85;
}

.hero-tagline {
    margin-top: 0.75rem;
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* Entrance: hidden until the preloader opens, then the title rushes forward */
.js .hero-title {
    opacity: 0;
    transform: scale(0.5);
}

.js .hero-subtitle,
.js .hero-tagline {
    opacity: 0;
    transform: translateY(12px);
}

.hero.revealed .hero-title {
    opacity: 1;
    transform: scale(1);
    transition: opacity 2.5s var(--ease-out), transform 3s var(--ease-out);
}

.hero.revealed .hero-subtitle {
    opacity: 0.85;
    transform: none;
    transition: opacity 1.2s var(--ease-out) 0.9s, transform 1.2s var(--ease-out) 0.9s;
}

.hero.revealed .hero-tagline {
    opacity: 1;
    transform: none;
    transition: opacity 1.2s var(--ease-out) 1.2s, transform 1.2s var(--ease-out) 1.2s;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 0.6;
    text-decoration: none;
    color: var(--text-color);
}

.scroll-indicator span {
    font-size: 0.7rem;
    letter-spacing: 2px;
}

.scroll-indicator .line {
    width: 1px;
    height: 60px;
    background: var(--text-color);
    position: relative;
    overflow: hidden;
}

.scroll-indicator .line::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    animation: scrollLine 2s infinite;
}

@keyframes scrollLine {
    0% { top: -100%; }
    100% { top: 100%; }
}

/*
=====================================================
   GENERAL LAYOUT
=====================================================
*/
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 4rem;
}

section {
    padding: 8rem 0;
}

/* Keeps the oversized ghost words from causing sideways scroll */
main > section {
    overflow-x: clip;
}

.section-heading {
    position: relative;
    margin-bottom: 5rem;
}

/* Huge outlined word behind each heading; script.js drifts it with scroll via --drift */
.section-heading::before {
    content: attr(data-ghost);
    position: absolute;
    top: 50%;
    left: -0.06em;
    transform: translate3d(var(--drift, 0px), -50%, 0);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(4.5rem, 15vw, 13rem);
    line-height: 1;
    white-space: nowrap;
    color: transparent;
    -webkit-text-stroke: 1px rgba(225, 217, 193, 0.09);
    pointer-events: none;
    z-index: -1;
}

/* Same metallic shine as the hero name */
.section-heading h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 1rem;
    width: fit-content;
    background: linear-gradient(90deg, #E1D9C1 0%, #8f8b80 50%, #E1D9C1 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 8s linear infinite;
}

/* Starfield canvas, fixed behind everything */
#stars {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    pointer-events: none;
}

/* Rows slide in one after another (class added by script.js, so no-JS still shows content) */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 1s var(--ease-out), transform 1s var(--ease-out), padding-left 0.6s var(--ease-out);
    transition-delay: var(--delay, 0s);
}

.reveal.visible {
    opacity: 1;
    transform: none;
}

/* A thin light sweeps along the divider when a row is hovered or active */
.stack-row,
.case-item {
    background: linear-gradient(90deg, transparent, rgba(225, 217, 193, 0.55), transparent) no-repeat;
    background-size: 30% 1px;
    background-position: -40% 100%;
}

.case-item.active,
.stack-row.active {
    background-position: 140% 100%;
    transition: background-position 1.4s var(--ease-out), padding-left 0.6s var(--ease-out), opacity 1s var(--ease-out), transform 1s var(--ease-out);
}

@media (hover: hover) {
    .case-item:hover,
    .stack-row:hover {
        background-position: 140% 100%;
        transition: background-position 1.4s var(--ease-out), padding-left 0.6s var(--ease-out), opacity 1s var(--ease-out), transform 1s var(--ease-out);
    }
}

.section-heading p {
    color: var(--text-muted);
    font-size: 1.15rem;
}

/*
=====================================================
   ABOUT (MANIFESTO)
=====================================================
*/
.manifesto {
    padding: 12rem 0;
    position: relative;
}

.manifesto-container {
    display: flex;
    align-items: center;
    gap: 5rem;
}

.anim-text {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.6s var(--ease-out), transform 1.6s var(--ease-out);
}

.anim-text.visible {
    opacity: 1;
    transform: none;
}

.profile-photo-wrapper {
    flex-shrink: 0;
}

.profile-photo {
    display: block;
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--hairline);
    filter: grayscale(0.35) contrast(1.05);
    transition: filter 1s ease, border-color 1s ease, box-shadow 1s ease;
}

@media (hover: hover) {
    .profile-photo:hover {
        filter: none;
        border-color: var(--accent);
        box-shadow: 0 0 30px rgba(225, 217, 193, 0.2);
    }
}

.manifesto-title {
    font-family: var(--font-heading);
    font-size: clamp(1.2rem, 2.4vw, 1.6rem);
    line-height: 1.35;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.manifesto-text {
    font-size: 1.2rem;
    line-height: 1.7;
    max-width: 680px;
    transition-delay: 0.15s;
}

.manifesto-aside {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 1.05rem;
    transition-delay: 0.3s;
}

/*
=====================================================
   STACK
=====================================================
*/
.stack {
    border-top: 1px solid var(--hairline);
}

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

.stack-row {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: baseline;
    padding: 2rem 0;
    border-bottom: 1px solid var(--hairline);
}

.stack-row dt {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 3px;
    color: var(--text-muted);
}

.stack-row dd {
    font-size: 1.3rem;
    line-height: 1.5;
}

/*
=====================================================
   WORK & EXPERIENCE ROWS
=====================================================
*/
#experience {
    border-top: 1px solid var(--hairline);
}

.cases-list {
    border-top: 1px solid var(--hairline);
}

.case-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 3rem 0;
    border-bottom: 1px solid var(--hairline);
    color: var(--text-color);
    position: relative;
    transition: padding-left 0.6s var(--ease-out);
}

.case-details {
    display: flex;
    align-items: center;
    gap: 2rem;
    position: relative;
    z-index: 2;
}

.case-text-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.case-num {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
}

.case-name {
    font-family: var(--font-heading);
    font-size: clamp(1.1rem, 2.2vw, 1.5rem);
    font-weight: 400;
}

.case-name a {
    text-decoration: none;
}

/* Stretches the title link over the whole row, so the row is the click target */
.case-name a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
}

.case-desc {
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.6;
    max-width: 620px;
}

.case-tags {
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--text-color);
    opacity: 0.7;
}

.case-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
    z-index: 2;
}

.case-image-hover {
    position: absolute;
    top: 50%;
    right: 20%;
    transform: translateY(-50%) scale(0.85);
    width: 400px;
    height: 250px;
    background-size: cover;
    background-position: center;
    /* One warm monochrome grade so every photo feels like part of the same film */
    filter: grayscale(1) sepia(0.35) contrast(1.15) brightness(1.1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s var(--ease-out), transform 0.8s var(--ease-out);
    z-index: 1;
}

/* Hover on mouse devices; .active is the same state on touch screens (set in script.js) */
.case-item.active {
    padding-left: 2rem;
}

.case-item.active .case-name {
    color: #fff;
}

.case-item.active .case-image-hover {
    opacity: 0.45;
    transform: translateY(-50%) scale(1);
}

@media (hover: hover) {
    .case-item:hover {
        padding-left: 2rem;
    }

    .case-item:hover .case-name {
        color: #fff;
    }

    .case-item:hover .case-image-hover {
        opacity: 0.45;
        transform: translateY(-50%) scale(1);
    }
}

/*
=====================================================
   CONTACT
=====================================================
*/
.contact {
    padding: 10rem 0;
    border-top: 1px solid var(--hairline);
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 4rem;
}

.contact-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-label {
    font-family: var(--font-heading);
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 2px;
}

.contact-text,
.contact-link,
.socials a {
    font-size: 1.2rem;
    color: var(--text-color);
    text-decoration: none;
    width: fit-content;
    background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
    transition: background-size 0.5s var(--ease-out);
}

.contact-text {
    background: none;
}

.socials {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.socials a {
    letter-spacing: 2px;
}

.contact-link:focus-visible,
.socials a:focus-visible {
    background-size: 100% 1px;
}

@media (hover: hover) {
    .contact-link:hover,
    .socials a:hover {
        background-size: 100% 1px;
    }
}

/*
=====================================================
   FOOTER
=====================================================
*/
.footer {
    padding: 2rem 0;
    border-top: 1px solid var(--hairline);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/*
=====================================================
   CUSTOM CURSOR
=====================================================
*/
.cursor-dot,
.cursor-outline {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 50%;
    pointer-events: none;
}

html.has-cursor .cursor-dot,
html.has-cursor .cursor-outline {
    display: block;
}

.cursor-dot {
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    background-color: var(--accent);
    z-index: 99999;
}

.cursor-outline {
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 1px solid rgba(225, 217, 193, 0.5);
    z-index: 99998;
    transition: width 0.4s var(--ease-out), height 0.4s var(--ease-out), margin 0.4s var(--ease-out), background-color 0.4s ease;
}

.cursor-outline.hovering {
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    background-color: rgba(225, 217, 193, 0.1);
}

/*
=====================================================
   TABLET & MOBILE
=====================================================
*/
@media (max-width: 1024px) {
    .container {
        padding: 0 2.5rem;
    }

    .header {
        padding: 1.75rem 2.5rem;
    }

    .case-image-hover {
        right: 5%;
        width: 320px;
        height: 200px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1.25rem 1.5rem;
    }

    /* The blend would invert the open menu, so switch it off only while it's open */
    .menu-open .header {
        mix-blend-mode: normal;
    }

    .menu-toggle {
        display: block;
        z-index: 2;
    }

    /* Full-screen menu in the same cinematic voice */
    .nav {
        position: fixed;
        inset: 0;
        flex-direction: column;
        justify-content: center;
        gap: 2rem;
        padding: 0 2rem;
        background: var(--bg-color);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.5s var(--ease-out), visibility 0.5s;
    }

    .nav a {
        font-family: var(--font-heading);
        font-size: 1.4rem;
        letter-spacing: 3px;
        width: fit-content;
    }

    .menu-open .nav {
        opacity: 1;
        visibility: visible;
    }

    .container {
        padding: 0 1.5rem;
    }

    section {
        padding: 5rem 0;
    }

    .manifesto {
        padding: 6rem 0;
    }

    .contact {
        padding: 6rem 0;
    }

    .section-heading {
        margin-bottom: 3rem;
    }

    .hero-subtitle {
        letter-spacing: 4px;
        font-size: 0.95rem;
    }

    .manifesto-container {
        flex-direction: column;
        text-align: center;
        gap: 2.5rem;
    }

    .manifesto-text {
        font-size: 1.05rem;
    }

    .profile-photo {
        width: 180px;
        height: 180px;
    }

    .stack-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 1.5rem 0;
    }

    .stack-row dd {
        font-size: 1.05rem;
    }

    /* Same reveal as desktop, but the photo fills the row behind the text */
    .case-image-hover {
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        transform: scale(1.04);
        -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 60%);
        mask-image: linear-gradient(90deg, transparent 0%, #000 60%);
    }

    .case-item.active .case-image-hover,
    .case-item:hover .case-image-hover {
        opacity: 0.3;
        transform: scale(1);
    }

    .case-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 2rem 0;
    }

    .case-item.active,
    .case-item:hover {
        padding-left: 0.75rem;
    }

    .case-details {
        align-items: flex-start;
        gap: 1rem;
    }

    .case-num {
        font-size: 0.9rem;
        padding-top: 0.2rem;
    }

    .case-date {
        white-space: normal;
        font-size: 0.8rem;
    }

    .contact-grid {
        gap: 2.5rem;
    }

    .footer-bottom {
        flex-direction: column;
    }
}

/*
=====================================================
   REDUCED MOTION
=====================================================
*/
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }
}
