/* philsinatra.com — see docs/superpowers/specs/2026-08-26-philsinatra-site-design.md */

/* Geist carries the page: headings run heavy and tight, body runs regular. */
@font-face {
    font-family: 'Geist';
    src: url('fonts/geist-variable.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* This file is the roman (upright) face, not italic — verified via the
   font's name table: nameID 1 "Instrument Serif", nameID 2 "Regular",
   nameID 4 "Instrument Serif Regular". Re-check the name table on any
   re-download; the Google Fonts CSS API can return the italic first when
   both styles are requested together. */
@font-face {
    font-family: 'Instrument Serif';
    src: url('fonts/instrument-serif.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Colour. Every value is oklch: uniform lightness handling across the
       palette, and the print block can shift lightness without touching hue. */
    --color-white: oklch(0.9551 0 0);
    --color-black: oklch(0.1496 0 0);
    --color-blue: oklch(0.60 0.1602 254.08);

    --bg: var(--color-black);
    --fg: var(--color-white);
    --body: oklch(0.8817 0.0027 106.45);
    --muted: oklch(0.7252 0 0);
    --rule: oklch(0.2350 0 0);
    --panel: oklch(0.1950 0 0);
    --accent: var(--color-blue);

    /* The one light section on the page — the children's books — runs on its
       own palette. Every token the dark page uses is redefined on .panel, so
       the section re-themes without a single component knowing about it. */
    --paper: oklch(0.9600 0.0140 84);
    --paper-ink: oklch(0.2100 0.0150 60);
    --paper-body: oklch(0.3000 0.0130 60);
    --paper-muted: oklch(0.4700 0.0130 60);
    --paper-rule: oklch(0.8700 0.0140 84);
    --paper-accent: oklch(0.4800 0.1500 254.08);

    --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
    --sans: 'Geist', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
        Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    /* Micro-labels only, and deliberately not a downloaded face: at 12px
       uppercase the differences between platform monos don't read, and a
       fourth font file would cost more than the effect is worth. */
    --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
        'Liberation Mono', monospace;

    --measure: 68ch;
    --pad: 1.25rem;
    --scale-factor: clamp(1rem, 0.8rem + 0.75vw, 1.5rem);
    --section-gap: 8rem;

    --duration-fast: 150ms;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (width >=40rem) {
    :root {
        --pad: 2rem;
    }

    html {
        font-size: var(--scale-factor);
    }
}

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

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--body);
    font-family: var(--sans);
    font-size: 1.1875rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: var(--accent);
    color: oklch(1 0 0);
}

.wrap {
    max-width: var(--measure);
    margin-inline: auto;
    padding-inline: var(--pad);
}

/* Typography */

h1,
h2 {
    font-family: var(--sans);
    font-weight: 680;
    color: var(--fg);
    line-height: 1.03;
    letter-spacing: -0.032em;
    text-wrap: balance;
    margin: 0;
}

h1 {
    font-size: clamp(2.5rem, 7.4vw, 4.4rem);
}

h2 {
    font-size: clamp(1.9rem, 5.2vw, 2.8rem);
}

/* The tagline under a project name. The serif is the only place the page
   changes voice, which is why it gets the one line that isn't a fact. */
h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.35rem, 3.4vw, 1.75rem);
    line-height: 1.2;
    letter-spacing: 0;
    color: var(--muted);
    text-wrap: balance;
    margin: 0.55rem 0 0;
    max-width: 34ch;
}

p {
    margin: 0 0 1.15em;
    text-wrap: pretty;
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.18em;
    text-decoration-thickness: 3px;
    text-decoration-color: color-mix(in srgb, var(--accent) 85%, transparent);
    transition: color var(--duration-fast) var(--ease),
        text-decoration-color var(--duration-fast) var(--ease);
}

a:hover,
a:focus-visible {
    color: var(--fg);
    text-decoration-color: var(--fg);
}

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

/* Micro-labels. Everything set in mono on this page is a label, an index, or
   a measurement — never prose. */

.label {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 1.5rem;
}

/* A section's own label also draws the rule that opens the section. */
section>.label,
.panel .wrap>.label {
    border-top: 1px solid var(--rule);
    padding-top: 1rem;
    margin-bottom: 3rem;
}

.meta {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    margin: 1.4rem 0 2.2rem;
}

.stack {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-top: 2rem;
}

/* Result block */

.result {
    margin-top: 2.5rem;
    background: var(--panel);
    border-left: 3px solid var(--accent);
    padding: 1.5rem 1.75rem;
}

.result>.label {
    color: var(--accent);
    border-top: 0;
    padding-top: 0;
    margin-bottom: 0.4rem;
}

.result dl {
    display: grid;
    grid-template-columns: 1fr auto;
    /* No column gap: the row rules have to meet in the middle. The gap lives
       in the term's padding instead. */
    gap: 0;
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.result dt,
.result dd {
    padding-block: 0.75rem;
    border-top: 1px solid var(--rule);
}

.result dt {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.4;
    padding-right: 2rem;
}

.result dd {
    margin: 0;
    color: var(--fg);
    font-weight: 600;
    text-align: right;
    line-height: 1.4;
}

.result dt:first-of-type,
.result dd:first-of-type {
    border-top: 0;
}

@media (width < 34rem) {
    .result {
        padding: 1.25rem 1.25rem;
    }

    .result dl {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .result dt {
        padding-right: 0;
        padding-bottom: 0.15rem;
    }

    .result dd {
        text-align: left;
        border-top: 0;
        padding-top: 0;
    }
}

/* Structure */

section {
    margin-block-start: var(--section-gap);
}

figure {
    margin: 2rem 0;
}

figure svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Header */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 2rem 0;
}

.mark {
    display: block;
    line-height: 0;
    text-decoration: none;
}

.mark-svg {
    /* Grows with the viewport but never crowds the email on the right. */
    width: clamp(118px, 15vw, 172px);
    height: auto;
}

.header-mail {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--muted);
    text-decoration: none;
}

.header-mail:hover,
.header-mail:focus-visible {
    color: var(--accent);
}

@media (width < 30rem) {
    .header-mail {
        display: none;
    }
}

/* Hero */

.hero {
    /* The hero is the first section, so it does not want the standard
       between-sections gap on top of its own padding. */
    margin-block-start: 0;
    padding-block: 4.5rem 0;
}

.hero h1 {
    max-width: 24ch;
}

/* The headline is two claims, not one sentence. Breaking it makes that
   visible; dropping the second half to --muted keeps the first half loud. */
.hero h1 span {
    display: block;
    color: var(--muted);
}

.hero-lede {
    font-size: 1.2rem;
    color: var(--body);
    margin-top: 2rem;
    max-width: 62ch;
}

.hero-lede+.hero-lede {
    color: var(--muted);
}

/* The line above this one has two em dashes in it; that is the joke. Set like
   something scribbled in the margin rather than like body copy. */
.hero-quip {
    align-items: center;
    color: var(--muted);
    display: flex;
    gap: 0.55rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    transform-origin: left center;
    transform: rotate(-1.4deg);
}

.hero-quip small {
    font-family: var(--serif);
    font-size: 1.1rem;
}

.quip-arrow {
    flex: none;
    width: 34px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hero-links {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 1rem;
    max-width: 62ch;
}

/* Case studies */

.case+.case {
    border-top: 1px solid var(--rule);
    padding-top: 5rem;
    margin-top: 5rem;
}

.case-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 56px;
    margin-bottom: 1.75rem;
}

.case-index {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    margin: 0 0 0 auto;
}

.case-mark {
    display: flex;
    align-items: center;
    line-height: 0;
}

.mark-tile {
    width: 56px;
    height: 56px;
    display: block;
}

/* Drawn marks take the page colour; the three real ones keep their own. */
.mark-drawn {
    color: var(--muted);
}

/* Not a square tile: the DePuy Synthes bug is wider than it is tall and
   carries its own colour. */
.mark-bug {
    height: 50px;
    width: auto;
    display: block;
}

.glyph {
    width: 0.85em;
    height: 0.85em;
    vertical-align: -0.06em;
    fill: currentColor;
}

/* The contact list sets its own text small, and these two marks carry more
   detail than the X does — they need the extra size to stay legible. */
.elsewhere .glyph {
    width: 1.05em;
    height: 1.05em;
    vertical-align: -0.17em;
}

/* An underline can't run under an inline SVG, so it renders as a stray dash
   in the trailing whitespace. The mark itself is the affordance. */
.x-link {
    text-decoration: none;
}

/* Screenshot */

.shot {
    margin: 2.5rem 0;
}

.shot img {
    display: block;
    width: 100%;
    max-width: 300px;
    height: auto;
    border: 1px solid var(--rule);
    border-radius: 6px;
}

.shot figcaption {
    font-family: var(--mono);
    font-size: 0.7rem;
    line-height: 1.6;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-top: 0.8rem;
    max-width: 48ch;
}

/* Shorter takes */

.short {
    max-width: 64ch;
}

.short h2 {
    font-size: clamp(1.5rem, 3.4vw, 1.9rem);
}

.short h3 {
    font-size: clamp(1.15rem, 2.4vw, 1.35rem);
    margin-bottom: 1.4rem;
}

.short+.short {
    padding-top: 3.5rem;
    margin-top: 3.5rem;
}

/* Front-end list */

.prose {
    max-width: 62ch;
    margin-top: 1.6rem;
}

.sites {
    list-style: none;
    margin: 3rem 0 0;
    padding: 0;
}

.sites li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.3rem 1.5rem;
    padding-block: 0.85rem;
    border-top: 1px solid var(--rule);
}

.sites a {
    color: var(--fg);
    font-weight: 500;
    text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
}

.sites a:hover,
.sites a:focus-visible {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

.sites span {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Light panel — the children's books */

.panel {
    background: var(--paper);
    padding-block: 5rem;

    --fg: var(--paper-ink);
    --body: var(--paper-body);
    --muted: var(--paper-muted);
    --rule: var(--paper-rule);
    --accent: var(--paper-accent);

    color: var(--body);
}

.scruffy {
    display: grid;
    gap: 2.5rem;
    align-items: center;
}

@media (width >=48rem) {
    .scruffy {
        grid-template-columns: 1.1fr 0.9fr;
        gap: 3rem;
    }
}

.scruffy h2 {
    margin-bottom: 1.8rem;
}

.scruffy h2 img {
    display: block;
    width: min(280px, 80%);
    height: auto;
}

.scruffy em {
    font-family: var(--serif);
    font-style: normal;
    font-size: 1.06em;
    color: var(--fg);
}

.scruffy-link {
    margin-top: 1.8rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
}

/* Cover switcher. The radios sit before the stack and the tabs so `:checked ~`
   can reach both. Rules are written out to four covers; there are two books. */

.covers-radio {
    /* Off-screen but still focusable and still in the tab order — the visible
       control is the label, so the focus ring is drawn there instead. */
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}

.covers-stack {
    display: grid;
}

.covers-multi .covers-stack>* {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-fast) var(--ease);
}

#scruffy-cover-0:checked~.covers-stack> :nth-child(1),
#scruffy-cover-1:checked~.covers-stack> :nth-child(2),
#scruffy-cover-2:checked~.covers-stack> :nth-child(3),
#scruffy-cover-3:checked~.covers-stack> :nth-child(4) {
    opacity: 1;
    visibility: visible;
}

.covers-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.covers-tabs label {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--rule);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease),
        border-color var(--duration-fast) var(--ease);
}

.covers-tabs label:hover {
    color: var(--fg);
    border-color: var(--muted);
}

#scruffy-cover-0:checked~.covers-tabs label:nth-child(1),
#scruffy-cover-1:checked~.covers-tabs label:nth-child(2),
#scruffy-cover-2:checked~.covers-tabs label:nth-child(3),
#scruffy-cover-3:checked~.covers-tabs label:nth-child(4) {
    color: var(--fg);
    border-color: var(--accent);
}

#scruffy-cover-0:focus-visible~.covers-tabs label:nth-child(1),
#scruffy-cover-1:focus-visible~.covers-tabs label:nth-child(2),
#scruffy-cover-2:focus-visible~.covers-tabs label:nth-child(3),
#scruffy-cover-3:focus-visible~.covers-tabs label:nth-child(4) {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.scruffy-cover {
    margin: 0;
}

.scruffy-cover img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 14px 44px oklch(0.21 0.015 60 / 0.22);
}

/* Principles */

.principles {
    list-style: none;
    margin: 2.5rem 0 0;
    padding: 0;
    max-width: 64ch;
    counter-reset: principle;
}

.principles li {
    position: relative;
    padding: 1.6rem 0 1.6rem 3.4rem;
    border-top: 1px solid var(--rule);
    color: var(--muted);
}

.principles li::before {
    counter-increment: principle;
    content: counter(principle, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 1.95rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.principles li:first-child {
    border-top: 0;
}

.principles strong {
    display: block;
    color: var(--fg);
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 0.35rem;
}

/* Contact */

.contact-grid {
    display: grid;
    gap: 3rem;
    align-items: start;
}

@media (width >=44rem) {
    .contact-grid {
        grid-template-columns: 1fr auto;
    }
}

.portrait {
    margin: 0;
}

.portrait img {
    display: block;
    width: 220px;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.contact-lede {
    font-size: 1.2rem;
    color: var(--muted);
    max-width: 46ch;
    margin-top: 1.2rem;
}

.contact-mail {
    font-family: var(--serif);
    font-size: clamp(1.7rem, 5vw, 2.6rem);
    line-height: 1.1;
    margin-top: 1.6rem;
}

.contact-mail a {
    text-decoration-thickness: 2px;
    text-decoration-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.elsewhere {
    list-style: none;
    margin: 3rem 0 0;
    padding: 0;
}

.elsewhere li {
    padding-block: 0.7rem;
    border-top: 1px solid var(--rule);
    font-size: 0.95rem;
}

.elsewhere a {
    color: var(--body);
    text-decoration: none;
}

.elsewhere a:hover,
.elsewhere a:focus-visible {
    color: var(--accent);
}

/* Footer */

.site-footer {
    margin-block: 7rem 3rem;
    color: var(--muted);
}

.site-footer p {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    margin: 0;
    padding-top: 2rem;
    border-top: 1px solid var(--rule);
}

/* Diagrams */

.diagram {
    margin: 2.5rem 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.diagram svg {
    display: block;
    width: 100%;
    min-width: 560px;
    height: auto;
}

.dn {
    font-family: var(--sans);
    font-size: 13px;
    fill: var(--body);
}

.dn.past {
    fill: var(--muted);
}

.dl {
    font-family: var(--mono);
    font-size: 10px;
    fill: var(--muted);
}

.dc {
    font-family: var(--sans);
    font-size: 11px;
    fill: var(--muted);
    font-style: italic;
}

.dline {
    stroke: var(--muted);
    stroke-width: 1;
    fill: none;
}

.dline.now {
    stroke: var(--accent);
}

/* Print */

@media print {
    @page {
        margin: 18mm 20mm;
    }

    :root {
        --bg: oklch(1 0 0);
        --fg: oklch(0 0 0);
        --body: oklch(0.2178 0 0);
        --muted: oklch(0.4091 0 0);
        --rule: oklch(0.8452 0 0);
        --panel: oklch(1 0 0);
        /* Same hue, dropped in lightness so it reads on white paper. */
        --accent: oklch(0.4500 0.1500 254.08);
        --section-gap: 2.5rem;
    }

    body {
        font-size: 10.5pt;
        line-height: 1.45;
    }

    .wrap {
        max-width: 42em;
        padding-inline: 0;
    }

    .header-mail {
        display: block;
    }

    a {
        color: var(--body);
        text-decoration: underline;
        text-decoration-color: var(--muted);
    }

    /* Print the full destination only for the two link lists, where the link
     text is a bare label. Inline prose links keep only the underline above. */
    .elsewhere a[href^="http"]::after,
    .sites a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: var(--muted);
        word-break: break-all;
    }

    /* The light panel stops being a panel on paper — it is already paper. */
    .panel {
        background: none;
        padding-block: 0;

        --fg: oklch(0 0 0);
        --body: oklch(0.2178 0 0);
        --muted: oklch(0.4091 0 0);
        --rule: oklch(0.8452 0 0);
        --accent: oklch(0.4500 0.1500 254.08);
    }

    .result {
        border-left: 2px solid var(--rule);
        padding: 0.6rem 1rem;
    }

    .shot {
        max-width: 2in;
    }

    .portrait img {
        max-width: 1.5in;
    }

    .scruffy-cover img {
        box-shadow: none;
        max-width: 2.4in;
    }

    .covers-tabs {
        display: none;
    }

    .case,
    .short,
    .principles li,
    .diagram,
    .result,
    .shot,
    .sites li,
    .scruffy,
    .contact-grid {
        break-inside: avoid;
    }

    h1,
    h2,
    h3 {
        break-after: avoid;
    }

    .diagram {
        overflow: visible;
    }

    .diagram svg {
        min-width: 0;
    }

    .site-footer {
        display: none;
    }
}
