/* ============================================
   Rimebound — Main Stylesheet
   Cool slate ground · soft filled surfaces · fjord + glacier accents
   ============================================ */

/* ---------- Tokens ---------- */
:root {
    color-scheme: dark;

    /* Dark (default): cool slate neutrals, hue ~230 */
    --bg: #0a0d10;
    --surface: #131920;
    --surface-2: #1b232c;
    --surface-3: #243039;
    --ink: #eef3f7;
    --ink-2: #a9b5c0;
    --ink-3: #7d8a96;
    --line: rgba(200, 225, 255, 0.08);
    --line-strong: rgba(200, 225, 255, 0.16);

    /* Primary accent — fjord blue: actions, focus, selection, links */
    --accent: #488dc2;
    --accent-hover: #5b9dd0;
    --accent-ink: #061321;
    --accent-soft: rgba(72, 141, 194, 0.16);
    --link: #7db4e0;

    /* Secondary accent — glacier teal: wayfinding, meta, progress */
    --accent-2: #45a5a8;
    --accent-2-text: #7cc9cb;
    --accent-2-soft: rgba(69, 165, 168, 0.14);
    --signal: #45a5a8;

    --feature-bg: #488dc2;
    --feature-ink: #061321;
    --feature-ink-2: rgba(6, 19, 33, 0.72);
    --feature-chip: rgba(6, 19, 33, 0.12);

    --nav-bg: rgba(10, 13, 16, 0.78);
    --pill-active: #243039;
    --shadow-pill: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.5);
    --shadow-portrait: 0 4px 8px rgba(0, 0, 0, 0.3), 0 40px 80px -24px rgba(0, 0, 0, 0.75);

    --footer-bg: #121a22;

    /* Type */
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Playfair', 'Playfair Display', Didot, 'Bodoni 72', Georgia, serif;
    --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

    /* Shape */
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 24px;
    --r-xl: 32px;
    --r-pill: 999px;

    /* Layout */
    --wrap: 1200px;
    --gutter: clamp(1rem, 4vw, 1.5rem);
    --nav-h: 72px;

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --t-fast: 150ms;
    --t-base: 300ms;
}

html[data-theme="light"] {
    color-scheme: light;

    --bg: #f8fafb;
    --surface: #eef2f5;
    --surface-2: #e3e9ee;
    --surface-3: #d7dfe6;
    --ink: #111a22;
    --ink-2: #43515e;
    --ink-3: #5f6d7a;
    --line: rgba(17, 26, 34, 0.08);
    --line-strong: rgba(17, 26, 34, 0.16);

    --accent: #488dc2;
    --accent-hover: #3d80b5;
    --accent-ink: #061321;
    --accent-soft: rgba(72, 141, 194, 0.12);
    --link: #2d6c9e;

    --accent-2: #45a5a8;
    --accent-2-text: #23686a;
    --accent-2-soft: rgba(69, 165, 168, 0.14);
    --signal: #45a5a8;

    --feature-bg: #0f2b42;
    --feature-ink: #ffffff;
    --feature-ink-2: rgba(255, 255, 255, 0.72);
    --feature-chip: rgba(255, 255, 255, 0.12);

    --nav-bg: rgba(248, 250, 251, 0.82);
    --pill-active: #ffffff;
    --shadow-pill: 0 1px 2px rgba(17, 26, 34, 0.06), 0 4px 12px rgba(17, 26, 34, 0.08);
    --shadow-card: 0 1px 2px rgba(17, 26, 34, 0.04), 0 12px 32px -12px rgba(17, 26, 34, 0.14);
    --shadow-portrait: 0 4px 8px rgba(17, 26, 34, 0.1), 0 40px 80px -28px rgba(17, 26, 34, 0.4);

    --footer-bg: #071019;
}


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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-size-adjust: 100%;
    scrollbar-color: var(--surface-3) var(--bg);
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    font-feature-settings: 'cv11', 'ss01';
    color: var(--ink);
    background: var(--footer-bg);
    overflow-x: hidden;
    caret-color: var(--accent);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.15;
    text-wrap: balance;
}

p { text-wrap: pretty; }

/* Display role: titles and section heads in Playfair, slightly wide (105%) at semibold 600; optical size follows font size.
   Card titles, labels and UI stay in Inter. */
.hero-title,
.masthead-title,
.page-title,
.article-title,
.section-title,
.slide-title,
.person-name,
.profile-name,
.footer-tagline,
.post-gallery-title,
.post-body h1,
.post-body h2,
.post-body h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-stretch: 105%;
    font-optical-sizing: auto;
    font-synthesis: none;
    font-feature-settings: normal;
}

::selection {
    background: var(--accent);
    color: var(--accent-ink);
}

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

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 999px;
    border: 3px solid var(--bg);
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

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

.wrap {
    width: min(var(--wrap), 100% - 2 * var(--gutter));
    margin-inline: auto;
}


/* ---------- Motion ---------- */
@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(14px);
        filter: blur(6px);
    }
}

.rise {
    animation: rise 0.9s var(--ease-out) both;
    animation-delay: var(--d, 0ms);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ---------- Page sheet & footer curtain ---------- */
.page {
    position: relative;
    z-index: 1;
    background: var(--bg);
    min-height: 100vh;
    padding-top: var(--nav-h);
}

html.curtain .page {
    margin-bottom: var(--footer-h, 0px);
    border-radius: 0 0 var(--r-xl) var(--r-xl);
    box-shadow: 0 1px 0 var(--line-strong), 0 24px 48px -24px rgba(0, 0, 0, 0.6);
}

html.curtain .footer {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 0;
}


/* ---------- Navigation ---------- */
.navbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 50;
    height: var(--nav-h);
    display: flex;
    align-items: center;
}

.navbar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--nav-bg);
    backdrop-filter: saturate(1.4) blur(16px);
    -webkit-backdrop-filter: saturate(1.4) blur(16px);
    border-bottom: 1px solid var(--line);
    opacity: 0;
    transition: opacity var(--t-base) var(--ease-out);
}

.navbar.scrolled::before { opacity: 1; }

.nav-container {
    position: relative;
    width: min(var(--wrap), 100% - 2 * var(--gutter));
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.nav-logo {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 0.9375rem;
    letter-spacing: 0.14em;
    color: var(--ink);
}

.logo-short { display: none; }

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: var(--surface);
    border-radius: var(--r-pill);
}

.nav-link {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 1rem;
    border-radius: var(--r-pill);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-2);
    transition: color var(--t-fast), background-color var(--t-fast);
}

.nav-link:hover { color: var(--ink); }

.nav-link[aria-current] {
    color: var(--ink);
    background: var(--pill-active);
    box-shadow: var(--shadow-pill);
}

.nav-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--r-pill);
    display: grid;
    place-items: center;
    color: var(--ink);
    background: var(--surface);
    transition: background-color var(--t-fast), transform var(--t-fast);
}

.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }

.theme-icon { display: block; }
html[data-theme="dark"] .theme-icon--moon,
html:not([data-theme="light"]) .theme-icon--moon { display: none; }
html[data-theme="light"] .theme-icon--sun { display: none; }
html[data-theme="light"] .theme-icon--moon { display: block; }

.nav-toggle { display: none; }

.nav-toggle-bars {
    position: relative;
    width: 16px;
    height: 10px;
}

.nav-toggle-bars span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1.5px;
    border-radius: 2px;
    background: currentColor;
    transition: transform var(--t-base) var(--ease-out), top var(--t-base) var(--ease-out);
}

.nav-toggle-bars span:first-child { top: 1px; }
.nav-toggle-bars span:last-child { top: 7.5px; }
.nav-toggle.active .nav-toggle-bars span:first-child { top: 4.25px; transform: rotate(45deg); }
.nav-toggle.active .nav-toggle-bars span:last-child { top: 4.25px; transform: rotate(-45deg); }


/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 44px;
    padding: 0 1.375rem;
    border-radius: var(--r-pill);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-quiet {
    background: var(--surface);
    color: var(--ink);
}

.btn-quiet:hover { background: var(--surface-2); }

.btn-sm {
    height: 36px;
    padding: 0 1rem;
    font-size: 0.875rem;
}

.btn svg { flex-shrink: 0; }


/* ---------- Page headers ---------- */
.page-head {
    padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 3.5rem);
}

.page-head--center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page-title {
    font-size: clamp(3rem, 8vw, 5.25rem);
    line-height: 1;
    letter-spacing: -0.015em;
}

.page-deck {
    margin-top: 1.25rem;
    max-width: 52ch;
    font-size: clamp(1rem, 1.6vw, 1.125rem);
    color: var(--ink-2);
}

.page-head--center .page-deck { margin-inline: auto; }

.page-head--center .hero-subjects { margin-top: 1.25rem; }

.about-lead {
    max-width: 62ch;
    line-height: 1.7;
}

.section {
    padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

.section--flush,
.section + .section { padding-top: 0; }
.section--end { padding-bottom: 0; }

.page-end { padding-bottom: clamp(3.5rem, 9vw, 7rem); }

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.section-title {
    font-size: clamp(1.875rem, 3.6vw, 2.625rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
}


/* ---------- Entry cards ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(0.75rem, 1.6vw, 1.25rem);
}

.card-grid > * { grid-column: span 2; }
.card-grid[data-count="2"] > * { grid-column: span 3; }
.card-grid[data-count="1"] > * { grid-column: 1 / -1; }

.entry-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--ink);
    transition: background-color var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}

.entry-card:hover {
    background: var(--surface-2);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

.entry-card-media {
    aspect-ratio: 4 / 3;
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--surface-2);
}

.entry-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-out);
}

.entry-card:hover .entry-card-media img { transform: scale(1.04); }

.entry-card-media--empty {
    display: grid;
    place-items: center;
    color: var(--ink-3);
    background: var(--surface-2);
}

.entry-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 1.125rem 0.875rem 0.875rem;
    flex: 1;
}

.entry-card-title {
    font-size: 1.1875rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
    font-weight: 600;
}

.entry-card-title a::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.entry-card-title a:focus-visible { outline: none; }
.entry-card:has(.entry-card-title a:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.entry-card-meta {
    margin-top: auto;
    padding-top: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--ink-3);
}

.entry-card-meta a {
    position: relative;
    z-index: 1;
    color: var(--ink-2);
    font-weight: 500;
    transition: color var(--t-fast);
}

.entry-card-meta a:hover { color: var(--ink); }

.dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}

.chip {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 0.625rem;
    border-radius: var(--r-pill);
    background: var(--accent-2-soft);
    color: var(--accent-2-text);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Feature fill — the one emphasised card */
.entry-card--feature {
    background: var(--feature-bg);
    color: var(--feature-ink);
}

.entry-card--feature:hover { background: var(--feature-bg); }
.entry-card--feature .entry-card-meta { color: var(--feature-ink-2); }
.entry-card--feature .entry-card-meta a { color: var(--feature-ink); }
.entry-card--feature .chip { background: var(--feature-chip); color: var(--feature-ink); }

/* Single item: lay out horizontally */
.card-grid[data-count="1"] .entry-card {
    flex-direction: row;
    align-items: stretch;
}

.card-grid[data-count="1"] .entry-card-media {
    flex: 0 0 58%;
    aspect-ratio: 16 / 10;
}

.card-grid[data-count="1"] .entry-card-body {
    padding: clamp(1.25rem, 3vw, 2.5rem);
    justify-content: center;
}

.card-grid[data-count="1"] .entry-card-title {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    letter-spacing: -0.03em;
}

.card-grid[data-count="1"] .entry-card-meta { margin-top: 0.5rem; }


/* ---------- Empty state ---------- */
.empty-state {
    padding: clamp(3rem, 8vw, 5rem) 1.5rem;
    border-radius: var(--r-lg);
    background: var(--surface);
    text-align: center;
}

.empty-state h3 {
    font-size: 1.125rem;
    margin-bottom: 0.375rem;
}

.empty-state p {
    color: var(--ink-2);
    font-size: 0.9375rem;
}


/* ---------- Pagination ---------- */
.pager {
    margin-top: clamp(2.5rem, 6vw, 4rem);
    display: flex;
    justify-content: center;
}

.pager-inner {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: var(--r-pill);
    background: var(--surface);
}

.pager-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 36px;
    padding: 0 0.875rem;
    border-radius: var(--r-pill);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink);
    transition: background-color var(--t-fast);
}

.pager-link:hover { background: var(--surface-3); }

.pager-link--disabled {
    color: var(--ink-3);
    opacity: 0.55;
    pointer-events: none;
}

.pager-current {
    height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.875rem;
    border-radius: var(--r-pill);
    background: var(--pill-active);
    box-shadow: var(--shadow-pill);
    color: var(--ink);
}


/* ---------- Home ---------- */
.hero {
    padding-block: clamp(3.5rem, 10vw, 7.5rem) clamp(2.5rem, 6vw, 4.5rem);
    text-align: center;
}

.hero-title {
    font-size: clamp(3.5rem, 12vw, 6rem);
    line-height: 0.98;
    letter-spacing: -0.015em;
}

.hero-subjects {
    margin-top: 1.25rem;
    font-size: clamp(1.125rem, 2.2vw, 1.375rem);
    font-weight: 500;
    letter-spacing: -0.015em;
    color: var(--ink);
}

.hero-subjects span { color: var(--accent-2); }

.hero-desc {
    margin: 1rem auto 0;
    max-width: 46ch;
    color: var(--ink-2);
    font-size: 1rem;
}

.hero-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.text-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--link);
    white-space: nowrap;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 0.3em;
    transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

.text-link:hover {
    color: var(--link);
    text-decoration-color: currentColor;
}

/* Hero: Codex fills the banner */
.home-hero--full {
    padding-top: clamp(1.25rem, 4vw, 2.5rem);
}

/* The nav already carries the wordmark, so the masthead leads with the
   subject line instead of repeating it. */
.masthead {
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.masthead-title {
    font-size: clamp(2.25rem, 5.5vw, 4.25rem);
    line-height: 1;
    letter-spacing: -0.015em;
    white-space: nowrap;
}

/* Subject-line stops: glacier, the wayfinding accent. */
.hero-title .stop,
.masthead-title .stop { color: var(--accent-2); }

/* Hero: 1–2 Codex entries beside the intro */
.home-hero--split {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
    padding-top: clamp(2.5rem, 7vw, 5rem);
}

.home-hero--split .hero-title { font-size: clamp(3rem, 7vw, 5.25rem); }
.home-intro .hero-desc { margin-left: 0; }
.home-intro .hero-actions { justify-content: flex-start; }

/* Featured Codex slider */
.feature {
    container-type: inline-size;
}

.feature-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    gap: 1rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    border-radius: var(--r-xl);
}

.feature-track::-webkit-scrollbar { display: none; }

.slide {
    --go-bg: var(--accent-ink);
    --go-ink: var(--accent);
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    padding: 10px;
    border-radius: var(--r-xl);
    background: var(--feature-bg);
    color: var(--feature-ink);
    scroll-snap-align: start;
}

html[data-theme="light"] .slide {
    --go-bg: var(--accent);
    --go-ink: var(--accent-ink);
}

.slide-media {
    aspect-ratio: 16 / 9;
    border-radius: calc(var(--r-xl) - 10px);
    overflow: hidden;
    background: var(--feature-chip);
}

.slide-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s var(--ease-out);
}

.slide:hover .slide-media img { transform: scale(1.03); }

.slide-media.is-empty img { display: none; }

.slide-media-empty,
.slide-media.is-empty::after {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--feature-ink-2);
}

.slide-media.is-empty::after { content: ''; }

.slide-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1.25rem 0.875rem 0.875rem;
}

.slide .chip {
    background: var(--feature-chip);
    color: var(--feature-ink);
}

.slide-title {
    font-size: clamp(1.75rem, 2.8cqi + 0.75rem, 2.875rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.slide-title a::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.slide-title a:focus-visible { outline: none; }

.slide:has(.slide-title a:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.slide-excerpt {
    max-width: 44ch;
    color: var(--feature-ink-2);
    font-size: 0.9375rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.slide-foot {
    margin-top: auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    padding-top: 0.5rem;
}

.slide-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--feature-ink-2);
}

.slide-meta span:first-child { color: var(--feature-ink); font-weight: 500; }

.slide-go {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 40px;
    padding: 0 1.125rem;
    border-radius: var(--r-pill);
    background: var(--go-bg);
    color: var(--go-ink);
    font-size: 0.875rem;
    font-weight: 500;
}

.slide-go svg { transition: transform var(--t-base) var(--ease-out); }
.slide:hover .slide-go svg { transform: translateX(3px); }

@container (min-width: 760px) {
    .slide {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
        grid-template-rows: none;
        min-height: clamp(400px, 46cqi, 540px);
    }

    .slide-media { aspect-ratio: auto; }

    .slide-panel {
        justify-content: flex-end;
        padding: clamp(1.75rem, 3.5cqi, 2.75rem);
    }
}

.feature-bar {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
}

.feature-tabs {
    flex: 1 1 22rem;
    min-width: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0.375rem;
}

.feature-tab {
    position: relative;
    min-width: 0;
    padding: 0.75rem 0.875rem 1.125rem;
    border-radius: var(--r-md);
    text-align: left;
    color: var(--ink-3);
    transition: background-color var(--t-fast), color var(--t-fast);
}

.feature-tab:hover { background: var(--surface); color: var(--ink-2); }
.feature-tab.is-active { background: var(--surface); color: var(--ink); }

.feature-tab-title {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feature-tab-progress {
    position: absolute;
    left: 0.875rem;
    right: 0.875rem;
    bottom: 0.5rem;
    height: 2px;
    border-radius: 2px;
    background: var(--line-strong);
    overflow: hidden;
}

.feature-tab-progress::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--signal);
    transform: scaleX(0);
    transform-origin: left;
}

.feature-tab.is-active .feature-tab-progress::after { transform: scaleX(1); }

.feature.is-playing .feature-tab.is-active .feature-tab-progress::after {
    animation: feature-progress var(--feature-dur, 7s) linear both;
}

.feature.is-paused .feature-tab.is-active .feature-tab-progress::after {
    animation-play-state: paused;
}

@keyframes feature-progress {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.feature-pause { flex: none; }
.feature-play-icon { display: none; }
.feature.is-paused .feature-pause-icon { display: none; }
.feature.is-paused .feature-play-icon { display: block; }

.feature-all { margin-left: auto; }

@container (max-width: 599px) {
    .feature-tabs { flex-basis: 100%; order: -1; }
    .feature-tab { padding: 0.875rem 0; }
    .feature-tab:hover,
    .feature-tab.is-active { background: none; }
    .feature-tab-title { display: none; }
    .feature-tab-progress { left: 0; right: 0; bottom: auto; top: 50%; }
    .feature-all { margin-left: auto; }
}

/* Latest blog posts — secondary list */
.home-latest {
    margin-top: clamp(2.5rem, 6vw, 4.5rem);
    padding-top: clamp(1.5rem, 3vw, 2rem);
    border-top: 1px solid var(--line);
}

.section-head--quiet {
    align-items: center;
    margin-bottom: 1rem;
}

.section-title--sm {
    font-size: 1.625rem;
    letter-spacing: -0.005em;
}

.post-rows {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem 1.5rem;
    margin-inline: -0.625rem;
}

.post-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.625rem;
    border-radius: var(--r-md);
    transition: background-color var(--t-fast);
}

.post-row:hover { background: var(--surface); }

.post-row:has(a:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.post-row-thumb {
    flex: none;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-2);
}

.post-row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-row-body { min-width: 0; }

.post-row-title {
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-row-title a::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.post-row-title a:focus-visible { outline: none; }

.post-row-meta {
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--ink-3);
}


/* ---------- Gallery ---------- */
.gallery-head { padding-bottom: clamp(1.5rem, 4vw, 2.5rem); }

/* Justified rows: each tile grows by its aspect ratio (--ar, set from the
   loaded image), so every row fills the width at an even height. */
.justified {
    --row-h: clamp(220px, 24vw, 360px);
    --gap: clamp(0.5rem, 1.2vw, 0.875rem);
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem var(--gap);
}

.justified::after {
    content: '';
    flex-grow: 999999;
}

.j-tile {
    --ar: 1.5;
    flex: calc(var(--ar) * 1000) 1 calc(var(--ar) * var(--row-h));
    max-width: calc(var(--ar) * var(--row-h) * 1.6);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.j-open {
    display: block;
    width: 100%;
    aspect-ratio: var(--ar);
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--surface);
    cursor: zoom-in;
}

.j-open img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.9s var(--ease-out), opacity var(--t-base);
}

.j-open:hover img { transform: scale(1.025); }

.j-open:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.j-caption {
    min-width: 0;
    padding-inline: 0.125rem;
}

.j-title {
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.j-meta {
    margin-top: 0.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
}

.j-meta span:not(.dot) {
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ---------- Lightbox ---------- */
html.lightbox-open body {
    position: fixed;
    inset-inline: 0;
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: rgba(5, 9, 13, 0.96);
    color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--t-base) var(--ease-out), visibility var(--t-base);
}

@supports (backdrop-filter: blur(1px)) {
    .lightbox {
        background: rgba(5, 9, 13, 0.88);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px));
}

.lightbox-bar--top {
    justify-content: space-between;
    padding-top: max(0.875rem, env(safe-area-inset-top, 0px));
    padding-bottom: 0.5rem;
}

.lightbox-bar--bottom {
    justify-content: center;
    gap: clamp(0.75rem, 3vw, 1.5rem);
    padding-top: 0.5rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
}

.lightbox-count {
    color: rgba(255, 255, 255, 0.6);
}

.lightbox-stage {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem var(--gutter);
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

.lightbox-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--r-sm);
    box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.6);
    transform: scale(0.98);
    opacity: 0;
    transition: transform 0.5s var(--ease-out), opacity var(--t-base) var(--ease-out);
}

.lightbox.active .lightbox-stage:not(.is-loading) .lightbox-img {
    transform: none;
    opacity: 1;
}

.lightbox-stage.is-loading {
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.06) 0 24px, transparent 25px) center / 100% 100% no-repeat;
}

.lightbox-caption {
    flex: 0 1 28rem;
    min-width: 0;
    text-align: center;
}

.lightbox-caption-title {
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox-caption-meta {
    margin-top: 0.125rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox-btn {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: var(--r-pill);
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transition: background-color var(--t-fast), opacity var(--t-fast);
}

.lightbox-btn:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-btn:disabled { opacity: 0.25; cursor: default; }
.lightbox-btn:disabled:hover { background: rgba(255, 255, 255, 0.1); }

.lightbox.is-single .lightbox-nav { visibility: hidden; }


/* ---------- Article (post & guide detail) ---------- */
.article-head {
    padding-block: clamp(3rem, 8vw, 5.5rem) clamp(2rem, 5vw, 3rem);
    text-align: center;
}

.article-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1.5rem;
}

.article-tags .chip { background: var(--accent-2-soft); }

.article-title {
    max-width: 20ch;
    margin-inline: auto;
    font-size: clamp(2.5rem, 6.5vw, 4.5rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.article-meta {
    margin-top: 1.75rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    color: var(--ink-3);
    font-size: 0.875rem;
}

.byline {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    height: 40px;
    padding: 0 1rem 0 4px;
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--ink);
    font-weight: 500;
    transition: background-color var(--t-fast);
}

.byline:hover { background: var(--surface-2); }

.avatar {
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-3);
    color: var(--ink-2);
    display: grid;
    place-items: center;
    font-weight: 600;
}

.avatar--sm { width: 32px; height: 32px; font-size: 0.8125rem; }
.avatar--md { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar--lg { width: 88px; height: 88px; font-size: 2rem; }

/* A little wider than the 42rem text column, so it frames the body
   instead of dwarfing it. */
.article-banner {
    width: min(52rem, 100% - 2 * var(--gutter));
    margin: 0 auto clamp(2.5rem, 6vw, 3.5rem);
    aspect-ratio: 16 / 9;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--surface);
}

.article-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-body-wrap {
    width: min(42rem, 100% - 2 * var(--gutter));
    margin-inline: auto;
    padding-bottom: clamp(3rem, 8vw, 5rem);
}

/* Markdown body */
.post-body {
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--ink-2);
}

.post-body > * + * { margin-top: 1.25em; }

.post-body p,
.post-body li { color: var(--ink-2); }

.post-body strong { color: var(--ink); font-weight: 600; }

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
    color: var(--ink);
    margin-top: 2.25em;
    letter-spacing: -0.025em;
}

.post-body h1 + *,
.post-body h2 + *,
.post-body h3 + *,
.post-body h4 + * { margin-top: 0.75em; }

.post-body h1 { font-size: 2.375rem; line-height: 1.05; letter-spacing: 0; }
.post-body h2 { font-size: 2rem; line-height: 1.1; letter-spacing: 0; }
.post-body h3 { font-size: 1.5625rem; line-height: 1.15; letter-spacing: 0; }
.post-body h4 { font-size: 1.125rem; }

.post-body a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
    transition: text-decoration-color var(--t-fast);
}

.post-body a:hover { text-decoration-color: currentColor; }

.post-body ul,
.post-body ol { padding-left: 1.4em; }

.post-body li + li { margin-top: 0.4em; }
.post-body li p { margin: 0; }
.post-body li::marker { color: var(--accent-2); }

.post-body blockquote {
    padding: 1.25rem 1.5rem;
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font-size: 1.1875rem;
    line-height: 1.6;
}

.post-body blockquote p { color: inherit; }
.post-body blockquote > * + * { margin-top: 0.75em; }

.post-body code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 0.125em 0.375em;
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
}

.post-body pre {
    padding: 1.125rem 1.25rem;
    border-radius: var(--r-md);
    background: var(--surface);
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

.post-body pre code { padding: 0; background: none; font-size: inherit; }

.post-body hr {
    border: 0;
    height: 1px;
    background: var(--line-strong);
    margin-block: 2.5em;
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    display: block;
    overflow-x: auto;
}

.post-body th,
.post-body td {
    text-align: left;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--line);
}

.post-body th { color: var(--ink); font-weight: 600; }

.post-body img,
.inline-image {
    width: 100%;
    border-radius: var(--r-md);
    background: var(--surface);
}

.post-body p:has(> img:only-child) { margin-block: 2em; }

.inline-image-container { margin-block: 2em; }

/* Photo set inside an entry */
.post-gallery {
    margin-top: clamp(3rem, 7vw, 4.5rem);
}

.post-gallery-title {
    font-size: 1.875rem;
    letter-spacing: -0.005em;
    margin-bottom: 1.25rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.625rem;
}

.gallery-grid .gallery-item {
    display: block;
    width: 100%;
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--surface);
    cursor: zoom-in;
}

.gallery-grid .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-out);
}

.gallery-grid .gallery-item:hover img { transform: scale(1.05); }

/* Author card at the foot of an entry */
.author-card {
    margin-top: clamp(3rem, 7vw, 4.5rem);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    border-radius: var(--r-lg);
    background: var(--surface);
}

.author-card-info {
    flex: 1;
    min-width: 0;
}

.author-card-name {
    font-size: 1.0625rem;
    letter-spacing: -0.015em;
}

.author-card-about {
    margin-top: 0.25rem;
    font-size: 0.9375rem;
    color: var(--ink-2);
    line-height: 1.5;
}

.author-card-about a { color: var(--link); }

.back-row {
    margin-top: 2rem;
    display: flex;
}


/* ---------- About ---------- */
/* Contributors lead the page; the section links sit below as a quiet list. */
.contributors {
    padding-top: clamp(0.5rem, 2vw, 1.5rem);
}

.people {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: clamp(0.75rem, 1.6vw, 1.25rem);
}

.people[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.person {
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-radius: var(--r-lg);
    background: var(--surface);
}

/* The photo is the plate: a tall portrait filling the top, inset 10px with
   concentric 16px corners. It links to the profile (the name is the
   accessible link; this one is a pointer-only duplicate). */
.person-photo {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 5;
    border-radius: var(--r-md);
    overflow: hidden;
    background:
        radial-gradient(90% 70% at 30% 20%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
        radial-gradient(80% 60% at 80% 90%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 70%),
        var(--surface-2);
}

.person-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-out);
}

.person:hover .person-photo img { transform: scale(1.03); }

.person-photo span {
    font-family: var(--font-display);
    font-size: clamp(5rem, 9vw, 7rem);
    font-weight: 600;
    font-stretch: 105%;
    line-height: 1;
    color: var(--ink);
}

.person-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    padding: 0 clamp(0.875rem, 2vw, 1.25rem) clamp(1rem, 2vw, 1.25rem);
}

.person-name {
    margin-top: 1.25rem;
    font-size: clamp(2.125rem, 3.8vw, 2.875rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.person-name a {
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.14em;
    transition: text-decoration-color var(--t-fast);
}

.person-name a:hover { text-decoration-color: currentColor; }

.person-stats {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--ink-3);
}

.person-stats b {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    font-feature-settings: 'tnum';
    color: var(--accent-2-text);
}

.person-bio {
    margin-top: 1rem;
    max-width: 60ch;
    color: var(--ink-2);
    font-size: 1rem;
    line-height: 1.65;
}

.person-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1.5rem;
}

.person .btn-quiet,
.person .social-pill { background: var(--surface-2); }

.person .btn-quiet:hover,
.person .social-pill:hover { background: var(--surface-3); }

.person .btn svg { transition: transform var(--t-fast) var(--ease-out); }
.person .btn:hover svg { transform: translateX(2px); }

/* One contributor: a single wide plate, photo beside the text. */
.people[data-count="1"] { grid-template-columns: 1fr; }

.people[data-count="1"] .person {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    align-items: stretch;
}

.people[data-count="1"] .person-photo {
    aspect-ratio: auto;
    min-height: 28rem;
}

.people[data-count="1"] .person-body {
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
}

.people[data-count="1"] .person-name {
    margin-top: 1.25rem;
    font-size: clamp(2.75rem, 5.5vw, 4rem);
    letter-spacing: -0.005em;
}

.people[data-count="1"] .person-bio { font-size: 1.0625rem; }

/* Sections: secondary, a hairline-topped list rather than cards */
.sections {
    margin-top: clamp(3rem, 7vw, 5rem);
    padding-top: clamp(1.5rem, 3vw, 2rem);
    border-top: 1px solid var(--line);
}

.section-links {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem 1.5rem;
    margin-inline: -0.875rem;
}

.section-link {
    position: relative;
    padding: 0.875rem;
    border-radius: var(--r-md);
    transition: background-color var(--t-fast);
}

.section-link:hover { background: var(--surface); }

.section-link:has(a:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.section-link a:focus-visible { outline: none; }

.section-link-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
}

.section-link-title a::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.section-link-title svg {
    color: var(--ink-3);
    transition: transform var(--t-fast) var(--ease-out), color var(--t-fast);
}

.section-link:hover .section-link-title svg {
    color: var(--link);
    transform: translateX(3px);
}

.section-link-desc {
    margin-top: 0.375rem;
    color: var(--ink-2);
    font-size: 0.875rem;
    line-height: 1.55;
}


/* ---------- Author profile ----------
   Front and centre: a large rectangular photo straddles the bottom edge of a
   clean banner, half over it and half below, cut out by a page-ground ring.
   Name, bio and links stack centred beneath it. */
.profile {
    --photo-w: clamp(220px, 26vw, 320px);
    --photo-hang: calc(var(--photo-w) * 2 / 3); /* half the 3:4 photo's height */
    display: grid;
    justify-items: center;
    padding-top: clamp(1rem, 3vw, 2rem);
}

.profile-banner {
    grid-column: 1;
    grid-row: 1;
    justify-self: stretch;
    aspect-ratio: 3 / 1;
    min-height: 300px;
    border-radius: var(--r-xl);
    overflow: hidden;
    background:
        radial-gradient(60% 80% at 20% 40%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%),
        radial-gradient(50% 70% at 85% 70%, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 70%),
        var(--surface);
    animation: banner-in 1.2s var(--ease-out) both;
}

.profile-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo {
    grid-column: 1;
    grid-row: 1;
    z-index: 1;
    align-self: end;
    width: var(--photo-w);
    margin-bottom: calc(-1 * var(--photo-hang));
    aspect-ratio: 3 / 4;
    border-radius: var(--r-xl);
    object-fit: cover;
    background: var(--surface-3);
    color: var(--ink);
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: clamp(5rem, 10vw, 8rem);
    font-weight: 600;
    box-shadow: 0 0 0 10px var(--bg), var(--shadow-portrait);
    animation: photo-in 1s var(--ease-out) 150ms both;
}

.profile-text {
    grid-column: 1;
    grid-row: 2;
    max-width: 44rem;
    padding-top: calc(var(--photo-hang) + clamp(1.75rem, 3vw, 2.5rem));
    text-align: center;
}

.profile-name {
    font-size: clamp(2.5rem, 5.5vw, 4rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.profile-about {
    margin-top: 1.25rem;
    color: var(--ink-2);
    font-size: 1.125rem;
    line-height: 1.7;
}

.profile-about > * + * { margin-top: 0.875em; }
.profile-about a { color: var(--link); text-decoration: underline; text-underline-offset: 0.2em; }

.profile-actions {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.profile .social-pill--icon { width: 44px; height: 44px; }
.profile .social-pill--icon img { width: 22px; height: 22px; }

/* Posts sit below as a quiet, hairline-topped list so the profile leads. */
.author-posts {
    margin-top: clamp(2.5rem, 6vw, 4rem);
    padding-top: clamp(1.5rem, 3vw, 2rem);
    border-top: 1px solid var(--line);
}

.empty-state--compact {
    padding: 1.5rem;
    text-align: left;
}

@keyframes banner-in {
    from { opacity: 0; }
}

@keyframes photo-in {
    from { opacity: 0; transform: translateY(24px); }
}

.social-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 36px;
    padding: 0 0.875rem 0 0.5rem;
    border-radius: var(--r-pill);
    background: var(--surface);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color var(--t-fast);
}

.social-pill:hover { background: var(--surface-2); }

.social-pill--icon {
    width: 36px;
    padding: 0;
    justify-content: center;
}

.social-pill img {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #fff;
}


/* ---------- Footer ---------- */
.footer {
    position: relative;
    isolation: isolate;
    background: var(--footer-bg);
    color: #fff;
    overflow: hidden;
}

/* Monochrome range rising behind the footer; fades out before it reaches the links. */
.footer::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--footer-art) center 30% / cover no-repeat;
    filter: grayscale(1) contrast(1.15) brightness(0.9);
    opacity: 0.2;
    -webkit-mask-image: linear-gradient(to bottom, transparent 20%, #000 70%);
    mask-image: linear-gradient(to bottom, transparent 20%, #000 70%);
    pointer-events: none;
}

/* Three bands: statement + index on black, the range left clear, a quiet base row on the ridgeline. */
.footer-inner {
    width: min(var(--wrap), 100% - 2 * var(--gutter));
    margin-inline: auto;
    padding-top: clamp(3.5rem, 9vw, 6rem);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.75rem 3rem;
}

.footer-tagline {
    font-size: clamp(2rem, 4.8vw, 3.5rem);
    letter-spacing: -0.005em;
    line-height: 1;
    text-wrap: balance;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 2rem;
    font-size: 0.9375rem;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: rgba(255, 255, 255, 0.62);
    transition: color var(--t-fast);
}

.footer-links a:hover { color: #fff; }

.footer-bottom {
    width: min(var(--wrap), 100% - 2 * var(--gutter));
    margin-inline: auto;
    margin-top: clamp(8rem, 20vw, 15rem);
    padding-block: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.58);
}

.footer-totop {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    color: rgba(255, 255, 255, 0.72);
    transition: color var(--t-fast);
}

.footer-totop svg { transition: transform var(--t-fast) var(--ease-out); }
.footer-totop:hover { color: #fff; }
.footer-totop:hover svg { transform: translateY(-2px); }

@media (max-width: 640px) {
    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 0 1.5rem;
        font-size: 1rem;
    }

    .footer-bottom { margin-top: 9rem; }
}

@media (prefers-reduced-motion: reduce) {
    .footer-totop svg { transition: none; }
}


/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .home-hero--split { grid-template-columns: 1fr; }
    .post-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card-grid > *,
    .card-grid[data-count="2"] > * { grid-column: span 3; }
    .card-grid[data-count="3"] > :first-child { grid-column: 1 / -1; }
    .card-grid[data-count="3"] > :first-child .entry-card-media { aspect-ratio: 16 / 9; }
    /* Tablet: each contributor becomes a row, photo left, so cells stay
       short and no plate is left orphaned in a two-column grid. */
    .people,
    .people[data-count="2"] { grid-template-columns: 1fr; }
    .person,
    .people[data-count="1"] .person {
        display: grid;
        grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
        align-items: stretch;
    }
    .person-photo,
    .people[data-count="1"] .person-photo { aspect-ratio: 4 / 5; min-height: 0; }
    .person-body,
    .people[data-count="1"] .person-body { justify-content: center; padding: clamp(1rem, 3vw, 1.75rem); }
    .person-name { margin-top: 0; }
    .person-actions { margin-top: 0; }
    .section-links { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 860px) {
    :root { --nav-h: 64px; }

    .nav-container { grid-template-columns: 1fr auto; }

    .nav-toggle { display: grid; }

    .nav-links {
        position: fixed;
        inset: var(--nav-h) 0 auto 0;
        height: calc(100dvh - var(--nav-h));
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        padding: 1rem var(--gutter) 2rem;
        border-radius: 0;
        background: var(--bg);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out), visibility var(--t-base);
    }

    .nav-links.active {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .nav-link {
        height: 56px;
        padding: 0 1rem;
        font-size: 1.5rem;
        font-weight: 600;
        letter-spacing: -0.03em;
        border-radius: var(--r-md);
    }

    .nav-link[aria-current] {
        background: var(--surface);
        box-shadow: none;
    }

    .navbar.menu-open::before { opacity: 1; }
}

@media (max-width: 640px) {
    .j-tile { flex-basis: 100%; max-width: none; }
    .post-rows { grid-template-columns: 1fr; }
    .card-grid > *,
    .card-grid[data-count] > * { grid-column: 1 / -1; }

    .card-grid[data-count="1"] .entry-card { flex-direction: column; }
    .card-grid[data-count="1"] .entry-card-media { flex: none; }
    .card-grid[data-count="1"] .entry-card-body { padding: 1.125rem 0.875rem 0.875rem; }

    .logo-full { display: none; }
    .logo-short { display: inline; }

    .section-head { align-items: center; }

    .article-banner { aspect-ratio: 4 / 3; }

    .author-card { flex-direction: column; align-items: flex-start; }

    .profile { --photo-w: 180px; }
    .profile-banner { aspect-ratio: 2 / 1; min-height: 0; border-radius: var(--r-lg); }
    .profile-photo {
        border-radius: var(--r-lg);
        font-size: 4.5rem;
        box-shadow: 0 0 0 6px var(--bg), var(--shadow-portrait);
    }
    .profile-text { padding-top: calc(var(--photo-hang) + 1.5rem); }

    .footer-links { gap: 0.75rem 2rem; }

    .about-lead { text-align: left; }

    .people[data-count="2"] { grid-template-columns: 1fr; }
    .person,
    .people[data-count="1"] .person { display: flex; }
    .person-photo,
    .people[data-count="1"] .person-photo { aspect-ratio: 1; }
    .person-body,
    .people[data-count="1"] .person-body { justify-content: flex-start; padding: 0 0.875rem 1rem; }
    .person-name { margin-top: 1.25rem; }
    .person-actions { margin-top: auto; }

    .pager-link span { display: none; }
}
