/* ===============================================================
   rayyan.dev — stylesheet
   Dark navy + amber. Mobile-first breakpoints at 640 / 900 px.
   =============================================================== */

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

:root {
    /* Surfaces */
    --bg:           #0A0E1A;
    --surface:      #111827;
    --surface-2:    #1A2234;
    --surface-glass: rgba(17, 24, 39, 0.72);

    /* Accent */
    --accent:       #F59E0B;
    --accent-hover: #FBBF24;
    --accent-dim:   rgba(245, 158, 11, 0.10);
    --accent-ring:  rgba(245, 158, 11, 0.35);

    /* Text — all three clear WCAG AA on --bg */
    --text:         #F0F4FF;
    --text-muted:   #9AA5BE;
    --text-faint:   #828DA6;

    /* Lines */
    --border:       #1F2937;
    --border-light: #374151;

    /* Feedback */
    --success:      #34D399;
    --danger:       #F87171;

    /* Scale */
    --radius:       12px;
    --radius-sm:    8px;
    --shadow:       0 12px 32px rgba(0, 0, 0, 0.35);
    --header-h:     64px;
    --gutter:       6%;
    --max-w:        1120px;

    --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg);
    -webkit-text-size-adjust: 100%;
    /* `clip`, not `hidden`: overflow-x:hidden here (or on body) turns the
       element into a scroll container, which breaks window scrolling and
       position:sticky. `clip` just trims the stray pixel. */
    overflow-x: clip;
}

body {
    background-color: transparent;
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.6;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Stops the sticky header from covering a heading you jumped to. */
:target,
section[id],
footer[id] {
    scroll-margin-top: calc(var(--header-h) + 16px);
}

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

/* One consistent, always-visible keyboard focus ring. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

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

ul, ol { list-style: none; }

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

/* ─── ANIMATED BACKGROUND ─────────────────── */
/* The gradient is the baseline: it renders with or without WebGL, so a
   blocked CDN or a failed integrity check never leaves a flat void. */
#bg3d {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    display: block;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(245, 158, 11, 0.07), transparent 70%),
        radial-gradient(ellipse 60% 50% at 85% 90%, rgba(245, 158, 11, 0.05), transparent 70%),
        var(--bg);
    transition: opacity 0.4s ease;
}

/* ─── SKIP LINK ───────────────────────────── */
.skip-link {
    position: fixed;
    top: -100%;
    left: 16px;
    z-index: 200;
    padding: 10px 16px;
    background: var(--accent);
    color: var(--bg);
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 0 0 6px 6px;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-link:focus { top: 0; }

/* ─── NAV ─────────────────────────────────── */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--gutter);
    height: var(--header-h);
    background: rgba(10, 14, 26, 0.55);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

header.header-scrolled nav {
    background: rgba(10, 14, 26, 0.88);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.nav-logo {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text);
    font-family: var(--font-mono);
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: opacity 0.2s;
}

.nav-logo span { color: var(--accent); }
.nav-logo:hover { opacity: 0.8; }

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

.nav-links li a {
    display: block;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 500;
    position: relative;
    padding: 8px 13px;
    border-radius: 7px;
    transition: color 0.2s, background 0.2s;
}

.nav-links li a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

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

.nav-links li a.active::after {
    content: '';
    position: absolute;
    left: 13px;
    right: 13px;
    bottom: 2px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}

.nav-links li a.nav-cta {
    color: var(--bg);
    background: var(--accent);
    font-weight: 600;
    padding: 8px 16px;
    margin-left: 8px;
    box-shadow: 0 2px 14px rgba(245, 158, 11, 0.22);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.nav-links li a.nav-cta:hover {
    background: var(--accent-hover);
    color: var(--bg);
    transform: translateY(-1px);
}

.nav-links li a.nav-cta.active { color: var(--bg); }
.nav-links li a.nav-cta.active::after { display: none; }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

/* Hamburger → X. (The old stylesheet had the transition but never the
   open state, so the icon never actually changed.) */
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ─── SHARED SECTION ──────────────────────── */
.page-section {
    padding: clamp(72px, 9vw, 108px) var(--gutter);
    max-width: var(--max-w);
    margin: 0 auto;
}

.section-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-family: var(--font-mono);
    margin-bottom: 10px;
}

.section-heading {
    font-size: clamp(1.85rem, 3.6vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 48px;
    line-height: 1.2;
}

.section-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 48px;
}

.section-heading-row .section-heading { margin-bottom: 0; }

/* Aligned to the content column rather than the raw page gutter. */
.divider {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border) 12%, var(--border) 88%, transparent);
    max-width: var(--max-w);
    margin: 0 auto;
    width: 88%;
}

/* ─── BUTTONS ─────────────────────────────── */
.btn-primary,
.btn-ghost {
    padding: 13px 28px;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: inherit;
    border-radius: 7px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--accent);
    color: #0A0E1A;
    border: 1px solid var(--accent);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
}

.btn-primary:active { transform: translateY(0); }

.btn-ghost {
    background: transparent;
    color: var(--text);
    font-weight: 600;
    border: 1px solid var(--border-light);
    transition: border-color 0.2s, color 0.2s, transform 0.15s, background 0.2s;
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    transform: translateY(-2px);
}

.btn-resume {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 20px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 7px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-resume svg { flex-shrink: 0; }

.btn-resume:hover {
    background: var(--accent);
    color: var(--bg);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25);
}

/* ─── HERO ────────────────────────────────── */
.hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh; /* no jump when mobile browser chrome hides */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px var(--gutter) 96px;
    overflow: hidden;
    isolation: isolate;
}

.hero-bg {
    position: absolute;
    inset: 0;
    /* Compressed to ~160 KB from a 2.6 MB camera original — it is blurred
       and dimmed to 40 %, so the detail was never visible anyway. */
    background-image: url('hero.jpg');
    background-size: cover;
    background-position: center 22%;
    filter: blur(2px) brightness(0.4) saturate(0.9);
    transform: scale(1.06);
    z-index: -2;
}

.hero-bg-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at center, rgba(10, 14, 26, 0.55) 0%, rgba(10, 14, 26, 0.82) 65%, rgba(10, 14, 26, 0.95) 100%),
        linear-gradient(to top, rgba(10, 14, 26, 0.95) 0%, rgba(10, 14, 26, 0) 32%);
    z-index: -1;
}

.hero-content {
    max-width: 720px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin-bottom: 22px;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.6);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.hero-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

.hero-greeting {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}

.hero-name {
    font-size: clamp(2.4rem, 5.5vw, 4.2rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 18px;
}

.hero-name span { color: var(--accent); }

.hero-typed {
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    color: var(--text-muted);
    /* Reserved height so the buttons never shift as characters land
       (two lines' worth, since the longest phrase wraps on narrow screens). */
    min-height: 2.9em;
    margin-bottom: 28px;
    font-family: var(--font-mono);
}

#typed-text { color: var(--accent); }

.type-caret {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background: var(--accent);
    animation: caret 1s step-end infinite;
}

@keyframes caret {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

.hero-btns {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.scroll-cue {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 38px;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    padding-top: 7px;
    transition: border-color 0.2s;
}

.scroll-cue:hover { border-color: var(--accent); }

.scroll-cue span {
    width: 3px;
    height: 7px;
    border-radius: 2px;
    background: var(--accent);
    animation: cue 1.8s ease-in-out infinite;
}

@keyframes cue {
    0%      { transform: translateY(0);    opacity: 1; }
    70%     { transform: translateY(11px); opacity: 0; }
    100%    { transform: translateY(0);    opacity: 0; }
}

/* ─── SCROLL REVEAL ───────────────────────── */
.reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

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

/* ─── ABOUT ───────────────────────────────── */
.about-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 52px;
    align-items: start;
}

.about-text p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.85;
    margin-bottom: 18px;
    max-width: 62ch;
}

.about-text p:last-child { margin-bottom: 0; }

.skills-block-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.skill-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 11px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-align: center;
    transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s;
}

.skill-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    transform: translateY(-2px);
}

/* ─── CARDS (activities + projects) ───────── */
.cards-grid,
.projects-grid {
    display: grid;
    gap: 22px;
}

.cards-grid    { grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); }
.projects-grid { grid-template-columns: repeat(auto-fit, minmax(298px, 1fr)); }

.card,
.project-card {
    background: var(--surface-glass);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.25s, transform 0.22s, box-shadow 0.22s;
}

.card::before,
.project-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: linear-gradient(to right, var(--accent), var(--accent-hover));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.card:hover,
.project-card:hover {
    border-color: var(--border-light);
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.card:hover::before,
.project-card:hover::before { transform: scaleX(1); }

.card-icon {
    font-size: 1.9rem;
    line-height: 1;
    margin-bottom: 14px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.card-sub {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--accent);
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.card-text,
.project-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.75;
}

/* ─── PROJECTS ────────────────────────────── */
.project-card {
    display: flex;
    flex-direction: column;
}

.project-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.project-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.project-status {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--accent-dim);
    color: var(--accent);
    white-space: nowrap;
}

.project-status--wip {
    background: rgba(154, 165, 190, 0.12);
    color: var(--text-muted);
}

.project-desc {
    flex: 1;
    margin-bottom: 18px;
}

.project-tags,
.timeline-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    font-size: 0.73rem;
    font-family: var(--font-mono);
    padding: 4px 10px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 4px;
    font-weight: 500;
}

/* ─── TIMELINE ────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 36px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px; top: 8px; bottom: 8px;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent), var(--border) 22%, var(--border));
}

.timeline-item {
    position: relative;
    margin-bottom: 52px;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -36px; top: 6px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg);
    box-shadow: 0 0 0 2px var(--accent);
}

.timeline-period {
    font-size: 0.73rem;
    font-weight: 500;
    color: var(--accent);
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.timeline-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.timeline-org {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.timeline-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.8;
    max-width: 70ch;
}

.timeline-tags { margin-top: 18px; }

/* ─── PROJECT INQUIRY FORM ────────────────── */
.project-form-intro {
    color: var(--text-muted);
    font-size: 0.98rem;
    max-width: 560px;
    margin-bottom: 36px;
}

.project-form {
    background: var(--surface-glass);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 36px;
    max-width: 640px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

/* :not(.file-drop) — the drop zone is a <label> too, and would otherwise
   inherit the uppercase mono field-label treatment. */
.form-group > label:not(.file-drop),
.form-group-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-family: var(--font-mono);
}

.label-optional {
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-faint);
    font-weight: 400;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group textarea {
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.92rem;
    width: 100%;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-faint);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-group input[aria-invalid="true"],
.form-group textarea[aria-invalid="true"] {
    border-color: var(--danger);
}

.form-group input[aria-invalid="true"]:focus,
.form-group textarea[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.28);
}

.field-error {
    color: var(--danger);
    font-size: 0.78rem;
    line-height: 1.5;
    margin-top: 6px;
    min-height: 1em;
}

.field-error:empty { display: none; }

/* File drop zone ------------------------------------------------ */
.file-drop {
    display: block;
    border: 1.5px dashed var(--border-light);
    border-radius: 10px;
    padding: 26px 18px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.file-drop:hover,
.file-drop--active {
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* The input is visually hidden but still focusable, so give the drop
   zone the focus ring on its behalf. */
#pf-files:focus-visible + .file-drop {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-color: var(--accent);
}

.file-drop-main {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.file-drop-sub {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* Sits outside the drop zone so clicking a filename no longer
   re-opens the file picker. */
.file-list {
    margin-top: 12px;
    text-align: left;
}

.file-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--accent);
    padding: 6px 2px;
    border-bottom: 1px solid var(--border);
}

.file-list .file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list .file-size {
    flex-shrink: 0;
    color: var(--text-faint);
}

.file-list .file-item--bad,
.file-list .file-item--bad .file-size { color: var(--danger); }

.form-submit {
    width: 100%;
    margin-top: 4px;
}

.form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.form-status {
    margin-top: 16px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    min-height: 1.2em;
}

.form-status--success { color: var(--success); }
.form-status--error   { color: var(--danger); }

/* ─── FOOTER / CONTACT ────────────────────── */
.contact-footer {
    background: rgba(17, 24, 39, 0.82);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 80px var(--gutter);
    text-align: center;
}

.footer-heading {
    font-size: clamp(1.7rem, 3.4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.footer-sub {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 480px;
    margin: 0 auto 40px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 48px;
}

.social-btn {
    padding: 12px 22px;
    border: 1px solid var(--border-light);
    border-radius: 7px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: border-color 0.2s, color 0.2s, transform 0.15s, background 0.2s;
}

.social-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
    transform: translateY(-2px);
}

/* Was --border-light (#374151) on a near-black background: about 2:1,
   effectively unreadable. --text-faint clears AA. */
.footer-copy {
    font-size: 0.78rem;
    color: var(--text-faint);
}

/* ─── RESPONSIVE ──────────────────────────── */
/* 900px, not 768px: seven nav items ran out of room well before the
   old breakpoint and wrapped on top of the logo. */
@media (max-width: 900px) {
    .nav-toggle { display: flex; }

    .nav-links {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: rgba(10, 14, 26, 0.97);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--border);
        padding: 12px var(--gutter) 20px;
        transform: translateY(-120%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .nav-links.nav-open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-links li a {
        padding: 13px 14px;
        font-size: 1rem;
        border-radius: var(--radius-sm);
    }

    .nav-links li a.active::after { display: none; }
    .nav-links li a.active { background: var(--accent-dim); }

    .nav-links li a.nav-cta {
        margin: 10px 0 0;
        text-align: center;
    }

    /* Stops the page scrolling behind an open menu. */
    body.nav-locked { overflow: hidden; }

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

@media (max-width: 640px) {
    :root { --gutter: 5.5%; }

    .hero { padding: 104px var(--gutter) 84px; }
    .hero-bg {
        /* Half-size file: no point shipping 1600px to a 390px screen. */
        background-image: url('hero-small.jpg');
        background-position: center 30%;
    }

    .section-heading-row { gap: 16px; }
    .btn-resume { font-size: 0.82rem; padding: 10px 16px; }

    .cards-grid,
    .projects-grid { grid-template-columns: 1fr; }

    .card, .project-card { padding: 24px; }

    .project-form { padding: 24px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }

    .hero-btns { width: 100%; flex-direction: column; }
    .hero-btns a { width: 100%; }

    .scroll-cue { display: none; }

    .timeline { padding-left: 28px; }
    .timeline-dot { left: -28px; width: 13px; height: 13px; }
}

/* ─── REDUCED MOTION ──────────────────────── */
/* One global override: no smooth scroll, no reveal, no looping decoration. */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }

    .type-caret,
    .hero-badge-dot,
    .scroll-cue span { animation: none; }
}

/* ─── PRINT ───────────────────────────────── */
@media print {
    #bg3d, header, .scroll-cue, .hero-bg, .hero-bg-overlay,
    .project-form, .nav-toggle { display: none !important; }

    body { color: #000; background: #fff; }
    .reveal { opacity: 1 !important; transform: none !important; }
    .page-section { padding: 24px 0; break-inside: avoid; }
    .card, .project-card, .timeline-item { break-inside: avoid; }
}
