/* =====================================================================
   Louis Huppenbauer — calling card, editorial/warm alternative
   A personal-essay layout: a mono-set margin rail beside a serif-led
   prose column, the way a magazine profile runs marginalia beside copy.
   ===================================================================== */

/* ---------- Design tokens ---------- */
:root {
    /* Light palette — warm parchment, wine, brass, moss.
       Chosen from the subject's own photographs: the oxblood velvet
       of the recliner, the brass hardware of his glasses and septum
       ring, not a default cream/terracotta pairing. */
    --paper: #EDE3D0;
    --paper-dim: #E1D3B8;
    --paper-raised: #F5EEDF;
    --ink: #2A2118;
    --ink-soft: #4D4033;
    --wine: #6B1F24;
    --brass: #96762F;
    --brass-text: #7A5D22;
    --moss: #47573C;
    --rule: #C9B896;
    --rule-strong: #B4A17A;
    --shadow: 220 30% 10%;

    --font-display: 'Piazzolla', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
    --font-body: 'Work Sans', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

    --measure: 42rem;
    --rail-width: 13rem;
    --gutter: clamp(1.5rem, 4vw, 3.5rem);

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    color-scheme: light;
}

/* Dark palette — a genuine counterpart, not an inversion: a warm
   espresso ground rather than slate or near-black, brass and wine
   both lifted for contrast without turning neon. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #211A13;
        --paper-dim: #2A2119;
        --paper-raised: #2D241A;
        --ink: #EDE0C8;
        --ink-soft: #D0C1A7;
        --wine: #D08880;
        --brass: #D7B369;
        --brass-text: #D7B369;
        --moss: #90A87E;
        --rule: #4A3D2C;
        --rule-strong: #5B4B34;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --paper: #211A13;
    --paper-dim: #2A2119;
    --paper-raised: #2D241A;
    --ink: #EDE0C8;
    --ink-soft: #C4B49A;
    --wine: #D08880;
    --brass: #D7B369;
    --brass-text: #D7B369;
    --moss: #90A87E;
    --rule: #4A3D2C;
    --rule-strong: #5B4B34;
    color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    /* color-scheme (below) changes the native scrollbar's rendering between
       light/dark, which otherwise shifts the usable content width a few px
       and causes a layout jump on toggle. Reserve the gutter unconditionally. */
    scrollbar-gutter: stable;
}
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; }

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

/* ---------- Masthead ---------- */
.masthead {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.masthead-inner {
    max-width: 76rem;
    margin: 0 auto;
    padding: 1rem var(--gutter);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.wordmark {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink);
    white-space: nowrap;
}
.primary-nav {
    display: flex;
    gap: 1.5rem;
    margin-left: auto;
    flex-wrap: wrap;
}
.primary-nav a {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-decoration: none;
    color: var(--ink-soft);
    position: relative;
    padding-bottom: 2px;
}
.primary-nav a:hover { color: var(--wine); }
.primary-nav a::after {
    content: '';
    position: absolute;
    left: 0; right: 100%;
    bottom: 0;
    height: 1px;
    background: var(--wine);
    transition: right 0.25s var(--ease);
}
.primary-nav a:hover::after { right: 0; }

.theme-toggle {
    appearance: none;
    border: 1px solid var(--rule-strong);
    background: var(--paper-raised);
    border-radius: 999px;
    width: 3.1rem;
    height: 1.7rem;
    padding: 2px;
    cursor: pointer;
    flex-shrink: 0;
}
.theme-toggle-track {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    position: relative;
}
.theme-toggle-mark {
    font-size: 0.72rem;
    line-height: 1;
    width: 1.2rem;
    text-align: center;
    color: var(--brass-text);
}
.theme-toggle-mark--moon { color: var(--ink-soft); }

/* ---------- Section / spread layout ---------- */
main { max-width: 76rem; margin: 0 auto; }
.spread {
    display: grid;
    grid-template-columns: var(--rail-width) minmax(0, 1fr);
    gap: var(--gutter);
    padding: clamp(3rem, 7vw, 5.5rem) var(--gutter);
    border-bottom: 1px solid var(--rule);
}
.spread:last-of-type { border-bottom: none; }

.rail { padding-top: 0.3rem; }
.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--brass-text);
    margin: 0;
    position: sticky;
    top: 5rem;
}
.column { min-width: 0; }
.column h2 {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 600;
    margin-bottom: 1.25rem;
    max-width: var(--measure);
}
.prose p, .section-note {
    max-width: var(--measure);
    font-size: 1.05rem;
    color: var(--ink);
    margin: 0 0 1.15em;
}
.prose p:last-child { margin-bottom: 0; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(2.5rem, 6vw, 4rem); }
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 17rem;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
}
.display-name {
    font-size: clamp(2.6rem, 6vw, 4.6rem);
    font-weight: 700;
    line-height: 0.98;
    letter-spacing: -0.01em;
    margin-bottom: 1.1rem;
}
.deck {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    color: var(--ink-soft);
    max-width: 30rem;
    margin: 0 0 1.75rem;
    text-transform: uppercase;
}
.lede {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.3rem, 2.4vw, 1.65rem);
    line-height: 1.45;
    color: var(--ink);
    max-width: 34rem;
    margin: 0;
}
.drop-cap {
    font-style: normal;
    font-weight: 700;
    font-size: 2.4em;
    line-height: 0.7;
    float: left;
    padding: 0.06em 0.06em 0 0;
    color: var(--wine);
}
.lede--contact { font-size: clamp(1.15rem, 1.8vw, 1.3rem); max-width: 38rem; }

.portrait-frame {
    margin: 0;
    border: 1px solid var(--rule-strong);
    padding: 0.6rem;
    background: var(--paper-raised);
}
.portrait-frame img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    filter: sepia(0.12) saturate(1.05);
}
.portrait-frame figcaption {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    color: var(--ink-soft);
    padding-top: 0.55rem;
    text-align: center;
}

/* ---------- Off the clock snapshot ---------- */
.snapshot {
    float: right;
    width: 15rem;
    max-width: 42%;
    margin: 0 0 1rem 2rem;
    border: 1px solid var(--rule-strong);
    padding: 0.5rem;
    background: var(--paper-raised);
}
.snapshot img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.snapshot figcaption {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--ink-soft);
    text-align: center;
    padding-top: 0.5rem;
}

/* ---------- Glossary (what I do) ---------- */
.glossary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.75rem 2.5rem;
    max-width: 48rem;
    margin: 0;
}
.glossary-entry {
    border-top: 1px solid var(--rule);
    padding-top: 0.75rem;
}
.glossary-entry dt {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
}
.glossary-entry dd {
    margin: 0;
    color: var(--ink-soft);
    font-size: 1rem;
    line-height: 1.6;
}

/* ---------- Technical index ---------- */
.section-note { color: var(--ink-soft); font-family: var(--font-body); font-size: 1rem; }
.index-list { max-width: 52rem; }
.index-row {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 1.5rem;
    padding: 0.9rem 0;
    border-top: 1px solid var(--rule);
}
.index-list .index-row:last-child { border-bottom: 1px solid var(--rule); }
.index-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--moss);
    margin: 0;
}
.index-terms {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--ink);
}

/* ---------- Career ---------- */
.career-list { list-style: none; margin: 0; padding: 0; max-width: 44rem; }
.career-entry {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1.1rem 0;
    border-top: 1px solid var(--rule);
}
.career-list .career-entry:last-child { border-bottom: 1px solid var(--rule); }
.career-years {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--ink-soft);
    margin: 0;
    padding-top: 0.15rem;
}
.career-role {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0 0 0.15rem;
}
.career-employer {
    margin: 0;
    font-size: 0.97rem;
    color: var(--ink-soft);
}
.career-entry--break .career-role { color: var(--wine); }
.career-employer--note {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--ink-soft);
}

/* ---------- Contact ---------- */
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
}
.contact-link {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-decoration: none;
    border: 1px solid var(--rule-strong);
    padding: 1rem 1.4rem;
    min-width: 15rem;
    background: var(--paper-raised);
    transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.contact-link:hover { border-color: var(--wine); transform: translateY(-2px); }
.contact-link-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brass-text);
}
.contact-link-value {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--ink);
}

/* ---------- Colophon / footer ---------- */
.colophon {
    max-width: 76rem;
    margin: 0 auto;
    padding: 2rem var(--gutter) 3rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .spread {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 3rem var(--gutter);
    }
    .rail { padding-top: 0; }
    .eyebrow { position: static; padding-bottom: 0.25rem; }
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
    .portrait-frame { max-width: 14rem; }
    .snapshot { float: none; width: 11rem; max-width: 60%; margin: 0 auto 1.25rem; }
    .glossary { grid-template-columns: 1fr; }
    .index-row, .career-entry { grid-template-columns: 1fr; gap: 0.35rem; }
    .career-years { padding-top: 0; }
}

@media (max-width: 560px) {
    .masthead-inner { flex-wrap: wrap; row-gap: 0.5rem; }
    .primary-nav { order: 3; width: 100%; margin-left: 0; gap: 1rem 1.25rem; }
    .display-name { font-size: clamp(2.2rem, 11vw, 3rem); }
}

/* ---------- Motion & accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
    .contact-link { transition: none; }
    .contact-link:hover { transform: none; }
    * { scroll-behavior: auto !important; }
}

html { scroll-behavior: smooth; }
