/* Tommy Hegarty - Unified Master Stylesheet */

/* === SELF-HOSTED FONTS ===
   Replaces the old Google Fonts @import (Forum + Poppins). Self-hosted so
   there's no third-party request and no flash of fallback text. */
@font-face {
    font-family: 'IM Fell English';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/im-fell-english-400.woff2') format('woff2');
}
@font-face {
    font-family: 'IM Fell English';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/im-fell-english-400-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'Alegreya Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/alegreya-sans-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Alegreya Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/alegreya-sans-700.woff2') format('woff2');
}

/* === DESIGN TOKENS ===
   Herbarium palette (pressed botanicals: paper ground with a green cast, gold
   for actions, leaf green as counter) on a hard-edged shape language: heavy
   borders and a solid offset shadow with no blur, so cards sit on the page
   like mounted specimens.

   The line color is --line, deliberately NOT the pale sage the palette uses
   for hairlines: a zero-blur offset shadow needs a dark edge or it reads as
   mud. Change the palette here and the whole site follows. */
:root {
    /* grounds + ink */
    --bg: #f6f8f1;
    --surface: #eef3e6;
    --surface-2: #e3ecd6;
    --text: #24301f;
    --text-dim: #56704c;
    --head: #24301f;

    /* the drawn line — borders and offset shadows both */
    --line: #2f3b28;
    --hairline: #b3cca0;

    /* accents: gold acts, leaf green counters */
    --accent: #9c6f00;
    --accent-ink: #fbf8ec;
    --accent-alt: #2f7d43;
    --accent-dim: rgba(156, 111, 0, 0.14);

    /* shape */
    --radius: 2px;
    --border-w: 2px;
    --shadow: 3px 3px 0 var(--line);
    --shadow-sm: 2px 2px 0 var(--line);
    --shadow-accent: 3px 3px 0 var(--accent);

    /* type */
    --font-display: 'IM Fell English', Georgia, serif;
    --font-body: 'Alegreya Sans', system-ui, sans-serif;

    color-scheme: light;
}

/* === GLOBAL RESET & BASE STYLES === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    padding: 5%;
}

/* Paper grain. z-index:-1 keeps it behind content on its own, so we do NOT need
   `body > * { position: relative }` to lift the content above it — that rule
   made .wrapper a containing block and broke the sticky sidebar, which then
   scrolled only as far as .wrapper's bottom instead of tracking the viewport. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    opacity: 0.45;
    background-image:
        repeating-linear-gradient(0deg, rgba(60, 50, 20, 0.035) 0 2px, transparent 2px 4px),
        repeating-linear-gradient(90deg, rgba(60, 50, 20, 0.022) 0 3px, transparent 3px 6px);
}

html {
    scroll-behavior: smooth;
}

/* Headings use the display serif */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--head);
    letter-spacing: -0.01em;
}

/* === GLOBAL ANIMATIONS === */
@keyframes cycleCards {
    0% {
        opacity: 0;
        z-index: 1;
    }
    100% {
        opacity: 1;
        z-index: 2;
    }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

/* === CONTAINERS === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

.gallery-container {
    padding: 2% 5%;
    background-color: var(--bg);
    min-height: 100vh;
}

/* === HEADERS === */
.header, .gallery-header {
    background-color: var(--surface);
    border: var(--border-w) solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    padding-top: 6%;
    padding-bottom: 6%;
    margin-bottom: 5vh;
    position: relative;
    overflow: hidden;
    align-self: stretch;
    scroll-margin-top: 2vh;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><pattern id="grain" width="100" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="5" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="30" cy="15" r="0.3" fill="rgba(255,255,255,0.08)"/><circle cx="60" cy="8" r="0.4" fill="rgba(255,255,255,0.06)"/><circle cx="80" cy="12" r="0.2" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="20" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.header h1, .gallery-header h1 {
    font-family: var(--font-display);
    color: var(--head);
    position: relative;
    z-index: 1;
}

.header p {
    color: var(--text-dim);
    position: relative;
    z-index: 1;
}

/* === NAVIGATION === */
.navigation {
    border: var(--border-w) solid var(--line);
    border-radius: var(--radius);
    background-color: var(--surface);
    box-shadow: var(--shadow);
    padding-top: 6%;
    padding-bottom: 6%;
    text-align: center;
    margin-bottom: 5vh;
    align-self: stretch;
    scroll-margin-top: 2vh;
}

.nav-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 4%;
}

.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: var(--accent);
    color: var(--accent-ink);
    transform: translateY(-2px);
}

.nav-link.active {
    background: var(--accent);
    color: var(--accent-ink);
}

/* === LAYOUT SYSTEMS === */
.wrapper {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-body);
}

.main {
    justify-content: space-between;
    display: flex;
    flex-direction: column;
    row-gap: 5vh;
    width: 74%;
    height: fit-content;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 5vh;
    margin-top: 0;
}

/* === SECTIONS ===
   padding is 8px, NOT the 6% this rule used to declare. In the original
   stylesheet `.card` came later in the cascade and overrode the 6% with 8px on
   every <section class="card">, so 6% never actually rendered. Stating the
   real value directly instead of relying on that override. */
section {
    align-self: stretch;
    scroll-margin-top: 2vh;
    border: var(--border-w) solid var(--line);
    border-radius: var(--radius);
    background-color: var(--surface);
    box-shadow: var(--shadow);
    padding: 8px;
}

.content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5vh;
    padding: 2%;
}

/* Centered heading column, alternating side by markup order — the original
   arrangement. */
.title {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 50%;
    height: 100%;
}

/* flex-start, not space-between: on a column the latter pushes children to the
   top and bottom edges, which stretched the education list into uneven gaps. */
.description {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    line-height: 1.6;
}

/* A flex container turns every direct child into a flex item, so an inline
   <span> mid-sentence gets its own line and breaks the paragraph in two.
   `display: inline` does NOT work here — flex items are blockified, so it
   computes back to block. `contents` is the fix: it removes the box so the
   text reflows into the parent.

   Tradeoff: with the box gone, box styling (background, border, padding) on
   these elements stops applying. Only inherited properties like font-style
   survive, which is all .italic needs. If a span here ever needs a
   background, wrap the whole paragraph in a <p> instead of using this. */
.description > span,
.description > em,
.description > strong,
.description > a {
    display: contents;
}

/* === VISUALIZATION SECTION === */
.visualization-section {
    border: var(--border-w) solid var(--line);
    border-radius: var(--radius);
    background-color: var(--surface);
    box-shadow: var(--shadow);
    padding-top: 6%;
    padding-bottom: 6%;
    position: relative;
    overflow: hidden;
    align-self: stretch;
    scroll-margin-top: 2vh;
}

.visualization-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139,69,19,0.03) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
    z-index: 0;
}

.section-title {
    font-family: var(--font-display);
    color: var(--head);
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

/* === CARDS ===
   NOTE: `section` above already draws the outer card. This rule deliberately
   does NOT include .card in the padding/radius reset, because every top-level
   <section class="card"> would otherwise have its 6% padding overridden by an
   8px one declared later in the cascade. Nested cards only. */
.project-card, .stat-card, .gallery-card, .topic-card {
    border: var(--border-w) solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background-color: var(--surface-2);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    padding: 10px;
}

/* Lift toward the light source so the offset shadow reads as depth, not blur */
.project-card:hover, .stat-card:hover, .gallery-card:hover, .topic-card:hover {
    transform: translate(-1px, -1px);
    box-shadow: var(--shadow-accent);
}

/* Project cards */
.project-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    column-gap: 20px;
    row-gap: 20px;
}

.project-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.project-link {
    text-decoration: none;
    color: inherit;
}

/* display:block so the title and description stack without needing a <br>
   between them — .project-card is already a flex column, so the <br> was just
   adding an empty line's worth of height. */
.project-title {
    display: block;
    font-family: var(--font-display);
    color: var(--head);
    font-size: large;
    line-height: 1.15;
}

.project-description {
    display: block;
    font-size: small;
    color: var(--text-dim);
    margin-top: 4px;
}

/* Stats */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 5vh;
}

.stat-card {
    text-align: center;
}

.stat-number {
    font-family: var(--font-display);
    font-weight: bold;
    color: var(--head);
    line-height: 1;
}

.stat-label {
    color: var(--text-dim);
    margin-top: 0.5rem;
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    padding: 0;
    margin-top: 3rem;
}

.gallery-card {
    overflow: hidden;
    padding: 0;
}

.gallery-card img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}

.gallery-card.landscape {
    grid-column: span 2;
}

.gallery-card.landscape img {
    height: 100%;
    object-fit: cover;
}

.fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease-in forwards;
}

/* Topic cards - display as grid like project cards */
.topic-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.topic-card {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.topic-rank {
    background: var(--accent);
    color: var(--accent-ink);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: bold;
    min-width: fit-content;
}

.topic-name {
    font-family: var(--font-display);
    font-weight: bold;
    color: var(--head);
    flex: 1;
    min-width: 200px;
}

.topic-strength {
    color: var(--text-dim);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.topic-category {
    color: var(--text-dim);
    font-style: italic;
}

.key-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.term {
    background: var(--accent-dim);
    padding: 0.25rem 0.6rem;
    border-radius: 15px;
    color: var(--accent);
    border: 1px solid var(--hairline);
}

.method-badge {
    background: var(--accent);
    color: var(--accent-ink);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-weight: bold;
    font-family: var(--font-display);
    display: inline-block;
    margin-bottom: 1rem;
}

/* === SIDEBAR === */
.sidebar-wrapper {
    width: 20%;
    height: fit-content;
    position: sticky;
    position: -webkit-sticky;
    top: 5%;
    justify-content: space-between;
    display: flex;
    flex-direction: column;
    row-gap: 5vh;
}

/* float:left removed — the parent is a flex column, so the float did nothing
   except risk odd interactions with the sticky wrapper. */
.sidebar {
    border: var(--border-w) solid var(--line);
    border-radius: var(--radius);
    padding: 8%;
    background-color: var(--surface);
    box-shadow: var(--shadow);
    height: fit-content;
}

.sidebar h3 {
    font-family: var(--font-display);
    color: var(--head);
    margin-bottom: 0.75rem;
}

.sidebar-content {
    min-height: 200px;
}

/* The email is a single unbreakable token wider than the sidebar between ~770px
   and the breakpoint, which pushed the whole document sideways. */
.contact {
    font-size: 0.85rem;
    color: var(--text-dim);
    display: block;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* === BUBBLE CLOUD === */
.bubble-cloud {
    position: relative;
    width: 100%;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}


/* === UTILITY CLASSES === */
.italic {
    font-style: italic;
}

.smaller-italic {
    font-style: italic;
    font-size: smaller;
}

.no-selection {
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
    margin: 2rem 0;
}

/* === LISTS === */
.education-list {
    list-style-type: none;
    font-size: small;
}

/* The italic year lines in the education list carry the accent */
.education-list em {
    color: var(--accent);
    font-style: italic;
}

/* The right-aligned detail lines are secondary to the institution name */
.education-list[style*="right"] {
    color: var(--text-dim);
}

/* Institution names in the display serif so each school reads as a heading
   rather than another list row. The <br> spacers in the markup do the spacing. */
.list .education-list:not([style*="right"]):has(+ .education-list em) {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--head);
}

.side-list {
    padding: 3px;
    list-style-type: none;
    vertical-align: middle;
}

.reading-list {
    padding: 5px;
    list-style-type: none;
    vertical-align: middle;
    font-size: small;
    color: var(--text-dim);
}

.reading-list a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--hairline);
}

.reading-list a:hover {
    border-bottom-color: var(--accent);
}

/* === THEATER TABLE ===
   Hairline rules between rows, and the Onstage/Offstage labels promoted to
   accent-colored small caps so the two groups read as headings not rows. */
.role-table td {
    padding: 4px 0;
    vertical-align: baseline;
}

.role-table tr + tr td {
    border-top: 1px solid var(--hairline);
}

.role-table td strong em {
    font-family: var(--font-display);
    font-style: normal;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--accent);
}

/* A group label sits on its own row — no rule above it */
.role-table td:has(strong em) {
    border-top: none;
    padding-top: 14px;
}

/* === BUTTONS === */
.link-list {
    padding-top: 30px;
    padding-bottom: 30px;
}

.permanent-button span {
    display: flex;
    width: fill;
}

/* The border is on the base state, not just :hover — otherwise the button
   grows by 2*--border-w the moment you point at it. */
.rolling-button {
    background-color: var(--surface-2);
    border: var(--border-w) solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    padding: 1% 2%;
    text-align: left;
    text-decoration: none;
    width: 65%;
    display: flex;
    align-items: center;
    column-gap: 8px;
    justify-content: flex-start;
    transition: width 0.35s ease, background-color 0.15s ease, color 0.15s ease;
}

/* Icon and label travel together on the left; space-between was flinging the
   label to the far edge and leaving a gap that read as a rendering bug. */
.rolling-button i {
    flex-shrink: 0;
    font-size: 1.05em;
    opacity: 0.8;
}

.rolling-button span {
    display: inline-flex;
}

.rolling-button:hover,
.rolling-button:focus-visible {
    width: 90%;
    background-color: var(--accent);
    color: var(--accent-ink);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem auto;
    background-color: var(--surface);
    border: var(--border-w) solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    max-width: 400px;
}

.page-btn {
    padding: 0.75rem 1.5rem;
    border: var(--border-w) solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn:hover:not(:disabled) {
    box-shadow: var(--shadow);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-family: var(--font-display);
    font-weight: bold;
}

.loading, .error {
    text-align: center;
    padding: 1rem;
    font-family: var(--font-display);
}

.loading-card {
    max-width: 400px;
    margin: 2rem auto;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--surface-2);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .header h1, .gallery-header h1 {
        font-size: 2.2rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    
    .topic-card {
        padding: 1rem;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .topic-name {
        min-width: auto;
        font-size: 1rem;
    }
    
    .sidebar {
        position: static;
        order: -1;
        width: auto;
        min-width: auto;
    }

    .nav-links {
        flex-direction: column;
        gap: 1rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-card.landscape {
        grid-column: span 1;
    }
    
    .wrapper {
        flex-direction: column;
        gap: 2rem;
    }

    .main {
        width: 100%;
    }

    /* Stack the heading above its text instead of leaving it a half-width
       column. The heading comes first regardless of its source order, since
       half the sections put .title after .description. */
    .content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .title {
        width: 100%;
        order: -1;
        height: auto;
    }

    .sidebar-wrapper {
        width: 100%;
        position: static;
    }

    /* One column: at 430px a 2-up grid leaves ~180px per card, which breaks the
       longer project titles onto four lines. */
    .project-cards {
        grid-template-columns: 1fr;
    }
}
/* === OVERFLOW CONTAINMENT ===
   The theater table's right column holds long production credits. Scroll it
   inside its own wrapper rather than letting the page body scroll sideways.
   (No overflow at present; this is a guard for narrower viewports.) */
.table {
    overflow-x: auto;
    max-width: 100%;
}

/* === DRAMA MASKS ICON ===
   Iconoir has no theater/drama mask (checked all ~1,670 icons in the build),
   so this one is hand-drawn to its conventions: 24x24 viewBox, stroke-width
   1.5, currentColor, round caps/joins. Declared as a mask-image the same way
   iconoir does, so `<i class="icon-drama-masks">` behaves like any other icon
   and inherits color and font-size from the button. */
.icon-drama-masks {
    display: inline-block;
}

.icon-drama-masks::before {
    content: ' ';
    display: block;
    width: 1em;
    height: 1em;
    background: currentColor;
    mask-size: cover;
    -webkit-mask-size: cover;
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' stroke-width='1.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 5C2.5 5 4.5 4.2 7.5 4.2C10.5 4.2 12.5 5 12.5 5C12.5 5 12.5 10.5 12.5 11.8C12.5 15 10.2 17.3 7.5 17.3C4.8 17.3 2.5 15 2.5 11.8C2.5 10.5 2.5 5 2.5 5Z' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M5.3 12.3C5.3 12.3 6.1 13.8 7.5 13.8C8.9 13.8 9.7 12.3 9.7 12.3' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M15 7C16.7 6.8 18.8 7.2 21 8C21 8 20.6 13.4 20.4 14.7C20 17.9 17.5 19.9 14.8 19.6C13.4 19.4 12.3 18.6 11.6 17.5' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M14.5 15.6C14.5 15.6 15.5 14.3 16.9 14.5C18.2 14.6 18.9 16.2 18.9 16.2' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' stroke-width='1.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 5C2.5 5 4.5 4.2 7.5 4.2C10.5 4.2 12.5 5 12.5 5C12.5 5 12.5 10.5 12.5 11.8C12.5 15 10.2 17.3 7.5 17.3C4.8 17.3 2.5 15 2.5 11.8C2.5 10.5 2.5 5 2.5 5Z' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M5.3 12.3C5.3 12.3 6.1 13.8 7.5 13.8C8.9 13.8 9.7 12.3 9.7 12.3' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M15 7C16.7 6.8 18.8 7.2 21 8C21 8 20.6 13.4 20.4 14.7C20 17.9 17.5 19.9 14.8 19.6C13.4 19.4 12.3 18.6 11.6 17.5' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M14.5 15.6C14.5 15.6 15.5 14.3 16.9 14.5C18.2 14.6 18.9 16.2 18.9 16.2' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* === ACCESSIBILITY === */
:where(a, button, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

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

/* === PROJECT BROWSER ===
   A menu beside a detail panel, with no JavaScript: three radio inputs drive
   it and the CSS keys off :checked. Radios also give arrow-key navigation for
   free, since they're a single named group.

   The menu items are .rolling-button (the sidebar component, unmodified — the
   65%->90% rollout, padding, colour and timing are all its own). The panel is
   .project-detail, a component of its own rather than a re-purposed
   .project-card: a grid tile and a detail panel want different things. */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.project-browser {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 1.1rem;
    margin-top: 0.75rem;
    /* reset the fieldset defaults */
    border: 0;
    padding: 0;
    margin-inline: 0;
    min-inline-size: 0;
}

/* the inputs are never seen; the labels are the UI */
.project-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* .link-list's 30px vertical padding is tuned for the sidebar */
.project-browser .link-list {
    padding: 0;
}

/* a <label> is not interactive by default, so it needs the pointer cursor;
   font is inherited already */
.project-browser .rolling-button {
    cursor: pointer;
}

/* The checked item holds the rolled-out width and the accent fill.
   :has() pairs each label with its own input by id, rather than relying on
   nth-of-type/nth-child staying in lockstep — which silently pinned the
   rollout to the first item when the two numbering schemes diverged. */
.project-browser:has(#dndetails:checked) label[for="dndetails"],
.project-browser:has(#paper:checked) label[for="paper"],
.project-browser:has(#website:checked) label[for="website"] {
    width: 90%;
    background-color: var(--accent);
    color: var(--accent-ink);
}

/* the input is hidden, so keyboard focus has to show on its label */
.project-browser:has(#dndetails:focus-visible) label[for="dndetails"],
.project-browser:has(#paper:focus-visible) label[for="paper"],
.project-browser:has(#website:focus-visible) label[for="website"] {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* every panel shares one grid cell, so the stage is as tall as the LONGEST
   description: sized by content, never scrolls, never resizes on switch */
.project-detail-stage {
    display: grid;
}

.project-detail {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1.1rem;
    text-align: center;
    background-color: var(--surface-2);
    border: var(--border-w) solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    /* visibility, not display: a display:none panel contributes no height and
       the stage would collapse to whichever panel is active */
    visibility: hidden;
    pointer-events: none;
}

.project-browser:has(#dndetails:checked) .project-detail:nth-child(1),
.project-browser:has(#paper:checked) .project-detail:nth-child(2),
.project-browser:has(#website:checked) .project-detail:nth-child(3) {
    visibility: visible;
    pointer-events: auto;
}

.project-detail-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--head);
}

/* body reads left-aligned; the title and link stay centred */
.project-detail-body {
    margin: 0;
    flex: 1;
    text-align: left;
    font-size: 0.87rem;
    line-height: 1.62;
    color: var(--text);
}

.project-detail-link {
    align-self: center;
    min-width: 7rem;
    padding: 0.3rem 1.1rem;
    font-size: 0.8rem;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    background-color: var(--surface);
    border: var(--border-w) solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.project-detail-link:hover,
.project-detail-link:focus-visible {
    background-color: var(--accent);
    color: var(--accent-ink);
}

@media (max-width: 768px) {
    .project-browser {
        grid-template-columns: 1fr;
    }
}
