/* styles.css */

:root {
    --bg: #ffffff;
    --bg-soft: #f5f8fc;
    --surface: #ffffff;
    --surface-2: #f8fafd;
    --text: #0e1726;
    --text-muted: #56637a;
    --border: #e2e8f0;
    --brand: #0b5cd5;
    --brand-ink: #08419a;
    --brand-soft: #e9f1fe;
    --gold: #8a6212;
    --gold-soft: #fdf4e0;
    --danger: #b91c1c;

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(14, 23, 38, 0.06), 0 1px 3px rgba(14, 23, 38, 0.04);
    --shadow-md: 0 10px 30px rgba(14, 23, 38, 0.08);

    --maxw: 1080px;
    --gutter: 20px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1220;
        --bg-soft: #0e1729;
        --surface: #121c31;
        --surface-2: #16223a;
        --text: #e7edf8;
        --text-muted: #9caac2;
        --border: #24324f;
        --brand: #74a8ff;
        --brand-ink: #a8c8ff;
        --brand-soft: #16233d;
        --gold: #e0b85f;
        --gold-soft: #2a2213;
        --danger: #fca5a5;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.45);
    }
}

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

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    line-height: 1.2;
    margin: 0;
    letter-spacing: -0.015em;
}

p {
    margin: 0;
}

ul,
ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

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

/* Component display rules would otherwise defeat the hidden attribute. */
[hidden] {
    display: none !important;
}

a {
    color: var(--brand);
}

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

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    padding: 10px 16px;
    background: var(--brand);
    color: #fff;
    z-index: 100;
    text-decoration: none;
}

.skip-link:focus {
    left: 12px;
    top: 12px;
}

.link {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
}

.link:hover {
    border-bottom-color: currentColor;
}

/* ---------- Header and navigation ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-nav {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 12px var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.brand__name {
    font-size: 0.98rem;
}

.nav__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}

.nav__toggle-bars {
    position: relative;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.nav__toggle-bars::before,
.nav__toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.nav__toggle-bars::before {
    top: -5px;
}

.nav__toggle-bars::after {
    top: 5px;
}

.nav__links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 6px;
}

.site-nav.is-open .nav__links {
    display: flex;
}

.nav__links a {
    display: block;
    padding: 9px 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
}

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

.nav__links a.is-active {
    color: var(--brand);
}

/* ---------- Hero ---------- */

.hero {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 48px var(--gutter) 8px;
}

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

.hero h1 {
    font-size: clamp(2.1rem, 7vw, 3.4rem);
    margin-bottom: 14px;
}

.hero__tagline {
    font-size: clamp(1.05rem, 3vw, 1.3rem);
    color: var(--text);
    font-weight: 500;
    max-width: 54ch;
    line-height: 1.45;
    margin-bottom: 16px;
}

.hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 26px;
}

/* Separator belongs to the preceding item so it never starts a wrapped line. */
.hero__meta span:not(:last-child)::after {
    content: " /";
    margin-left: 10px;
    color: var(--border);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 20px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
}

.btn--primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn--primary:hover {
    background: color-mix(in srgb, var(--brand) 88%, #000);
}

.hero__portrait {
    justify-self: start;
}

.hero__portrait img {
    width: min(280px, 70vw);
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: 50% 38%;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

/* ---------- Stats ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 44px;
}

.stat {
    padding: 18px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stat__value {
    display: block;
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--brand);
}

.stat__label {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-muted);
}

/* ---------- Sections ---------- */

.section {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 56px var(--gutter);
}

.section--contact {
    padding-bottom: 72px;
}

.section__title {
    font-size: clamp(1.5rem, 4.5vw, 2rem);
    margin-bottom: 26px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.section__title::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 0.9em;
    margin-right: 12px;
    vertical-align: -0.06em;
    border-radius: 3px;
    background: var(--brand);
}

.subhead {
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 40px 0 18px;
}

.prose p + p {
    margin-top: 14px;
}

.prose p {
    max-width: 68ch;
    color: var(--text-muted);
}

.lede {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text);
    max-width: 44ch;
}

/* ---------- Skills ---------- */

.skill-groups {
    display: grid;
    gap: 16px;
    margin-top: 32px;
}

.skill-group {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.skill-group h3 {
    font-size: 1rem;
    margin-bottom: 14px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---------- Logos with monogram fallback ---------- */

.logo {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-2);
    background: color-mix(in srgb, var(--logo-tint, var(--brand)) 12%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--logo-tint, var(--brand)) 28%, var(--border));
}

.logo__mono {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: var(--logo-tint, var(--brand));
}

.logo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 5px;
    object-fit: contain;
    /* Always white: brand marks are drawn for light backgrounds, and several of
       these PNGs are opaque, which would look patchy against the dark theme. */
    background: #ffffff;
}

.logo--sm {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
}

.logo--sm .logo__mono {
    font-size: 0.9rem;
}

@media (prefers-color-scheme: dark) {
    .logo__mono {
        color: color-mix(in srgb, var(--logo-tint, var(--brand)) 45%, #ffffff);
    }
}

/* ---------- Awards ---------- */

.award {
    display: grid;
    gap: 16px;
    padding: 22px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.award + .award {
    margin-top: 16px;
}

.award--featured {
    border-color: color-mix(in srgb, var(--gold) 40%, var(--border));
    background: linear-gradient(180deg, var(--gold-soft), var(--surface) 55%);
}

.award__badge {
    align-self: start;
    justify-self: start;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--gold);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.award__badge--muted {
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

@media (prefers-color-scheme: dark) {
    /* The dark palette lightens --gold, so white text on it reads poorly. */
    .award__badge {
        color: #171104;
    }

    .award__badge--muted {
        color: var(--text-muted);
    }
}

.award__body h3 {
    font-size: 1.25rem;
}

.award__meta {
    margin: 6px 0 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

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

.award__points {
    margin-top: 14px;
    display: grid;
    gap: 8px;
}

.award__points li {
    position: relative;
    padding-left: 22px;
    font-size: 0.93rem;
    color: var(--text-muted);
}

.award__points li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0.62em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
}

/* ---------- Experience ---------- */

.company {
    padding: 22px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.company__head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.company__head h3 {
    font-size: 1.3rem;
}

.company__meta {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.roles {
    margin-top: 22px;
    padding-left: 22px;
    border-left: 2px solid var(--border);
    display: grid;
    gap: 24px;
}

.role {
    position: relative;
}

.role::before {
    content: "";
    position: absolute;
    left: -29px;
    top: 0.42em;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--brand);
}

.role:first-child::before {
    background: var(--brand);
}

.role h4 {
    font-size: 1.05rem;
}

.role__meta {
    margin: 3px 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand);
}

.role p:last-child {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.earlier {
    display: grid;
    gap: 12px;
}

.earlier__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.earlier__item h4 {
    font-size: 0.98rem;
}

.earlier__meta {
    margin-top: 2px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---------- Projects ---------- */

.projects {
    display: grid;
    gap: 18px;
}

.project-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.project-card__cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.project-card__body {
    padding: 20px;
}

.project-card__tag {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--brand);
    margin-bottom: 8px;
}

.project-card__body h3 {
    font-size: 1.15rem;
    margin-bottom: 10px;
}

.project-card__body p:last-child {
    color: var(--text-muted);
    font-size: 0.93rem;
}

/* ---------- Education and certifications ---------- */

.edu-grid {
    display: grid;
    gap: 16px;
}

.edu {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.edu h3 {
    font-size: 1.08rem;
}

.edu__meta {
    margin: 5px 0 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--brand);
}

.edu p:last-child {
    color: var(--text-muted);
    font-size: 0.93rem;
}

.edu__meta:last-child {
    margin-bottom: 0;
}

.certs {
    display: grid;
    gap: 14px;
}

.cert {
    padding: 18px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.cert--active {
    background: var(--surface);
    border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
    box-shadow: var(--shadow-sm);
}

.cert h4 {
    font-size: 0.98rem;
}

.cert__meta {
    margin: 6px 0 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cert__meta:last-child {
    margin-bottom: 0;
}

/* ---------- Contact ---------- */

.contact {
    display: grid;
    gap: 28px;
    padding: 26px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.contact__pitch .subhead {
    margin: 22px 0 14px;
}

.contact__looking {
    display: grid;
    gap: 10px;
}

.contact__looking li {
    position: relative;
    padding-left: 22px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.contact__looking li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.55em;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--brand);
}

.contact__side {
    display: grid;
    gap: 22px;
    align-content: start;
}

.contact-form {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 6px;
}

.field label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.field input,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
    resize: vertical;
    min-height: 110px;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.contact-form button {
    justify-self: start;
}

.contact-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-status {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-status:empty {
    display: none;
}

.form-status[data-state="success"] {
    color: var(--brand);
    font-weight: 600;
}

.form-status[data-state="error"] {
    color: var(--danger);
    font-weight: 600;
}

.contact__links {
    display: grid;
    gap: 14px;
    align-content: start;
}

.contact__links li {
    display: grid;
    gap: 2px;
}

.contact__label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 24px var(--gutter);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ---------- Reveal on scroll (added by script.js) ---------- */

body.js-reveal .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* ---------- Responsive ---------- */

@media (min-width: 640px) {
    .stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .projects {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .edu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .certs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .award {
        /* Fixed badge column so headings line up across cards. */
        grid-template-columns: 150px minmax(0, 1fr);
        gap: 22px;
        padding: 26px 24px;
    }

    .company,
    .contact {
        padding: 28px 26px;
    }
}

@media (min-width: 1024px) {
    :root {
        --gutter: 28px;
    }

    .nav__toggle {
        display: none;
    }

    .nav__links {
        display: flex;
        flex-direction: row;
        width: auto;
        gap: 22px;
        padding-bottom: 0;
    }

    .nav__links a {
        padding: 4px 0;
        border-bottom: 2px solid transparent;
    }

    .nav__links a.is-active {
        border-bottom-color: var(--brand);
    }

    .hero {
        padding-top: 72px;
    }

    .hero__inner {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 56px;
    }

    .hero__portrait img {
        width: 320px;
    }

    .skill-groups {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .contact {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        gap: 48px;
        padding: 34px 32px;
    }
}

/* ---------- Motion and print ---------- */

@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;
    }

    body.js-reveal .reveal {
        opacity: 1;
        transform: none;
    }
}

@media print {
    .site-header,
    .hero__actions,
    .skip-link {
        display: none;
    }

    body {
        color: #000;
        background: #fff;
    }

    .section,
    .hero {
        padding-block: 16px;
        break-inside: avoid;
    }

    .project-card,
    .award,
    .company,
    .edu,
    .cert {
        box-shadow: none;
        break-inside: avoid;
    }
}
