/* ------------------------------------------------------------------
   Font (self-hosted, latin subset, SIL Open Font License)
------------------------------------------------------------------- */
@font-face {
    font-family: "Schibsted Grotesk";
    src: url("fonts/schibsted-variable.woff2") format("woff2");
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Schibsted Grotesk";
    src: url("fonts/schibsted-italic-variable.woff2") format("woff2");
    font-weight: 400 900;
    font-style: italic;
    font-display: swap;
}

/* ------------------------------------------------------------------
   Tokens
   The page is built for a hiring manager skimming it: section names sit in
   the margin like a ledger, and the results worth remembering carry a
   highlighter stroke, the way a recruiter marks up a resume they like.
------------------------------------------------------------------- */
:root {
    color-scheme: light dark;

    --paper: #f3f5f8;
    --surface: #ffffff;
    --ink: #131c2e;
    --muted: #576174;
    --rule: #d8dde5;
    --accent: #2340b0;
    --accent-ink: #ffffff;
    --accent-tint: rgba(35, 64, 176, 0.07);
    --mark: #ffe16a;
    --danger: #b42318;
    --success: #0b6b3a;

    --font: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;

    --step--1: 0.875rem;
    --step-0: 1.0625rem;
    --step-1: 1.3125rem;
    --step-2: 1.625rem;
    --step-3: 2.25rem;

    --page: 1180px;
    --gutter: clamp(16px, 4vw, 40px);
    --radius: 3px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0f1522;
        --surface: #161e2f;
        --ink: #e6ebf3;
        --muted: #9ba6b8;
        --rule: #283349;
        --accent: #93a9ff;
        --accent-ink: #0f1522;
        --accent-tint: rgba(147, 169, 255, 0.09);
        --mark: rgba(255, 208, 64, 0.32);
        --danger: #f97066;
        --success: #47cd89;
    }
}

/* Set from the admin Appearance page when the site is forced light or dark. */
:root[data-theme="light"] { color-scheme: light; }

:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #0f1522;
    --surface: #161e2f;
    --ink: #e6ebf3;
    --muted: #9ba6b8;
    --rule: #283349;
    --accent: #93a9ff;
    --accent-ink: #0f1522;
    --accent-tint: rgba(147, 169, 255, 0.09);
    --mark: rgba(255, 208, 64, 0.32);
    --danger: #f97066;
    --success: #47cd89;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--step-0);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    line-height: 1.15;
    margin: 0;
    font-weight: 700;
}

p { margin: 0 0 1em; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

code {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.9em;
    background: var(--accent-tint);
    padding: 0.05em 0.35em;
    border-radius: 3px;
    overflow-wrap: anywhere;
}

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

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    background: var(--ink);
    color: var(--paper);
    padding: 8px 14px;
    z-index: 10;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------
   Highlighter: the signature element
------------------------------------------------------------------- */
mark {
    color: inherit;
    font-weight: 650;
    padding: 0 0.14em;
    margin: 0 -0.14em;
    background-color: transparent;
    background-image: linear-gradient(transparent 50%, var(--mark) 50%, var(--mark) 92%, transparent 92%);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* The summary's results are marked as the page opens. */
@media screen and (prefers-reduced-motion: no-preference) {
    .hero mark { animation: mark-sweep 750ms cubic-bezier(.4, .1, .2, 1) 450ms both; }
    .hero mark:nth-of-type(2) { animation-delay: 700ms; }
    .hero mark:nth-of-type(3) { animation-delay: 950ms; }
    .hero mark:nth-of-type(n + 4) { animation-delay: 1200ms; }
}

@keyframes mark-sweep {
    from { background-size: 0% 100%; }
    to { background-size: 100% 100%; }
}

/* ------------------------------------------------------------------
   Reading as you scroll
   Results further down are marked as they come into view, like a reader
   working down the page. Browsers without scroll-driven animations, and
   visitors who prefer less motion, simply see the finished page.
------------------------------------------------------------------- */
@supports (animation-timeline: view()) {
    @media screen and (prefers-reduced-motion: no-preference) {
        .ledger mark {
            animation: mark-sweep linear both;
            animation-timeline: view();
            animation-range: entry 60% cover 30%;
        }

        /* Proof numbers rise in as the row arrives. */
        .proof-item {
            animation: rise-in linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 80%;
        }
        /* Offsets the columns so each row fills in left to right. */
        .proof-item:nth-child(3n + 2) { animation-range: entry 15% entry 95%; }
        .proof-item:nth-child(3n) { animation-range: entry 30% cover 30%; }

        /* The promotion ladder draws from the current role down. */
        .is-ladder { view-timeline: --ladder; }
        .is-ladder .role:not(:last-child)::after {
            transform-origin: top;
            animation: draw-down linear both;
            animation-timeline: --ladder;
            animation-range: entry 70% cover 45%;
        }

        /* Each section's name gets an accent rule as the section is read. */
        .ledger-heading::after {
            animation: rule-grow linear both;
            animation-timeline: view();
            animation-range: entry 80% cover 25%;
        }

        /* Reading progress along the bottom of the toolbar, and a border once the page has moved. */
        .read-progress {
            animation: progress linear both;
            animation-timeline: scroll(root);
        }
        .site-bar {
            animation: bar-settle linear both;
            animation-timeline: scroll(root);
            animation-range: 0 80px;
        }
    }
}

@keyframes rise-in {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}
@keyframes draw-down {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}
@keyframes rule-grow {
    from { width: 0; }
    to { width: 32px; }
}
@keyframes progress {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}
@keyframes bar-settle {
    from { border-bottom-color: transparent; box-shadow: none; }
    to { border-bottom-color: var(--rule); box-shadow: 0 6px 20px -14px rgba(19, 28, 46, 0.35); }
}

/* ------------------------------------------------------------------
   Site chrome: a toolbar that stays put while you read
------------------------------------------------------------------- */
:root { --bar-h: 60px; }
html { scroll-padding-top: calc(var(--bar-h) + 16px); }

.site-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--rule);
}

.site-bar-inner {
    max-width: var(--page);
    min-height: var(--bar-h);
    margin: 0 auto;
    padding: 10px var(--gutter);
    display: flex;
    align-items: center;
    gap: 8px 20px;
}

.site-mark {
    font-weight: 800;
    font-size: var(--step-0);
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.site-nav { display: flex; gap: 4px; }

.bar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.bar-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    font: inherit;
    font-size: 0.9375rem;
    color: var(--ink);
    text-decoration: none;
    background: none;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
}
.bar-link:hover { background: var(--accent-tint); color: var(--accent); }
.bar-link .icon { flex: none; color: var(--accent); }
.bar-label-short { display: none; }
.bar-cta { margin-left: 8px; }

.read-progress {
    height: 2px;
    margin-bottom: -1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
}

.site-bar nav a,
.admin-bar nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius);
}
.site-bar nav a:hover,
.admin-bar nav a:hover { color: var(--ink); background: var(--accent-tint); }
.site-bar nav a.active,
.admin-bar nav a.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }

.site-foot {
    max-width: var(--page);
    margin: 64px auto 0;
    padding: 24px var(--gutter) 40px;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: var(--step--1);
}
.site-foot p { margin: 0; }
.foot-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }

@media screen { .print-only { display: none !important; } }

/* ------------------------------------------------------------------
   Buttons
------------------------------------------------------------------- */
.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: inherit;
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.2;
    padding: 12px 20px;
    border-radius: var(--radius);
    border: 2px solid var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    text-decoration: none;
    cursor: pointer;
}
.button:hover { filter: brightness(1.12); }

.button-quiet {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule);
}
.button-quiet:hover { border-color: var(--accent); filter: none; }

.button-small { padding: 6px 11px; font-size: 0.8125rem; }

.button-danger { background: transparent; color: var(--danger); border-color: var(--rule); }
.button-danger:hover { border-color: var(--danger); filter: none; }

.link-button {
    font: inherit;
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.18em;
    cursor: pointer;
}
.link-danger { color: var(--danger); }

/* ------------------------------------------------------------------
   Resume: introduction
------------------------------------------------------------------- */
.hero {
    max-width: var(--page);
    margin: 0 auto;
    padding: clamp(32px, 7vw, 96px) var(--gutter) clamp(36px, 5vw, 64px);
}

/* With a photo, it sits to the right of the introduction and fills what was empty space. */
.hero.has-photo {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
    gap: clamp(32px, 5vw, 72px);
    align-items: center;
}
.hero-photo { grid-column: 2; grid-row: 1; margin: 0; }
.hero-photo img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 30px 60px -30px rgba(19, 28, 46, 0.45);
}
.hero-text { min-width: 0; }

@media screen and (prefers-reduced-motion: no-preference) {
    .hero-photo { animation: rise-in-time 900ms cubic-bezier(.2, .8, .2, 1) 250ms both; }
}

@media (max-width: 860px) {
    .hero.has-photo { display: block; }
    .hero-photo { width: 112px; margin-bottom: 20px; }
    .hero-photo img { aspect-ratio: 1; border-radius: 50%; box-shadow: none; }
}

.hero-name {
    font-size: clamp(3rem, 10vw, 7rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 0.92;
}

@media screen and (prefers-reduced-motion: no-preference) {
    .hero-name { animation: name-in 900ms cubic-bezier(.2, .8, .2, 1) both; }
    .hero-meta, .hero-tagline, .hero-summary { animation: rise-in-time 700ms cubic-bezier(.2, .8, .2, 1) both; }
    .hero-meta { animation-delay: 120ms; }
    .hero-tagline { animation-delay: 200ms; }
    .hero-summary { animation-delay: 300ms; }
}

@keyframes name-in {
    from { opacity: 0; transform: translateY(0.18em); clip-path: inset(0 0 100% 0); }
    to { opacity: 1; transform: none; clip-path: inset(0 0 -10% 0); }
}
@keyframes rise-in-time {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

.hero-meta {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 22px;
    color: var(--muted);
    font-size: var(--step--1);
}

.hero-tagline {
    max-width: 30ch;
    margin: 22px 0 0;
    font-size: clamp(1.375rem, 2.8vw, 2rem);
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.hero-summary {
    max-width: 64ch;
    margin: 28px 0 0;
    font-size: var(--step-1);
    line-height: 1.6;
    color: color-mix(in srgb, var(--ink) 78%, var(--paper));
}
.hero-summary mark { color: var(--ink); }

.hero-contact {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
    color: var(--muted);
    font-size: 0.9375rem;
    overflow-wrap: anywhere;
}

/* Proof row: the numbers a hiring manager should leave with. */
.proof {
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.proof-frame {
    overflow: hidden;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--rule);
}
/* Every item draws its own left and top divider; the negative margins push the outer ones under the frame's edge. */
.proof-list {
    --cols: 3;
    list-style: none;
    margin: -1px 0 0 -25px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
}
.proof-item {
    display: grid;
    align-content: start;
    gap: 6px;
    padding: 20px 24px 24px;
    border-left: 1px solid var(--rule);
    border-top: 1px solid var(--rule);
}
.proof-value {
    justify-self: start;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    font-variant-numeric: lining-nums;
    /* The same highlighter stroke as marked results, swept in on hover. */
    padding: 0 0.1em;
    margin: 0 -0.1em;
    background-image: linear-gradient(transparent 55%, var(--mark) 55%, var(--mark) 92%, transparent 92%);
    background-repeat: no-repeat;
    background-size: 0% 100%;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* Pointing at a result marks it, the way a reader would. Mouse and trackpad only, so taps don't leave it stuck on. */
@media (hover: hover) {
    .proof-item { transition: background-color 200ms ease, box-shadow 200ms ease; }
    .proof-value { transition: background-size 380ms cubic-bezier(.4, .1, .2, 1); }
    .proof-item:hover { background-color: var(--accent-tint); box-shadow: inset 0 3px 0 var(--accent); }
    .proof-item:hover .proof-value { background-size: 100% 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .proof-item, .proof-value { transition: none; }
}
.proof-label { color: var(--muted); font-size: var(--step--1); line-height: 1.4; }

/* ------------------------------------------------------------------
   Resume: ledger sections (name in the margin, content beside it)
------------------------------------------------------------------- */
.ledger {
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.ledger-row {
    display: grid;
    grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
    gap: clamp(24px, 5vw, 64px);
    padding: clamp(40px, 6vw, 72px) 0;
}
.ledger-row + .ledger-row { border-top: 1px solid var(--rule); }

.ledger-heading {
    position: sticky;
    top: calc(var(--bar-h) + 28px);
    align-self: start;
    font-size: var(--step-1);
    letter-spacing: -0.01em;
}
.ledger-heading::after {
    content: "";
    display: block;
    width: 32px;
    height: 3px;
    margin-top: 12px;
    background: var(--accent);
}

.ledger-body { min-width: 0; max-width: 46rem; }

.strengths {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px 44px;
}
.strength-title { font-size: var(--step-0); margin-bottom: 6px; }
.strengths p { margin: 0; color: var(--muted); font-size: 0.9875rem; line-height: 1.55; }

/* Positions */
.position + .position { margin-top: 52px; padding-top: 44px; border-top: 1px solid var(--rule); }

.position-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px 20px;
    flex-wrap: wrap;
}
.position-org { font-size: var(--step-2); letter-spacing: -0.02em; }
.position-meta { margin: 0; color: var(--muted); font-size: var(--step--1); }

/* Roles: when there are several, a line joins them so the promotions read as a climb. */
.roles { list-style: none; margin: 16px 0 0; padding: 0; }
.role {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 2px 16px;
    flex-wrap: wrap;
    padding: 5px 0 5px 24px;
}
.role::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.85em;
    width: 10px;
    height: 10px;
    border: 2px solid var(--accent);
    background: var(--paper);
    border-radius: 50%;
}
/* Drawn with borders rather than backgrounds so the dots and line survive printing. */
.role:first-child::before { border-width: 5px; }
.is-ladder .role:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 4px;
    top: calc(0.85em + 10px);
    bottom: -0.85em;
    border-left: 2px solid var(--accent);
    opacity: 0.35;
}
.role-title { font-weight: 700; }
.role:not(:first-child) .role-title { font-weight: 450; }
.role-dates { color: var(--muted); font-size: var(--step--1); white-space: nowrap; padding-top: 2px; }

.position-intro { margin: 16px 0 0; color: var(--muted); }

.highlight-group { margin-top: 28px; }
.group-title { font-size: 0.9375rem; color: var(--accent); margin-bottom: 10px; }

.highlights { margin: 16px 0 0; padding-left: 1.1em; display: grid; gap: 9px; }
.highlight-group .highlights { margin-top: 0; }
.highlights li::marker { color: var(--accent); }
.details { margin: 8px 0 4px; padding-left: 1.1em; display: grid; gap: 4px; color: var(--muted); }

/* Skills */
.skill-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 44px; }
.skill-title { font-size: 0.9375rem; margin-bottom: 8px; }

/* Skills read as a run of text with hairline separators: calmer than a wall of chips. */
.skills { list-style: none; margin: 0; padding: 0; line-height: 1.75; color: var(--muted); font-size: 0.9375rem; }
/* inline-block keeps each separator with the item before it, so a line never starts with one. */
.skills li { display: inline-block; }
.skills li:not(:last-child)::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 0.85em;
    margin: 0 0.6em;
    vertical-align: -0.08em;
    background: var(--rule);
}

.footnote { margin-top: 32px; color: var(--muted); }

/* Closing call to action */
.closing {
    width: calc(100% - 2 * var(--gutter));
    max-width: calc(var(--page) - 2 * var(--gutter));
    margin: 8px auto 0;
    padding: clamp(32px, 6vw, 64px) clamp(20px, 6vw, 64px);
    /* Inverted, so the page ends on a clear next step in either color mode. */
    background: var(--ink);
    color: var(--paper);
    border-radius: 4px;
}
.closing h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; max-width: 22ch; }
.closing p { margin: 14px 0 26px; max-width: 56ch; color: color-mix(in srgb, var(--paper) 78%, var(--ink)); }
.closing .button { background: var(--paper); border-color: var(--paper); color: var(--ink); padding: 14px 24px; font-size: 1rem; }

/* ------------------------------------------------------------------
   Projects
------------------------------------------------------------------- */
.projects { list-style: none; margin: 0; padding: 0; }

.project {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 20px;
    padding: 22px 0;
    border-top: 1px solid var(--rule);
}
.project:first-child { border-top: 0; padding-top: 0; }
.page-narrow .project:first-child { border-top: 1px solid var(--rule); padding-top: 22px; }
.project:last-child { border-bottom: 1px solid var(--rule); }

.project-period { color: var(--muted); font-size: var(--step--1); margin: 4px 0 0; }
.project-image { display: block; width: 100%; max-width: 520px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; margin-bottom: 14px; }
.project-hero-image { display: block; width: 100%; height: auto; border-radius: 6px; margin: 8px 0 28px; }
.project-title { font-size: var(--step-1); }
.project-title a { color: var(--ink); text-decoration: none; }
.project-title a:hover { color: var(--accent); }
.project-meta { color: var(--muted); font-size: var(--step--1); margin: 4px 0 8px; }
.project-summary { margin-bottom: 10px; max-width: 65ch; }
.project-outcome {
    display: inline-block;
    font-weight: 700;
    padding: 2px 10px;
    border-left: 3px solid var(--accent);
    background: var(--accent-tint);
}
.project-links { display: flex; gap: 20px; flex-wrap: wrap; margin: 12px 0 0; font-weight: 700; font-size: var(--step--1); }

.tags { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: 0.8125rem; color: var(--muted); border: 1px solid var(--rule); padding: 2px 8px; border-radius: 2px; }

.more { margin-top: 16px; font-weight: 700; }

/* ------------------------------------------------------------------
   Inner pages
------------------------------------------------------------------- */
.page-narrow {
    max-width: 760px;
    margin: 0 auto;
    padding: clamp(24px, 5vw, 56px) var(--gutter) 0;
}

.page-title {
    font-size: clamp(2.25rem, 6vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    margin-bottom: 16px;
}

.page-lede { font-size: var(--step-1); color: var(--muted); max-width: 60ch; }

.back { font-size: var(--step--1); margin-bottom: 8px; }

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 36px;
    margin: 28px 0;
    padding: 16px 0;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--rule);
}
.facts dt { font-size: var(--step--1); color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }

.prose { max-width: 68ch; }
.prose p { margin-bottom: 1.1em; }

.empty { color: var(--muted); padding: 24px 0; }

.notice {
    max-width: 640px;
    margin: 0 auto;
    padding: 80px var(--gutter);
}
.notice h1 { font-size: var(--step-3); margin-bottom: 12px; }
.notice-meta { color: var(--muted); font-size: var(--step--1); }

/* ------------------------------------------------------------------
   Forms
------------------------------------------------------------------- */
.form { display: grid; gap: 18px; max-width: 560px; margin-top: 24px; }
.form-wide { max-width: 880px; }

.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }

.field label { font-weight: 700; font-size: 0.9375rem; }
.optional, .hint { font-weight: 400; color: var(--muted); font-size: var(--step--1); }
.hint { margin: 0; }

input[type="text"], input[type="email"], input[type="url"], input[type="tel"], input[type="password"], input[type="number"], input:not([type]),
textarea, select {
    font: inherit;
    font-size: 1rem;
    width: 100%;
    padding: 10px 12px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: 2px solid var(--accent-tint); outline-offset: 0; }

.invalid { border-color: var(--danger) !important; }
.validation-message { color: var(--danger); font-size: var(--step--1); }

.checks { display: flex; gap: 24px; flex-wrap: wrap; }
.checks label { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); }

.form button[type="submit"] { justify-self: start; }

.form-error,
.form-success {
    padding: 12px 16px;
    border-left: 4px solid var(--danger);
    background: var(--surface);
    max-width: 560px;
}
.form-success { border-left-color: var(--success); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.cf-turnstile { min-height: 65px; }

.confirm { margin: 8px 0 28px; padding: 16px 20px; background: var(--surface); border-left: 4px solid var(--success); }
.confirm-text { margin: 0; font-size: var(--step-1); }

.login { max-width: 480px; }

/* ------------------------------------------------------------------
   Admin
------------------------------------------------------------------- */
.admin-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 12px 24px;
    flex-wrap: wrap;
    padding: 12px var(--gutter);
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
}
.admin-bar .site-mark { font-size: var(--step-0); }
.admin-bar nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.admin-bar nav a { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9375rem; }
.admin-bar-end { display: flex; align-items: center; gap: 18px; font-size: 0.9375rem; }
.admin-bar-end form { margin: 0; }

.badge {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    border-radius: 10px;
    color: var(--accent-ink);
    background: var(--accent);
}

.admin-main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px var(--gutter) 64px;
}
.admin-main h1 { font-size: var(--step-3); font-weight: 800; letter-spacing: -0.02em; }

.admin-head {
    display: flex;
    align-items: center;
    gap: 12px 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.admin-head h1 { margin-right: auto; }

.segmented { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.segmented a { padding: 6px 14px; color: var(--muted); text-decoration: none; font-size: 0.9375rem; }
.segmented a + a { border-left: 1px solid var(--rule); }
.segmented a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.toggle { font-size: 0.9375rem; }

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

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 0 0 20px;
    background: var(--surface);
    border: 1px solid var(--rule);
}
.stats div { padding: 16px 20px; }
.stats div + div { border-left: 1px solid var(--rule); }
.stats dt { font-size: var(--step--1); color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: var(--step-3); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }

.panel {
    background: var(--surface);
    border: 1px solid var(--rule);
    padding: 18px 20px;
    margin-bottom: 20px;
    min-width: 0;
}
.panel-title { font-size: var(--step-0); font-weight: 700; margin-bottom: 14px; }
.panel .form { margin-top: 0; }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 20px; }
.panel-grid .panel { margin-bottom: 20px; }

.tip { border-left: 3px solid var(--accent); }
.tip p { font-size: 0.9375rem; }

.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart-bar { fill: var(--accent); opacity: 0.85; }
.chart-bar:hover { opacity: 1; }
.chart-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-axis { stroke: var(--rule); stroke-width: 1; }
.chart-grid { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-dates { display: flex; justify-content: space-between; margin-top: 6px; font-size: var(--step--1); color: var(--muted); }
.chart-key { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 10px; font-size: var(--step--1); color: var(--muted); }
.key::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.key-bar::before { background: var(--accent); }
.key-line::before { height: 2px; vertical-align: 4px; background: var(--ink); }
.chart-peak { margin-left: auto; }

.counts { width: 100%; border-collapse: collapse; font-size: 0.9375rem; table-layout: fixed; }
.counts td { padding: 5px 0; }
.counts .count-col { width: 64px; }
.counts td:first-child { position: relative; padding-left: 8px; }
.count-fill { position: absolute; inset: 2px auto 2px 0; background: var(--accent-tint); border-left: 2px solid var(--accent); }
.count-label { position: relative; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { text-align: right; width: 64px; font-variant-numeric: tabular-nums; }

.table-scroll { overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.data th { text-align: left; font-size: var(--step--1); color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--rule); white-space: nowrap; }
.data td { padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.data .is-bot td { color: var(--muted); }
.nowrap { white-space: nowrap; }
.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 14px; align-items: center; justify-content: flex-end; white-space: nowrap; }

.post-button { display: inline; margin: 0; }

.inline-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inline-form select { width: auto; }

.messages { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.message { background: var(--surface); border: 1px solid var(--rule); padding: 18px 20px; }
.message.is-unread { border-left: 4px solid var(--accent); }
.message-head { display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.message-from { font-size: var(--step-1); }
.message-meta { margin: 2px 0 0; font-size: 0.9375rem; overflow-wrap: anywhere; }
.message-time { color: var(--muted); font-size: var(--step--1); }
.message-reason { font-size: var(--step--1); color: var(--danger); margin-bottom: 8px; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 80ch; }
.message-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--rule); }

/* AI assistant */
.chat { list-style: none; margin: 24px 0; padding: 0; display: grid; gap: 16px; max-width: 900px; }
.chat-turn { padding: 16px 20px; border: 1px solid var(--rule); background: var(--surface); border-radius: 6px; }
.chat-user { background: var(--accent-tint); border-color: transparent; margin-left: clamp(0px, 8vw, 80px); }
.chat-who { margin: 0 0 6px; font-weight: 700; font-size: 0.9375rem; }
.chat-who .muted { font-weight: 400; margin-left: 8px; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.chat-meta { margin: 10px 0 0; font-size: 0.8125rem; }
.chat-form { max-width: 900px; }
.chat-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.proposal { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: 4px; background: var(--paper); }
.proposal-applied { border-left-color: var(--success); }
.proposal-discarded { border-left-color: var(--rule); opacity: 0.75; }
.proposal-title { margin: 0 0 6px; font-weight: 700; }
.proposal-changes { margin: 0 0 10px; padding-left: 1.1em; display: grid; gap: 4px; font-size: 0.9375rem; }
.proposal-status { margin: 0; font-size: 0.875rem; color: var(--muted); }
.proposal-actions { display: flex; gap: 8px; margin-top: 12px; }
.proposal-diff summary, .history-item summary { cursor: pointer; font-weight: 700; font-size: 0.875rem; color: var(--accent); margin: 6px 0; }
.diff-table { font-size: 0.8125rem; margin-top: 8px; }
.diff-table td { overflow-wrap: anywhere; }
.diff-path { color: var(--muted); width: 22%; }
.diff-before { background: color-mix(in srgb, var(--danger) 6%, transparent); width: 39%; }
.diff-after { background: color-mix(in srgb, var(--success) 8%, transparent); width: 39%; }

/* Settings, security, history, visitors */
.settings-links { display: flex; gap: 8px 20px; flex-wrap: wrap; margin: -6px 0 20px; font-size: 0.9375rem; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400 !important; font-size: 0.9375rem; }
.ban-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 0.9375rem; }
.ban-form input { width: auto; min-width: 180px; }
.data tr.is-alert td { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.history { list-style: none; margin: 20px 0 0; padding: 0; }
.history-label { margin: 0; font-weight: 700; }
.history-item .muted { margin: 2px 0 0; font-size: 0.875rem; }
.data tr.is-live td { background: var(--accent-tint); }
.data .badge { margin-left: 8px; }
.visit-path { margin: 16px 0 0; padding-left: 1.2em; display: grid; gap: 8px; }
.visit-time { display: inline-block; min-width: 110px; color: var(--muted); font-variant-numeric: tabular-nums; }
.clip-inline { overflow-wrap: anywhere; }
.sections-editor .row-editor-head, .sections-editor .row-editor-row { grid-template-columns: 80px minmax(0, 280px) minmax(0, 1fr); align-items: center; }
.section-visible { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; }

/* Media library */
.upload-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 14px; align-items: end; }
.upload-form input[type="file"] { font: inherit; font-size: 0.9375rem; }
.media-usage { display: grid; gap: 12px; margin: 0; }
.media-usage div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px; align-items: center; }
.media-usage dt { font-weight: 700; font-size: 0.9375rem; }
.media-usage dd { margin: 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.media-thumb-small { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--rule); }
.media-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.media-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; display: grid; }
.media-card.is-new { outline: 2px solid var(--accent); }
.media-card > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--paper); }
.media-info { padding: 12px 14px 14px; display: grid; gap: 8px; min-width: 0; }
.media-info p { margin: 0; font-size: 0.875rem; }
.media-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-alt { display: flex; gap: 6px; }
.media-alt input { font-size: 0.875rem; padding: 6px 8px; }
.media-actions { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.875rem; align-items: center; }
form.is-busy { opacity: 0.75; }

/* Content and appearance editors */
.section-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 20px 0; }
.section-card {
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 16px 18px;
    color: var(--ink);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--accent);
}
.section-card span { color: var(--muted); font-size: 0.9375rem; line-height: 1.45; }
.section-card:hover { border-color: var(--accent); }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head .panel-title { margin: 0; }
.panel-danger { border-left: 3px solid var(--danger); }

.position-rows { list-style: none; margin: 0; padding: 0; }
.position-rows li { display: flex; justify-content: space-between; align-items: center; gap: 8px 20px; flex-wrap: wrap; padding: 10px 0; }
.position-rows li + li { border-top: 1px solid var(--rule); }
.position-rows li > div:first-child { display: grid; }

.fieldset {
    display: grid;
    gap: 16px;
    min-width: 0;
    margin: 0;
    padding: 18px 20px 20px;
    background: var(--surface);
    border: 1px solid var(--rule);
}
.fieldset legend { font-weight: 700; padding: 0 6px; }
.field-row:has(> .field-order) { grid-template-columns: minmax(0, 1fr) 96px; }
.group-block { display: grid; gap: 14px; padding-top: 16px; border-top: 1px solid var(--rule); }

.link-row { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 14px; }

.row-editor { display: grid; gap: 10px; }
.row-editor-head,
.row-editor-row { display: grid; grid-template-columns: 80px minmax(0, 240px) minmax(0, 1fr); gap: 12px; }
.row-editor-head { font-size: var(--step--1); font-weight: 700; color: var(--muted); }

.code-input { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.875rem; line-height: 1.5; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px 12px; }
.swatch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-weight: 400;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    cursor: pointer;
}
.swatch:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.swatch input[type="radio"] { accent-color: var(--accent); }
.swatch-chip { width: 20px; height: 20px; border-radius: 50%; }
.swatch-mark { width: 28px; height: 14px; border-radius: 2px; background: var(--chip); border: 1px solid var(--rule); }
.swatch-picker { width: 34px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.checks-stacked { flex-direction: column; gap: 10px; }

/* ------------------------------------------------------------------
   Responsive
------------------------------------------------------------------- */
/* Toolbar: the full email address while there's room, then "Email", then icons only. */
@media (max-width: 1120px) {
    .bar-label-wide { display: none; }
    .bar-label-short { display: inline; }
}
@media (max-width: 760px) {
    .bar-link .bar-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .bar-link { padding: 8px; }
    .site-bar-inner { gap: 4px 10px; }
    .site-nav a { padding: 6px 8px; }
}
@media (max-width: 400px) {
    .site-mark { font-size: 0.9375rem; }
    .bar-cta { margin-left: 2px; }
}

@media (max-width: 900px) {
    .ledger-row { grid-template-columns: minmax(0, 1fr); gap: 22px; }
    .ledger-heading { position: static; font-size: var(--step-2); }
    .proof-list { --cols: 2; }
}

@media (max-width: 720px) {
    /* Admin menu becomes one swipeable row under the title bar. */
    .admin-bar { justify-content: space-between; }
    .admin-bar nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); scrollbar-width: none; }
    .admin-bar nav a { white-space: nowrap; }

    .strengths, .skill-groups { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}

@media (max-width: 560px) {
    .proof-list { --cols: 1; }
    .proof-item { padding: 16px 24px; }
    .project { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .stats div + div { border-left: 0; border-top: 1px solid var(--rule); }
    .panel-grid { grid-template-columns: minmax(0, 1fr); }
    .chart-peak { margin-left: 0; }
    .link-row, .row-editor-row, .sections-editor .row-editor-row, .upload-form, .media-usage div { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .row-editor-row { padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
    .row-editor-head { display: none; }
}

/* ------------------------------------------------------------------
   Print: a clean two-page paper resume
------------------------------------------------------------------- */
@media print {
    @page { margin: 0.45in 0.55in; }
    :root {
        --paper: #fff; --surface: #fff; --ink: #000; --muted: #3a3f4a; --rule: #c4c9d2;
        --accent: #2340b0; --accent-tint: transparent; --mark: #fff0a0;
    }
    /* Scales every rem-based size (dates, labels, skills) down to paper proportions. */
    html { font-size: 11px; }
    body { font-size: 9pt; line-height: 1.34; }
    .site-bar, .site-foot, .closing, .featured, .skip-link, .screen-only { display: none !important; }
    mark { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    .hero, .hero.has-photo { display: block; padding: 0 0 10pt; }
    .hero-photo { display: none; }
    .hero-name { font-size: 28pt; }
    .hero-meta { margin-top: 3pt; font-size: 8.5pt; }
    .ledger-heading::after { margin-top: 5pt; width: 20px; height: 2px; }
    .hero-tagline { font-size: 11.5pt; margin-top: 6pt; max-width: none; }
    .hero-summary { font-size: 9.5pt; margin-top: 5pt; max-width: none; }
    .hero-contact { margin-top: 6pt; font-size: 9.5pt; }
    .hero-contact a { color: inherit; }

    .proof, .ledger { padding: 0; }
    .proof-list { --cols: 3; margin-left: -11pt; }
    .proof-item { padding: 6pt 10pt 7pt; gap: 2pt; }
    .proof-value { font-size: 12.5pt; }
    .proof-label { font-size: 8.5pt; }

    .ledger-row { grid-template-columns: 0.95in minmax(0, 1fr); gap: 12pt; padding: 7pt 0; }    .ledger-heading { position: static; font-size: 10.5pt; }
    .ledger-body { max-width: none; }
    .strengths { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7pt 14pt; }
    .strength-title { font-size: 9.25pt; margin-bottom: 1pt; }
    /* On paper each skill group is one row, title beside its items. */
    .skill-groups { grid-template-columns: minmax(0, 1fr); gap: 3pt; }
    .skill-group { display: grid; grid-template-columns: 1.55in minmax(0, 1fr); gap: 10pt; }
    .skill-title { font-size: 8.75pt; margin: 0; line-height: 1.35; }
    .position-meta, .role-dates { font-size: 8.25pt; }
    .strengths p, .skills { font-size: 8.5pt; line-height: 1.35; }
    .strengths li, .skill-group, .highlights > li, .role, .position-head { break-inside: avoid; }

    .position + .position { margin-top: 8pt; padding-top: 7pt; }
    .position-org { font-size: 12pt; }
    .position-head { break-after: avoid; }
    .roles { margin-top: 4pt; }
    .role { padding: 0 0 0 15pt; }
    .role::before { width: 8px; height: 8px; top: 0.45em; }
    .role:first-child::before { border-width: 4px; }
    .is-ladder .role:not(:last-child)::after { left: 3px; top: calc(0.45em + 8px); bottom: -0.45em; }
    .position-intro { margin-top: 4pt; margin-bottom: 0; }
    .highlight-group { margin-top: 5pt; }
    .group-title { font-size: 9.25pt; margin-bottom: 2pt; break-after: avoid; }
    .highlights { gap: 1.5pt; margin-top: 5pt; }
    .details { margin: 2pt 0 1pt; gap: 0; }
    a { color: inherit; text-decoration: none; }
}
