/* matthewnicolella.com */

:root {
    --bg: #f7f8fa;
    --bg-alt: #eef1f5;
    --surface: #ffffff;
    --border: #dde2ea;
    --text: #141a24;
    --muted: #5a6577;
    --accent: #0f766e;
    --accent-strong: #0b5e57;
    --accent-soft: rgba(15, 118, 110, .10);
    --on-accent: #ffffff;
    --ok: #15803d;
    --err: #b91c1c;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .12);

    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --radius: 14px;
    --wrap: 1120px;
    --nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1117;
        --bg-alt: #111720;
        --surface: #161d27;
        --border: #263040;
        --text: #e6ebf2;
        --muted: #93a0b4;
        --accent: #2dd4bf;
        --accent-strong: #5eead4;
        --accent-soft: rgba(45, 212, 191, .10);
        --on-accent: #04201d;
        --ok: #4ade80;
        --err: #f87171;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
    }
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }

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

img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px;
    font: 600 15px/1 var(--font);
    color: var(--on-accent); background: var(--accent);
    border: 1px solid var(--accent); border-radius: 10px;
    cursor: pointer; transition: background .15s, transform .15s, border-color .15s;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); text-decoration: none; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); color: var(--text); border-color: var(--accent); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }

/* Nav */
.nav {
    position: sticky; top: 0; z-index: 50;
    height: var(--nav-h);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark {
    display: grid; place-items: center; width: 34px; height: 34px;
    font: 500 14px/1 var(--mono); color: var(--accent);
    border: 1.5px solid var(--accent); border-radius: 9px;
}
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a:not(.btn) { color: var(--muted); font-size: 15px; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.nav-links a:not(.btn):hover, .nav-links a.active { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.nav-links .btn { margin-left: 8px; }

.nav-toggle { display: none; width: 40px; height: 40px; padding: 0; background: none; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 18px; height: 2px; margin: 4px auto; background: var(--text); border-radius: 2px; transition: transform .2s; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3px) rotate(-45deg); }

@media (max-width: 820px) {
    .nav-toggle { display: block; }
    .nav-links {
        position: absolute; top: var(--nav-h); left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 2px;
        padding: 12px 16px 20px;
        background: var(--bg); border-bottom: 1px solid var(--border);
        display: none;
    }
    .nav-links.open { display: flex; }
    .nav-links a:not(.btn) { padding: 12px; }
    .nav-links .btn { margin: 8px 0 0; }
}

/* Hero */
.hero { position: relative; padding: 72px 0 56px; overflow: hidden; }
.hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 44px 44px;
    opacity: .45;
    mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 10%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 10%, transparent 75%);
}
.hero-inner { display: grid; grid-template-columns: 1fr auto; gap: 56px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 500 13px/1 var(--mono); color: var(--muted); padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.hero h1 { margin-top: 22px; font-size: clamp(40px, 6.4vw, 68px); font-weight: 700; letter-spacing: -0.035em; }
.hero-role { margin: 10px 0 22px; font-size: clamp(19px, 2.4vw, 24px); font-weight: 500; color: var(--muted); }
.hero-role span { color: var(--accent); }
.lead { max-width: 60ch; font-size: 18px; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.social { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 28px; }
.social a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 500; }
.social a:hover { color: var(--text); text-decoration: none; }
.social svg { width: 18px; height: 18px; fill: currentColor; }
.social svg[fill="none"] { fill: none; }

.hero-photo { position: relative; width: 300px; }
.hero-photo::after {
    content: ""; position: absolute; inset: 14px -14px -14px 14px; z-index: -1;
    border: 1.5px solid var(--accent); border-radius: 22px; opacity: .6;
}
.hero-photo img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 22px; box-shadow: var(--shadow); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 64px 0 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.stats div { padding: 22px 24px; }
.stats div + div { border-left: 1px solid var(--border); }
.stats dt { font: 600 26px/1.1 var(--font); letter-spacing: -0.02em; }
.stats dd { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }

@media (max-width: 900px) {
    .hero { padding-top: 44px; }
    .hero-inner { grid-template-columns: 1fr; gap: 40px; }
    .hero-photo { width: 200px; order: -1; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stats div:nth-child(3) { border-left: 0; }
    .stats div:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 420px) {
    .stats { grid-template-columns: 1fr; }
    .stats div + div { border-left: 0; border-top: 1px solid var(--border); }
}

/* Sections */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
@media (max-width: 600px) { .section { padding: 64px 0; } }
.section-head { margin-bottom: 40px; }
.kicker { margin: 0 0 12px; font: 500 13px/1 var(--mono); color: var(--accent); letter-spacing: .02em; }
.section-head h2 { font-size: clamp(28px, 4vw, 40px); max-width: 22ch; }
.prose { color: var(--muted); font-size: 17px; max-width: 62ch; }
.prose a { font-weight: 500; }

.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; margin-bottom: 56px; }
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; gap: 32px; } }

.facts { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.facts li { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 14px 20px; font-size: 15px; overflow-wrap: anywhere; }
.facts li + li { border-top: 1px solid var(--border); }
.facts span { flex: 0 0 84px; font: 500 12px/2 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Cards */
.cards { display: grid; gap: 20px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1000px) { .cards-4 { grid-template-columns: repeat(2, 1fr); } .cards-3 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .cards-4 { grid-template-columns: 1fr; } }

.card {
    display: flex; flex-direction: column;
    padding: 26px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow);
    transition: border-color .2s, transform .2s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-2px); }
.card h3 { font-size: 18px; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 15px; }
.card-num { font: 500 12px/1 var(--mono); color: var(--accent); margin-bottom: 18px; }
.project p { flex: 1; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.project .tags { margin-top: 20px; }
.tags li { font: 500 13px/1 var(--mono); padding: 7px 10px; color: var(--text); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: 7px; }

/* Timeline */
.timeline { display: grid; gap: 28px; }
.job { display: grid; grid-template-columns: 200px 1fr; gap: 32px; }
.job-meta { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.job-dates { font: 500 14px/1.4 var(--mono); color: var(--accent); }
.job-place { font-size: 14px; color: var(--muted); }
.job-body { padding: 30px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.job-body h3 { font-size: 22px; }
.job-org { margin: 6px 0 16px; font-weight: 600; color: var(--muted); }
.job-body > p:not(.job-org) { color: var(--muted); max-width: 70ch; }
.highlights { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 32px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.hl { padding: 14px 0 14px 16px; border-left: 2px solid var(--accent-soft); transition: border-color .2s; }
.hl:hover { border-left-color: var(--accent); }
.hl h4 { font-size: 15px; margin-bottom: 6px; }
.hl p { font-size: 14.5px; color: var(--muted); }
@media (max-width: 900px) {
    .job { grid-template-columns: 1fr; gap: 10px; }
    .job-meta { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
    .highlights { grid-template-columns: 1fr; }
}
@media (max-width: 600px) { .job-body { padding: 22px 18px; } }

/* PKI diagram */
.diagram { margin: 40px 0 0; padding: 28px; border: 1px dashed var(--border); border-radius: var(--radius); }
.diagram figcaption { font: 500 13px/1 var(--mono); color: var(--muted); margin-bottom: 22px; }
.chain { display: flex; align-items: center; gap: 0; }
.node { flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.node strong { font-size: 15px; }
.node span { font: 400 12.5px/1.3 var(--mono); color: var(--muted); }
.node-root { border-color: var(--accent); }
.arrow { flex: 1 1 32px; min-width: 32px; height: 2px; background: var(--accent); position: relative; opacity: .7; }
.arrow::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--accent); border-right: 0; }
.leaves { display: flex; flex-direction: column; gap: 10px; }
.node-leaf { padding: 10px 16px; }
@media (max-width: 820px) {
    .chain { flex-direction: column; align-items: stretch; }
    .arrow { flex: 0 0 26px; min-width: 0; width: 2px; height: 26px; align-self: center; }
    .arrow::after { right: auto; top: auto; bottom: -1px; left: -4px; border: 5px solid transparent; border-top: 7px solid var(--accent); border-bottom: 0; }
}
@media (max-width: 600px) { .diagram { padding: 20px 16px; } }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
@media (max-width: 400px) { .skills { grid-template-columns: 1fr; } }
.skill-group { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.skill-group h3 { font-size: 15px; margin-bottom: 16px; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 56px; align-items: start; }
.contact-grid .prose { margin-bottom: 28px; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; gap: 40px; } }

.form { padding: 30px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
@media (max-width: 600px) { .form { padding: 22px 18px; } }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; gap: 0; } }
.field { display: block; margin-bottom: 18px; }
.field span { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 600; }
.field input, .field textarea {
    width: 100%; padding: 12px 14px;
    font: 15px/1.5 var(--font); color: var(--text);
    background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.invalid input, .field.invalid textarea { border-color: var(--err); }
.form .btn { width: 100%; margin-top: 4px; }
.form-status { margin: 14px 0 0; min-height: 1.5em; font-size: 15px; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--err); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Footer */
.footer { padding: 28px 0; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }
