/* =============================================
   JULIA MILNER — PORTFOLIO STYLESHEET
   ============================================= */

/* ─── CSS VARIABLES ─────────────────────────── */
:root {
    /* Colours */
    --color-white:        #FFFFFF; /* Pure white for maximum contrast highlights*/
    --color-bg:           #FDF9F4; /* Main: Clean and bright */
    --color-bg-alt:       #F5E6D3; /* Brown - Soft section transitions */
    --color-bg-tan:       #D9B38C; /* Brown - Card backgrounds or emphasized blocks */
    --color-text:         #371B06; /* High-contrast body text */
    --color-text-muted:   #5C402A; /* Secondary info and meta-text */
    --color-accent:       #96633E; /* Brown - Primary brand color/Buttons */
    --color-accent-dk:    #7A4D2E; /* Brown - Accessible icons, links, and bold UI */
    --color-green-lt:     #A4AD6C; /* Green - soft backgrounds */
    --color-green:        #79774D; /* Green - large UI elements/buttons */
    --color-green-text:   #5B6043; /* Green - success messages and accessible text/icons */
    --color-green-dk:     #4D5640; /* Green - high-contrast editorial moments */
    --color-bg-blue:      #EBF2F5; /* Blue - soft backgrounds */ 
    --color-blue-lt:      #8EABB8; /* Blue - large UI elements, borders, decorations */
    --color-blue:         #4B6573; /* Blue - accessible text/icons */
    --color-blue-dk:      #32424A; /* Blue - high-contrast editorial moments */
    --color-grey:         #706E6C;
    --color-red:          #91463D; /* Red - error states and critical accents */
    --color-border:       rgba(59, 44, 27, 0.122);

    /* RGB component versions (for rgba() use) */
    --color-bg-rgb:         253, 249, 244;
    --color-accent-rgb:     150, 99, 62;
    --color-accent-dk-rgb:  122, 77, 46;
    --color-bg-alt-rgb:     245, 230, 211;
    --color-bg-tan-rgb:     217, 179, 140;
    --color-bg-blue-rgb:    235, 242, 245;
    --color-blue-lt-rgb:    142, 171, 184;
    --color-blue-rgb:       75, 101, 115;


    /* Typography */
    --font-serif:         'Crimson Pro', 'Newsreader', Georgia, serif;
    --font-sans:          'Inter', 'Public Sans', system-ui, sans-serif;

    /* Spacing */
    --space-xs:           0.5rem;
    --space-sm:           1rem;
    --space-md:           2rem;
    --space-lg:           4rem;
    --space-xl:           7rem;

    /* Layout */
    --max-width:          1140px;
    --nav-height:         70px;
    --text-max-width:     68ch;

    /* Transitions */
    --transition-base:    0.3s ease;

   /* Typescales (modified from M3) */
    --typescale-display:    clamp(3.5rem, 8vw, 5rem);  /* Fluid scaling for the Hero */

    --typescale-display-large: 3.5625rem;
    --typescale-display-medium: 2.8125rem; /* H2 */
    --typescale-display-small: 2.25rem;
    --typescale-headline-large: 2rem; /* H3 */
    --typescale-headline-medium: 1.75rem;
    --typescale-headline-small: 1.5rem;
    --typescale-title-large: 1.375rem;
    --typescale-title-medium: 1rem;
    --typescale-title-small: 0.875rem;
    --typescale-body-large: 1rem; /* Paragraph / Body */
    --typescale-body-medium: 0.875rem;
    --typescale-body-small: 0.75rem;
    --typescale-label-large: 0.875rem; /* Nav */
    --typescale-label-medium: 0.75rem; /* Eyebrow */
    --typescale-label-small: 0.6875rem; 

    /* Spacing */
    --lineheight-display:   1.1;
    --lineheight-heading:   1.3;
    --lineheight-body:      1.7; 

     /* Font weights */
    --weight-display: 700;
    --weight-headline: 500;
    --weight-title: 600;
    --weight-body: 400;
    --weight-label: 600; 
    
    /* Tracking */
    --tracking-display:    -0.02em;  /* Tighten large text for a "locked-in" look */
    --tracking-body:        0.02em;  /* Slightly loosen body text for readability */
    --tracking-label:       0.04em;  /* Open up small labels for an airy feel */
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-weight: var(--weight-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

ul {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-base), opacity var(--transition-base);
}

a:hover {
    color: var(--color-accent);
}

/* Screen-reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── TYPOGRAPHY ─────────────────────────────── */
h1 {
    font-family: var(--font-serif);
    font-size: var(--typescale-display-large);
    font-weight: var(--weight-display);
    line-height: var(--lineheight-display);
    letter-spacing: var(--tracking-display);
    /* Try italics for a "human" touch */
    font-style: normal; 
}

h2 {
    font-family: var(--font-serif);
    font-size: var(--typescale-display-large);
    text-transform: none;
    font-weight: var(--weight-headline);
    color: var(--color-text);
    margin-bottom: var(--space-md); 
}

h3 {
    font-family: var(--font-serif);
    font-size: var(--typescale-headline-large);
    text-transform: none;
    font-weight: var(--weight-headline);
    color: var(--color-accent-dk);
    margin-bottom: var(--space-sm); 
}

/* Use a "Label" style for eyebrow text */
.label-eyebrow {
    font-family: var(--font-sans);
    font-size: var(--typescale-label-medium);
    font-weight: var(--weight-display);
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
    color: var(--color-accent-dk);
    margin-bottom: 0.5rem;
    display: block;
}

p {
    font-family: var(--font-sans);
    font-size: var(--typescale-body-large);
    font-weight: var(--weight-body);
    line-height: var(--lineheight-body);
    color: var(--color-text-muted); /* Slightly softer than pure black/brown */
    max-width: 65ch; /* Limit line length for comfortable reading */
    margin-bottom: var(--space-sm); 
}

.intro-text h2 {
    text-align: left;
}

.italic-text-primary {
    font-family: var(--font-serif);
    font-size: var(--typescale-display-large);
    font-weight: var(--weight-display);
    line-height: var(--lineheight-display);
    letter-spacing: var(--tracking-display);
    font-style: italic; 
    color: var(--color-accent);
}

/* ─── LAYOUT UTILITIES ───────────────────────── */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.grid-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* ─── NAVIGATION ─────────────────────────────── */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 100;
    background-color: transparent;
    overflow: visible;
    transition: background-color var(--transition-base),
                box-shadow var(--transition-base);
}

#main-nav.scrolled {
    background-color: var(--color-bg);
    box-shadow: 0 1px 0 var(--color-border);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: transparent;
}

.nav-logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.001em;
    color: var(--color-text);
}

.nav-logo-initials {
    display: none;
}

.nav-logo-full {
    display: inline;
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.nav-links a {
    font-family: var(--font-sans);
    font-size: var(--typescale-label-large);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--color-accent);
    transition: width var(--transition-base);
}

.nav-links a:hover::after,
.nav-links a:focus::after {
    width: 100%;
}

.nav-links a:hover {
    color: var(--color-text);
}

.nav-hamburger {
    display: none;
}

.nav-mobile-menu {
    display: none;
}

/* Override nav link styles when btn-primary is used in nav */
.nav-links .btn-secondary {
    margin-left: var(--space-sm);
}

.nav-links .btn-secondary::after {
    display: none;
}


/* - BUTTON HEIRARCHY -
   Primary: .btn-primary — for main CTAs, bold and filled
   Secondary: .btn-secondary — for less critical actions, outlined
   Text: .btn-text — for subtle links, with animated underline
*/

/* ─── PRIMARY BUTTON ─────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: var(--typescale-label-large);
    font-weight: var(--weight-label);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-bg);
    background-color: var(--color-text);
    border: 2px solid var(--color-text);
    border-radius: 100px;
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: background-color 0.25s ease,
                color 0.25s ease,
                border-color 0.25s ease,
                transform 0.15s ease,
                box-shadow 0.25s ease;

    /* Prevent text selection on click */
    user-select: none;
    -webkit-user-select: none;
}

/* Hover state — inverts to outlined style */
.btn-primary:hover {
    background-color: transparent;
    color: var(--color-text);
    border-color: var(--color-text);
    box-shadow: 0 4px 16px rgba(55, 27, 6, 0.15);
}

/* Active / clicked state — slight press effect */
.btn-primary:active {
    transform: scale(0.97);
    box-shadow: none;
    background-color: var(--color-bg-alt);
    color: var(--color-text);
}

/* Focus state — keyboard navigation */
.btn-primary:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
    background-color: transparent;
    color: var(--color-text);
}

/* Disabled state */
.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── SECONDARY BUTTON ───────────────────────── */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: var(--typescale-label-large);
    font-weight: var(--weight-label);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text);
    background-color: transparent;
    border: 1.5px solid var(--color-text-muted);
    border-radius: 100px;
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: background-color 0.25s ease,
                color 0.25s ease,
                border-color 0.25s ease,
                transform 0.15s ease,
                box-shadow 0.25s ease;
    user-select: none;
    -webkit-user-select: none;
}

/* Hover state — subtle fill appears */
.btn-secondary:hover {
    background-color: var(--color-bg-alt);
    border-color: var(--color-text);
    color: var(--color-text);
    box-shadow: 0 4px 16px rgba(55, 27, 6, 0.08);
}

/* Active / clicked state */
.btn-secondary:active {
    transform: scale(0.97);
    box-shadow: none;
    background-color: var(--color-bg-tan);
    border-color: var(--color-text);
}

/* Focus state — keyboard navigation */
.btn-secondary:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

/* Disabled state */
.btn-secondary:disabled,
.btn-secondary[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── TEXT BUTTON ────────────────────────────── */
.btn-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    font-family: var(--font-sans);
    font-size: var(--typescale-label-large);
    font-weight: var(--weight-label);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text);
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0.25rem 0;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    transition: color 0.25s ease,
                transform 0.15s ease,
                gap 0.25s ease;
    user-select: none;
    -webkit-user-select: none;
}

/* Animated underline */
.btn-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--color-text);
    transition: width 0.25s ease;
}

/* Hover state — underline grows, arrow nudges right */
.btn-text:hover {
    color: var(--color-text);
    gap: 0.55em;
}

.btn-text:hover::after {
    width: 100%;
}

/* Active / clicked state */
.btn-text:active {
    transform: scale(0.97);
    color: var(--color-text-muted);
}

/* Focus state */
.btn-text:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

/* Disabled state */
.btn-text:disabled,
.btn-text[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Arrow variant — adds a → that nudges on hover */
.btn-text.btn-text--arrow::before {
    content: none;
}

.btn-text.btn-text--arrow::after {
    display: none;
}

.btn-text.btn-text--arrow .btn-arrow {
    display: inline-block;
    transition: transform 0.25s ease;
}

.btn-text.btn-text--arrow:hover .btn-arrow {
    transform: translateX(4px);
}

/* ─── HERO SECTION ───────────────────────────── */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    overflow: hidden;
    background-color: var(--color-bg-alt);
}

/* ─── AURA HERO ──────────────────────────────── */
#aura-hero {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    filter: blur(8vw);
    z-index: 0;
}

#aura-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.aura-mask {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 55%,
        var(--color-bg) 100%
    );
    z-index: 1;
}

.hero-text-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    margin-left: auto;
    margin-right: auto;
}

.hero-headline {
    font-family: var(--font-serif);
    font-size: clamp(3.5rem, 12vw, 9.6875rem); /* scales to ~155px at wide screens */
    font-weight: var(--weight-display);
    line-height: 1;
    letter-spacing: 0.01em;
    color: var(--color-bg);
    text-align: center;
    mix-blend-mode: multiply;
}
.hero-subhead {
    font-family: var(--font-sans);
    font-size: clamp(1rem, 2vw, 1.375rem);
    font-weight: var(--weight-display);
    line-height: var(--lineheight-heading);
    letter-spacing: var(--tracking-body);
    color: var(--color-text-muted);
    text-align: center;
    margin-top: var(--space-lg);
    padding: 0 var(--space-md);
    max-width: 700px;
    mix-blend-mode: multiply;
}


/* ─── HERO SCROLL INDICATOR ──────────────────── */
.hero-scroll-indicator {
    position: absolute;
    bottom: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-blue);
    opacity: 0.8;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition-base);
    animation: chevron-bounce 2s ease-in-out infinite;
}

.hero-scroll-indicator:hover {
    opacity: 1;
    color: white;
}

@keyframes chevron-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%       { transform: translateX(-50%) translateY(8px); }
}

/* ─── ELEVATOR PITCH SECTION ─────────────────── */
.section-pitch {
    padding: var(--space-lg) 0;
    background-color: var(--color-text);
    text-align: center;
}

.pitch-inner {
    max-width: 780px;
}

.pitch-inner h2 {
    color: var(--color-bg);
    font-size: var(--typescale-display-medium);
    margin-bottom: var(--space-md);
    letter-spacing: 0.02em;
}

.pitch-inner p {
    color: var(--color-bg-alt);
    opacity: 0.8;
    font-size: var(--typescale-title-medium);
    line-height: var(--lineheight-heading);
    max-width: var(--text-max-width);
    margin: 0 auto;
}

.pitch-closing {
    margin-top: var(--space-md) !important;
    font-family: var(--font-serif);
    font-size: var(--typescale-headline-small) !important;
    font-style: italic;
    opacity: 1 !important;
    color: var(--color-accent) !important;
    line-height: var(--lineheight-headline-small) !important;
}

/* ─── CRED BAR SECTION ───────────────────────── */
.section-cred {
    padding: var(--space-md) 0;
    background-color: var(--color-bg-alt);
    overflow: hidden;
}

.cred-track-wrapper {
    position: relative;
    width: 100%;
    /* Edge fade using mask */
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 12%,
        black 88%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 12%,
        black 88%,
        transparent 100%
    );
}

.cred-track {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    width: max-content;
    animation: cred-scroll 35s linear infinite;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

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

.cred-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.cred-logo img {
    height: 36px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    filter: grayscale(100%) opacity(65%);
    transition: filter var(--transition-base);
}

.cred-logo img:hover {
    filter: grayscale(100%) opacity(70%);
}

@keyframes cred-scroll {
    0%   { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-50%, 0, 0); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cred-track {
        animation: none;
    }
}

/* ─── INTRODUCTION SECTION ───────────────────── */
.section-introduction {
    padding: var(--space-xl) 0;
    background-color: var(--color-bg);
}

.intro-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: var(--space-lg);
}

.intro-text h2 {
    margin-bottom: var(--space-md);
}

.intro-text p {
    font-family: var(--font-sans);
    font-size: var(--typescale-body-large);
    line-height: var(--lineheight-body);
    letter-spacing: var(--tracking-body);
    color: var(--color-text);
    max-width: var(--text-max-width);
}

.intro-image {
    position: relative;
}

.intro-image img {
    width: 100%;
    height: 520px;
    border-radius: 32px;
    object-fit: cover;
    object-position: center;
}

.intro-image::before {
    content: '';
    position: absolute;
    top: -16px;
    left: -16px;
    width: 100%;
    height: 100%;
    border: 1px solid var(--color-border);
    z-index: -1;
    border-radius: 32px;
}

/* ─── PROJECTS SECTION ───────────────────────── */
.section-projects {
    padding: var(--space-md) 0 var(--space-xl) 0;
    background-color: var(--color-bg-alt);
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
    gap: var(--space-sm);
}

.projects-header h2 {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .projects-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Responsive grid */
.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

@media (min-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-md);
        align-items: start;
    }
}

/* Project card styling */
.project-card {
    background-color: var(--color-bg);
    border-radius: 20px;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    cursor: pointer;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    isolation: isolate;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

.project-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    height: 100%;
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    outline: none;
    transition: outline-offset 0.2s ease;
}

/* Focus visible for keyboard/tap */
.project-card-link:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
    border-radius: 20px;
}

/* Hover: scale image AND overlay together */
/* ONLY apply hover effects on devices that support hover (desktop) */
@media (hover: hover) and (pointer: fine) {
    .project-card-link:hover .project-card {
        transform: translateY(-6px);
        box-shadow: 0 20px 48px rgba(42, 43, 47, 0.10);
    }
    
    .project-card:hover .project-card-media img,
    .project-card:hover .project-card-media::after {
        transform: scale(1.03);
    }
}

/* Remove hover effect on touch devices to prevent glitch */
@media (hover: none) and (pointer: coarse) {
    .project-card:active {
        transform: scale(0.98);
        transition: transform 0.05s ease;
    }
}

/* Better touch feedback for all interactive elements on mobile */
@media (hover: none) and (pointer: coarse) {
    .project-card-link:active .project-card {
        background-color: var(--color-bg-alt);
        transition: background-color 0.05s ease;
    }
    
    .btn-primary:active,
    .btn-secondary:active,
    .btn-text:active {
        transform: scale(0.97);
    }
}

/* Project card media container (image + overlay) */
.project-card-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3; 
    flex-shrink: 0;
    min-height: 0;
    background-color: var(--color-accent);  /* fallback for image gaps */
    border-radius: 20px 20px 0 0;
}

.project-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center; 
    transition: transform 0.5s ease;
    transform: translateZ(0);
}

/* Overlay that recolours the image */
.project-card-media::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-accent);
    mix-blend-mode: overlay;
    pointer-events: none;
    transition: transform 0.5s ease;
    transform: scale(1.01);
}

/* Colour variants */
.project-card[data-color="green"] .project-card-media::after {
    background-color: var(--color-green);
}
.project-card[data-color="blue"] .project-card-media::after {
    background-color: var(--color-blue-lt);
}

.project-card[data-color="brown"] .project-card-media::after {
    background-color: var(--color-text-muted);
}

/* Adjusted text spacing for better mobile readability */
.project-card h3 {
    padding: var(--space-sm) var(--space-md) 0.25rem var(--space-md);
    font-size: var(--typescale-headline-small);
}

.project-card p {
    padding: 0 var(--space-md) var(--space-md) var(--space-md);
    font-size: var(--typescale-label-large);
    font-weight: var(--weight-headline);
    letter-spacing: var(--tracking-body);
    color: var(--color-text-muted);
    text-transform: none;
    flex: 1 0 auto;
    line-height: 1.5;
}

/* Smaller padding on very narrow screens (under 400px) */
@media (max-width: 400px) {
    .project-card h3,
    .project-card p {
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }
}

.project-card:last-child {
    margin-bottom: 0;
}


/* ─── SERVICES SECTION ───────────────────────── */
.section-services {
    padding: var(--space-md) 0 var(--space-xl) 0;
    background-color: var(--color-bg);
}

.services-grid {
    gap: var(--space-md);
}

.service-card {
    padding: var(--space-md) var(--space-md);
    background-color: var(--color-bg-alt);
    border-top: 2px solid var(--color-accent);
    border-radius: 20px;
    transition: background-color var(--transition-base);
}

.service-card:hover {
    background-color: var(--color-bg-alt);
}

.service-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.service-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background-color: var(--color-bg-alt);
    border-radius: 14px;
    color: var(--color-accent);
}

.service-card h3 {
    font-family: var(--font-serif);
    font-size: var(--typescale-headline-small);
    line-height: var(--lineheight-heading);
    margin-bottom: 0;
    letter-spacing: 0.02em;
}

.service-card p {
    font-family: var(--font-sans);
    font-size: var(--typescale-label-large);
    font-weight: var(--weight-headline);
    line-height: var(--lineheight-body);
    color: var(--color-text-muted);
    padding: 0.3rem 0;
    border-bottom: none;
}

/* ─── CONTACT SECTION ────────────────────────── */
.section-contact {
    position: relative;
    padding: var(--space-xl) 0;
    background-color: var(--color-bg-alt);
    text-align: center;
    overflow: hidden;
}

#contact-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.35;
    pointer-events: none;
}

.contact-inner {
    position: relative;
    z-index: 1;
    max-width: 640px;
}

.contact-inner h2 {
    margin-bottom: var(--space-sm);
}

.contact-inner p {
    font-family: var(--font-sans);
    font-size: var(--typescale-body-large);
    line-height: var(--lineheight-body);
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
    max-width: var(--text-max-width);
    margin-left: auto;
    margin-right: auto;
}

.contact-email {
    display: inline-block;
    font-family: var(--font-serif);
    font-size: var(--typescale-headline-medium);
    line-height: var(--lineheight-heading);
    color: var(--color-green);
    letter-spacing: 0.02em;
    border-bottom: 1px solid var(--color-accent);
    padding-bottom: 2px;
    transition: opacity var(--transition-base);
}

.contact-email:hover {
    opacity: 0.7;
    color: var(--color-accent);
}

/* ─── FOOTER ─────────────────────────────────── */
#footer {
    background-color: var(--color-text);
    color: var(--color-bg);
    padding: var(--space-lg) 0;
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    text-align: center;
}

.footer-nav {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    justify-content: center;
}

.footer-nav a {
    font-family: var(--font-sans);
    font-size: var(--typescale-label-large);
    letter-spacing: var(--tracking-label);
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-bg-alt);
    opacity: 0.7;
    transition: opacity var(--transition-base);
}

.footer-nav a:hover {
    opacity: 1;
    color: var(--color-bg-alt);
}

.footer-social {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.footer-social a {
    color: var(--color-bg-alt);
    opacity: 0.6;
    transition: opacity var(--transition-base), color var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.footer-copy {
    font-family: var(--font-sans);
    font-size: var(--typescale-body-small);
    line-height: var(--lineheight-body);
    color: var(--color-bg-alt);
    opacity: 0.4;
    letter-spacing: 0.04em;
}

/* ─── RESPONSIVE: TABLET ─────────────────────── */
@media (max-width: 900px) {
    :root {
        --space-xl: 5rem;
        --space-lg: 3rem;
    }

    .grid-two-col {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-md);
    }

    .intro-text {
        padding-right: var(--space-sm);
    }
}

/* ─── RESPONSIVE: MOBILE ─────────────────────── */
@media (max-width: 640px) {
    :root {
        --space-xl: 4rem;
        --space-lg: 2.5rem;
        --typescale-headline-large:  1.75rem;
        --typescale-headline-medium: 1.5rem;
        --typescale-headline-small:  1.25rem;
        --typescale-title-large:     1.25rem;
    }

    .grid-two-col {
        grid-template-columns: 1fr;
    }

    /* Stack intro image below text on mobile */
    .section-introduction .grid-two-col {
        grid-template-columns: 1fr;
    }

    .intro-text {
        padding-right: 0;
    }

    .intro-image {
        margin-top: var(--space-md);
    }

    .intro-image::before {
        display: none;
    }

    .intro-image img {
        height: 380px;
    }

    /* Nav adjustments */
    .nav-links {
        gap: var(--space-md);
    }

    .nav-links a {
        font-size: var(--typescale-label-medium);
    }

    /* Services full width */
    .services-grid {
        grid-template-columns: 1fr;
    }

    /* Hero */
    #hero {
        min-height: 500px;
    }

    /* Footer */
    .footer-nav {
        gap: var(--space-sm);
    }

    /* Nav — show initials, hide full name */
    .nav-logo-full {
        display: none;
    }

    .nav-logo-initials {
        display: inline;
    }

    /* Nav — hide desktop links, show hamburger */
    .nav-links {
        display: none;
    }

    .nav-hamburger {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 28px;
        height: 14px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 200;
    }

    .nav-hamburger span {
        display: block;
        width: 100%;
        height: 1.5px;
        background-color: var(--color-text);
        transition: transform 0.3s ease, opacity 0.3s ease;
        transform-origin: center;
    }

    /* Hamburger animates to X when open */
    .nav-hamburger.is-open span:nth-child(1) {
        transform: translateY(6.25px) rotate(45deg);
    }

    .nav-hamburger.is-open span:nth-child(2) {
        transform: translateY(-6.25px) rotate(-45deg);
    }

    /* Mobile menu overlay */
    .nav-mobile-menu {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--color-bg);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.4s ease, visibility 0.4s ease;
        z-index: 98;
    }

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

    .nav-mobile-links {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--space-md);
        padding: 0;
    }

    .nav-mobile-links li a {
        display: block;
        font-family: var(--font-serif);
        font-size: var(--typescale-headline-large);
        font-weight: var(--weight-headline);
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--color-text);
        transition: color var(--transition-base);
        opacity: 0;
        transform: translateY(12px);
        transition: color var(--transition-base),
                    opacity 0.4s ease,
                    transform 0.4s ease;
    }
    
    .nav-mobile-links li:first-child a {
        font-weight: var(--weight-display);
        letter-spacing: var(--tracking-display);
    }

    .nav-mobile-menu.is-open .nav-mobile-links li a {
        opacity: 1;
        transform: translateY(0);
    }

    /* Stagger each link's entrance */
    .nav-mobile-menu.is-open .nav-mobile-links li:nth-child(1) a { transition-delay: 0.1s; }
    .nav-mobile-menu.is-open .nav-mobile-links li:nth-child(2) a { transition-delay: 0.18s; }
    .nav-mobile-menu.is-open .nav-mobile-links li:nth-child(3) a { transition-delay: 0.26s; }
    .nav-mobile-menu.is-open .nav-mobile-links li:nth-child(4) a { transition-delay: 0.34s; }

    .nav-mobile-links li a:hover {
        color: var(--color-accent);
    }

        .nav-mobile-social {
        display: flex;
        gap: var(--space-md);
        align-items: center;
        justify-content: center;
        margin-top: var(--space-lg);
        padding-top: var(--space-md);
        border-top: 1px solid var(--color-border);
    }

    .nav-mobile-social a {
        color: var(--color-text-muted);
        opacity: 0.6;
        transition: opacity var(--transition-base), color var(--transition-base);
        display: flex;
        align-items: center;
    }

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

/* ─── FOCUS STYLES (ACCESSIBILITY) ──────────── */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ─── REDUCED MOTION ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}