/* ==========================================================================
   Stoicism — a minimal stylesheet inspired by the Greek stoa (colonnade).
   Light mode: limestone & Aegean blue.  Dark mode: basalt & candle-light gold.
   Friendly sans-serif type (Nunito headings, Source Sans 3 text) and soft, rounded boxes.
   ========================================================================== */

:root {
    color-scheme: light;

    /* a soft limestone rather than paper-white, so a bright screen does not glare; every text colour keeps at least
       4.5:1 contrast on the page, the cards and the tinted areas */
    --bg: #e6dfd2;
    --surface: #eee8de;
    --tint: #ddd5c6;
    --ink: #29271f;
    --ink-soft: #55504a;
    --line: #cfc6b5;
    --line-strong: #a69c89;
    --accent: #2a566f;
    --accent-ink: #ffffff;
    --accent-soft: rgba(42, 86, 111, 0.1);
    --glow: rgba(42, 86, 111, 0.08);
    --ok: #345d3d;
    --warn: #854e31;
    --flame: #df9a2f;                          /* candle light: warm in both themes */
    --flame-glow: rgba(223, 154, 47, 0.18);
    --hover: color-mix(in srgb, var(--accent) 7%, var(--surface));   /* a light Aegean wash for hovered cards */
    --shadow: 0 1px 2px rgba(43, 41, 38, 0.04), 0 12px 32px -20px rgba(43, 41, 38, 0.22);
    --shadow-up: 0 2px 4px rgba(43, 41, 38, 0.05), 0 18px 40px -20px rgba(43, 41, 38, 0.3);

    --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-head: "Nunito", "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --radius: 16px;       /* cards, panels */
    --radius-sm: 10px;    /* inputs, small boxes, icon buttons */
    --radius-pill: 999px; /* buttons, chips, badges */

    --container: 1200px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #14161a;
    --surface: #1a1d22;
    --tint: #1b1e23;
    --ink: #ece7dc;
    --ink-soft: #a7a296;
    --line: #2d3138;
    --line-strong: #4a4f58;
    --accent: #d6b36a;
    --accent-ink: #14161a;
    --accent-soft: rgba(214, 179, 106, 0.12);
    --glow: rgba(214, 179, 106, 0.1);
    --ok: #86b595;
    --warn: #d8997a;
    --flame: var(--accent);
    --flame-glow: var(--accent-soft);
    --hover: color-mix(in srgb, var(--accent) 7%, var(--surface));
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -20px rgba(0, 0, 0, 0.7);
    --shadow-up: 0 2px 4px rgba(0, 0, 0, 0.35), 0 18px 40px -20px rgba(0, 0, 0, 0.8);
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5.5rem; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 1.125rem/1.65 var(--font-body);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Smooth cross-fade when the theme is toggled (class is added briefly by stoa.js), unless motion is reduced. */
@media (prefers-reduced-motion: no-preference) {
    html.theme-transition,
    html.theme-transition *,
    html.theme-transition *::before,
    html.theme-transition *::after {
        transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, fill 0.35s ease, stroke 0.35s ease !important;
    }
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-head); font-weight: 750; line-height: 1.2; text-wrap: balance; overflow-wrap: break-word; hyphens: auto; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
code { font-size: 0.9em; }

a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 0.2em; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }

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

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

.skip-link {
    position: absolute; left: 1rem; top: -4rem; z-index: 100;
    padding: 0.6rem 1rem; background: var(--ink); color: var(--bg); text-decoration: none; border-radius: var(--radius-sm);
    font: 700 0.95rem var(--font-head);
}
.skip-link:focus { top: 1rem; }

.container { width: min(var(--container), 100% - 3rem); margin-inline: auto; }
.container.narrow { width: min(760px, 100% - 3rem); }

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

/* ---------- Type helpers ---------- */

.eyebrow {
    font: 750 0.95rem/1.4 var(--font-head);
    color: var(--accent);
    margin-bottom: 0.6rem;
}

/* A Greek word and its Latin-script spelling: "ἀρετή · aretē". */
.greek { font-family: var(--font-body); font-weight: 600; }
.translit { font-family: var(--font-body); font-style: italic; font-weight: 400; color: var(--ink-soft); white-space: nowrap; }
.greek + .translit::before { content: "·"; display: inline-block; margin: 0 0.4em; font-style: normal; color: var(--line-strong); }

h1 {
    font-weight: 800;
    font-size: clamp(2.4rem, 6.5vw, 4.2rem);
    letter-spacing: -0.015em;
    line-height: 1.08;
}

h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); letter-spacing: -0.01em; }
h3 { font-size: 1.3rem; font-weight: 700; }
h4 { font: 750 1rem/1.4 var(--font-head); color: var(--ink-soft); margin: 1.25rem 0 0.4rem; }

.lede { font-size: clamp(1.2rem, 2vw, 1.4rem); line-height: 1.55; color: var(--ink-soft); max-width: 34em; }
.prose p { max-width: 40em; }

/* Links in an introduction or in running text: clearly links, not just darker words. */
.lede a, .section-head p a, .prose a:not(.text-link), .longform p a, .longform li a {
    color: var(--accent); font-weight: 650;
    text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em;
    text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
    transition: text-decoration-color 0.2s, background-color 0.2s;
    border-radius: 4px;
}
.lede a:hover, .section-head p a:hover, .prose a:not(.text-link):hover, .longform p a:hover, .longform li a:hover {
    text-decoration-color: currentColor; background: var(--accent-soft);
}

.text-link {
    font: 700 1rem/1.4 var(--font-head);
    color: var(--accent);
    text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.22em;
    text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
    transition: text-decoration-color 0.2s;
}
.text-link:hover { text-decoration-color: currentColor; }

/* ---------- Buttons & chips ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.75rem 1.35rem;
    font: 750 1rem/1 var(--font-head);
    text-decoration: none;
    color: var(--ink);
    background: transparent;
    border: 1.5px solid var(--ink);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: transparent; color: var(--accent); }
.btn-sm { padding: 0.55rem 1rem; font-size: 0.92rem; }
.btn-ghost { border-color: var(--line-strong); color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.chip {
    display: inline-flex; align-items: baseline; gap: 0.5rem;
    padding: 0.45rem 0.95rem;
    font: 700 0.95rem/1.2 var(--font-head);
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.chip small { font-size: 0.8rem; opacity: 0.7; }
.chip:hover:not(:disabled) { border-color: var(--ink); }
.chip.picked { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip:disabled { cursor: default; }
.chip:disabled:not(.picked) { opacity: 0.4; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 2.5rem; height: 2.5rem;
    background: transparent; color: var(--ink);
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
/* the theme toggle: an unlit candle in light mode, lit in dark mode */
.icon-candle { display: none; }
:root[data-theme="dark"] .icon-candle-unlit { display: none; }
:root[data-theme="dark"] .icon-candle { display: block; }
.icon-candle .flame { fill: var(--flame); stroke: var(--flame); }

/* ---------- Back to top ---------- */

.to-top {
    position: fixed; z-index: 40;
    right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom));
    width: 2.75rem; height: 2.75rem;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    opacity: 0; visibility: hidden; transform: translateY(0.5rem);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s linear 0.25s, border-color 0.2s, color 0.2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
@media print { .to-top { display: none; } }

/* ---------- Header ---------- */

.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
/* with very large text on a narrow screen, the buttons drop to a second row rather than pushing the page sideways */
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 2rem; min-height: 4.25rem; padding-block: 0.4rem; }

.brand { display: inline-flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--accent); }
/* the mark gives way (shrinks) when very large text crowds a narrow header, so the page never scrolls sideways */
.brand-mark { width: 2.35rem; height: 2.35rem; color: var(--accent); }
.brand-name { font: 800 1.35rem/1 var(--font-head); letter-spacing: 0.01em; }

.site-nav { display: flex; gap: 1.9rem; margin-left: auto; }
.site-nav a {
    position: relative;
    padding: 0.4rem 0;
    font: 700 1rem/1 var(--font-head);
    text-decoration: none;
    color: var(--ink-soft);
    transition: color 0.2s;
}
.site-nav a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -0.25rem; height: 2px; border-radius: 2px;
    background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 0.3s var(--ease);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.active { color: var(--accent); }
.site-nav a:hover::after, .site-nav a.active::after { transform: scaleX(1); }

.header-tools { display: flex; align-items: center; gap: 0.6rem; }
.menu-btn { display: none; }
.menu-bars, .menu-bars::before, .menu-bars::after {
    display: block; width: 1.1rem; height: 1.5px; background: currentColor; content: ""; position: relative;
}
.menu-bars::before { position: absolute; top: -5px; }
.menu-bars::after { position: absolute; top: 5px; }

@media (max-width: 73.75em) {
    .header-inner { gap: 1.25rem; }
    .site-nav { gap: 1.1rem; }
    .site-nav a { font-size: 0.95rem; }
}

@media (max-width: 60em) {
    .header-inner { gap: 1rem; }
    .header-tools { margin-left: auto; }
    .menu-btn { display: inline-grid; }
    .site-nav {
        display: none;
        position: absolute; left: 0; right: 0; top: 100%;
        flex-direction: column; gap: 0;
        margin: 0; padding: 0.5rem 1.5rem 1rem;
        background: var(--bg); border-bottom: 1px solid var(--line);
    }
    .site-nav.open { display: flex; }
    .site-nav a { padding: 1rem 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
    .site-nav a:last-child { border-bottom: 0; }
    .site-nav a::after { display: none; }
}

/* ---------- Sections ---------- */

.section-head { max-width: 40rem; margin-bottom: 2.5rem; }
.section-head p:not(.eyebrow) { color: var(--ink-soft); margin-top: 1rem; }
.section-head h2 { margin-bottom: 0; }

/* every page opens the way the home page does: the eyebrow, title and intro centred */
.page-head { padding: clamp(2.75rem, 7vw, 5rem) 0 clamp(1.5rem, 4vw, 2.5rem); text-align: center; }
.page-head h1 { margin-bottom: 1.1rem; font-size: clamp(2.2rem, 5.5vw, 3.5rem); text-wrap: balance; }
.page-head .lede { margin-inline: auto; }
/* centred, a short last line looks like a stray fragment: even out the lines instead. Chromium only balances up to six
   lines, so the longer intros also keep their last two words together (a non-breaking space in the markup). */
.hero .lede, .page-head .lede { text-wrap: balance; }


.grid { display: grid; gap: 1.5rem; }

/* Philosopher cards: centred flow, three across; the last card stands alone like a pediment apex. */
.grid-cards { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 3.25rem 2.5rem; margin-top: 0; }
.grid-cards > .philosopher { flex: 0 1 calc((100% - 5rem) / 3); min-width: 0; }
@media (max-width: 900px) { .grid-cards > .philosopher { flex-basis: calc((100% - 2.5rem) / 2); } }

/* ---------- Hero ---------- */

.hero { position: relative; overflow: hidden; padding: clamp(4rem, 10vw, 7rem) 0 0; text-align: center; }
.hero::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 38rem;
    background: radial-gradient(60% 70% at 50% 0%, var(--glow), transparent 70%);
    pointer-events: none;
}
.hero-inner { position: relative; }
.hero h1 { margin-bottom: 1.5rem; }
.hero .lede { margin-inline: auto; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-top: 2.25rem; }
.hero .container:last-child { position: relative; margin-top: clamp(3rem, 7vw, 5rem); }

.portico { display: block; width: 100%; max-width: 880px; height: auto; margin-inline: auto; color: var(--ink-soft); overflow: visible; }
.portico * { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.portico .solid { fill: var(--bg); }
.portico .portico-glow { stroke: none; fill: var(--flame-glow); }
.portico .portico-candle { fill: var(--bg); }
.portico .portico-flame { stroke: var(--flame); fill: var(--flame); transform-box: fill-box; transform-origin: 50% 100%; animation: flicker 3.4s ease-in-out infinite; }
.portico .col { transform-box: fill-box; transform-origin: 50% 100%; animation: rise 1s var(--ease) both; animation-delay: calc(var(--i) * 110ms + 100ms); }
.portico .portico-roof { animation: settle 1s var(--ease) both; animation-delay: 850ms; }
.portico .portico-steps { animation: fade 1s ease both; }

@keyframes rise { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
@keyframes settle { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes flicker { 0%, 100% { transform: none; } 35% { transform: scale(0.94, 1.07) rotate(-2deg); } 65% { transform: scale(1.05, 0.95) rotate(2deg); } }

/* ---------- Tiles ---------- */

.tile {
    padding: 1.6rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.tile h3 { margin-bottom: 0.6rem; }
.tile p { color: var(--ink-soft); }
.tile-greek { display: flex; flex-direction: column; margin-bottom: 0.6rem; line-height: 1.3; }
.tile-greek .greek { font-size: 1.5rem; color: var(--accent); overflow-wrap: anywhere; }
.tile-greek .translit { font-size: 1rem; }
.tile-greek .greek + .translit::before { content: none; }
.tile-question { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); font-style: italic; color: var(--ink) !important; }

.link-tile {
    display: block; position: relative; padding: 1.4rem 1.5rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
    text-decoration: none; color: var(--ink);
    transition: border-color 0.25s, transform 0.25s var(--ease), background-color 0.25s, box-shadow 0.25s;
}
.link-tile:hover { border-color: var(--accent); transform: translateY(-3px); color: var(--ink); background: var(--hover); box-shadow: var(--shadow-up); }
.link-tile h3 { margin-bottom: 0.4rem; }
.link-tile h3::after { content: " →"; color: var(--accent); }
.link-tile p { color: var(--ink-soft); font-size: 1.02rem; line-height: 1.5; }

/* ---------- Quotes: one card for every quote on the site ---------- */

/* A quote is a rounded box; when it has a source link, the whole box is that link (the "Open on ..." link's
   ::after covers the card), while links and buttons inside it stay clickable above it. */
.quote-list { display: grid; gap: 1rem; max-width: 46rem; margin-top: 1.5rem; }
.quote-item {
    position: relative; margin: 0; padding: 1.2rem 1.4rem; scroll-margin-top: 6rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.quote-item blockquote { margin: 0 0 0.7rem; }
.quote-item blockquote p { margin: 0; font-size: 1.18rem; font-style: italic; line-height: 1.55; color: var(--ink); }
.quote-item.is-link { padding-right: 3rem; }
.quote-item.is-link:hover { border-color: var(--accent); background: var(--hover); box-shadow: var(--shadow-up); }

/* the citation: one line, its parts separated by a dot */
.quote-cite { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0; font-size: 0.98rem; line-height: 1.45; color: var(--ink-soft); }
.quote-cite > .cite-part + .cite-part::before { content: "·"; margin: 0 0.5rem; color: var(--line-strong); }
.quote-author { font: 750 1rem var(--font-head); color: var(--accent); text-decoration: none; }
a.quote-author:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.quote-cite a { padding-block: 0.15rem; } /* a comfortable target above the card's own link */
.quote-source { color: var(--ink-soft); }
a.quote-source-link { color: var(--ink-soft); text-decoration-color: var(--line-strong); }
a.quote-source-link:hover { color: var(--accent); }
/* the link itself is laid over the whole card (out of the citation's line); its arrow sits in the top-right corner */
.quote-open { position: absolute; inset: 0; border-radius: var(--radius); color: var(--accent); text-decoration: none; }
.quote-arrow {
    position: absolute; top: 1.05rem; right: 1.05rem; width: 1.2rem; height: 1.2rem;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    opacity: 0.55; transition: opacity 0.2s, transform 0.2s var(--ease);
}
.quote-item.is-link:hover .quote-arrow, .quote-open:focus-visible .quote-arrow { opacity: 1; transform: translate(2px, -2px); }
.quote-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* links and buttons inside the card stay clickable above the card-sized link */
.quote-item a.quote-author, .quote-item a.quote-source-link, .quote-item .quote-actions > * { position: relative; z-index: 1; }

.quote-badge {
    padding: 0.05rem 0.55rem; border: 1px solid var(--accent); border-radius: var(--radius-pill);
    font: 750 0.78rem/1.5 var(--font-head); color: var(--accent);
}

/* the big one: today's reading */
.quote-featured { max-width: 46rem; padding: 1.6rem 3.25rem 1.6rem 1.75rem; }
.quote-featured blockquote p { font-size: clamp(1.35rem, 2.6vw, 1.8rem); line-height: 1.4; font-weight: 500; }
.quote-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; }

/* a longer passage inside running text (Philosophy, Misconceptions) */
.longform .quote-item { margin: 2rem 0; }
.longform .quote-item blockquote p { font-size: 1.12rem; line-height: 1.65; }

/* ---------- Quote library (Wikiquote) ---------- */

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

.quote-tools { display: grid; gap: 1.25rem; }
.searchbar {
    width: 100%; max-width: 46rem; padding: 0.8rem 1.3rem;
    background: var(--surface); color: var(--ink);
    border: 1px solid color-mix(in srgb, var(--ink-soft) 70%, var(--bg)); border-radius: var(--radius-pill);
    font: 400 1.1rem/1.4 var(--font-body);
    transition: border-color 0.2s;
}
.searchbar::placeholder { color: var(--ink-soft); opacity: 1; }
.searchbar:hover { border-color: var(--ink-soft); }
.searchbar:focus-visible { border-color: var(--accent); outline-offset: 2px; }
.search-tips { margin: -0.5rem 0 0; color: var(--ink-soft); font-size: 1rem; }
.link-btn { padding: 0; background: none; border: 0; color: var(--accent); font: inherit; font-weight: 650; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); cursor: pointer; }
.link-btn:hover { text-decoration-color: currentColor; }
.quote-status { margin: 1rem 0 0; min-height: 1.6em; color: var(--ink-soft); font-size: 1.05rem; }
.quote-note { margin: 0.25rem 0 0; color: var(--ink-soft); font-size: 0.95rem; font-style: italic; }

.notice {
    margin: 1.25rem 0; padding: 1rem 1.25rem;
    background: var(--surface); border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); border-radius: var(--radius-sm);
}
.notice p { margin: 0; }
#all-quotes .notice { max-width: 46rem; }
.notice .btn { margin-top: 0.85rem; }

.quote-group { margin-top: 2.5rem; }
.quote-group-head {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.35rem 1.5rem;
    max-width: 46rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line-strong);
}
.quote-group-head h3 { font-size: clamp(1.35rem, 2.2vw, 1.6rem); }
.quote-group-head .meta { margin: 0; color: var(--ink-soft); font-size: 1.05rem; }
.quote-group-head .meta a { color: var(--accent); }
.quote-license { margin-top: 3.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 1rem; line-height: 1.55; max-width: 46rem; }
.quote-license a { color: inherit; }
.quote-more { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.quote-group .quote-list { margin-top: 0.5rem; }

.quote-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; }
.quote-section { color: var(--ink-soft); font-style: italic; }

/* ---------- Philosophers ---------- */

.era-note { margin: 1.5rem 0 0; color: var(--ink-soft); max-width: 46rem; min-height: 3.3em; }
.era-note strong { color: var(--ink); font-weight: 600; }

.timeline { --label-w: 11rem; position: relative; margin-top: 1.5rem; padding-top: 1.9rem; }
.tl-lines { position: absolute; inset: 0 0 0 var(--label-w); pointer-events: none; }
.tl-lines span { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line); }
.tl-lines em {
    position: absolute; top: 0; left: 0; transform: translateX(-50%); white-space: nowrap;
    font: 700 0.8rem/1 var(--font-head); font-style: normal; color: var(--ink-soft);
}
.tl-lines span:last-child em { transform: translateX(-100%); }
.tl-row {
    position: relative; display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); align-items: center;
    width: 100%; padding: 0.32rem 0; background: none; border: 0; text-align: left; cursor: pointer;
    transition: opacity 0.3s;
}
.tl-name { padding-right: 0.75rem; font-size: 1.05rem; line-height: 1.2; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 0.8rem; }
.tl-bar { position: absolute; top: 0; height: 100%; background: var(--accent); border-radius: var(--radius-pill); opacity: 0.5; transition: opacity 0.2s; }
.tl-bar.era-early { opacity: 0.38; }
.tl-bar.era-middle { opacity: 0.58; }
.tl-bar.era-roman { opacity: 0.8; }
.tl-dates { position: absolute; top: 50%; transform: translateY(-50%); margin-inline: 0.5rem; white-space: nowrap; font-size: 0.85rem; color: var(--ink-soft); opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.tl-row:hover .tl-dates, .tl-row.selected .tl-dates { opacity: 1; }
@media (max-width: 600px) { .tl-dates { display: none; } }
.tl-row:hover .tl-name, .tl-row.selected .tl-name { color: var(--ink); }
.tl-row:hover .tl-bar, .tl-row.selected .tl-bar { opacity: 1; }
.tl-row.selected .tl-name { font-weight: 600; }
.tl-row.dim { opacity: 0.28; }
.tl-row:focus-visible { outline-offset: -2px; }
@media (max-width: 600px) {
    .timeline { --label-w: 8.25rem; }
    .tl-name { font-size: 0.92rem; }
    .tl-lines em { font-size: 0.7rem; }
    /* Fewer axis labels so they don't collide on a phone. */
    .tl-lines span:nth-child(even) em { display: none; }
}

.portrait {
    position: relative; display: block; overflow: hidden;
    width: 100%; max-width: 300px; margin-inline: auto;
    aspect-ratio: 4 / 5;
    background: var(--tint);
    border: 1px solid var(--line-strong);
    border-radius: 50% 50% var(--radius) var(--radius) / 40% 40% var(--radius) var(--radius);
    transition: border-color 0.3s;
}
.philosopher:hover .portrait, .philosopher.selected .portrait { border-color: var(--accent); }

.portrait-fallback { position: absolute; inset: 0; display: grid; place-items: end center; }
.portrait-fallback svg { position: absolute; inset: 8% 8% 0 8%; width: 84%; height: 92%; fill: var(--line); }
.portrait-fallback b { position: relative; margin-bottom: 11%; font: 800 2.2rem/1 var(--font-head); color: var(--ink-soft); }

.portrait img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; object-position: 50% 22%;
    opacity: 0;
    filter: grayscale(0.92) contrast(1.04);
    transition: opacity 0.7s ease, filter 0.5s ease, transform 0.8s var(--ease);
}
.portrait img[data-loaded] { opacity: 1; }
:root[data-theme="dark"] .portrait img { filter: grayscale(0.92) contrast(1.04) brightness(0.88); }
.portrait:hover img, .portrait:focus-visible img { filter: grayscale(0); transform: scale(1.04); }
:root[data-theme="dark"] .portrait:hover img, :root[data-theme="dark"] .portrait:focus-visible img { filter: grayscale(0) brightness(0.92); }

.portrait-cta {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 0.75rem;
    text-align: center;
    font: 750 0.92rem/1 var(--font-head);
    color: var(--bg); background: color-mix(in srgb, var(--ink) 88%, transparent);
    transform: translateY(100%); transition: transform 0.35s var(--ease);
}
.portrait:hover .portrait-cta, .portrait:focus-visible .portrait-cta { transform: none; }
@media (hover: none) { .portrait-cta { transform: none; background: color-mix(in srgb, var(--ink) 70%, transparent); } }

.philosopher-head { padding: 1.25rem 0.25rem 0; text-align: center; }
.era-tag { font: 750 0.88rem/1.3 var(--font-head); color: var(--accent); margin-bottom: 0.35rem; }
.philosopher-head h3 { margin-bottom: 0.2rem; }
.dates { color: var(--ink-soft); font-size: 1rem; margin-bottom: 0.5rem; }
.tagline { font-style: italic; margin-bottom: 1rem; }

.more-btn {
    display: inline-flex; align-items: center; gap: 0.6rem; max-width: 100%; padding: 0.4rem 0; text-align: left;
    background: none; border: 0; border-bottom: 1px solid var(--line-strong); cursor: pointer;
    font: 750 0.95rem/1.2 var(--font-head); color: var(--ink-soft);
    transition: color 0.2s, border-color 0.2s;
}
.more-btn:hover { color: var(--accent); border-color: var(--accent); }
.more-btn i, .acc-item button i { position: relative; width: 0.7rem; height: 0.7rem; flex: none; }
.more-btn i::before, .more-btn i::after, .acc-item button i::before, .acc-item button i::after {
    content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 1.5px; background: currentColor; transition: transform 0.3s var(--ease);
}
.more-btn i::after, .acc-item button i::after { transform: rotate(90deg); }
.more-btn[aria-expanded="true"] i::after, .acc-item.open button i::after { transform: rotate(0); }

.more-panel { margin: 1.25rem 0 0; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; font-size: 1.04rem; line-height: 1.55; animation: fade 0.4s ease both; }
.more-panel p { margin-bottom: 0.8em; }
.origin { color: var(--ink-soft); }
.origin span { font: 750 0.92rem var(--font-head); color: var(--accent); margin-right: 0.4rem; }
.more-panel ul { list-style: none; }
.more-panel li { position: relative; padding-left: 1.1rem; margin-bottom: 0.3rem; }
.more-panel li::before { content: ""; position: absolute; left: 0; top: 0.7em; width: 0.45rem; height: 1px; background: var(--accent); }
.more-panel .text-link { display: inline-block; margin-top: 1.25rem; }

@media (max-width: 600px) {
    .grid-cards { gap: 2.25rem 0; }
    .grid-cards > .philosopher {
        flex-basis: 100%;
        display: grid; grid-template-columns: min(7.5rem, 35%) minmax(0, 1fr); column-gap: 1.25rem; align-items: center;
        padding-bottom: 2.25rem; border-bottom: 1px solid var(--line);
    }
    .grid-cards > .philosopher:last-child { border-bottom: 0; padding-bottom: 0; }
    .philosopher .portrait { margin: 0; }
    .philosopher-head { padding: 0; text-align: left; }
    .philosopher-head h3 { font-size: 1.4rem; }
    .philosopher .more-panel { grid-column: 1 / -1; margin: 1.5rem 0 0; }
    .portrait-cta { padding: 0.45rem; font-size: 0.75rem; }
    .portrait-fallback b { font-size: 1.4rem; }
}

/* ---------- Virtue temple ---------- */

.temple { max-width: 780px; margin: 0 auto; }
.temple-roof { position: relative; height: 4rem; background: var(--line-strong); clip-path: polygon(0 100%, 50% 0, 100% 100%); }
.temple-roof::after { content: ""; position: absolute; inset: 3px 2px 0 2px; background: var(--bg); clip-path: polygon(0 100%, 50% 0, 100% 100%); }
.temple-frieze {
    min-height: 17rem; padding: 2rem clamp(1.25rem, 4vw, 3rem);
    background: var(--surface); border: 1px solid var(--line-strong); border-width: 2px 1px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    text-align: center;
}
.temple-frieze .eyebrow { margin-bottom: 0.4rem; font-size: 1.05rem; }
.temple-frieze .eyebrow .greek { font-size: 1.2em; }
.temple-frieze h3 { font-size: 2rem; margin-bottom: 0.75rem; }
.temple-frieze p { max-width: 36em; margin-inline: auto; }
.try { margin-top: 1.1rem !important; color: var(--ink-soft); }
.acc-panel .try { margin-top: 0 !important; margin-bottom: 0; color: var(--ink); }
.try span { font: 750 0.95rem var(--font-head); color: var(--accent); margin-right: 0.4rem; }
.temple-frieze .quote-item { max-width: 34rem; margin: 1.25rem auto 0; text-align: left; background: var(--bg); }

.temple-columns { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(0.5rem, 2.5vw, 1.75rem); padding: 0 clamp(0.5rem, 2vw, 1.5rem); }
.column { display: flex; flex-direction: column; align-items: center; padding: 0; background: none; border: 0; cursor: pointer; transition: transform 0.3s var(--ease); }
.column:hover { transform: translateY(-3px); }
.column .cap, .column .base {
    width: 100%; height: 1rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; transition: border-color 0.3s;
}
.column .cap { width: 100%; border-top-width: 2px; }
.column .base { width: 110%; border-bottom-width: 2px; }
.column .shaft {
    position: relative; display: grid; place-items: center;
    width: 76%; height: 14rem;
    background:
        repeating-linear-gradient(90deg, transparent 0 9px, var(--line) 9px 10px),
        var(--surface);
    border-inline: 1px solid var(--line-strong);
    transition: border-color 0.3s;
}
.column .label {
    padding: 0.8rem 0.25rem; background: var(--surface);
    writing-mode: vertical-rl; transform: rotate(180deg);
    font: 750 1rem/1 var(--font-head); letter-spacing: 0.06em; color: var(--ink-soft);
    transition: color 0.3s;
}
.column:hover .label { color: var(--ink); }
.column.active .cap, .column.active .base, .column.active .shaft { border-color: var(--accent); }
.column.active .shaft {
    background:
        repeating-linear-gradient(90deg, transparent 0 9px, var(--accent-soft) 9px 10px),
        linear-gradient(var(--accent-soft), var(--accent-soft)),
        var(--surface);
}
.column.active .label { color: var(--accent); font-weight: 800; }
@media (max-width: 520px) { .column .base { width: 104%; } .column .shaft { height: 11rem; } .column .label { letter-spacing: 0.03em; font-size: 0.85rem; } .temple-frieze { min-height: 23rem; } }

.steps { display: grid; }
.steps i { display: block; height: 0.55rem; background: var(--surface); border: 1px solid var(--line-strong); border-top: 0; }
/* each step juts out a little further, but never beyond the page gutter (1.5rem), or the page scrolls sideways */
.steps i:nth-child(1) { margin-inline: max(-1.2%, -0.5rem); }
.steps i:nth-child(2) { margin-inline: max(-2.4%, -1rem); }
.steps i:nth-child(3) { margin-inline: max(-3.6%, -1.5rem); }

/* ---------- Control sorter ---------- */

.sort-list { list-style: none; display: grid; gap: 0.6rem; max-width: 46rem; }
.sort-item { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem 1.5rem; align-items: center; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color 0.3s, background-color 0.3s; }
.sort-text { margin: 0; font-size: 1.15rem; }
.sort-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sort-note { grid-column: 1 / -1; margin: 0.25rem 0 0; color: var(--ink-soft); font-size: 1.02rem; animation: fade 0.4s ease both; }
.sort-item.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--surface)); }
.sort-item.wrong { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.sort-item.right .sort-note strong { color: var(--ok); }
.sort-item.wrong .sort-note strong { color: var(--warn); }
.sort-item.right .chip.picked { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.sort-item.wrong .chip.picked { background: var(--warn); border-color: var(--warn); color: var(--bg); }
.sort-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; max-width: 46rem; margin-top: 1.25rem; color: var(--ink-soft); }
.sort-footer p { margin: 0; }
.sort-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sort-set { margin: 0 0 0.75rem; font: 750 0.95rem var(--font-head); color: var(--accent); }
.sort-footer strong { color: var(--ink); }
@media (max-width: 560px) { .sort-item { grid-template-columns: 1fr; } }

/* ---------- Accordion ---------- */

.accordion { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem; max-width: 46rem; }
.acc-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color 0.2s; }
.acc-item.open { border-color: var(--line-strong); }
.acc-item h3 { font-size: inherit; font-weight: inherit; }
.acc-item button {
    display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) auto; align-items: center; width: 100%;
    padding: 1rem 1.25rem; background: none; border: 0; border-radius: var(--radius); text-align: left; cursor: pointer; transition: color 0.2s;
}
.acc-item button:hover { color: var(--accent); }
.acc-num { font: 800 0.95rem var(--font-head); color: var(--accent); }
.acc-title { font: 750 1.2rem/1.25 var(--font-head); text-wrap: balance; overflow-wrap: break-word; hyphens: auto; }
.acc-panel { padding: 0 1.25rem 1.25rem 4rem; animation: fade 0.4s ease both; }
.acc-panel p { max-width: 38em; }
.acc-panel .try { margin-top: 0; }
/* an interactive page inside a practice (the view from above: The Scale of the Universe) */
.embed { max-width: 40rem; margin: 1.25rem 0 0; }
.embed iframe {
    display: block; width: 100%; aspect-ratio: 4 / 3; min-height: 20rem; border: 1px solid var(--line);
    border-radius: var(--radius); background: #000; box-shadow: var(--shadow);
}
.embed figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 1rem; margin-top: 0.6rem; font-size: 0.98rem; color: var(--ink-soft); }
/* under the temple: the virtues are one (Diogenes Laertius 7.125), centred beneath the columns */
.unity-quote { max-width: 40rem; margin: 1.75rem auto 0; }
/* the passage a practice comes from, in the same card as every other quote */
.acc-panel .practice-quote { max-width: 40rem; margin: 1.1rem 0 1.2rem; }
.acc-panel .practice-quote blockquote p { font-size: 1.1rem; }

/* the glossary: a card per word */
.glossary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin: 0; }
.term { padding: 1rem 1.15rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.term dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.4rem; margin-bottom: 0.35rem; }
.term dt .greek { font-size: 1.25rem; color: var(--accent); overflow-wrap: anywhere; }
.term dt .translit { white-space: normal; }
.term dd { margin: 0; color: var(--ink-soft); font-size: 1.02rem; line-height: 1.5; }
@container (max-width: 34rem) { .glossary { grid-template-columns: minmax(0, 1fr); } }
/* phones (and large text): the panel and its quote card give their padding back to the words */
@media (max-width: 32.5em) {
    .acc-panel { padding-left: 1.25rem; overflow-wrap: break-word; }
    /* only the quote's text needs to keep clear of the corner arrow; the citation gets the full width, so it stays on one line */
    .acc-panel .practice-quote { padding: 1rem 1.1rem; }
    .acc-panel .practice-quote blockquote { padding-right: 1.5rem; }
    .acc-panel .practice-quote .quote-arrow { top: 0.9rem; right: 0.85rem; }
}

/* ---------- Resources ---------- */

.resources { max-width: 48rem; }
.res-intro { max-width: 38em; margin: 0.6rem 0 0; color: var(--ink-soft); font-size: 1.08rem; line-height: 1.6; }

.resource-list { list-style: none; margin: 0; border-top: 1px solid var(--line-strong); }
.resource { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 3rem; padding: 1.75rem 0; border-bottom: 1px solid var(--line); }
.resource:last-child { border-bottom: 0; } /* the next group's own rule closes the list */
.resource h3 { margin-bottom: 0.15rem; }
.resource-by { color: var(--ink-soft); font-style: italic; margin-bottom: 0.6rem; }
.resource-main > p:last-child { max-width: 38em; margin-bottom: 0; }
.resource-links { display: flex; flex-direction: column; align-items: flex-end; gap: 0.75rem; justify-content: center; }
.resource-links .text-link { white-space: nowrap; }
@media (max-width: 640px) {
    .resource { grid-template-columns: 1fr; }
    .resource-links { flex-direction: row; flex-wrap: wrap; align-items: flex-start; justify-content: flex-start; gap: 0 1.5rem; }
    .resource-links .text-link { padding-block: 0.85rem 0.8rem; white-space: normal; overflow-wrap: anywhere; } /* at least 44px to tap */
}

/* ---------- Link lists (Philosophy, Misconceptions) ---------- */

.link-list { list-style: none; border-top: 1px solid var(--line-strong); }
.link-list li { border-bottom: 1px solid var(--line-strong); }
.link-list a { display: block; padding: 1rem 0.25rem; text-decoration: none; font: 700 1.1rem/1.4 var(--font-head); transition: padding 0.25s var(--ease), color 0.2s; }
.link-list a:hover { padding-left: 0.75rem; }
.not-found-links { margin-top: 2.25rem; text-align: left; }

/* ---------- Every page: a sticky "Contents" list beside the page's sections ---------- */

.article { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; padding-bottom: 2rem; }
.hero + .article { margin-top: clamp(2.5rem, 6vw, 4rem); }

.toc { position: sticky; top: 6rem; }
.toc-title { margin: 0 0 0.6rem 0.75rem; font: 800 1rem/1.4 var(--font-head); color: var(--ink); }
.toc ol { list-style: none; display: grid; gap: 2px; }
.toc a {
    display: block; padding: 0.45rem 0.75rem; border-radius: var(--radius-sm); text-decoration: none;
    font: 650 1rem/1.3 var(--font-head); color: var(--ink-soft);
    transition: color 0.2s, background-color 0.2s;
}
.toc a:hover { color: var(--ink); background: var(--tint); }
/* the section being read: colour, weight and a bar, so it does not rely on colour alone */
.toc a[aria-current="true"] { color: var(--accent); font-weight: 800; background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
/* a section reached from the contents takes the keyboard focus, without a ring of its own */
.page-body [tabindex="-1"]:focus { outline: none; }

/* narrow screens: the contents become a row of pills above the page */
@media (max-width: 56.25em) {
    .article { grid-template-columns: 1fr; gap: 1.5rem; }
    .toc { position: static; }
    .toc-title { margin-left: 0; }
    .toc ol { display: flex; flex-wrap: wrap; gap: 0.45rem; }
    .toc a { padding: 0.45rem 0.9rem; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); font-size: 0.95rem; }
    .toc a[aria-current="true"] { box-shadow: none; border-color: var(--accent); }
}

/* the sections of a page, divided by a rule (the page's own scroll-padding already clears the header) */
.page-body { min-width: 0; container-type: inline-size; }
.page-body > section { padding-bottom: clamp(2.25rem, 5vw, 3.5rem); }
.page-body > section + section { padding-top: clamp(2.25rem, 5vw, 3.5rem); border-top: 1px solid var(--line); }
.page-body .section-head { margin-bottom: 1.75rem; }
/* three tiles side by side, or stacked: never two and a lonely third */
.page-body .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; }
.page-body .grid-explore { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.page-body .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 46rem; margin-top: 0; }
@container (max-width: 34rem) { .page-body .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@container (max-width: 46rem) { .page-body .grid-3 { grid-template-columns: minmax(0, 1fr); } .page-body .grid-explore { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 30rem) { .page-body .grid-explore { grid-template-columns: minmax(0, 1fr); } }

.longform { max-width: 40rem; font-size: 1.125rem; line-height: 1.75; }
.longform p { margin-bottom: 1.15em; }
.longform a { color: var(--accent); }

.part-head { margin-bottom: 1.75rem; }
.part-head .eyebrow { margin-bottom: 0.5rem; }
.part-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); line-height: 1.2; }

.longform h3 { margin: 2.5rem 0 0.8rem; font-size: 1.4rem; }
.aka { font-family: var(--font-body); font-size: 0.85em; font-weight: 400; font-style: italic; color: var(--ink-soft); }
.lead-in { margin-top: 2.25rem; }
.lead-in strong { color: var(--accent); font-weight: 600; }
.goal { padding-left: 1rem; border-left: 2px solid var(--line-strong); font-style: italic; color: var(--ink-soft); }

.longform ul:not(.link-list) { list-style: none; margin: 0 0 1.4em; }
.longform ul:not(.link-list) li { position: relative; padding-left: 1.2rem; margin-bottom: 0.45rem; }
.longform ul:not(.link-list) li::before { content: ""; position: absolute; left: 0; top: 0.85em; width: 0.5rem; height: 1px; background: var(--accent); }
.passions { margin: 0 0 1.4em; padding-left: 2.4rem; list-style: decimal; }
.passions li { margin-bottom: 0.5rem; padding-left: 0.4rem; }
.passions li::marker { color: var(--accent); font-family: var(--font-head); font-weight: 800; font-size: 0.9em; }

.reading-guide { margin: 1.5rem 0 2.25rem; padding: 1.5rem 1.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 1.06rem; }
.reading-guide strong { color: var(--ink); font-weight: 700; }
.reading-guide p:last-child { margin-bottom: 0; }

.longform .link-list { margin-top: 2rem; }
.link-list a small { display: block; margin-bottom: 0.15rem; font: 750 0.88rem/1.4 var(--font-head); color: var(--accent); }

.diagram { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 2rem; align-items: center; margin: 2.25rem 0; padding: 1.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.circles { display: block; width: 100%; height: auto; }
.ring { stroke: var(--line-strong); stroke-width: 1.5; }
.ring-3 { fill: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.ring-2 { fill: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.ring-1 { fill: color-mix(in srgb, var(--accent) 26%, var(--surface)); stroke: var(--accent); }
.ring-label { font: 800 1.15rem var(--font-head); fill: var(--ink); text-anchor: middle; }
.diagram figcaption ol { list-style: none; margin: 0; }
.diagram figcaption li { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: 0.6rem; margin-bottom: 0.9rem; font-size: 1.04rem; line-height: 1.5; }
.diagram .num { font: 800 1rem/1.6 var(--font-head); color: var(--accent); }
.diagram .source { margin: 1rem 0 0; font-size: 0.95rem; line-height: 1.5; color: var(--ink-soft); }
@media (max-width: 40em) { .diagram { grid-template-columns: 1fr; padding: 1.25rem; } .circles { max-width: 14rem; margin-inline: auto; } }
@container (max-width: 34rem) { .diagram { grid-template-columns: 1fr; } .circles { max-width: 14rem; margin-inline: auto; } }

/* ---------- Footer ---------- */

.site-footer { background: var(--tint); border-top: 1px solid var(--line); }
.meander {
    height: 0.9rem; background: var(--line-strong); opacity: 0.8;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Cpath d='M0 13H4V1H20V9H10V5H15M20 13H28' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") repeat-x center / 28px 100%;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='14' viewBox='0 0 28 14'%3E%3Cpath d='M0 13H4V1H20V9H10V5H15M20 13H28' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") repeat-x center / 28px 100%;
    margin-top: 1.25rem;
}
.footer-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding: 2.5rem 0 2.25rem; }
/* the last line of the footer, centred above the steps */
.footer-credit { margin: 0 auto; padding: 1.1rem 0 1.4rem; border-top: 1px solid var(--line); text-align: center; font-size: 0.95rem; color: var(--ink-soft); }
/* on narrow screens the line reaches the corner: lift it clear of the floating back-to-top button */
@media (max-width: 25em) { .footer-credit { padding-bottom: 2.6rem; } }
/* the full badge ("Stoicism, est. 300 BCE") in the accent colour: beside the site's name on wide footers, above it on
   narrower ones (tablets, phones, large text), so the note keeps a comfortable width and the badge a readable size */
.footer-brand { display: flex; align-items: center; gap: 1.75rem; }
.footer-brand > div { min-width: 0; }
.badge-mark { flex: none; display: block; width: 9rem; height: auto; color: var(--accent); }
@media (max-width: 60em) { .footer-brand { flex-direction: column; align-items: flex-start; gap: 1.25rem; } }
/* Windows high contrast: the logos take the system colours (the header mark the link's) instead of the brand colour */
@media (forced-colors: active) { .brand-mark { color: inherit; } .badge-mark { color: CanvasText; } }
.footer-title { font: 800 1.2rem var(--font-head); margin-bottom: 0.6rem; }
.footer-note { font-size: 1rem; line-height: 1.55; color: var(--ink-soft); max-width: 30em; text-wrap: pretty; }
.footer-right { justify-self: end; }
.site-footer .steps i { border-color: var(--line-strong); background: var(--bg); }
.site-footer .steps { width: min(var(--container), 100% - 3rem); margin-inline: auto; }
@media (max-width: 700px) { .footer-inner { grid-template-columns: 1fr; } .footer-right { justify-self: start; } }

/* ---------- Blazor chrome ---------- */

#blazor-error-ui {
    display: none; position: fixed; z-index: 1000; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
    width: max-content; max-width: calc(100% - 2rem); padding: 0.9rem 3rem 0.9rem 1.5rem;
    background: var(--warn); color: var(--bg); border-radius: var(--radius-sm);
    font-size: 1.02rem;
}
#blazor-error-ui a { color: inherit; margin-left: 1rem; cursor: pointer; }
#blazor-error-ui .dismiss { position: absolute; right: 1rem; top: 0.7rem; font-size: 1.4rem; line-height: 1; text-decoration: none; }

#interactive-notice, #noscript-notice {
    position: fixed; z-index: 1001; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
    width: max-content; max-width: calc(100% - 2rem); padding: 0.9rem 1.5rem;
    background: var(--ink); color: var(--bg); border-radius: var(--radius-sm); font-size: 1.02rem; line-height: 1.45;
}
#interactive-notice[hidden] { display: none; }
#noscript-notice { text-align: center; }
#interactive-notice p { margin: 0; }
#interactive-notice button { margin-left: 0.5rem; padding: 0.2rem 0.7rem; background: transparent; color: inherit; border: 1px solid currentColor; border-radius: var(--radius-pill); cursor: pointer; }

/* the loading screen in index.html, shown while the app downloads and starts (Blazor sets --blazor-load-percentage) */
.app-loading {
    min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 1rem; padding: 2rem;
    color: var(--accent); text-align: center;
}
.app-loading-mark { width: 5.5rem; height: 5.5rem; }
.app-loading-name { margin: 0; font: 800 1.6rem/1 var(--font-head); color: var(--ink); }
.app-loading-bar { width: 10rem; height: 4px; border-radius: var(--radius-pill); background: var(--line); overflow: hidden; }
.app-loading-bar i { display: block; height: 100%; width: var(--blazor-load-percentage, 8%); background: var(--accent); transition: width 0.2s ease; }

/* ---------- Motion preferences ---------- */

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

/* ---------- Contact ---------- */

.contact-card {
    display: grid; gap: 1.1rem; justify-items: start; max-width: 40rem; padding: 1.6rem 1.75rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.contact-address { font: 800 clamp(1.35rem, 3.2vw, 1.8rem)/1.25 var(--font-head); color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.contact-address:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
