/* shared.css — the canonical stylesheet for the Structured Chaos family.
 *
 * This file is the single source of truth for design tokens, base styles,
 * typography, layout primitives, and all shared components (global bar,
 * site header, navigation, panels, chips, color pairs, buttons, forms,
 * lists, gallery, footer, responsive breakpoints).
 *
 * Every family site loads it from the root Structured Chaos site
 * (misssponto.me.uk in production, localhost:4000 in local dev) BEFORE
 * its own site-specific stylesheet. Site-specific sheets only contain
 * overrides for layout values (e.g. .shell max-width) and components
 * unique to that site (e.g. KnitStitch's sketch canvas, StructuredChaos's
 * landing cards and markdown body).
 *
 * When changing a token or component here, every site picks it up on
 * next load — no per-repo edits needed.
 */

/* ==========================================================================
   1. Design Tokens
   ========================================================================== */
:root {
    --body: #333333;
    --body-light: #8a8a8a;
    --body-dark: #111111;
    --primary: #8a9a5b;
    --primary-light: #b5c18e;
    --primary-dark: #5a6b3d;
    --secondary: #f4f6f0;
    --secondary-light: #f9faf6;
    --secondary-dark: #dde2d4;
    --tertiary: #ffffff;
    --tertiary-dark: #eef1ea;
    --border: var(--secondary-dark);

    /* Brand colors */
    --github-color: #24292f;
    --github-hover-bg: #f3f5f7;
    --github-hover-border: #d0d7de;
    --gitlab-color: #fc6d26;
    --gitlab-hover-bg: #fff3ea;
    --gitlab-hover-border: #f7c6a5;

    /* Color pairs — higher contrast text colours for chips/tags.
     * Each pair has a -bg and -text token. Use with .color-pair-* classes. */
    --color-pair-gold-bg: #efe9da;
    --color-pair-gold-text: var(--primary-dark);
    --color-pair-sand-bg: #f3efe6;
    --color-pair-sand-text: #5a4427;
    --color-pair-sage-bg: #e3ede4;
    --color-pair-sage-text: #3a6b42;
    --color-pair-olive-bg: #ece8d8;
    --color-pair-olive-text: #6b6333;
    --color-pair-sky-bg: #dde8f2;
    --color-pair-sky-text: #2c5f8a;
    --color-pair-stone-bg: #e8e2d8;
    --color-pair-stone-text: #6b6356;
    --color-pair-rose-bg: #f2dddd;
    --color-pair-rose-text: #8a2c2c;
    --color-pair-clay-bg: #f3e5dc;
    --color-pair-clay-text: #6a402b;
    --color-pair-plum-bg: #e8dde8;
    --color-pair-plum-text: #6a3d6a;
    --color-pair-ink-bg: #ddd;
    --color-pair-ink-text: #111111;
    --color-pair-moss-bg: #e1e9d9;
    --color-pair-moss-text: #3a4b2e;
    --color-pair-lavender-bg: #e8e3f0;
    --color-pair-lavender-text: #4a3a5d;
    --color-pair-peach-bg: #f5e8df;
    --color-pair-peach-text: #6a4a3a;
    --color-pair-slate-bg: #e2e6eb;
    --color-pair-slate-text: #2a3548;
    --color-pair-rust-bg: #f0e3db;
    --color-pair-rust-text: #7a3a22;
    --color-pair-berry-bg: #efe2e6;
    --color-pair-berry-text: #5a2a3a;

    /* Shadows */
    --shadow-sm: 0 1px 0 rgba(17, 17, 17, 0.03);
    --shadow-md: 0 5px 12px rgba(17, 17, 17, 0.08);
    --shadow-lg: 0 14px 28px rgba(15, 25, 10, 0.12);

    /* Typography */
    --font-body: "Open Sans", sans-serif;
    --font-heading: "Playfair Display", serif;
    --font-brand: "Dancing Script", cursive;
    --type-h1: clamp(30px, 4vw, 42px);
    --type-h2: 28px;
    --type-h3: 25px;
    --type-h4: 18px;
    --type-h5: 14px;
    --type-h6: 12px;
    --type-body: 14px;
    --type-subtitle: 13px;
    --type-caption: 12px;
    --type-button: 12px;
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
}

[id] {
    scroll-margin-top: 120px;
}

body {
    color: var(--body);
    background: var(--secondary);
    font-family: var(--font-body);
    font-size: var(--type-body);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: 0.85; }

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

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 1.5em 0;
}

/* ==========================================================================
   3. Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--body-dark);
}

h1 {
    margin-block: 0 0.55em;
    margin-inline: 0;
    font-family: var(--font-body);
    font-size: var(--type-h1);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.2px;
}

h2 {
    margin-block: 1.5em 0.45em;
    margin-inline: 0;
    font-family: var(--font-body);
    font-size: var(--type-h2);
    font-weight: 700;
    line-height: 1.2;
}

h3 {
    margin-block: 1.25em 0.25em;
    margin-inline: 0;
    font-family: var(--font-body);
    font-size: var(--type-h3);
    font-weight: 700;
    line-height: 1.3;
}

h4 {
    margin-block: 1em 0.35em;
    margin-inline: 0;
    font-family: var(--font-body);
    font-size: var(--type-h4);
    font-weight: 700;
    line-height: 1.3;
}

h5 {
    margin-block: 1em 0.35em;
    margin-inline: 0;
    font-family: var(--font-body);
    font-size: var(--type-h5);
    font-weight: 700;
    line-height: 1.3;
}

h6 {
    margin-block: 1em 0.35em;
    margin-inline: 0;
    font-family: var(--font-body);
    font-size: var(--type-h6);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child {
    margin-block-start: 0;
}

.body {
    font-size: var(--type-body);
    line-height: 1.7;
}

.subtitle {
    font-size: var(--type-subtitle);
    line-height: 1.5;
    color: var(--body-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 14px;
}

.caption {
    font-size: var(--type-caption);
    line-height: 1.4;
    color: var(--body-light);
}

p,
ul,
ol,
blockquote,
pre,
table {
    margin: 0 0 1.1em;
}

blockquote {
    padding: 0.9em 1.2em;
    border-left: 4px solid var(--primary);
    background: var(--secondary-light);
    border-radius: 0 8px 8px 0;
}

pre {
    overflow-x: auto;
    padding: 1em 1.2em;
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
    background: var(--secondary-light);
    color: var(--body-dark);
}

code {
    padding: 0.18em 0.35em;
    border-radius: 4px;
    background: var(--secondary-dark);
    color: var(--primary-dark);
    font-size: 0.95em;
}

pre code {
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.7em 0.8em;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

/* ==========================================================================
   4. Layout
   ========================================================================== */
.shell {
    width: 80%;
    margin: 0 auto;
}

.page-main {
    margin: 0 auto 60px;
}

.page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 14px;
    align-items: start;
}

.page-layout--wide {
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 14px;
}

.content-main {
    min-width: 0;
}

/* ==========================================================================
   4b. Global Bar (shared between sites)
   ========================================================================== */
.global-bar {
    background: var(--body-dark);
    position: sticky;
    top: 0;
    z-index: 110;
}

.global-bar-row {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 36px;
}

.global-bar-link {
    color: var(--secondary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    opacity: 0.7;
    transition: opacity 140ms ease, color 140ms ease;
}

.global-bar-link:hover {
    opacity: 1;
    color: var(--primary-light);
}

.global-bar-link.active {
    opacity: 1;
    color: var(--primary);
}

.global-bar-link--right {
    margin-left: auto;
}

.global-bar-link[aria-disabled="true"] {
    opacity: 0.4;
    pointer-events: none;
}

/* ==========================================================================
   5. Site Header & Navigation
   ========================================================================== */
.site-header {
    background: var(--tertiary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 36px;
    z-index: 100;
}

.header-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    min-height: 72px;
    gap: 24px;
}

.header-row > .brand {
    justify-self: start;
}

.brand {
    margin: 0;
    align-self: center;
    color: var(--body-dark);
    font-family: var(--font-brand);
    font-size: clamp(30px, 4vw, 48px);
    line-height: 0.95;
    white-space: nowrap;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    gap: 26px;
    justify-self: center;
}

.main-nav-item {
    position: relative;
    display: flex;
    align-items: center;
}

.main-nav-link {
    color: var(--body-dark);
    font-size: var(--type-h5);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    min-height: 72px;
}

.main-nav-link:hover {
    color: var(--primary);
    text-decoration: none;
}

.main-nav-link.active {
    color: var(--primary);
}

.main-nav-item.has-submenu .main-nav-link::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-left: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
}

.main-nav-submenu {
    position: absolute;
    top: calc(100% - 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    padding: 10px 0;
    background: var(--tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
    z-index: 120;
}

.main-nav-item:hover .main-nav-submenu,
.main-nav-item:focus-within .main-nav-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(4px);
}

.main-nav-submenu-link {
    display: block;
    padding: 10px 16px;
    color: var(--body-dark);
    font-size: var(--type-h5);
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: none;
    white-space: nowrap;
}

.main-nav-submenu-link:hover {
    background: var(--secondary-light);
    opacity: 1;
}

.header-project-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-self: end;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--tertiary);
    color: var(--body-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.project-link:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.project-link svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: currentColor;
    flex: 0 0 auto;
}

.project-link--github {
    color: var(--github-color);
}

.project-link--gitlab {
    color: var(--gitlab-color);
}

.project-link--github:hover {
    background: var(--github-hover-bg);
    border-color: var(--github-hover-border);
}

.project-link--gitlab:hover {
    background: var(--gitlab-hover-bg);
    border-color: var(--gitlab-hover-border);
}

/* ==========================================================================
   6. Page Sub-header
   ========================================================================== */
.page-subheader {
    padding: 32px 0 14px;
    margin-bottom: 14px;
}

.page-subheader-inner {
    text-align: center;
    padding: 22px 28px;
    background: var(--secondary-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-subheader-inner h1 {
    margin: 0;
}

/* ==========================================================================
   7. Homepage
   ========================================================================== */
.home-main {
    padding: 56px 0 72px;
}

.home-hero {
    --home-hero-overlay: rgba(38, 27, 14, 0.36);
    min-height: 400px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--tertiary);
    background-color: var(--secondary-dark);
    background-image: linear-gradient(var(--home-hero-overlay), var(--home-hero-overlay)), var(--home-hero-image, none);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.home-hero-inner {
    padding: 32px 0;
}

.home-intro {
    text-align: center;
    max-width: 860px;
    margin: 0 auto 46px;
}

.home-project-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 44px;
}

.home-project-card-link {
    display: block;
    color: inherit;
}

.home-project-card-link:hover {
    opacity: 1;
}

.home-project-card-link:hover .panel {
    border-color: var(--primary-light);
}

/* ==========================================================================
   8. Posts Archive
   ========================================================================== */
.projects {
    padding-bottom: 68px;
}

.grid {
    display: grid;
    gap: 26px;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}

.posts-panel {
    position: sticky;
    top: 109px;
}

/* ==========================================================================
   9. Single Post
   ========================================================================== */
.gallery-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--tertiary-dark);
}

.instructions {
    margin-top: 28px;
}

/* ==========================================================================
   10. Lists
   ========================================================================== */
ul,
ol {
    list-style: none;
    padding-left: 0;
    margin: 0.6em 0 0;
    display: grid;
    gap: 5px;
}

ul > li {
    position: relative;
    padding-left: 1.2em;
    line-height: 1.6;
}

ul > li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 600;
}

ol {
    gap: 12px;
    counter-reset: step;
}

ol > li {
    position: relative;
    padding-left: 1.6em;
    line-height: 1.6;
    counter-increment: step;
}

ol > li::before {
    content: counter(step) ".";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 600;
}

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

.list > li {
    padding-left: 0;
}

.list > li::before {
    content: none;
}

.panel--padded .list > li {
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.panel--padded .list > li:first-child {
    border-top: 0;
    padding-top: 0;
}

.list > li.sub-category {
    padding-left: 1.4em;
    font-size: 0.95em;
}

.list > li.sub-category a {
    color: var(--body-light);
}

input[type="checkbox"] {
    margin-inline-end: 0.45em;
}

/* ==========================================================================
   11. Gallery & Lightbox
   ========================================================================== */
.gallery {
    margin-top: 16px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 4px;
    object-fit: contain;
}

/* ==========================================================================
   12. Buttons
   ========================================================================== */
button,
.button {
    font-family: inherit;
    font-size: var(--type-button);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.button {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 4px;
    border: 1px solid var(--border);
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    background: var(--primary-dark);
    color: var(--tertiary);
    border-color: var(--primary-dark);
}

.button-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.button-secondary {
    background: transparent;
    color: var(--body-dark);
}

.button-sm {
    padding: 6px 10px;
    font-size: 11px;
}

/* ==========================================================================
   13. Forms
   ========================================================================== */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
}

select {
    min-width: 140px;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-row label {
    min-width: 80px;
    font-size: 13px;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="email"],
.form-row input[type="password"] {
    flex: 1;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0;
    font-size: 13px;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-row input[type="range"] {
    flex: 1;
}

.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ==========================================================================
   14. Cards & Panels
   ========================================================================== */
.panel {
    background: var(--tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel--padded {
    padding: 20px 24px;
    margin-bottom: 16px;
}

.panel--image-top {
    padding: 0;
}

.panel-body {
    padding: 14px;
    display: grid;
    gap: 8px;
    flex: 1;
}

.container > .panel + .panel {
    margin-top: 14px;
}

.panel-heading {
    width: 100%;
    display: grid;
    gap: 4px;
    align-content: start;
}

.panel-excerpt {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    min-height: 4.8em;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.panel-chips,
.panel-category-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   15. Chips & Color Pairs
   ========================================================================== */
.chip {
    display: inline-block;
    vertical-align: middle;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    white-space: nowrap;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1.4;
}

.chip:hover {
    text-decoration: none;
    opacity: 0.85;
}

.color-pair-gold {
    background: var(--color-pair-gold-bg);
    color: var(--color-pair-gold-text);
}

.color-pair-sand {
    background: var(--color-pair-sand-bg);
    color: var(--color-pair-sand-text);
}

.color-pair-sage {
    background: var(--color-pair-sage-bg);
    color: var(--color-pair-sage-text);
}

.color-pair-olive {
    background: var(--color-pair-olive-bg);
    color: var(--color-pair-olive-text);
}

.color-pair-sky {
    background: var(--color-pair-sky-bg);
    color: var(--color-pair-sky-text);
}

.color-pair-stone {
    background: var(--color-pair-stone-bg);
    color: var(--color-pair-stone-text);
}

.color-pair-rose {
    background: var(--color-pair-rose-bg);
    color: var(--color-pair-rose-text);
}

.color-pair-clay {
    background: var(--color-pair-clay-bg);
    color: var(--color-pair-clay-text);
}

.color-pair-plum {
    background: var(--color-pair-plum-bg);
    color: var(--color-pair-plum-text);
}

.color-pair-ink {
    background: var(--color-pair-ink-bg);
    color: var(--color-pair-ink-text);
}

.color-pair-moss {
    background: var(--color-pair-moss-bg);
    color: var(--color-pair-moss-text);
}

.color-pair-lavender {
    background: var(--color-pair-lavender-bg);
    color: var(--color-pair-lavender-text);
}

.color-pair-peach {
    background: var(--color-pair-peach-bg);
    color: var(--color-pair-peach-text);
}

.color-pair-slate {
    background: var(--color-pair-slate-bg);
    color: var(--color-pair-slate-text);
}

.color-pair-rust {
    background: var(--color-pair-rust-bg);
    color: var(--color-pair-rust-text);
}

.color-pair-berry {
    background: var(--color-pair-berry-bg);
    color: var(--color-pair-berry-text);
}

/* Alias — some sites use "red" instead of "rose" for the breaking-change chip */
.color-pair-red {
    background: var(--color-pair-rose-bg);
    color: var(--color-pair-rose-text);
}

/* ==========================================================================
   16. Panel (Sidebar)
   ========================================================================== */
.container {
    min-width: 0;
    padding: 14px;
    background: var(--secondary-light);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.container--sticky {
    position: sticky;
    top: 109px;
}

.sidebar {
    min-width: 0;
}

.sidebar--sticky {
    position: sticky;
    top: 129px;
}

.container-sections {
    display: grid;
    gap: 14px;
}

.container-section {
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.container-sections > .container-section:first-child {
    border-top: 0;
    padding-top: 0;
}

/* Headed panel section — a panel with a grey header bar and white body.
   Available on any page that needs labelled group boxes inside a container. */
.container-section--headed {
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--tertiary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.container-section-header {
    padding: 6px 14px;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    background: var(--tertiary-dark);
}

.container-section-body {
    padding: 14px;
}

/* Changelog sidebar blocks — moved into the sidebar via JS. They need their
   own gap since they sit inside a plain div, not .container-sections. */
.changelog-types-sidebar {
    display: grid;
    gap: 14px;
}

/* Version list panel — cap height and scroll so a long version list does not
   push the sidebar past the page content. */
.changelog-versions .container-section-body {
    max-height: 320px;
    overflow-y: auto;
}

.container-actions {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* ==========================================================================
   17. Filter List (Taxonomy)
   ========================================================================== */
.filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--body-dark);
    line-height: 1.5;
}

.filter-row input {
    margin: 0;
    accent-color: var(--primary);
}

/* ==========================================================================
   17b. Changelog Tabs
   ========================================================================== */
.changelog-tabs {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--body-light);
    font-family: var(--font-body);
    font-size: var(--type-h5);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 140ms ease, border-color 140ms ease;
}

.tab-btn:hover {
    color: var(--body-dark);
}

.tab-btn.active {
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ==========================================================================
   18. Pagination
   ========================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 32px;
}

.pagination-info {
    font-size: var(--type-subtitle);
    color: var(--body-light);
}

/* ==========================================================================
   18b. Markdown Body (credits, readme, roadmap pages)
   ========================================================================== */
.markdown-body h1 {
    margin-top: 0;
}

.markdown-body h2 {
    margin-top: 0;
}

.markdown-body ul {
    list-style: none;
    padding-left: 0;
}

.markdown-body li {
    position: relative;
    padding-left: 1.25em;
}

.markdown-body li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: var(--body-light);
}

/* ==========================================================================
   18c. Document Page (changelog, markdown pages with sticky footer)
   ========================================================================== */
.page-document {
    min-height: 100vh;
}

.page-document .site-footer {
    margin-top: auto;
}

.page-document .page-main {
    flex: 1;
}

/* ==========================================================================
   18d. Changelog / Markdown Loading & Error States
   ========================================================================== */
.changelog-loading,
.md-loading,
.changelog-error,
.md-error {
    text-align: center;
    padding: 40px;
    font-size: var(--type-subtitle);
}

.changelog-loading,
.md-loading {
    color: var(--body-light);
}

.changelog-error,
.md-error {
    color: #8a2c2c;
}

/* ==========================================================================
   19. Site Footer
   ========================================================================== */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--tertiary-dark);
    padding: 22px 0;
    margin-top: auto;
}

.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    font-size: 13px;
}

.footer-socials {
    display: flex;
    gap: 14px;
    align-items: center;
}

.footer-version {
    margin-left: auto;
    font-weight: 400;
}

/* ==========================================================================
   20. Responsive
   ========================================================================== */
@media (max-width: 980px) {
    .home-project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .posts-panel {
        position: static;
    }

    .main-nav {
        gap: 14px;
    }

    .main-nav-link {
        font-size: 12px;
        letter-spacing: 0.6px;
    }
}

@media (max-width: 740px) {
    .shell {
        width: min(100% - 28px);
    }

    .home-main {
        padding: 40px 0 60px;
    }

    .home-hero {
        min-height: 300px;
    }

    .home-hero-inner {
        padding: 24px 0;
    }

    .home-intro {
        margin-bottom: 36px;
    }

    .home-project-grid {
        grid-template-columns: 1fr;
    }

    .page-subheader {
        padding-top: 28px;
    }

    .page-subheader-inner {
        padding: 18px 20px;
    }

    .header-row {
        display: flex;
        flex-wrap: wrap;
    }

    .main-nav {
        width: 100%;
        order: 2;
        justify-content: flex-start;
        justify-self: auto;
        flex-wrap: wrap;
        gap: 0 18px;
    }

    .main-nav-link {
        min-height: 44px;
    }

    .main-nav-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav-submenu {
        position: static;
        transform: none;
        min-width: 0;
        margin-top: 4px;
        padding: 6px 0 8px 14px;
        border: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        background: transparent;
    }

    .main-nav-item:hover .main-nav-submenu,
    .main-nav-item:focus-within .main-nav-submenu {
        transform: none;
    }

    .main-nav-submenu-link {
        padding: 6px 0;
    }

    .header-project-links {
        width: 100%;
        order: 3;
        justify-self: auto;
        justify-content: flex-start;
    }

    .page-layout {
        grid-template-columns: 1fr;
    }

    .gallery {
        grid-template-columns: 1fr;
    }

    .container {
        position: static;
        padding: 22px;
    }

    .footer-row {
        flex-direction: column;
        align-items: flex-start;
    }
}
