:root {
    --bg:            #16161A;
    --bg-band:       #1E1E22;
    --card:          #26262A;
    --line:          #444441;
    --line-soft:     #2C2C2A;

    --red:           #E24B4A;
    --red-deep:      #A32D2D;
    --red-darker:    #791F1F;
    --red-darkest:   #501313;
    --red-soft:      #F09595;
    --red-pale:      #F7C1C1;
    --red-tint:      #FCEBEB;

    --amber:         #BA7517;
    --amber-deep:    #854F0B;
    --amber-darkest: #412402;
    --amber-soft:    #FAC775;
    --amber-tint:    #FAEEDA;

    --cream:         #F0E9D2;
    --text:          #B4B2A9;
    --text-dim:      #888780;
    --text-faint:    #5F5E5A;

    --mono: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
    --wrap: 1140px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}

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

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }

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

.skip-link {
    position: absolute; top: -60px; left: 16px; z-index: 100;
    background: var(--red); color: var(--red-darkest);
    padding: 10px 16px; border-radius: 4px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ---------- buttons ---------- */

.btn {
    display: inline-block;
    font-family: inherit;
    font-size: 13px;
    padding: 11px 20px;
    border-radius: 4px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--red); color: var(--red-darkest); font-weight: 500; }
.btn-primary:hover { background: var(--red-soft); }

.btn-ghost { background: transparent; color: #D3D1C7; border-color: var(--text-faint); }
.btn-ghost:hover { border-color: var(--cream); color: var(--cream); }

.btn-block { width: 100%; }

/* ---------- nav ---------- */

.nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(22,22,26,.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line-soft);
}
.nav-inner {
    max-width: var(--wrap); margin: 0 auto; padding: 14px 32px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nav-logo {
    color: var(--cream); font-size: 14px; letter-spacing: 1.5px;
    text-decoration: none; white-space: nowrap;
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a {
    color: var(--text); font-size: 12px; text-decoration: none;
    transition: color .15s ease;
}
.nav-links a:hover { color: var(--cream); }
.nav-links .nav-resume { padding: 8px 14px; font-size: 12px; }
.nav-links .nav-resume:hover { color: var(--red-darkest); }

.nav-toggle {
    display: none;
    background: none; border: 1px solid var(--line);
    color: var(--cream); font-size: 16px;
    padding: 8px 11px; border-radius: 4px; cursor: pointer;
}

/* ---------- sections ---------- */

section { padding: 72px 0; }
.band { background: var(--bg-band); }
.hero { padding: 112px 0 96px; }

.eyebrow {
    color: var(--red-soft);
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 400;
    margin-bottom: 24px;
}

.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}
.section-head .eyebrow { margin-bottom: 24px; }
.section-hint { color: var(--text-faint); font-size: 11px; }

/* ---------- hero ---------- */

.hero .eyebrow { margin-bottom: 14px; }
.hero h1 {
    color: var(--cream);
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 700;
    line-height: 1.2;
    max-width: 16ch;
    margin-bottom: 18px;
}
.hero-lede { max-width: 52ch; line-height: 1.8; }
.hero-actions { display: flex; gap: 10px; margin-top: 32px; flex-wrap: wrap; }

/* ---------- skills ---------- */

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.skill-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px 18px;
}
.skill-card i { color: var(--red-soft); font-size: 20px; }
.skill-card h3 {
    color: var(--cream); font-size: 13px; font-weight: 500;
    margin: 14px 0 8px;
}
.skill-card p { color: var(--text-dim); font-size: 11px; line-height: 1.6; }

/* ---------- projects ---------- */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 14px;
}

.flip-card {
    background: none; border: 0; padding: 0;
    font-family: inherit; text-align: left; cursor: pointer;
    perspective: 1400px;
    min-height: 260px;
}

.flip-inner {
    position: relative;
    width: 100%; height: 100%; min-height: 260px;
    transition: transform .55s cubic-bezier(.4,.2,.2,1);
    transform-style: preserve-3d;
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }

.flip-face {
    position: absolute; inset: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 8px;
    padding: 22px;
    display: flex; flex-direction: column;
}

.flip-front {
    background: var(--card);
    border: 1px solid var(--line);
    transition: border-color .15s ease;
}
.flip-card:hover .flip-front { border-color: var(--text-faint); }
.flip-card.work .flip-front { border-color: var(--amber-deep); }

.flip-back {
    transform: rotateY(180deg);
    background: var(--red-darkest);
    border: 1px solid var(--red);
    overflow: auto;
}
.flip-card.work .flip-back {
    background: var(--amber-darkest);
    border-color: var(--amber);
}

.p-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px; margin-bottom: 10px;
}
.p-title { color: var(--cream); font-size: 15px; font-weight: 500; }
.flip-back .p-title { color: var(--red-tint); }
.flip-card.work .flip-back .p-title { color: var(--amber-tint); }

.p-badge {
    background: var(--amber-darkest); color: var(--amber-soft);
    font-size: 9px; letter-spacing: 1px;
    padding: 3px 7px; border-radius: 3px; white-space: nowrap;
}

.p-short { color: var(--text-dim); font-size: 12px; line-height: 1.7; flex: 1; }
.p-flip-hint { color: var(--text-faint); font-size: 11px; }

.p-long {
    color: var(--red-pale); font-size: 12px; line-height: 1.7;
    margin-bottom: 14px; flex: 1;
}
.flip-card.work .p-long { color: var(--amber-soft); }

.p-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.p-tags span {
    background: var(--red-darker); color: var(--red-tint);
    font-size: 10px; padding: 3px 8px; border-radius: 3px;
}
.flip-card.work .p-tags span {
    background: var(--amber-deep); color: var(--amber-tint);
}

.p-links { display: flex; gap: 8px; }
.p-links a {
    flex: 1; text-align: center;
    border: 1px solid var(--red-soft); color: var(--red-tint);
    font-size: 11px; padding: 8px; border-radius: 4px;
    text-decoration: none;
    transition: background .15s ease;
}
.p-links a:hover { background: var(--red-darker); }
.p-links a.primary { background: var(--red); color: var(--red-darkest); border-color: var(--red); }
.p-links a.primary:hover { background: var(--red-soft); }

/* Link not wired up yet: visible, but clearly not clickable. */
.p-links a.pending {
    border-color: var(--text-faint);
    color: var(--text-faint);
    cursor: default;
    pointer-events: none;
}

.p-private {
    background: rgba(0,0,0,.25);
    border: 1px solid var(--amber);
    border-radius: 4px;
    padding: 10px 12px;
    color: var(--amber-soft);
    font-size: 11px; line-height: 1.5; text-align: center;
}

/* ---------- about ---------- */

.about-grid {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 32px; align-items: start;
}
.about-photo {
    width: 100%; aspect-ratio: 3/4; object-fit: cover;
    background: var(--card);
    border: 1px solid var(--line); border-radius: 8px;
}
.about-lead { color: var(--cream); font-size: 14px; line-height: 1.9; margin-bottom: 16px; }
.about-body { font-size: 12px; line-height: 1.9; }
.about-meta {
    display: flex; gap: 20px; flex-wrap: wrap;
    list-style: none; margin-top: 22px;
}
.about-meta li { color: var(--text-dim); font-size: 11px; }
.about-meta i { color: var(--red-soft); margin-right: 4px; }

/* ---------- contact ---------- */

.contact-lede { font-size: 13px; margin-bottom: 24px; max-width: 52ch; }
.contact-form { width: 100%; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.field { display: block; margin-bottom: 12px; }

.contact-form input,
.contact-form textarea {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 11px 12px;
    color: var(--cream);
    font-family: inherit; font-size: 12px;
    resize: vertical;
    transition: border-color .15s ease;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--text-faint); }
.contact-form input:hover,
.contact-form textarea:hover { border-color: var(--text-faint); }
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--red); outline: none; }

.form-error { color: var(--red-soft); font-size: 11px; margin-bottom: 12px; }

.socials {
    display: flex; gap: 18px; flex-wrap: wrap;
    list-style: none; margin-top: 24px;
}
.socials a {
    color: var(--text); font-size: 12px; text-decoration: none;
    transition: color .15s ease;
}
.socials a:hover { color: var(--cream); }
.socials i { color: var(--red-soft); margin-right: 4px; }

/* ---------- footer ---------- */

.footer { border-top: 1px solid var(--line-soft); padding: 20px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer span { color: var(--text-faint); font-size: 11px; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
    .wrap, .nav-inner { padding-left: 20px; padding-right: 20px; }
    section { padding: 56px 0; }
    .hero { padding: 72px 0 64px; }
    .about-grid { grid-template-columns: 1fr; gap: 24px; }
    .about-photo { max-width: 200px; }

    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--bg-band);
        border-bottom: 1px solid var(--line-soft);
        padding: 8px 20px 16px;
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 12px 0; font-size: 13px; }
    .nav-links .nav-resume { text-align: center; margin-top: 8px; }
}

@media (max-width: 560px) {
    .field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
    .flip-inner { transition: none; }
}