/*
Theme Name: Atlas IO
Description: Dark, terminal-flavoured portfolio theme: home and about, a projects archive with work, side-quest and gallery tabs, a blog, a contact page and site search. Requires the Atlas IO Content plugin.
Author: Jeff Fredericks
Version: 1.0.0
Requires at least: 6.5
Requires PHP: 8.1
Text Domain: atlas-io
*/

/* ── Reset & Variables ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0a0b0f;
    --surface: #12131a;
    --heading: #e8e6e1;
    --body-text: #9a978f;
    --accent: #c9a84c;
    --accent2: #5b9bd5;
    --term-text: #7a7770;
    --nav-bg: rgba(10, 11, 15, 0.92);

    /* Used by the gallery, the lightbox and the cert rows. Values match .project-row. */
    --border: rgba(255, 255, 255, 0.06);
    --card-bg: rgba(255, 255, 255, 0.015);

    /* ── Layout scale ──
       The gutter is a clamp(), so page padding needs no breakpoint at all. */
    --gutter:    clamp(20px, 5vw, 60px);
    --shell-y:   clamp(48px, 8vw, 80px);
    --page-max:  1200px;
    --nav-h:     64px;
}

/* ── The page shell ──
   One rule for every page class: container width and gutter live in one place. */
.home-page,
.home-about,
.projects-page,
.contact-page,
.blog-page,
.blog-post-page,
.search-page,
.error-page {
    padding: var(--shell-y) var(--gutter);
    max-width: var(--page-max);
    margin: 0 auto;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg);
    color: var(--body-text);
    font-family: 'DM Sans', sans-serif;
    position: relative;
}

/* ── Utility ── */
.accent  { color: var(--accent); }
.accent2 { color: var(--accent2); }
.italic  { font-style: italic; }
.hidden  { display: none !important; }

/* ── Background Effects ── */
.grid-texture {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.015) 1px, transparent 0);
    background-size: 48px 48px;
}

.ambient-glow {
    position: fixed;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(201,168,76,0.04) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

/* ── Navigation ── */
/* Scoped to the class. A bare `nav` selector also claims the pagination <nav>. */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    padding: 0 var(--gutter);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--heading);
    letter-spacing: -0.02em;
    cursor: pointer;
    text-decoration: none;
}

.nav-tagline {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--term-text);
    margin-left: 10px;
    font-weight: 400;
}

.nav-links {
    display: flex;
    gap: 12px;
    /* min-width:0 -- a flex item will not shrink below its content, which is how the
       strip came to hang off the right edge of a phone. The scroller keeps the links
       it gives up reachable. */
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-btn {
    background: transparent;
    white-space: nowrap;
    border: none;
    color: var(--term-text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.15rem;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-block;
}

.nav-btn:hover,
.nav-btn.active {
    background: rgba(201,168,76,0.12);
    color: var(--accent);
}

/* The dropdown handle. In the markup at every width, shown only by the 900 block,
   so "which nav is this" is one media query's decision. */
.nav-toggle { display: none; }

/* ── Main Layout ── */
main {
    height: 100dvh;
    overflow-y: auto;
    padding-top: 64px;
    position: relative;
    z-index: 1;
    animation: pageIn 0.4s ease both;
    display: flex;
    flex-direction: column;
}

.page-content { flex: 1; }

@keyframes pageIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Footer ── */
footer {
    padding: 32px var(--gutter);
    border-top: 1px solid rgba(255,255,255,0.04);
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--term-text);
    letter-spacing: 0.06em;
}

/* ── FadeIn Animation ── */
/* 0.45s, not 0.6s: the other half of a reveal's felt lateness. The delay half is
   capped at 0.2s in main.js. */
.fade-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Terminal Line ── */
.terminal-line {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    /* Fluid so the characters-per-line -- the thing that actually decides the wrap --
       stays put across phone widths. The 64-char output line needs <= ~14.4px to take
       two lines in a 332px column (390px phone, less gutters, rule and pad). */
    font-size: clamp(0.85rem, 3.5vw, 1.3rem);
    color: var(--term-text);
    opacity: 0;
    transform: translateX(-16px);
    /* Named rather than `all`: with a fluid font-size, `all` animates the
       type through half a second of intermediate sizes on every rotate. */
    transition: opacity 0.5s ease, transform 0.5s ease;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}

.terminal-line.visible {
    opacity: 1;
    transform: translateX(0);
}

.terminal-line .prefix {
    color: var(--accent);
    margin-right: 8px;
}

/* ── Section Heading ── */
.section-heading h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.section-heading-bar {
    width: 48px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
    margin-bottom: 36px;
}

/* ── HOME PAGE ── */
.home-page {
    display: flex;
    align-items: center;
}

.terminal-block {
    font-size: 1.15rem;
    margin-bottom: 24px;
    border-left: 2px solid var(--accent);
    padding-left: 16px;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    /* The floor was the bug, not the cap: clamp(3rem, ...) pinned the title at 48px
       all the way down to 320. 28px is what 375px needs to keep "Building systems
       that scale" on one line; above 467px the 6vw term takes over and the desktop
       scale is untouched. */
    font-size: clamp(1.75rem, 6vw, 4.8rem);
    font-weight: 800;
    color: var(--heading);
    line-height: 1.1;
    margin: 0 0 24px;
    letter-spacing: -0.03em;
}

.hero-subtitle {
    /* Fluid too, or a paragraph pinned at 20.8px becomes the largest text in the hero
       on a phone. */
    font-size: clamp(1.05rem, 3.4vw, 1.3rem);
    line-height: 1.7;
    max-width: 640px;
    margin: 0 0 36px;
    color: var(--body-text);
}

.btn-row {
    display: flex;
    /* The pair wants 384px and a 390px phone offers 350. Wrapping drops the second
       button to its own line at full size; shrinking broke both labels instead. */
    flex-wrap: wrap;
    gap: 16px;
}

.btn-primary {
    background: var(--accent);
    color: #0a0b0f;
    border: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 600;
    padding: 14px 32px;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.btn-primary:hover { opacity: 0.85; }

/* The `disabled` attribute does the real work -- no click, no tab stop. This
   only makes it legible: the gold fill is what reads as "this does
   something", so a button that does nothing must not wear it. The :hover
   pair cancels the lift above, since Firefox still matches :hover on a
   disabled control where Chrome does not. */
.btn-primary:disabled,
.btn-primary:disabled:hover {
    background: rgba(255,255,255,0.05);
    color: var(--term-text);
    opacity: 1;
    cursor: default;
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(201,168,76,0.3);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    padding: 14px 32px;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
    transition: border-color 0.2s ease;
}

.btn-secondary:hover { border-color: rgba(201,168,76,0.6); }

/* ── About, as a section of the home page ──
   Padding and width come from the page-shell rule. This only says where the hero
   ends, and has to read as a seam rather than a box. */
.home-about {
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── The hero, with the about section under it ──
   No min-height: a full-viewport centred box reserves room it is not using, which
   pushed the "About" heading most of a screen below the fold. */
.home-page {
    /* 54, not 40, to match the 40 below the rule: a heading's caps sit 13px below the
       top of its own line box, so 40 there reads as 53. The eye matches the gaps it
       can see. */
    padding-bottom: 54px;
}

/* ── The About section's internal seams ──
   The same 54px the section is set off from the hero by. 41 before a heading for
   the reason above .home-page: 13px of the gap is inside the heading's line box.
   The third seam, above the status card, is .about-grid's own margin-bottom. */
.home-about .section-heading:not(:first-child) { margin-top: 41px; }

.home-about {
    padding-top: 40px;
    /* The nav is fixed over the scroller, so a jump to #about would otherwise
       stop with the heading behind it. Its own height is the offset. */
    scroll-margin-top: var(--nav-h);
}

/* ── ABOUT CONTENT ── */

/* ── The about grid ──
   Photo beside the bio until the two stop fitting -- a 280px photo column plus a
   bio that needs ~380px before the text averages under four words a line. flex-wrap
   drops the bio to its own row in source order, so it lands under the photo. A hard
   `280px 1fr` grid gave a 95px text column at ~500px instead. */
.about-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 48px;
    margin-bottom: 54px;
}

/* The photo is the wrap trigger, so it must not shrink. `width` rather than
   `flex-basis` so 320px caps it at the column instead of overflowing the gutter. */
.about-grid > :first-child { flex: 0 0 auto; width: min(280px, 100%); }

/* min-width:0 -- a flex item's automatic minimum is its content, so a long URL
   would push the row wider than the page rather than wrapping inside it. */
.about-grid > :last-child { flex: 1 1 380px; min-width: 0; }

.photo-wrapper { position: relative; }

.photo-frame {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(201,168,76,0.2);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    background: linear-gradient(145deg, #1a1b22 0%, #12131a 50%, #1a1b22 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.photo-initials {
    font-family: 'Playfair Display', serif;
    font-size: 3.2rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.02em;
    opacity: 0.6;
}

.photo-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--term-text);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.5;
}

.photo-corner {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 48px;
    height: 48px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    border-radius: 0 0 8px 0;
    opacity: 0.4;
    pointer-events: none;
}

.bio-text {
    line-height: 1.8;
    font-size: 1.2rem;
    color: var(--body-text);
}

.bio-text--gap { margin-top: 16px; }

.status-card {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 6px;
    padding: 28px 32px;
}

.status-card-header {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.15rem;
    color: var(--term-text);
    margin-bottom: 16px;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 48px;
}

/* ── PROJECTS PAGE ── */

/* Sub-tabs. Tabs left, the active tab's pager right, sharing one rule. */
.sub-tab-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 36px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* The tabs are the primary control and take the width they need; the pager absorbs
   what is left. Without flex-shrink:0 "Side Quests" wraps. */
.sub-tab-group {
    display: flex;
    flex-shrink: 0;
}

/* Holds the tab's pager, right-aligned against the tab group. */
.sub-tab-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    padding-bottom: 12px;
}

.sub-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--term-text);
    font-family: 'DM Sans', sans-serif;
    font-size: 1.2rem;
    font-weight: 400;
    white-space: nowrap;
    padding: 18px 44px;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: all 0.25s ease;
    margin-bottom: -1px;
}

/* The first tab sits flush with the heading above it, so the active underline
   starts on the same vertical as the title's accent bar. */
.sub-tab-group .sub-tab-btn:first-child { padding-left: 0; }

.sub-tab-btn.active {
    border-bottom-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

/* ── The Work tab's controls ──
   Categories left; the size of the set and the sort right. space-between rather
   than a spacer element -- that is a layout decision expressed as a DOM node. */
.filter-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 32px;
    /* The rule spans the whole bar, not just the tabs: under only the left half it
       would read as an underline on the categories rather than as a tier. */
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.filter-group {
    display: flex;
    gap: 24px;
}

/* Wraps rather than overflows -- the sort drops to its own line instead of running
   off the right edge. */
.result-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    min-width: 0;
    padding-bottom: 12px;
}

/* The Side Quests and Gallery tabs have no filter bar to sit inside. */
.result-line--solo { padding-bottom: 0; margin-bottom: 28px; }

.result-count {
    color: var(--term-text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* ── Sort ──
   Not a filter: it reorders the set, it does not narrow it. Drawn as text so it
   cannot read as a row of five chips with two of them lit. */
.sort-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-label {
    color: var(--term-text);
    opacity: 0.6;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sort-btn {
    color: var(--term-text);
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: color 0.25s ease;
}

.sort-btn:hover { color: var(--heading); }

.sort-btn.active {
    color: var(--accent);
    font-weight: 600;
}

/* Category is a refinement of the tab above it, not a peer. Boxed and uppercase
   they compete with Work/Side Quests/Gallery; here they take that bar's vocabulary
   a size down, so the two rows read as one control with two tiers. That is about
   hierarchy rather than width, so it is the styling at every size. */
.filter-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--term-text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    padding: 10px 0;
    /* Sits the underline on the bar's own rule rather than 1px above it. */
    margin-bottom: -1px;
    cursor: pointer;
    transition: color 0.25s ease, border-color 0.25s ease;
}

.filter-btn.active {
    border-bottom-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.cat-infrastructure:hover { background: rgba(255,255,255,0.04); border-color: var(--accent); }
.cat-code:hover           { background: rgba(255,255,255,0.04); border-color: var(--accent2); }

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.card-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cat-infrastructure .card-dot { background: var(--accent);  box-shadow: 0 0 8px rgba(201,168,76,0.4); }
.cat-code           .card-dot { background: var(--accent2); box-shadow: 0 0 8px rgba(91,155,213,0.4); }

.card-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
    color: var(--heading);
    letter-spacing: -0.01em;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    padding: 4px 12px;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    border-radius: 3px;
    letter-spacing: 0.03em;
}

.cat-infrastructure .tag { color: var(--accent);  background: rgba(201,168,76,0.07); border: 1px solid rgba(201,168,76,0.15); }
.cat-code           .tag { color: var(--accent2); background: rgba(91,155,213,0.07); border: 1px solid rgba(91,155,213,0.15); }

/* Side Quests */
.side-quests-intro {
    font-size: 1.2rem;
    line-height: 1.7;
    color: var(--body-text);
    max-width: 700px;
    margin-bottom: 40px;
}

.quest-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.active      { background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.4); }
.status-dot.in_progress { background: var(--accent); box-shadow: 0 0 8px rgba(201,168,76,0.4); }

.quest-status-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
}

.quest-status-label.active      { color: #4ade80; }
.quest-status-label.in_progress { color: var(--accent); }

.spec-tag {
    padding: 4px 12px;
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent2);
    background: rgba(91,155,213,0.08);
    border: 1px solid rgba(91,155,213,0.15);
    border-radius: 3px;
    letter-spacing: 0.02em;
}

/* ── SKILLS ── */

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

.skill-group-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 14px;
    font-weight: 500;
}

.skill-item {
    padding: 8px 0;
    font-size: 1.1rem;
    color: var(--body-text);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    gap: 10px;
}

.skill-bullet {
    color: var(--accent);
    font-size: 0.82rem;
    flex-shrink: 0;
}

/* ── Certifications ── */
.certs-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 48px;
}

.cert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.01);
    transition: border-color 0.2s;
}

.cert-row:hover { border-color: rgba(201, 168, 76, 0.2); }

.cert-row-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cert-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cert-status-dot.active      { background: #4ac97e; box-shadow: 0 0 6px rgba(74, 201, 126, 0.5); }
.cert-status-dot.in_progress { background: var(--accent); box-shadow: 0 0 6px rgba(201, 168, 76, 0.5); }
.cert-status-dot.expired     { background: rgba(255, 255, 255, 0.2); }

.cert-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cert-name {
    font-size: 0.95rem;
    color: var(--heading);
    font-weight: 500;
}

.cert-issuer {
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--body-text);
    opacity: 0.6;
}

.cert-year {
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--body-text);
    opacity: 0.5;
    flex-shrink: 0;
}

/* ── CONTACT PAGE ── */

.contact-card {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 6px;
    padding: 40px;
}

.contact-intro {
    line-height: 1.7;
    margin-bottom: 28px;
    font-size: 1.2rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.contact-icon {
    color: var(--accent);
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.contact-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--term-text);
    min-width: 120px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-shrink: 0;
}

/* min-width:0 lets the row shrink and `anywhere` lets a URL break mid-token, which
   is the only place a URL can break. Without both, "linkedin.com/in/yourprofile"
   ran off the right edge of the card. */
.contact-value {
    color: var(--heading);
    font-size: 1.1rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Contact — new entries */
a.contact-link {
    text-decoration: none;
    transition: background 0.2s ease;
    padding: 14px 16px;
    border-radius: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

a.contact-link:hover { background: rgba(255,255,255,0.02); }

.contact-link--disabled {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    border-radius: 4px;
    opacity: 0.45;
    cursor: default;
}

.contact-value--muted { color: var(--term-text); }

/* Email client picker */
.contact-link--email {
    cursor: pointer;
    user-select: none;
    padding: 14px 16px;
    border-radius: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.2s ease;
}

.contact-link--email:hover { background: rgba(255,255,255,0.02); }

.contact-link--email.open {
    background: rgba(201,168,76,0.04);
    border-color: rgba(201,168,76,0.15);
    border-radius: 4px 4px 0 0;
}

.picker-chevron {
    margin-left: auto;
    color: var(--term-text);
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.contact-link--email.open .picker-chevron { transform: rotate(180deg); }

.email-picker {
    background: rgba(201,168,76,0.03);
    border: 1px solid rgba(201,168,76,0.12);
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 16px 20px;
    animation: fadeIn 0.2s ease;
}

.email-picker[hidden] { display: none; }

.email-picker-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--term-text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.email-picker-options {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.email-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px;
    color: var(--heading);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.email-option:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(201,168,76,0.2);
}

.email-option-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.email-option-dot.gmail   { background: #ea4335; }
.email-option-dot.outlook { background: #0078d4; }
.email-option-dot.default { background: var(--accent); }

.email-copy-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px;
    padding: 8px 16px;
    color: var(--term-text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.email-copy-btn:hover {
    border-color: rgba(201,168,76,0.2);
    color: var(--heading);
}

.email-copy-btn.copied {
    color: #4ade80;
    border-color: rgba(74,222,128,0.25);
}

.resume-row {
    margin-top: 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.resume-btn {
    display: flex;
    align-items: center;
    gap: 10px;
}

.resume-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--term-text);
    letter-spacing: 0.04em;
}

/* ── PROJECTS — LIST ROWS ── */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-row-wrap { display: flex; flex-direction: column; }

.project-row {
    background: rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 22px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.25s ease;
}

.project-row:hover { background: rgba(255,255,255,0.025); }

.project-row.active {
    background: rgba(201,168,76,0.06);
    border-color: rgba(201,168,76,0.25);
}

.cat-infrastructure.project-row:hover,
.cat-infrastructure.project-row.active { border-color: var(--accent); }

.cat-code.project-row:hover,
.cat-code.project-row.active { border-color: var(--accent2); }

.project-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.project-row-text { min-width: 0; }

.project-row-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: var(--heading);
    transition: color 0.2s ease;
}

.project-row.active .project-row-title { color: var(--accent); }

.project-row-desc {
    margin: 4px 0 0;
    font-size: 0.92rem;
    color: var(--body-text);
    line-height: 1.5;
}

.project-row-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    margin-left: 20px;
}

.project-row-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    max-width: 200px;
}

.row-tag {
    padding: 3px 10px;
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    border-radius: 3px;
    letter-spacing: 0.02em;
}

.cat-infrastructure .row-tag {
    color: var(--accent);
    background: rgba(201,168,76,0.07);
    border: 1px solid rgba(201,168,76,0.15);
}

.cat-code .row-tag {
    color: var(--accent2);
    background: rgba(91,155,213,0.07);
    border: 1px solid rgba(91,155,213,0.15);
}

.ext-link-icon { color: var(--term-text); flex-shrink: 0; }

/* Quest rows */
.quest-list { display: flex; flex-direction: column; gap: 12px; }

.quest-row {
    background: rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 20px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.25s ease;
}

.quest-row:hover { background: rgba(255,255,255,0.025); }

.quest-row.active {
    background: rgba(201,168,76,0.06);
    border-color: rgba(201,168,76,0.25);
}

.quest-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quest-row-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: var(--heading);
    transition: color 0.2s ease;
}

.quest-row.active .quest-row-title { color: var(--accent); }

.quest-row-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.quest-row-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

/* ── DETAIL PANEL ── */
#panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6,7,10,0.62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    z-index: 200;
}

#panel-backdrop.open {
    display: block;
    animation: fadeIn 0.25s ease both;
}

.detail-panel {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(560px, 85vw);
    background: #12131a;
    border-left: 1px solid rgba(201,168,76,0.15);
    z-index: 201;
    overflow-y: auto;
    box-shadow: -8px 0 32px rgba(0,0,0,0.4);
}

.detail-panel.open {
    display: block;
    animation: slideIn 0.35s ease both;
}

/* The panel takes programmatic focus on open. That is a mechanism, not a state
   worth outlining; children keep their own rings. */
.detail-panel:focus { outline: none; }

/* Scroll lock. Both <html> and <body>, to cover whichever is the scrolling element;
   the scrollbar-width compensation is in JS, the only place it is measurable. */
html.panel-open,
html.panel-open body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .detail-panel.open,
    #panel-backdrop.open,
    .nav-links.open { animation: none; }
    .nav-toggle-bar { transition: none; }
}

.panel-header {
    position: sticky;
    top: 0;
    background: #12131a;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1;
}

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.panel-dot.infrastructure { background: var(--accent);  box-shadow: 0 0 8px rgba(201,168,76,0.4); }
.panel-dot.code           { background: var(--accent2); box-shadow: 0 0 8px rgba(91,155,213,0.4); }
.panel-dot.active         { background: #4ade80;        box-shadow: 0 0 8px rgba(74,222,128,0.4); }
.panel-dot.in_progress    { background: var(--accent);  box-shadow: 0 0 8px rgba(201,168,76,0.4); }

.panel-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: 'Playfair Display', serif;
    color: var(--heading);
}

.panel-close-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--term-text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.panel-close-btn:hover {
    border-color: rgba(255,255,255,0.2);
    color: var(--heading);
}

.panel-body { padding: 32px; }

.panel-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
}

.panel-tag {
    padding: 4px 12px;
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent2);
    background: rgba(91,155,213,0.08);
    border: 1px solid rgba(91,155,213,0.15);
    border-radius: 3px;
}

.panel-long-desc {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--body-text);
    margin: 0 0 36px;
}

.panel-section { margin-bottom: 32px; }

.panel-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.panel-section-label svg { color: var(--accent); flex-shrink: 0; }

.panel-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.gallery-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 4px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    text-align: center;
}

.gallery-item:hover { border-color: rgba(201,168,76,0.2); }

.gallery-item svg { color: var(--term-text); }

.gallery-item span { font-size: 0.85rem; color: var(--heading); }

.panel-gallery-img-wrap {
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-gallery-img {
    display: block;
    width: 100%;
    height: auto;
}

.panel-gallery-img-label {
    padding: 6px 10px;
    font-size: 0.8rem;
    color: var(--heading);
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.panel-file-list { display: flex; flex-direction: column; gap: 8px; }

.panel-file-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 4px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.panel-file-item:hover { border-color: rgba(201,168,76,0.2); }

.panel-file-item svg { color: var(--term-text); flex-shrink: 0; }
.panel-file-item .dl-icon { color: var(--accent2); }

.panel-file-name {
    font-size: 0.92rem;
    color: var(--heading);
    margin-bottom: 2px;
}

.panel-file-meta {
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--term-text);
    text-transform: uppercase;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── BLOG PAGE ── */

.blog-intro {
    font-size: 1.2rem;
    line-height: 1.7;
    color: var(--body-text);
    max-width: 700px;
    margin-bottom: 40px;
}

.blog-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.blog-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 36px 40px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.blog-card:hover {
    background: rgba(255,255,255,0.03);
    border-color: rgba(201,168,76,0.2);
}

.blog-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.blog-card-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    color: var(--heading);
    line-height: 1.35;
}

.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    max-width: 200px;
    flex-shrink: 0;
}

.blog-tag {
    padding: 3px 10px;
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent2);
    background: rgba(91,155,213,0.08);
    border: 1px solid rgba(91,155,213,0.15);
    border-radius: 3px;
}

.blog-card-excerpt {
    margin: 0;
    font-size: 1.05rem;
    color: var(--body-text);
    line-height: 1.7;
    max-width: 820px;
}

.blog-card-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 4px;
}

.blog-card-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    letter-spacing: 0.04em;
    opacity: 0.8;
}

/* ── BLOG POST PAGE ── */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    text-decoration: none;
    letter-spacing: 0.04em;
    padding-bottom: 32px;
    display: block;
}

.back-link:hover { opacity: 0.75; }

.blog-post-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--term-text);
    margin-bottom: 12px;
    letter-spacing: 0.04em;
}

.blog-post-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--heading);
    margin: 0 0 20px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.blog-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 40px;
}

.blog-post-content {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 6px;
    padding: 40px;
}

.blog-post-excerpt {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--body-text);
    margin: 0;
    font-style: italic;
}

.blog-post-divider {
    border-top: 1px solid rgba(255,255,255,0.06);
    margin: 28px 0;
}

.blog-post-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--body-text);
    margin: 0;
}

/* ── ERROR PAGES ── */
.error-page {
    text-align: center;
}

.error-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 6rem;
    color: var(--accent);
    opacity: 0.3;
    margin-bottom: 16px;
    line-height: 1;
}

.error-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--heading);
    margin-bottom: 12px;
}

.error-body {
    color: var(--body-text);
    margin-bottom: 32px;
    font-size: 1.1rem;
}

/* ── Gallery tab ── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 8px 0 24px;
}

/* ══ Two axes, not one ══

   WIDTH -- how much room there is. Three steps:

     640    phone / fold cover screen   (320-640)
     900    tablet portrait, 2-col grid (641-900)
    1024    nav sheds its tagline, tabs tighten, tab pager is dropped

   INPUT -- what is doing the pointing. `pointer: coarse` is the only honest way
   to ask: a 1366px iPad in landscape has a laptop's width and a thumb's precision.
   The device is never named, only what it can do.

     column counts, wrapping, type scale ......... WIDTH
     tap targets, the nav dropdown, hover ........ INPUT

   Page gutters are on neither -- --gutter is a clamp() and scales continuously. */
@media (max-width: 900px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── The top nav ── (WIDTH or INPUT: either one is sufficient)
   Below 900 the strip does not fit; on a touch screen it fits but should not be
   used. One block with a comma, so the two answers cannot drift apart. */
@media (max-width: 900px), (pointer: coarse) {
    .site-nav { gap: 12px; }
    .nav-logo { flex-shrink: 0; }

    /* The strip wants 724px and needs ~845px of bar to lay out unsqueezed; by 641px it
       genuinely overflows. It drops to a column rather than scrolling horizontally,
       which hid whatever fell off the right edge behind an unannounced gesture.
       Strip and dropdown are the same markup -- only display and flex-direction differ. */

    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        /* 5px gap around 2px bars puts the outer two at +/-7px, which is what
           the rotate-into-an-X below translates by. */
        gap: 5px;
        /* 44px is the touch target, not the drawing -- the bars are 24px. */
        width: 44px;
        height: 44px;
        padding: 0 10px;
        background: transparent;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

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

    /* Driven off aria-expanded rather than a second class: the attribute has to be
       right for assistive tech anyway. */
    .nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: var(--accent); }
    .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
    .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .nav-links {
        /* .site-nav is position:fixed, so this hangs off the bar itself and
           overlays the page rather than pushing it down. */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px var(--gutter) 16px;
        background: var(--nav-bg);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(255,255,255,0.04);
        /* The base rule scrolls this sideways, which is the wrong axis for a
           column: a menu taller than the phone has to scroll down. */
        overflow-x: visible;
        overflow-y: auto;
        max-height: calc(100dvh - var(--nav-h));
        display: none;
    }

    .nav-links.open { display: flex; animation: fadeIn 0.18s ease; }

    /* Full-width rows, sized for a thumb rather than for a strip that had to
       fit five of them side by side. */
    .nav-btn {
        font-size: 1rem;
        padding: 14px 12px;
        letter-spacing: 0.08em;
        border-radius: 4px;
    }

    /* Search is the last item and takes the whole row -- the grow-on-focus width
       existed to stop it shoving the links along the strip. */
    /* Qualified by .nav-links to outrank the base rules ~150 lines further down: a
       media query adds no specificity, so a bare selector here loses the tie. */
    .nav-links .nav-search {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
        padding-top: 14px;
        border-top: 1px solid rgba(255,255,255,0.06);
    }

    .nav-links .nav-search-input,
    .nav-links .nav-search-input:focus { width: 100%; }
}

.gallery-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--card-bg);
    transition: border-color 0.2s, transform 0.2s;
}

.gallery-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.gallery-placeholder {
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}

.gallery-placeholder.cat-infrastructure { color: rgba(76, 163, 201, 0.6); }
.gallery-placeholder.cat-code           { color: rgba(201, 168, 76, 0.6); }
.gallery-placeholder.quest              { color: rgba(130, 201, 76, 0.6); }

.gallery-placeholder-label {
    font-size: 0.75rem;
    color: var(--body-text);
    opacity: 0.6;
    text-align: center;
    padding: 0 12px;
    line-height: 1.3;
}

.gallery-card-footer {
    padding: 8px 12px;
    display: flex;
    align-items: center;
}

.gallery-source-tag {
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid var(--border);
    color: var(--body-text);
    /* It is an <a>, and the chip's border is the affordance -- an underline
       inside a bordered chip reads as two competing frames. */
    text-decoration: none;
}

.gallery-source-tag.cat-infrastructure { border-color: rgba(76, 163, 201, 0.3); color: rgba(76, 163, 201, 0.8); }
.gallery-source-tag.cat-code           { border-color: rgba(201, 168, 76, 0.3); color: rgba(201, 168, 76, 0.8); }
.gallery-source-tag.quest              { border-color: rgba(130, 201, 76, 0.3); color: rgba(130, 201, 76, 0.8); }
.gallery-source-tag.blog               { border-color: rgba(168, 130, 201, 0.3); color: rgba(168, 130, 201, 0.8); }

.gallery-img {
    width: 100%;
    /* WordPress writes width/height attributes on the <img>; without this the
       height attribute wins over aspect-ratio and the card is as tall as the file. */
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--border);
}

/* ── Gallery Lightbox ── */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox[hidden] { display: none; }

@keyframes lightboxIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
}

.lightbox-frame {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 1200px);
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    animation: lightboxIn 0.18s ease;
}

.lightbox-img {
    display: block;
    max-width: 100%;
    max-height: calc(90dvh - 52px);
    object-fit: contain;
    border-radius: 4px 4px 0 0;
}

.lightbox-caption {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lightbox-caption-label {
    font-size: 0.85rem;
    color: var(--heading);
    flex: 1;
}

.lightbox-caption-source {
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--body-text);
    opacity: 0.6;
}

/* absolute (not fixed) — the lightbox itself is the full-viewport layer */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--heading);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.15); }

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--heading);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255, 255, 255, 0.15); }

.lightbox-prev[disabled],
.lightbox-next[disabled] { opacity: 0.2; cursor: default; pointer-events: none; }

/* ── Rows as links, pagination, detail pages ── */

/* Rows are anchors now, so a middle-click opens the real detail page and
   keyboard users get a focusable target. Strip the default link styling. */
.project-row,
.quest-row,
.sub-tab-btn,
.filter-btn {
    color: inherit;
    text-decoration: none;
}

.sub-tab-btn,
.filter-btn {
    display: inline-block;
}

.project-row:focus-visible,
.quest-row:focus-visible,
.search-hit:focus-visible,
.page-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Skip layout and paint for rows well out of view. contain-intrinsic-size still
   reserves the height, so the scrollbar stays honest. */
.project-row-wrap,
.quest-row-wrap {
    content-visibility: auto;
    contain-intrinsic-size: auto 96px;
}

.gallery-card {
    content-visibility: auto;
    contain-intrinsic-size: auto 240px;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── The end-of-list pager ──
   The tab bar's pager repeated at the bottom of the rows it pages, because that bar
   is a screen and a half up. .pagination supplies the chrome; this only places it. */
.panel-pager {
    display: flex;
    justify-content: center;
}

/* Mounted in the tab bar the pager drops its footer chrome -- the bar's own
   bottom border is already the dividing line. */
.tab-pager.hidden { display: none; }

.tab-pager .pagination {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex-wrap: nowrap;
    gap: 4px;
}

/* In the tab bar the pager is a companion to the tabs, not the headline: steps
   shrink to their arrows and every chip loses a little padding. */
.tab-pager .page-word { display: none; }

.tab-pager .page-btn {
    padding: 5px 10px;
    min-width: 30px;
    text-align: center;
}

.tab-pager .page-btn--step {
    padding: 5px 9px;
    font-size: 0.95rem;
    line-height: 1;
}

/* Above 1024 this pager is still drawn, but the result line under it already
   says how big the set is; two copies of one number on one screen. */
.tab-pager .page-count { display: none; }

/* The tab bar's one-line budget, measured: 447px of tabs plus the deepest pager the
   data can produce (429px compact) plus the 32px gap is 908px, and the bar gets 90%
   of the viewport -- so one line holds to ~1009px. The step below is 1024.

   Below that the pager is dropped rather than given a row of its own, where it
   would stand over content the reader has not reached. The one thing it carried
   that is worth having above the list -- how big the set is -- is in the result line. */
@media (max-width: 1024px) {
    .sub-tab-btn { padding: 16px 28px; }
    .sub-tab-pager { display: none; }

    /* ── The top nav ──
       Logo, tagline and five links need ~818px. The tagline is 210px of that and says
       nothing the page below it does not, so it goes first; the links then give up a
       little size. Below 900, or on any touch screen, the row becomes a dropdown. */
    .nav-tagline { display: none; }
    .nav-btn { font-size: 1rem; padding: 8px 12px; }
}

@media (max-width: 640px) {
    .sub-tab-btn { padding: 12px 14px; font-size: 1rem; }

    /* ── The pager on a phone ──
       Numbered paging is a desktop control: 30px chips sit under any touch-target
       guideline, and nobody wants page 7 of a project list. Prev and Next take the
       width with the position between them, so dropping the numbers does not also
       drop "where am I". Same markup at every width. */
    /* Centred, the nav is only as wide as its content, so `flex: 1` below would have
       nothing to grow into. */
    .panel-pager { display: block; }
    .pagination { gap: 8px; }
    .page-btn:not(.page-btn--step),
    .page-gap { display: none; }

    /* Qualified by .pagination throughout this block: the base rules sit ~60 lines
       further down and a media query adds no specificity. */
    .pagination .page-btn--step {
        flex: 1;
        padding: 13px 12px;
        font-size: 0.9rem;
    }

    .pagination .page-pos {
        display: block;
        flex-shrink: 0;
        color: var(--term-text);
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.85rem;
        letter-spacing: 0.06em;
    }

    /* The result line above the rows and the readout between the arrows already say
       this; a third count is the same fact a third time. */
    .pagination .page-count { display: none; }

    /* ── The Work tab's controls ──
       The tier-2 styling is the same at every width (see .filter-btn); only the
       arrangement changes. The controls want ~437px and the column is 350, so the bar
       becomes two rows and the rule the tabs sit on moves with them. */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin-bottom: 24px;
        border-bottom: none;
    }

    .filter-group {
        gap: 20px;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    .filter-btn { font-size: 0.85rem; }

    .result-line {
        justify-content: space-between;
        padding: 12px 0 0;
    }

    /* Folded in from the old 560/600 queries -- three breakpoints inside an
       80px band were three chances to disagree with each other. */
    .gallery-grid { grid-template-columns: 1fr; }
    .lightbox-prev { left: 6px; }
    .lightbox-next { right: 6px; }

    /* ── The about grid, stacked ──
       The grid has already wrapped itself by here; this only sizes the result. At 280px
       the frame is 373px tall and eats most of a phone screen before a word of the bio. */
    .about-grid { gap: 28px; }
    .about-grid > :first-child { width: min(200px, 55%); }
    .photo-initials { font-size: 2.4rem; }

    /* ── Contact rows ──
       Icon and label on one line, the value indented under the icon on the next. All
       three on one line would break every address across two or three lines. */
    .contact-card { padding: 24px 20px; }
    /* `a.contact-link` is one selector heavier than `.contact-link`, so the
       anchor rows keep their own padding unless it is named here too. */
    .contact-link,
    a.contact-link { flex-wrap: wrap; gap: 12px; padding: 12px; }
    .contact-label { min-width: 0; }
    .contact-value { flex-basis: 100%; padding-left: 32px; }

    /* Three buttons across is ~95px each at this width, which cuts "Default
       app" in half. They stack. */
    .email-picker { padding: 14px 16px; }
    .email-picker-options { flex-direction: column; }

    /* The button and its "PDF · Updated 2026" note want ~340px together. */
    .resume-row { flex-wrap: wrap; gap: 12px; }
}

.page-btn {
    background: transparent;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--term-text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: 3px;
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: all 0.25s ease;
}

.page-btn:hover:not(.disabled):not(.active) {
    border-color: rgba(201,168,76,0.4);
    color: var(--heading);
}

.page-btn.active {
    background: rgba(201,168,76,0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn.disabled {
    opacity: 0.35;
    cursor: default;
}

/* The arrow and the word are separate spans so a tight host can drop one; inline-flex
   supplies the space the markup deliberately does not have. */
.page-btn--step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Only the phone draws this -- see the 640 block. */
.page-pos { display: none; }

.page-gap {
    color: var(--term-text);
    font-family: 'JetBrains Mono', monospace;
}

.page-count {
    margin-left: auto;
    color: var(--term-text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
}

/* ── Detail panel as a standalone page (/projects/<slug>) ──
   Same partial as the slide-over; only the framing changes. */
.detail-panel--page {
    display: block;
    position: static;
    width: 100%;
    max-width: 860px;
    border-left: none;
    border: 1px solid rgba(201,168,76,0.15);
    border-radius: 4px;
    box-shadow: none;
    overflow: visible;
    margin-top: 24px;
}

.detail-panel--page .panel-header {
    position: static;
    border-radius: 4px 4px 0 0;
}

a.panel-close-btn {
    text-decoration: none;
}

/* ── Screen-reader-only text ──
   clip-path plus a 1px box rather than display:none, which also leaves the
   accessibility tree, and rather than a negative indent, which RTL reverses back
   into view. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ── Nav search ──
   Inside .nav-links, so it inherits the strip's scroller. flex-shrink makes it the
   thing that gives when the row is tight -- links stay whole, the box narrows. */
.nav-search {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    flex: 0 1 auto;
    min-width: 0;
}

.nav-search-input {
    width: 132px;
    min-width: 72px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--heading);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    padding: 7px 10px;
    transition: border-color 0.25s ease, background 0.25s ease, width 0.25s ease;
}

.nav-search-input::placeholder {
    color: var(--term-text);
    text-transform: lowercase;
}

.nav-search-input:focus {
    outline: none;
    width: 200px;
    border-color: var(--accent);
    background: rgba(255,255,255,0.05);
}

/* Chrome and Safari draw their own clear button on type="search"; it lands
   in the middle of the padding and does not match anything else here. */
.nav-search-input::-webkit-search-decoration,
.nav-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.nav-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--term-text);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: color 0.25s ease, background 0.25s ease;
}

.nav-search-btn:hover {
    color: var(--accent);
    background: rgba(201,168,76,0.12);
}

/* ── Search results ── */
.search-hero {
    display: flex;
    gap: 10px;
    margin: 8px 0 32px;
}

.search-hero-input {
    flex: 1;
    min-width: 0;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--heading);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.05rem;
    padding: 14px 18px;
    transition: border-color 0.25s ease;
}

.search-hero-input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-hero-input::-webkit-search-decoration,
.search-hero-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.search-hero-btn {
    background: rgba(201,168,76,0.15);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.25s ease;
}

.search-hero-btn:hover { background: rgba(201,168,76,0.25); }

.search-empty,
.search-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    color: var(--term-text);
    line-height: 1.7;
    margin-bottom: 32px;
}

.search-count strong,
.search-empty strong { color: var(--accent); font-weight: 500; }
.search-empty code {
    color: var(--accent2);
    background: rgba(91,155,213,0.08);
    padding: 1px 5px;
    border-radius: 3px;
}

.search-group { margin-bottom: 40px; }

.search-group-title {
    display: flex;
    align-items: baseline;
    gap: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--term-text);
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.search-group-more {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: none;
    color: var(--accent2);
    text-decoration: none;
}

.search-group-more:hover { color: var(--accent); }

.search-tag-row { display: flex; flex-wrap: wrap; gap: 8px; }

.search-hit-list { display: flex; flex-direction: column; gap: 10px; }

.search-hit {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    text-decoration: none;
    /* Every child sets its own colour, so this changes nothing today. It is here so the
       first one that forgets inherits the card's ink rather than link blue. */
    color: inherit;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.search-hit:hover {
    background: rgba(255,255,255,0.03);
    border-color: rgba(201,168,76,0.3);
}

.search-hit-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    color: var(--heading);
}

/* Two lines of context, then an ellipsis: a results list where one hit is six lines
   tall stops being scannable. */
.search-hit-snippet {
    font-size: 0.92rem;
    color: var(--body-text);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-hit-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--term-text);
}

.search-hit-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }


/* ── Search: narrow screens ── */
@media (max-width: 900px) {
    .search-hero { flex-direction: column; }
    .search-hero-btn { padding: 12px 24px; }
}

/* ══ WordPress ══
   Everything below exists because the markup now comes from WordPress rather
   than from hand-written templates. */

/* The admin bar. This layout scrolls <main> inside a viewport-high body rather
   than scrolling the page, so core's usual fix (a margin on <html>) has nowhere
   to land; the theme turns that fix off (functions.php) and offsets the fixed
   layers by the bar's height instead. */
:root { --adminbar-h: 0px; }
body.admin-bar { --adminbar-h: 32px; }
@media screen and (max-width: 782px) {
    body.admin-bar { --adminbar-h: 46px; }
}

body.admin-bar .site-nav        { top: var(--adminbar-h); }
body.admin-bar main             { height: calc(100dvh - var(--adminbar-h)); margin-top: var(--adminbar-h); }
body.admin-bar .detail-panel    { top: var(--adminbar-h); }
body.admin-bar .gallery-lightbox { top: var(--adminbar-h); }

@media (max-width: 900px), (pointer: coarse) {
    body.admin-bar .nav-links { max-height: calc(100dvh - var(--nav-h) - var(--adminbar-h)); }
}

/* Prose from the editor: paragraphs, headings, lists, quotes, code, images.
   The reset at the top of this file zeroes every margin, so spacing between
   blocks is put back here. */
.blog-post-body > * + *,
.panel-long-desc > * + * { margin-top: 1.1em; }

.blog-post-body h2,
.blog-post-body h3,
.blog-post-body h4 {
    font-family: 'Playfair Display', serif;
    color: var(--heading);
    line-height: 1.3;
    letter-spacing: -0.01em;
}
.blog-post-body h2 { font-size: 1.6rem; margin-top: 1.8em; }
.blog-post-body h3 { font-size: 1.3rem; margin-top: 1.6em; }
.blog-post-body h4 { font-size: 1.1rem; margin-top: 1.4em; }

.blog-post-body a,
.panel-long-desc a {
    color: var(--accent);
    text-decoration-color: rgba(201,168,76,0.4);
    text-underline-offset: 3px;
}
.blog-post-body a:hover,
.panel-long-desc a:hover { text-decoration-color: currentColor; }

.blog-post-body ul,
.blog-post-body ol,
.panel-long-desc ul,
.panel-long-desc ol { padding-left: 1.4em; }
.blog-post-body li + li,
.panel-long-desc li + li { margin-top: 0.35em; }

.blog-post-body blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 1.1em;
    font-style: italic;
}

.blog-post-body code,
.panel-long-desc code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    padding: 0.1em 0.35em;
}
.blog-post-body pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px 18px;
    overflow-x: auto;
}
.blog-post-body pre code { background: none; padding: 0; font-size: inherit; }

.blog-post-body img { max-width: 100%; height: auto; border-radius: 4px; }
.blog-post-body figure { margin-left: 0; margin-right: 0; }
.blog-post-body figcaption {
    font-size: 0.85rem;
    color: var(--term-text);
    margin-top: 0.5em;
}
.blog-post-body .alignleft   { float: left;  margin: 0 1.2em 1em 0; }
.blog-post-body .alignright  { float: right; margin: 0 0 1em 1.2em; }
.blog-post-body .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.blog-post-body::after { content: ""; display: block; clear: both; }

/* A file row is a link when it has a URL and plain text when it does not. */
a.panel-file-item { color: inherit; text-decoration: none; }
a.panel-file-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
div.panel-file-item { cursor: default; }
div.panel-file-item:hover { border-color: rgba(255,255,255,0.04); }

/* ══ INPUT: touch ══ (see the two-axes note above the 900 block)
   Last in the file on purpose: these override base rules that sit further down, and
   a media query adds no specificity. Bounded below at 641 because the phone block
   already sizes all of this for a thumb. */
@media (pointer: coarse) and (min-width: 641px) {
    /* ~34px targets, sized for a cursor; the number everyone quotes is 44. Vertical
       padding only, so the tabs keep their widths and the row does not re-wrap. */
    .filter-btn { padding: 15px 0; }
    .filter-group { gap: 28px; }
    .sort-btn { padding: 12px 0; }
    .sort-group { gap: 18px; }

    /* Numbered paging survives here -- unlike on a phone, there is room for
       the chips -- but 30px of chip is not something to aim a thumb at. */
    .pagination .page-btn { padding: 11px 16px; }
    .pagination { gap: 8px; }
}

@media (hover: none) {
    /* A finger never leaves, so the lift latches on the last card tapped and reads as
       "still selected" long after it. */
    .gallery-card:hover { transform: none; }
}
