/* ============================================================================
   Josh Fechner - resume site
   Hand-built. No framework. Monospace / "warm terminal" aesthetic.
   ========================================================================== */

/* --- Self-hosted fonts (Hack, OFL/MIT) ------------------------------------ */
@font-face {
    font-family: 'Hack';
    src: url('../fonts/hack-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Hack';
    src: url('../fonts/hack-bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Hack';
    src: url('../fonts/hack-italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Hack';
    src: url('../fonts/hack-bolditalic.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

/* --- Design tokens -------------------------------------------------------- */
:root {
    /* Light "warm paper" theme (default) */
    --bg:          #f4f1e9;
    --bg-elev:     #fbf9f3;
    --bg-sunken:   #ece7da;
    --fg:          #2b2823;
    --fg-muted:    #6b6459;
    --border:      #e0d9c8;
    --border-strong: #cfc6b1;
    --accent:      #b4531f;   /* terracotta / rust */
    --accent-ink:  #9a441a;   /* darker, for link text on paper (AA) */
    --accent-2:    #2f6f6a;   /* muted teal */
    --selection:   rgba(180, 83, 31, 0.18);
    --shadow:      0 1px 2px rgba(43, 40, 35, 0.06), 0 8px 24px rgba(43, 40, 35, 0.08);

    --mono: 'Hack', 'JetBrains Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
    --measure: 68ch;
    --nav-h: 3.25rem;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:          #17191d;
        --bg-elev:     #1f2228;
        --bg-sunken:   #121317;
        --fg:          #dcd7ca;
        --fg-muted:    #948d7d;
        --border:      #2e323a;
        --border-strong: #3c414b;
        --accent:      #e0985a;   /* warm amber */
        --accent-ink:  #e8a771;
        --accent-2:    #6fb2ab;   /* teal */
        --selection:   rgba(224, 152, 90, 0.22);
        --shadow:      0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
        color-scheme: dark;
    }
}

/* Explicit toggle wins in both directions */
:root[data-theme="dark"] {
    --bg:          #17191d;
    --bg-elev:     #1f2228;
    --bg-sunken:   #121317;
    --fg:          #dcd7ca;
    --fg-muted:    #948d7d;
    --border:      #2e323a;
    --border-strong: #3c414b;
    --accent:      #e0985a;
    --accent-ink:  #e8a771;
    --accent-2:    #6fb2ab;
    --selection:   rgba(224, 152, 90, 0.22);
    --shadow:      0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
}

/* --- Reset-ish ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 1rem); }
body {
    margin: 0;
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.6;
    color: var(--fg);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}
.hero .blurb, .prose p, .hero .meta span { overflow-wrap: break-word; }
::selection { background: var(--selection); }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { font-weight: 700; line-height: 1.25; margin: 0; }
p { margin: 0 0 1rem; }
ul { margin: 0; padding: 0; list-style: none; }

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

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    z-index: 100;
    background: var(--accent);
    color: #fff;
    padding: 0.5rem 0.9rem;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.container { width: min(100% - 2.5rem, 62rem); margin-inline: auto; }

/* --- Nav ------------------------------------------------------------------ */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--nav-h);
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--border);
}
.nav__inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.brand {
    font-weight: 700;
    white-space: nowrap;
    color: var(--fg-muted);
}
.brand .u { color: var(--accent); }
.brand .p { color: var(--fg-muted); }
.brand a { color: inherit; }

.nav__links {
    display: flex;
    gap: 1.1rem;
    margin-left: auto;
    align-items: center;
}
.nav__links a {
    color: var(--fg-muted);
    font-size: 0.85rem;
    padding: 0.2rem 0;
    border-bottom: 2px solid transparent;
}
.nav__links a:hover { color: var(--fg); text-decoration: none; }
.nav__links a.is-active { color: var(--fg); border-bottom-color: var(--accent); }
.nav__links a .sigil { color: var(--accent); opacity: 0.8; }

.nav__tools { display: flex; align-items: center; gap: 0.35rem; }
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elev);
    color: var(--fg-muted);
    cursor: pointer;
    padding: 0;
}
.icon-btn:hover { color: var(--fg); border-color: var(--border-strong); }
.icon-btn svg { width: 1.05rem; height: 1.05rem; }
.icon-btn .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun,
.theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

.nav__burger { display: none; }

/* --- Section scaffolding -------------------------------------------------- */
main { padding-bottom: 5rem; }
.section { padding: 3.25rem 0 1rem; }
.section__head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 1.6rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px dashed var(--border-strong);
}
.section__head .prompt { color: var(--accent); font-weight: 700; }
.section__head h2 { font-size: 1rem; color: var(--fg); font-weight: 700; }
.section__head .cmd { color: var(--fg); }
.section__head .n { margin-left: auto; color: var(--fg-muted); font-size: 0.8rem; }

/* --- Hero ----------------------------------------------------------------- */
.hero { padding: 3.5rem 0 1.5rem; }
.hero__window {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elev);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.hero__bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    background: var(--bg-sunken);
    border-bottom: 1px solid var(--border);
}
.hero__bar .dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--border-strong); }
.hero__bar .title { margin-left: 0.4rem; color: var(--fg-muted); font-size: 0.8rem; }
.hero__body { padding: 1.6rem 1.4rem 1.9rem; }
.hero__body .line { color: var(--fg-muted); margin-bottom: 0.4rem; }
.hero__body .line .accent { color: var(--accent); }
.hero h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); margin: 0.5rem 0 0.3rem; }
.hero .tagline { color: var(--accent); font-weight: 700; margin: 0 0 0.9rem; }
.hero .blurb { color: var(--fg); max-width: var(--measure); margin-bottom: 1.2rem; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.3rem; color: var(--fg-muted); font-size: 0.85rem; }
.hero .meta .k { color: var(--accent-2); }
.caret {
    display: inline-block;
    width: 0.6ch;
    background: var(--accent);
    color: transparent;
    margin-left: 0.15ch;
    animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* --- About ---------------------------------------------------------------- */
.prose { max-width: var(--measure); }
.prose p { color: var(--fg); }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.tag {
    font-size: 0.78rem;
    color: var(--fg-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.15rem 0.7rem;
    background: var(--bg-elev);
}
.tag::before { content: "#"; color: var(--accent); }

/* --- Experience ----------------------------------------------------------- */
.exp { display: grid; gap: 1.5rem; }
.exp__item {
    border-left: 2px solid var(--border-strong);
    padding-left: 1.2rem;
    position: relative;
}
.exp__item::before {
    content: "";
    position: absolute;
    left: -0.32rem;
    top: 0.5rem;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--bg);
}
.exp__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.8rem; }
.exp__title { font-size: 1rem; }
.exp__title .at { color: var(--fg-muted); font-weight: 400; }
.exp__title .co { color: var(--accent-2); }
.exp__dates { margin-left: auto; color: var(--fg-muted); font-size: 0.82rem; white-space: nowrap; }
.exp__bullets { margin-top: 0.6rem; display: grid; gap: 0.35rem; }
.exp__bullets li { padding-left: 1.35rem; position: relative; color: var(--fg); }
.exp__bullets li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--accent);
}
.exp__bullets code {
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 0.35em;
    font-size: 0.9em;
    color: var(--accent-ink);
}
.era-label {
    font-size: 0.78rem;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 1.6rem 0 -0.4rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.era-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* --- Skills --------------------------------------------------------------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.skill-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elev);
    padding: 1rem 1.1rem;
}
.skill-group h3 { font-size: 0.85rem; color: var(--accent); margin-bottom: 0.6rem; }
.skill-group h3::before { content: "› "; color: var(--fg-muted); }
.skill-group ul { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.skill-group li {
    font-size: 0.8rem;
    color: var(--fg);
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.5rem;
}

/* --- Architecture --------------------------------------------------------- */
.arch-note { color: var(--fg-muted); max-width: var(--measure); margin-bottom: 1.4rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.1rem; }
.card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elev);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.card__frame {
    display: block;
    width: 100%;
    border: 0;
    background: #ffffff;
    padding: 0;
    cursor: zoom-in;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}
.card__frame img { width: 100%; height: 100%; object-fit: contain; padding: 0.6rem; }
.card__cap { padding: 0.7rem 0.9rem; border-top: 1px solid var(--border); }
.card__cap b { display: block; font-size: 0.88rem; }
.card__cap span { color: var(--fg-muted); font-size: 0.78rem; }

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: rgba(15, 15, 18, 0.8);
    backdrop-filter: blur(3px);
}
.lightbox img { max-width: 100%; max-height: 90vh; background: #fff; border-radius: 6px; padding: 1rem; }
.lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.4rem;
    background: none;
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 6px;
    cursor: pointer;
}

/* --- Contact -------------------------------------------------------------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.contact-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elev);
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.contact-card svg { width: 1.3rem; height: 1.3rem; color: var(--accent); flex: none; }
.contact-card .k { display: block; color: var(--fg-muted); font-size: 0.75rem; }
.contact-card a, .contact-card span { color: var(--fg); word-break: break-all; }

/* --- Footer --------------------------------------------------------------- */
.footer {
    border-top: 1px solid var(--border);
    padding: 1.6rem 0;
    color: var(--fg-muted);
    font-size: 0.8rem;
}
.footer .container { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; align-items: center; }
.footer .prompt { color: var(--accent); }
.footer a { color: var(--fg-muted); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 640px) {
    .nav__inner { gap: 0.4rem; }
    .brand { font-size: 0.9rem; margin-right: auto; }
    .nav__tools { gap: 0.25rem; }
    .icon-btn { width: 1.95rem; height: 1.95rem; }
    .nav__links {
        position: absolute;
        top: var(--nav-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        background: var(--bg-elev);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 1.25rem 1rem;
        margin-left: 0;
    }
    .nav__links[hidden] { display: none; }
    .nav__links a { width: 100%; padding: 0.5rem 0; font-size: 0.95rem; }
    .nav__burger { display: inline-flex; order: 1; }
    .exp__dates { margin-left: 0; width: 100%; }
}

/* --- Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .caret { animation: none; }
    * { transition: none !important; }
}

/* ============================================================================
   Print - clean, compact, near one page. Recent roles detailed; the pre-cloud
   EE/sysadmin era condensed to header lines.
   ========================================================================== */
@media print {
    :root {
        --bg: #fff; --bg-elev: #fff; --bg-sunken: #fff;
        --fg: #000; --fg-muted: #333; --border: #bbb; --border-strong: #999;
        --accent: #000; --accent-ink: #000; --accent-2: #000;
    }
    body { font-size: 9.5pt; line-height: 1.32; background: #fff; }
    .container { width: 100%; }
    @page { margin: 12mm; }

    .nav, .footer, .hero__bar, .lightbox, .no-print, .skip-link { display: none !important; }
    /* About prose duplicates the summary in the hero; drop it in print. */
    #about { display: none; }
    main { padding-bottom: 0; }

    .hero { padding: 0 0 0.3rem; }
    .hero__window { border: 0; box-shadow: none; }
    .hero__body { padding: 0; }
    .hero__body .line, .caret { display: none; }
    .hero h1 { font-size: 17pt; }
    .hero .tagline { margin-bottom: 0.25rem; }
    .hero .blurb { max-width: none; margin-bottom: 0.3rem; }
    .hero .meta { gap: 0.1rem 1rem; font-size: 8.5pt; }

    .section { padding: 0.35rem 0 0; }
    .section__head { margin-bottom: 0.4rem; padding-bottom: 0.15rem; border-bottom: 1px solid #000; break-after: avoid; }
    .section__head .prompt, .section__head .n { display: none; }
    .section__head h2 { font-size: 11pt; text-transform: uppercase; letter-spacing: 0.06em; }

    .exp { gap: 0.45rem; }
    .exp__item { border-left: 0; padding-left: 0; break-inside: avoid; }
    .exp__item::before { display: none; }
    .exp__bullets { margin-top: 0.2rem; gap: 0.1rem; }
    .exp__bullets li::before { content: "-"; }
    .exp__bullets code { border: 0; background: none; padding: 0; }

    /* Condense the pre-cloud era: keep header, drop bullets */
    .exp__item.print-condense .exp__bullets { display: none; }

    .skills { gap: 0.4rem; }
    .skill-group { border: 0; padding: 0; }
    .skill-group li { border: 0; background: none; padding: 0; }
    .skill-group li:not(:last-child)::after { content: ", "; }

    .gallery, .arch-note, .tags { display: none; }
    .contact-grid { gap: 0.3rem; }
    .contact-card { border: 0; padding: 0; }

    a { color: #000; text-decoration: none; }
}
