/* ============================================================
   RALPH NATAL — PORTFOLIO STYLES
   Theming lives in CSS custom properties on :root.
   [data-theme="dark"] overrides them; with JavaScript off the
   prefers-color-scheme media query picks the theme instead.
   ============================================================ */

/* ---------- Fonts (self-hosted Google Fonts, latin subset, SIL OFL 1.1 — see assets/fonts/) ---------- */
@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url('../assets/fonts/space-grotesk-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('../assets/fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Design tokens: light (default) ---------- */
:root {
    color-scheme: light;

    --bg: #F6F8FC;
    --bg-alt: #EDF2FA;
    --surface: #FFFFFF;
    --surface-2: #F1F5FB;
    --text: #0F172A;
    --text-muted: #475569;
    --border: #D6DEEA;

    --primary: #1D4ED8;          /* text links / accents, 6.7:1 on white */
    --primary-strong: #1E40AF;
    --primary-soft: #DBEAFE;
    --btn-bg: #2563EB;           /* white text on this = 5.2:1 */
    --btn-bg-hover: #1D4ED8;
    --btn-text: #FFFFFF;
    --accent: #6D28D9;

    --chip-bg: #EEF4FF;
    --chip-text: #1E3A8A;
    --chip-border: #CFDDF7;

    --badge-live-bg: #DCFCE7;
    --badge-live-text: #14532D;
    --badge-dev-bg: #FEF3C7;
    --badge-dev-text: #78350F;
    --badge-neutral-bg: #E2E8F0;
    --badge-neutral-text: #1E293B;

    --focus: #1D4ED8;
    --header-bg: rgba(246, 248, 252, 0.85);
    --grid-line: rgba(37, 99, 235, 0.07);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.14);

    --font-head: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-mono: ui-monospace, 'Cascadia Code', 'SFMono-Regular', Menlo, Consolas, monospace;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --header-h: 64px;
    --gutter: 16px;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Design tokens: dark ---------- */
:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0B1120;
    --bg-alt: #0F172A;
    --surface: #131C2F;
    --surface-2: #1A2540;
    --text: #E6EBF5;
    --text-muted: #A7B3C7;
    --border: #273450;

    --primary: #8AB4FF;
    --primary-strong: #B4CEFF;
    --primary-soft: rgba(138, 180, 255, 0.14);
    --btn-bg: #8AB4FF;
    --btn-bg-hover: #A9C8FF;
    --btn-text: #0B1120;
    --accent: #C4B5FD;

    --chip-bg: rgba(138, 180, 255, 0.10);
    --chip-text: #C9DAFF;
    --chip-border: rgba(138, 180, 255, 0.24);

    --badge-live-bg: rgba(34, 197, 94, 0.16);
    --badge-live-text: #86EFAC;
    --badge-dev-bg: rgba(245, 158, 11, 0.16);
    --badge-dev-text: #FCD34D;
    --badge-neutral-bg: rgba(148, 163, 184, 0.18);
    --badge-neutral-text: #E2E8F0;

    --focus: #93C5FD;
    --header-bg: rgba(11, 17, 32, 0.82);
    --grid-line: rgba(138, 180, 255, 0.06);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 44px rgba(0, 0, 0, 0.5);
}

/* No-JS fallback: follow the OS setting (same values as above) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --bg: #0B1120; --bg-alt: #0F172A; --surface: #131C2F; --surface-2: #1A2540;
        --text: #E6EBF5; --text-muted: #A7B3C7; --border: #273450;
        --primary: #8AB4FF; --primary-strong: #B4CEFF; --primary-soft: rgba(138, 180, 255, 0.14);
        --btn-bg: #8AB4FF; --btn-bg-hover: #A9C8FF; --btn-text: #0B1120; --accent: #C4B5FD;
        --chip-bg: rgba(138, 180, 255, 0.10); --chip-text: #C9DAFF; --chip-border: rgba(138, 180, 255, 0.24);
        --badge-live-bg: rgba(34, 197, 94, 0.16); --badge-live-text: #86EFAC;
        --badge-dev-bg: rgba(245, 158, 11, 0.16); --badge-dev-text: #FCD34D;
        --badge-neutral-bg: rgba(148, 163, 184, 0.18); --badge-neutral-text: #E2E8F0;
        --focus: #93C5FD; --header-bg: rgba(11, 17, 32, 0.82); --grid-line: rgba(138, 180, 255, 0.06);
    }
}

@media (min-width: 600px) {
    :root { --gutter: 24px; }
}

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 8px);
    -webkit-text-size-adjust: 100%;
}

html.modal-open { overflow: hidden; }

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
    background-color: var(--bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-strong); }

button { font: inherit; color: inherit; cursor: pointer; }

ul { padding: 0; list-style: none; }

h1, h2, h3, h4 {
    font-family: var(--font-head);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text);
}

p { color: var(--text-muted); }

strong { color: var(--text); font-weight: 600; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Visible keyboard focus everywhere */
:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    border-radius: 6px;
}

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

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 200;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--btn-text); }

.container {
    width: 100%;
    max-width: 1160px;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.muted { color: var(--text-muted); font-weight: 400; font-size: 0.85em; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 22px;
    border-radius: 999px;
    border: 2px solid transparent;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--ease), box-shadow .2s;
}

.btn-primary {
    background: var(--btn-bg);
    color: var(--btn-text);
    box-shadow: var(--shadow-md);
}
.btn-primary:hover { background: var(--btn-bg-hover); color: var(--btn-text); transform: translateY(-2px); }

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    transition: border-color .2s, color .2s, background-color .2s;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ============================================================
   HEADER / NAVIGATION
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s, box-shadow .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }

.nav {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
    color: var(--text);
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
}
.nav-logo:hover { color: var(--text); }

.logo-mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563EB, #6D28D9);
    color: #fff;
    font-size: 0.95rem;
    letter-spacing: -0.04em;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: block;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    transition: color .2s, background-color .2s;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.is-active { color: var(--primary); background: var(--primary-soft); }

.nav-actions { display: flex; align-items: center; gap: 8px; }

/* Theme toggle shows the icon of the theme you'll switch TO */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html:not(.js) .theme-toggle { display: none; }

.nav-toggle { display: none; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

/* Collapsed mobile menu (only when JS can open it) */
@media (max-width: 959px) {
    .js .nav-toggle { display: inline-grid; }

    .js .nav-menu {
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 12px var(--gutter) 20px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity .2s, transform .2s var(--ease), visibility 0s linear .2s;
    }
    .js .nav-menu.is-open {
        visibility: visible;
        opacity: 1;
        transform: none;
        transition: opacity .2s, transform .2s var(--ease), visibility 0s;
    }
    .js .nav-link { padding: 12px 14px; font-size: 1rem; border-radius: var(--radius-sm); }

    html:not(.js) .nav { height: auto; flex-wrap: wrap; padding-block: 10px; }
    html:not(.js) .site-header { height: auto; position: static; }
    html:not(.js) .nav-menu { flex-wrap: wrap; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    position: relative;
    padding-block: 48px 64px;
    overflow: hidden;
    isolation: isolate;
}

/* Subtle blueprint grid + glow behind the hero */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
        radial-gradient(600px 360px at 85% 20%, rgba(37, 99, 235, 0.14), transparent 70%),
        radial-gradient(500px 300px at 5% 90%, rgba(109, 40, 217, 0.10), transparent 70%),
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: auto, auto, 32px 32px, 32px 32px;
    mask-image: linear-gradient(to bottom, #000 70%, transparent);
}

.hero-grid {
    display: grid;
    gap: 32px;
    align-items: center;
}

.hero-visual { order: -1; justify-self: start; }

.hero-photo {
    width: 160px;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 28px;
    border: 4px solid var(--surface);
    box-shadow: var(--shadow-lg);
    background: var(--surface-2);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--chip-border);
    background: var(--chip-bg);
    color: var(--chip-text);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.hero-title {
    font-size: clamp(2.1rem, 7vw, 3.75rem);
    font-weight: 700;
    letter-spacing: -0.025em;
}

.accent-text {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Typed subtitle: ghost reserves the final size, typed text overlays it */
.hero-subtitle {
    display: grid;
    margin-top: 14px;
    font-family: var(--font-head);
    font-size: clamp(1.1rem, 3.4vw, 1.45rem);
    font-weight: 600;
    color: var(--primary);
}
.hero-subtitle > .typed-ghost,
.hero-subtitle > .typed { grid-area: 1 / 1; }
.typed-ghost { visibility: hidden; }
/* With JS and motion allowed, keep the typed line empty until typing starts on load */
@media (prefers-reduced-motion: no-preference) {
    .js .typed:not(.is-typing):not(.typed-done) { visibility: hidden; }
}
.typed.is-typing::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 3px;
    vertical-align: -0.12em;
    background: currentColor;
    animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.hero-pitch {
    margin-top: 18px;
    max-width: 58ch;
    font-size: clamp(1rem, 2.4vw, 1.125rem);
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.925rem;
}
.hero-meta li { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .icon { width: 18px; height: 18px; color: var(--primary); }

@media (min-width: 900px) {
    .hero { padding-block: 88px 104px; }
    .hero-grid { grid-template-columns: 1.35fr 1fr; gap: 56px; }
    .hero-visual { order: 0; justify-self: end; }
    .hero-photo { width: min(380px, 100%); border-radius: 36px; transform: rotate(2deg); }
}

/* ============================================================
   SECTIONS (shared)
   ============================================================ */
.section { padding-block: 64px; }
.section-alt { background: var(--bg-alt); }

.section-head { margin-bottom: 36px; max-width: 720px; }

.section-kicker {
    margin-bottom: 8px;
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.section-kicker::before { content: '// '; opacity: 0.75; }

.section-title { font-size: clamp(1.75rem, 5vw, 2.6rem); font-weight: 700; }

.section-lead { margin-top: 12px; font-size: 1.05rem; }

@media (min-width: 900px) {
    .section { padding-block: 96px; }
    .section-head { margin-bottom: 48px; }
}

/* Scroll reveal: only hidden when JS is on and motion is allowed */
.reveal-ready .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal-ready .reveal.is-visible { opacity: 1; transform: none; }

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid { display: grid; gap: 28px; }
.about-text p + p { margin-top: 14px; }
.about-text p { font-size: 1.05rem; }

.about-cards { display: grid; gap: 16px; }

.info-card {
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.info-card h3 { font-size: 1.1rem; margin-bottom: 12px; }
.info-card .info-sub { margin-top: 18px; margin-bottom: 6px; }
.info-strong { color: var(--text); font-weight: 600; }

.check-list li {
    position: relative;
    padding-left: 26px;
    color: var(--text-muted);
}
.check-list li + li { margin-top: 8px; }
.check-list li::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 0.5em;
    width: 12px;
    height: 7px;
    border-left: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    transform: rotate(-45deg);
}

@media (min-width: 900px) {
    .about-grid { grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: start; }
}

/* ============================================================
   CHIPS (skills + project stacks)
   ============================================================ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chips li,
.chip {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid var(--chip-border);
    background: var(--chip-bg);
    color: var(--chip-text);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: nowrap;
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.skill-group {
    padding: 22px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}
.skill-group h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 1.05rem;
}
.skill-group h3 .icon { width: 20px; height: 20px; color: var(--primary); }
.skill-group .chips li { white-space: normal; }

/* ============================================================
   PROJECTS
   ============================================================ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.filter-chip {
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.925rem;
    transition: background-color .2s, color .2s, border-color .2s;
}
.filter-chip:hover { border-color: var(--primary); color: var(--text); }
.filter-chip[aria-pressed="true"] {
    background: var(--btn-bg);
    border-color: var(--btn-bg);
    color: var(--btn-text);
}

.project-group + .project-group { margin-top: 48px; }
.project-group[hidden] { display: none; }

.group-title {
    margin-bottom: 18px;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.projects-featured { display: grid; gap: 24px; }

.projects-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.project-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.project-card[hidden] { display: none; }
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--chip-border); }

.project-cover {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--surface-2);
    overflow: hidden;
}
.project-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

/* Generated placeholder cover (used until a real screenshot exists) */
.cover-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px 20px;
    color: #fff;
    background-color: var(--project-accent, #1D4ED8);
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1.5px),
        linear-gradient(135deg, var(--project-accent, #1D4ED8) 0%, color-mix(in srgb, var(--project-accent, #1D4ED8) 55%, #000) 100%);
    background-size: 18px 18px, auto;
}
.cover-placeholder .ph-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.16);
}
.cover-placeholder .ph-icon .icon { width: 24px; height: 24px; }
.cover-placeholder .ph-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: clamp(1.15rem, 3.2vw, 1.5rem);
    line-height: 1.15;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.cover-placeholder .ph-category {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    opacity: 0.9;
}

.project-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
    padding: 20px;
}

.project-meta-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.project-title { font-size: 1.2rem; }

/* The title button stretches over the whole card, so the card is one big click target */
.card-link {
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    font: inherit;
    color: inherit;
}
.card-link::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.card-link:focus-visible { outline: none; }
.card-link:focus-visible::after { outline: 3px solid var(--focus); outline-offset: -3px; }

.project-client { font-size: 0.9rem; color: var(--text-muted); }
.project-summary { font-size: 0.975rem; }
.project-stack { margin-top: auto; padding-top: 6px; }

.card-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.925rem;
}
.card-more svg { width: 18px; height: 18px; transition: transform .2s var(--ease); }
.project-card:hover .card-more svg { transform: translateX(3px); }

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--badge-neutral-bg);
    color: var(--badge-neutral-text);
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--live { background: var(--badge-live-bg); color: var(--badge-live-text); }
.badge--dev { background: var(--badge-dev-bg); color: var(--badge-dev-text); }
.badge--cat { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.badge--cat::before { display: none; }

/* Featured cards: horizontal on wide screens */
.project-card--featured .project-title { font-size: clamp(1.3rem, 3vw, 1.6rem); }
.project-card--featured .project-body { padding: 24px; gap: 12px; }

@media (min-width: 900px) {
    .project-card--featured { flex-direction: row; }
    .project-card--featured .project-cover { flex: 0 0 46%; aspect-ratio: auto; min-height: 300px; }
    .project-card--featured .project-body { padding: 32px; }
    .project-card--featured:nth-child(even) { flex-direction: row-reverse; }
}

.noscript-note { padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ============================================================
   PROJECT MODAL + LIGHTBOX (native <dialog>)
   ============================================================ */
dialog { padding: 0; border: 0; color: var(--text); }
dialog::backdrop { background: rgba(2, 6, 23, 0.66); }

.modal {
    width: min(880px, calc(100% - 16px));
    max-height: calc(100dvh - 16px);
    margin: auto;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    overflow: auto;
    overscroll-behavior: contain;
}
.modal[open] { animation: modal-in .25s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.modal-panel { position: relative; }

.modal-close {
    position: sticky;
    top: 12px;
    float: right;
    margin: 12px 12px -56px 0;
    z-index: 2;
    box-shadow: var(--shadow-md);
}

.modal-cover { position: relative; aspect-ratio: 16 / 7; background: var(--surface-2); overflow: hidden; }
.modal-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.modal-cover .cover-placeholder { padding: 24px 28px; }

.modal-content { padding: 24px 20px 32px; }
.modal-content h2 { font-size: clamp(1.5rem, 4.5vw, 2.1rem); margin: 10px 0 4px; }
.modal-sub { font-size: 0.95rem; }

.modal-grid { display: grid; gap: 28px; margin-top: 24px; }
.modal-main > * + * { margin-top: 24px; }
.modal-main h3, .modal-aside h3 {
    margin-bottom: 10px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.modal-main ul li { position: relative; padding-left: 18px; color: var(--text-muted); }
.modal-main ul li + li { margin-top: 8px; }
.modal-main ul li::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 0.65em;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--primary);
}
.modal-aside { display: grid; gap: 22px; align-content: start; }
.modal-aside p { color: var(--text); }

.modal-links { display: flex; flex-wrap: wrap; gap: 10px; }
.modal-links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    font-size: 0.925rem;
    text-decoration: none;
}
.modal-links .icon { width: 18px; height: 18px; }
.modal-links a:hover { border-color: var(--primary); color: var(--primary); }
.modal-empty { color: var(--text-muted); font-style: italic; }

.modal-shots { display: grid; gap: 12px; }
.modal-shots img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }

@media (min-width: 760px) {
    .modal-content { padding: 32px 36px 40px; }
    .modal-grid { grid-template-columns: 1.6fr 1fr; gap: 40px; }
}

/* Lightbox */
.lightbox {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    background: rgba(2, 6, 23, 0.94);
    color: #F1F5F9;
}
.lightbox::backdrop { background: rgba(2, 6, 23, 0.94); }
.lightbox-panel {
    position: relative;
    display: grid;
    place-items: center;
    height: 100%;
    padding: 64px 12px 24px;
}
.lightbox-figure { display: grid; justify-items: center; gap: 12px; max-width: 100%; }
.lightbox-figure img {
    max-width: min(100%, 1400px);
    max-height: calc(100dvh - 150px);
    width: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
}
.lightbox-figure figcaption { color: #E2E8F0; font-weight: 500; text-align: center; }
.lightbox-close { position: absolute; top: 12px; right: 12px; background: #1E293B; color: #F1F5F9; border-color: #334155; }
.lightbox-close:hover { color: #fff; border-color: #93C5FD; }
.lightbox .gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox :focus-visible { outline-color: #93C5FD; }

/* ============================================================
   DESIGN GALLERY
   ============================================================ */
.gallery {
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.gallery-stage {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    background: var(--surface-2);
    overflow: hidden;
}

.gallery-open {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}
.gallery-open:focus-visible { outline-offset: -3px; }
.gallery-open img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity .2s;
}
.gallery-open img.is-loading { opacity: 0.4; }

.gallery-zoom-hint {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    pointer-events: none;
}
.gallery-zoom-hint .icon { width: 18px; height: 18px; }

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    transition: background-color .2s;
}
.gallery-nav:hover { background: rgba(15, 23, 42, 0.92); }
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }

.gallery-info { padding: 18px 4px 6px; min-height: 96px; }
.gallery-info h3 { font-size: 1.2rem; margin-bottom: 6px; }

.gallery-thumbs-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.gallery-thumbs {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding: 6px 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.thumb {
    flex: 0 0 auto;
    width: 76px;
    height: 76px;
    padding: 0;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--surface-2);
    overflow: hidden;
    scroll-snap-align: start;
    opacity: 0.8;
    transition: opacity .2s, border-color .2s, transform .2s var(--ease);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb:hover { opacity: 1; transform: translateY(-2px); }
.thumb[aria-pressed="true"] { opacity: 1; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }

.thumbs-scroll {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}
.thumbs-scroll:hover { border-color: var(--primary); color: var(--primary); }
.thumbs-scroll .icon { width: 18px; height: 18px; }

@media (min-width: 760px) {
    .gallery { padding: 24px; }
    .gallery-stage { aspect-ratio: 16 / 10; }
    .thumb { width: 96px; height: 96px; }
}

/* ============================================================
   SERVICES
   ============================================================ */
.services-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.service-card {
    padding: 26px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.service-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--chip-border); }
.service-card h3 { font-size: 1.15rem; margin: 16px 0 8px; }

.service-icon {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
}
.service-icon .icon { width: 24px; height: 24px; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact-card {
    display: grid;
    gap: 24px;
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.contact-list {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.contact-list li { display: flex; align-items: center; gap: 14px; min-width: 0; }
.contact-list li > div { display: flex; flex-direction: column; min-width: 0; }
.contact-list a, .contact-list span:not(.contact-label):not(.contact-icon) {
    color: var(--text);
    font-weight: 500;
    overflow-wrap: anywhere;
}
.contact-list a { text-decoration: none; }
.contact-list a:hover { color: var(--primary); text-decoration: underline; }

.contact-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
}
.contact-icon .icon { width: 20px; height: 20px; }
.contact-label {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.contact-cta { justify-self: start; }

@media (min-width: 760px) {
    .contact-card { padding: 36px; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    padding-block: 32px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: center;
    justify-content: space-between;
}
.footer-inner p { font-size: 0.925rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.footer-links a {
    display: inline-block;
    padding: 6px 0;
    color: var(--text-muted);
    font-size: 0.925rem;
    text-decoration: none;
}
.footer-links a:hover { color: var(--primary); }

/* ============================================================
   REDUCED MOTION — no animations, transitions or smooth scroll
   ============================================================ */
@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;
    }
    .project-card:hover,
    .service-card:hover,
    .btn:hover,
    .thumb:hover { transform: none; }
    .hero-photo { transform: none !important; }
}
