/* ============================================================
   BSM3D – Main Stylesheet
   ============================================================ */

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; -webkit-overflow-scrolling: touch; overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
[id] { scroll-margin-top: 90px; }

/* Touch optimizations */
a, button, [role="button"], input, textarea, select, label { touch-action: manipulation; }
a, button, input, textarea, select { -webkit-tap-highlight-color: transparent; }
.nav-links a, .mobile-menu a, .btn-primary, .btn-outline, .btn-submit, .github-link, .footer-social a { min-height: 44px; display: inline-flex; align-items: center; }
.form-group input, .form-group textarea, .form-group select { font-size: 16px; }

/* Keyboard focus */
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 4px; }
.form-group input:focus-visible, .form-group textarea:focus-visible, .form-group select:focus-visible { outline: none; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--orange); }

/* CSS variables */
:root { --orange: #b35208; --orange-dark: #8f4106; --orange-soft: #fff3ea; --orange-ink: #8f4106; --btn-bg: #b35208; --btn-bg-hover: #8f4106; --code-ink: #c2410c; --black: #000; --white: #fff; --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb; --gray-300: #d1d5db; --gray-400: #9ca3af; --gray-500: #6b7280; --gray-600: #4b5563; --gray-700: #374151; --gray-800: #1f2937; --nav-h: 64px;
        --bg: #fff; --surface: #fff; --text: #1f2937; --pre-bg: #1f2937; --pill-bg: #1f2937; --card-border: transparent; --hero-fade: #050506; color-scheme: light; }

/* Dark theme is the default; the light palette only applies once a visitor picks it
   (data-theme="light", set before first paint by the inline script in each <head>).
   The gray ramp is inverted rather than renamed, so every rule written against
   --gray-* keeps its meaning: 50-200 stay "background-ish", 500-800 "text-ish".
   Contrast (WCAG AA, 4.5:1): the brand #d4600a only passes as text on dark grounds,
   so light pages use #b35208 for orange text, and every white-on-orange button uses
   --btn-bg (5.1:1) in both themes. */
:root:not([data-theme="light"]) {
    --orange: #d4600a; --orange-soft: #2a1a0e; --orange-ink: #f0a060; --code-ink: #f59e5b;
    --gray-50: #111317; --gray-100: #1a1d22; --gray-200: #262a31; --gray-300: #353a42; --gray-400: #8b929c; --gray-500: #9aa1ab; --gray-600: #b4bac2; --gray-700: #cfd3d9; --gray-800: #e6e8eb;
    --bg: #0b0c0e; --surface: #14161a; --text: #e6e8eb; --pre-bg: #0f1115; --pill-bg: #2d323a; --card-border: #23272e; --hero-fade: var(--bg); color-scheme: dark;
}

/* Always-dark areas keep the brand orange whatever the theme (5.5:1 on black) */
.site-nav, .site-footer, .hero, .lang-bar { --orange: #d4600a; }

/* Utilities */
.orange-text { color: var(--orange); }
.orange-bg { background-color: var(--orange); }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* Inline links inside prose (the global `a { color: inherit }` otherwise hides them) */
.doc-content a:not(.btn-primary):not(.btn-outline):not(.github-link),
.bio-text-col a:not(.btn-primary):not(.btn-outline),
.about-col p a, .contact-info-item a, .feature-col p a,
.site-main p a:not(.btn-primary):not(.btn-outline):not(.github-link):not(.card-link),
.section-lead a, .notice a { color: var(--orange); text-decoration: underline; text-decoration-color: rgba(212,96,10,.35); text-underline-offset: 3px; transition: color .2s, text-decoration-color .2s; }
.doc-content a:not(.btn-primary):not(.btn-outline):not(.github-link):hover,
.bio-text-col a:not(.btn-primary):not(.btn-outline):hover,
.about-col p a:hover, .contact-info-item a:hover, .feature-col p a:hover,
.site-main p a:not(.btn-primary):not(.btn-outline):not(.github-link):not(.card-link):hover,
.section-lead a:hover, .notice a:hover { color: var(--orange-ink); text-decoration-color: currentColor; }

/* ============================================================
   Navigation
   ============================================================ */
.site-nav { background: var(--black); color: var(--white); padding: 0 1.5rem; box-shadow: 0 2px 10px rgba(0,0,0,.3); position: sticky; top: 0; z-index: 50; }
.site-nav .nav-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; min-height: var(--nav-h); }
.site-nav .logo { font-size: 1.5rem; font-weight: 700; color: var(--orange); letter-spacing: .02em; }
.site-nav .logo:hover { opacity: .85; }
.nav-links { display: flex; gap: 1.75rem; align-items: center; }
.nav-links a { color: var(--white); font-weight: 500; position: relative; transition: color .25s; padding: .25rem 0; }
.nav-links a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--orange); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.nav-links a:hover, .nav-links a.active { color: var(--orange); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.lang-switch { margin-left: 1.25rem; border: 1px solid #374151; border-radius: 999px; padding: .3rem .75rem; font-size: .78rem; font-weight: 700; letter-spacing: .06em; color: #9ca3af; transition: border-color .25s, color .25s, background .25s; display: inline-flex; align-items: center; min-height: 34px; flex-shrink: 0; }
.lang-switch:hover { border-color: var(--orange); color: var(--orange); background: rgba(212,96,10,.12); }
.menu-toggle { display: none; background: none; border: none; color: var(--white); font-size: 1.5rem; cursor: pointer; min-width: 44px; min-height: 44px; justify-content: center; align-items: center; }
.mobile-menu { display: none; flex-direction: column; gap: .25rem; padding: .5rem 1.5rem 1rem; background: var(--black); max-width: 1200px; margin: 0 auto; border-top: 1px solid #1f2937; }
.mobile-menu a { color: var(--white); font-weight: 500; transition: color .25s; padding: .55rem .25rem; }
.mobile-menu a:hover, .mobile-menu a.active { color: var(--orange); }
.mobile-menu.open { display: flex; }

/* ============================================================
   Header banner
   ============================================================ */
.header-banner { min-height: 250px; display: flex; background-size: cover; background-position: center; position: relative; }
.header-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,.6) 100%); }
.header-content { position: relative; z-index: 10; width: 100%; display: flex; flex-direction: column; justify-content: center; max-width: 1200px; margin: 0 auto; padding: 2.25rem 1.5rem; }
.header-content h1 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 700; color: var(--white); margin-bottom: .75rem; text-shadow: 0 2px 12px rgba(0,0,0,.4); }
.header-content p { font-size: 1.1rem; color: rgba(255,255,255,.9); text-shadow: 0 1px 8px rgba(0,0,0,.4); }

/* ============================================================
   Hero
   ============================================================ */
/* The hero is always dark, whatever the theme. Background is the static site banner
   (same image as .header-banner); .hero-shade keeps the text column readable. */
.hero { position: relative; overflow: hidden; isolation: isolate; color: #f3f4f6; min-height: 250px; display: flex; align-items: center; padding: 2.25rem 0; background: #111; }
/* Image lives on its own layer, wider than the hero so the sideways drift (--px, set in js/main.js) never shows an edge */
.hero::before { content: ''; position: absolute; top: 0; bottom: 0; left: -140px; right: -140px; z-index: -2; background: url('../img/bsm3d_banner.webp') center / cover no-repeat; transform: translate3d(var(--px, 0px), 0, 0); will-change: transform; }
.hero-shade { position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,.6) 100%); }
.hero-inner { display: flex; flex-direction: column; gap: 2.5rem; align-items: flex-start; width: 100%; }
.hero-text { display: flex; align-items: center; gap: 1.5rem; }
.hero-badge { width: 72px; height: 72px; flex-shrink: 0; border-radius: 50%; object-fit: cover; object-position: top; border: 2px solid var(--orange); box-shadow: 0 0 0 6px rgba(212,96,10,.15); }
.hero-text h1 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 700; line-height: 1.2; margin-bottom: .75rem; color: var(--white); text-shadow: 0 2px 12px rgba(0,0,0,.4); }
.hero-text h2 { font-size: 1.1rem; font-weight: 400; color: rgba(255,255,255,.9); text-shadow: 0 1px 8px rgba(0,0,0,.4); }
.hero-intro { padding: 2.5rem 0 3rem; }
.hero-intro p { font-size: 1.1rem; color: var(--gray-600); line-height: 1.75; margin-bottom: 1.5rem; max-width: 720px; }
@media (max-width: 768px) {
    .hero { min-height: 170px; padding: 1.75rem 0; }
    .hero-text { gap: 1rem; }
    .hero-badge { width: 56px; height: 56px; }
    .hero-intro { padding: 2rem 0 2.5rem; }
}

/* Theme toggle (injected by js/main.js next to the language switch) */
.nav-tools { display: flex; align-items: center; gap: .6rem; margin-left: 1.25rem; flex-shrink: 0; }
.nav-tools .lang-switch { margin-left: 0; }
.theme-toggle { width: 34px; height: 34px; border-radius: 50%; border: 1px solid #374151; background: none; color: #9ca3af; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; flex-shrink: 0; transition: border-color .25s, color .25s, background .25s; }
.theme-toggle:hover { border-color: var(--orange); color: var(--orange); background: rgba(212,96,10,.12); }

/* Shadows don't read on a dark ground: outline the raised surfaces instead */
.card, .tool-card, .doc-category, .project-card-dev, .contact-form { border: 1px solid var(--card-border); }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn-primary { background: var(--btn-bg); color: var(--white); padding: .75rem 1.75rem; border-radius: 999px; font-weight: 500; transition: background .25s, transform .2s, box-shadow .25s; display: inline-block; }
.btn-primary:hover { background: var(--btn-bg-hover); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(212,96,10,.3); }
.btn-outline { border: 2px solid var(--orange); color: var(--orange); padding: .72rem 1.75rem; border-radius: 999px; font-weight: 500; transition: background .25s, color .25s, transform .2s; display: inline-block; }
.btn-outline:hover { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--white); transform: translateY(-1px); }

/* ============================================================
   Sections
   ============================================================ */
.section { padding: 4.5rem 0; }
.section-alt { background: var(--gray-50); border-top: 1px solid var(--gray-100); border-bottom: 1px solid var(--gray-100); }
.section-title { font-size: 2rem; font-weight: 700; text-align: center; color: var(--orange); margin-bottom: .75rem; }
.section-lead { text-align: center; color: var(--gray-600); max-width: 640px; margin: 0 auto 2.75rem; line-height: 1.7; }
.section-title + .grid-3, .section-title + .grid-2, .section-title + .cat-grid, .section-title + .feature-row { margin-top: 2.25rem; }
.site-main { max-width: 1200px; margin: 0 auto; padding: 2.5rem 1.5rem; }

/* ============================================================
   Grids & Cards
   ============================================================ */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; }
.card { background: var(--surface); border-radius: .75rem; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.08); transition: transform .3s, box-shadow .3s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 25px rgba(0,0,0,.15); }
.card-body { padding: 1.75rem; flex: 1; display: flex; flex-direction: column; }
.card-icon { font-size: 2.5rem; color: var(--orange); margin-bottom: 1rem; }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--orange); margin-bottom: .6rem; }
.card-text { color: var(--gray-600); margin-bottom: 1rem; line-height: 1.6; }
/* Let the description absorb the slack so tags and footers line up across a row */
.card-body .card-text { flex: 1 1 auto; }
.card-body .card-footer { margin-top: auto; padding-top: 1rem; display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.card-body .tags { margin-bottom: .25rem; }
/* Cards that end on their tag row instead of a footer still have to bottom-align */
.card-body .tags:last-child { margin-top: auto; padding-top: .25rem; }
.tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag { background: var(--gray-200); padding: .2rem .75rem; border-radius: 999px; font-size: .8rem; color: var(--gray-700); }
.card-thumb { height: 190px; background: var(--gray-200); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--gray-400); font-size: 4rem; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.card-date { font-size: .85rem; color: var(--gray-500); }
.card-cat { font-size: .75rem; background: var(--orange-soft); color: var(--orange-ink); padding: .2rem .6rem; border-radius: 999px; }
.card-link { color: var(--orange); font-weight: 500; font-size: .95rem; }
.card-link:hover { text-decoration: underline; }
.section-cta { text-align: center; margin-top: 2.5rem; }

/* Article category tiles (homepage) */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.25rem; }
.cat-tile { background: var(--surface); border: 1px solid var(--gray-200); border-radius: .75rem; padding: 1.4rem 1.25rem; display: flex; flex-direction: column; gap: .4rem; transition: border-color .25s, transform .25s, box-shadow .25s; }
.cat-tile:hover { border-color: var(--orange); transform: translateY(-3px); box-shadow: 0 8px 22px rgba(0,0,0,.1); }
.cat-tile i { font-size: 1.6rem; color: var(--orange); margin-bottom: .35rem; }
.cat-tile strong { font-size: 1.05rem; color: var(--gray-800); }
.cat-tile span { font-size: .85rem; color: var(--gray-500); }

/* ============================================================
   Feature rows
   ============================================================ */
.feature-row { display: flex; gap: 2.5rem; align-items: center; flex-wrap: wrap; }
.feature-row.reverse { flex-direction: row-reverse; }
.feature-col { flex: 1 1 300px; }
.feature-img { height: 320px; background: var(--gray-200); border-radius: .75rem; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,.12); display: flex; align-items: center; justify-content: center; font-size: 5rem; color: var(--gray-400); }
.feature-img img { width: 100%; height: 100%; object-fit: cover; }
.feature-col h3 { font-size: 1.5rem; font-weight: 700; color: var(--orange); margin-bottom: 1rem; }
.feature-col p { color: var(--gray-600); line-height: 1.75; margin-bottom: 1.25rem; }
.feature-col h4 { font-weight: 700; color: var(--orange); margin-bottom: .5rem; }
.feature-col ul { padding-left: 1.25rem; color: var(--gray-600); margin-bottom: 1.5rem; }
.feature-col ul li { margin-bottom: .35rem; list-style: disc; }
.feature-col > br { display: none; }
.feature-row + .feature-row { margin-top: 4.5rem; }

/* ============================================================
   Tools page
   ============================================================ */
.tool-category { margin-bottom: 3.5rem; }
.tool-category-title { font-size: 1.4rem; font-weight: 700; color: var(--orange); border-left: 4px solid var(--orange); padding-left: .75rem; margin-bottom: 1.5rem; }
.tool-card { display: flex; gap: 1rem; align-items: flex-start; background: var(--surface); border-radius: .6rem; padding: 1.25rem; box-shadow: 0 2px 8px rgba(0,0,0,.07); transition: transform .3s, box-shadow .3s; }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.14); }
.tool-icon { font-size: 2rem; color: var(--orange); flex-shrink: 0; padding-top: .1rem; }
.tool-info h3 { font-size: 1rem; font-weight: 700; margin-bottom: .3rem; }
.tool-info p { font-size: .9rem; color: var(--gray-600); line-height: 1.5; }
.tool-info .tags { margin-top: .5rem; }

/* ============================================================
   Docs index
   ============================================================ */
.docs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; align-items: stretch; }
.doc-category { background: var(--surface); border-radius: .75rem; padding: 1.75rem; box-shadow: 0 2px 10px rgba(0,0,0,.07); transition: box-shadow .3s; }
.doc-category:hover { box-shadow: 0 6px 20px rgba(0,0,0,.13); }
.doc-category-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; padding-bottom: .75rem; border-bottom: 1px solid var(--gray-100); }
.doc-category-icon { font-size: 1.75rem; color: var(--orange); }
.doc-category-header h2 { font-size: 1.1rem; font-weight: 700; color: var(--orange); }
.doc-category-header .count { margin-left: auto; font-size: .8rem; color: var(--gray-600); background: var(--gray-100); padding: .15rem .6rem; border-radius: 999px; }
.doc-list { display: flex; flex-direction: column; gap: .25rem; }
/* Five categories in two columns always strand the fifth on a row of its own, with
   a hole beside it. Let the odd one out span the full width and run its list in two
   columns, so the last row is filled instead of half-empty. Scoped above 1024px
   because below that .docs-grid is a single column and nothing is ever stranded. */
@media (min-width: 1025px) {
    .docs-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
    /* Flowed columns, not a 2-track grid: a grid puts an odd item alone on a final
       row with half the width empty beside it, while columns fill top-to-bottom and
       leave at most one short line at the foot of the second column. */
    .docs-grid > :last-child:nth-child(odd) .doc-list { display: block; columns: 2; column-gap: 1.5rem; }
    .docs-grid > :last-child:nth-child(odd) .doc-list a { break-inside: avoid; }
}
.doc-list a { display: flex; align-items: center; gap: .5rem; color: var(--gray-700); font-size: .87rem; padding: .45rem .5rem; border-radius: .4rem; transition: background .2s, color .2s, padding-left .2s; }
@media (min-width: 700px) {
    .doc-list a { white-space: nowrap; }
}
.doc-list a:hover { background: var(--orange-soft); color: var(--orange-ink); padding-left: .75rem; }
.doc-list a i { font-size: .75rem; color: var(--orange); flex-shrink: 0; }

/* ============================================================
   Legacy / archive page
   ============================================================ */
.legacy-era { margin-bottom: 2.75rem; }
.legacy-era-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .85rem; flex-wrap: wrap; }
.legacy-era-icon { font-size: 1.4rem; color: var(--orange); width: 1.6rem; text-align: center; flex-shrink: 0; }
.legacy-era-header h2 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.legacy-era-header .card-cat { margin-left: auto; white-space: nowrap; }
.legacy-era p { color: var(--gray-600); line-height: 1.75; margin-bottom: 1rem; }
.legacy-era p:last-child { margin-bottom: 0; }

/* ============================================================
   Doc single page layout
   ============================================================ */
.doc-layout { display: flex; gap: 2.5rem; align-items: flex-start; }
.doc-sidebar { width: 250px; flex-shrink: 0; position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: .25rem; }
.doc-sidebar h3 { font-size: .8rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .75rem; }
.doc-sidebar ul { display: flex; flex-direction: column; gap: .15rem; border-left: 2px solid var(--gray-200); }
.doc-sidebar ul a { display: block; font-size: .9rem; color: var(--gray-600); padding: .3rem .75rem; margin-left: -2px; border-left: 2px solid transparent; transition: color .2s, border-color .2s, background .2s; }
.doc-sidebar ul a:hover { color: var(--orange); background: var(--gray-50); }
.doc-sidebar ul a.active { color: var(--orange); font-weight: 600; border-left-color: var(--orange); }
.doc-sidebar-toggle { display: none; }
.doc-content { flex: 1; min-width: 0; max-width: 78ch; }
.doc-content h1 { font-size: 2rem; font-weight: 700; margin-bottom: 1.5rem; line-height: 1.2; }
.doc-content h2 { font-size: 1.45rem; font-weight: 700; color: var(--orange); margin: 2.5rem 0 .85rem; padding-bottom: .35rem; border-bottom: 1px solid var(--gray-100); }
.doc-content h3 { font-size: 1.1rem; font-weight: 700; color: var(--orange); margin: 1.6rem 0 .5rem; }
/* Year-by-year timeline inside articles */
.doc-content .tl { list-style: none; margin: 1.25rem 0 2rem; padding: 0; border-left: 2px solid var(--gray-200); }
.doc-content .tl li { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1rem; padding: .7rem 0 .7rem 1.25rem; position: relative; }
.doc-content .tl li::before { content: ''; position: absolute; left: -6px; top: 1.15rem; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
.doc-content .tl-year { font-weight: 700; color: var(--orange); font-variant-numeric: tabular-nums; line-height: 1.5; }
.doc-content .tl-body strong { display: block; color: var(--gray-800); line-height: 1.5; margin-bottom: .15rem; }
.doc-content .tl-body p { margin: 0; color: var(--gray-600); font-size: .95rem; line-height: 1.65; }
@media (max-width: 600px) {
    .doc-content .tl li { grid-template-columns: 1fr; gap: .1rem; }
}
/* Justified with hyphens:auto, not justify alone - browsers stretch word gaps to
   fill the line when there's nowhere to break, and without hyphenation a long
   technical word (photogrammetry, thigmotropism) pushed to the next line leaves a
   visible gap-filled "river" on the one above it. Hyphenation needs the page's own
   lang attribute (set per-article, en/fr) to pick the right break points. */
.doc-content p { color: var(--gray-600); line-height: 1.8; margin-bottom: 1.1rem; }
/* Justify only once a line holds enough words to spread the gaps invisibly - on a
   narrow phone column, "three complementary mechanisms: a" (few words, one long)
   showed exactly the river the hyphens:auto below can't fully prevent on its own. */
@media (min-width: 640px) {
    .doc-content p,
    .bio-text-col p, .bio-highlights li, .timeline-body p,
    .about-col p, .feature-col p, .legacy-era p { text-align: justify; hyphens: auto; }
}
.doc-content ul, .doc-content ol { padding-left: 1.5rem; color: var(--gray-600); margin-bottom: 1.1rem; line-height: 1.7; }
.doc-content ul li { list-style: disc; }
.doc-content ol li { list-style: decimal; }
.doc-content li { margin-bottom: .4rem; }
.doc-content code { background: var(--gray-100); border-radius: .3rem; padding: .1rem .4rem; font-family: ui-monospace, 'Cascadia Code', Consolas, 'Courier New', monospace; font-size: .88em; color: var(--code-ink); overflow-wrap: break-word; }
.doc-content pre { background: var(--pre-bg); color: #e5e7eb; padding: 1.25rem; border-radius: .5rem; overflow-x: auto; margin-bottom: 1.25rem; font-size: .88rem; font-family: ui-monospace, 'Cascadia Code', Consolas, 'Courier New', monospace; line-height: 1.6; }
.doc-content pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.doc-content table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .9rem; }
.doc-content th, .doc-content td { border: 1px solid var(--gray-200); padding: .5rem .75rem; text-align: left; color: var(--gray-600); vertical-align: top; }
/* Headers in accent orange; gray-50 keeps it at 4.8:1+ in both themes. The extra
   `table` outranks the th/td color rule some articles still carry inline. */
.doc-content table th { background: var(--gray-50); color: var(--orange); font-weight: 700; border-bottom: 2px solid var(--orange); }
.doc-content .callout { border-left: 4px solid var(--orange); background: var(--orange-soft); padding: .9rem 1.2rem; margin: 1.2rem 0; border-radius: 0 6px 6px 0; color: var(--gray-700); line-height: 1.7; }
.doc-content .table-scroll { overflow-x: auto; }
.doc-content blockquote { border-left: 4px solid var(--orange); padding: .75rem 1.2rem; margin: 1.2rem 0; background: var(--gray-50); color: var(--gray-700); }
.doc-nav { display: flex; justify-content: space-between; gap: 1.5rem; margin-top: 3rem; border-top: 1px solid var(--gray-200); padding-top: 1.5rem; }
.doc-nav a { color: var(--orange); font-weight: 500; max-width: 48%; }
.doc-nav a:last-child { text-align: right; margin-left: auto; }
.doc-nav a:hover { text-decoration: underline; }

/* Inline notice block (e.g. language availability) */
.notice { display: flex; gap: .9rem; align-items: flex-start; background: var(--orange-soft); border: 1px solid rgba(212,96,10,.25); border-radius: .6rem; padding: 1rem 1.2rem; margin-bottom: 2rem; color: var(--gray-700); line-height: 1.65; font-size: .93rem; }
.notice i { color: var(--orange); font-size: 1.15rem; margin-top: .15rem; flex-shrink: 0; }
.notice strong { color: var(--gray-800); }
.lang-tag { display: inline-block; font-size: .62rem; font-weight: 700; letter-spacing: .06em; border: 1px solid var(--gray-300); color: var(--gray-500); border-radius: 3px; padding: 0 .3rem; vertical-align: middle; margin-left: .15rem; }

/* Language suggestion bar (shown once, never a forced redirect - see js/main.js) */
.lang-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: #1f2937; color: var(--white); display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; padding: .85rem 1.25rem; box-shadow: 0 -4px 20px rgba(0,0,0,.25); transform: translateY(100%); transition: transform .35s ease; }
.lang-bar.show { transform: translateY(0); }
.lang-bar p { margin: 0; font-size: .92rem; }
.lang-bar .lang-bar-actions { display: flex; gap: .6rem; align-items: center; }
.lang-bar a { background: var(--btn-bg); color: var(--white); padding: .4rem 1.1rem; border-radius: 999px; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.lang-bar a:hover { background: var(--btn-bg-hover); }
.lang-bar button { background: none; border: none; color: #9ca3af; font-size: .88rem; cursor: pointer; padding: .4rem .6rem; }
.lang-bar button:hover { color: var(--white); }
@media (max-width: 768px) { .lang-bar { flex-direction: column; gap: .6rem; text-align: center; } .back-to-top { bottom: 5.5rem; } }

/* Back to top */
.back-to-top { position: fixed; right: 1.25rem; bottom: 1.25rem; width: 46px; height: 46px; border-radius: 50%; border: none; background: var(--btn-bg); color: var(--white); font-size: 1.1rem; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.25); opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .25s, transform .25s, visibility .25s, background .2s; z-index: 40; display: flex; align-items: center; justify-content: center; }
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--btn-bg-hover); }

/* ============================================================
   Developer page
   ============================================================ */
.project-card-dev { background: var(--surface); border-radius: .75rem; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.08); transition: transform .3s, box-shadow .3s; display: flex; flex-direction: column; }
.project-card-dev:hover { transform: translateY(-4px); box-shadow: 0 10px 25px rgba(0,0,0,.15); }
.project-card-dev .card-thumb { height: 150px; font-size: 3.25rem; background: linear-gradient(135deg, var(--gray-100), var(--gray-200)); }
.project-card-dev .card-body { flex: 1; display: flex; flex-direction: column; }
.project-card-dev .card-title { font-size: 1rem; }
.project-card-dev .card-footer { margin-top: auto; padding-top: 1rem; display: flex; justify-content: space-between; align-items: center; }
/* A GitHub link is a link, not a call to action: orange text + the mark, matching
   .card-link so the two read the same in a footer. The solid pill is reserved for the
   one standalone "profile" button per page, which opts in with .is-pill. */
.github-link { display: inline-flex; align-items: center; gap: .45rem; color: var(--orange); font-size: .95rem; font-weight: 500; transition: color .2s; }
.github-link i { font-size: 1.05em; }
.github-link:hover { color: var(--orange-ink); text-decoration: underline; }
.github-link.is-pill { color: var(--white); background: var(--pill-bg); padding: .4rem 1rem; border-radius: 999px; font-size: .85rem; transition: background .2s, color .2s; }
.github-link.is-pill:hover { background: var(--btn-bg); color: var(--white); text-decoration: none; }
.card-footer .github-link { padding: .35rem 0; }
.card-footer .card-link { padding: .35rem 0; }

/* ============================================================
   Bio page
   ============================================================ */
.bio-layout { display: flex; gap: 3rem; align-items: flex-start; flex-wrap: wrap; }
.bio-photo-col { flex-shrink: 0; }
.bio-photo { width: 260px; height: 260px; border-radius: .75rem; overflow: hidden; border: 4px solid var(--orange); box-shadow: 0 8px 24px rgba(0,0,0,.15); background: var(--gray-200); display: flex; align-items: center; justify-content: center; font-size: 5rem; color: var(--gray-400); }
.bio-photo img { width: 100%; height: 100%; object-fit: cover; }
.bio-text-col { flex: 1 1 360px; max-width: 78ch; }
.bio-text-col h2 { font-size: 1.5rem; font-weight: 700; color: var(--orange); margin-bottom: .75rem; }
.bio-text-col p { color: var(--gray-600); line-height: 1.75; margin-bottom: 1rem; }
.bio-highlights { margin: 1.25rem 0 1.5rem; padding-left: 1.25rem; display: grid; gap: .6rem; list-style: disc; }
.bio-highlights li { color: var(--gray-600); line-height: 1.6; padding-left: .25rem; }
.bio-highlights li::marker { color: var(--orange); }
.timeline { margin-top: 3rem; }
.timeline-title { font-size: 1.5rem; font-weight: 700; color: var(--orange); margin-bottom: 2rem; }
.timeline-item { display: flex; gap: 1.5rem; margin-bottom: 2rem; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: 18px; top: 36px; bottom: -2rem; width: 2px; background: var(--gray-200); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 38px; height: 38px; background: var(--btn-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--white); font-size: .85rem; flex-shrink: 0; position: relative; z-index: 1; }
.timeline-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: .2rem; }
.timeline-body .tl-meta { font-size: .85rem; color: var(--orange); margin-bottom: .4rem; }
.timeline-body p { font-size: .9rem; color: var(--gray-600); }
.skills-section { margin-top: 3rem; }
.skills-section h2 { font-size: 1.5rem; font-weight: 700; color: var(--orange); margin-bottom: 1.5rem; }
.skill-bar-group { display: flex; flex-direction: column; gap: 1rem; }
.skill-bar label { font-size: .9rem; font-weight: 600; display: flex; justify-content: space-between; margin-bottom: .3rem; }
.skill-bar .bar-track { height: 8px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.skill-bar .bar-fill { height: 100%; background: var(--orange); border-radius: 999px; }

/* ============================================================
   About / Contact
   ============================================================ */
.about-layout { display: flex; gap: 3rem; flex-wrap: wrap; }
.about-col { flex: 1 1 320px; }
.about-col h2 { font-size: 1.4rem; font-weight: 700; color: var(--orange); margin-bottom: 1rem; }
.about-col p { color: var(--gray-600); line-height: 1.75; margin-bottom: 1rem; }
.contact-form { background: var(--surface); border-radius: .75rem; padding: 2rem; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.contact-form h2 { font-size: 1.4rem; font-weight: 700; color: var(--orange); margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .4rem; color: var(--gray-700); }
.form-group input, .form-group textarea, .form-group select { width: 100%; border: 1.5px solid var(--gray-200); border-radius: .5rem; padding: .65rem 1rem; font-size: 16px; font-family: inherit; background: var(--surface); color: var(--gray-800); transition: border-color .2s, box-shadow .2s; outline: none; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(212,96,10,.15); }
.form-group textarea { min-height: 140px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.btn-submit { background: var(--btn-bg); color: var(--white); border: none; padding: .8rem 2rem; border-radius: 999px; font-size: 1rem; font-weight: 600; cursor: pointer; width: 100%; transition: background .25s; }
.btn-submit:hover { background: var(--btn-bg-hover); }
.btn-submit:disabled { opacity: .6; cursor: wait; }
.contact-info-list { display: flex; flex-direction: column; gap: 1rem; margin-top: .5rem; }
.contact-info-item { display: flex; align-items: flex-start; gap: .75rem; }
.contact-info-item i { color: var(--orange); margin-top: .15rem; width: 18px; text-align: center; }
.contact-info-item span { color: var(--gray-600); font-size: .95rem; }

/* About page: plain rows - a small label on the left, content on the right, hairlines between */
.about-page { padding-top: 1rem; }
.about-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 2.5rem; padding: 2.75rem 0; border-top: 1px solid var(--gray-200); }
.about-row:first-child { border-top: none; }
.about-label { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-500); padding-top: .3rem; }
.about-body { max-width: 640px; }
.about-body > p { color: var(--gray-600); line-height: 1.8; margin-bottom: 1rem; text-align: justify; hyphens: auto; }
.about-body > p:last-child { margin-bottom: 0; }
.about-body > p a, .about-facts a { color: var(--orange); }
.about-facts > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--gray-100); }
.about-facts > div:last-child { border-bottom: none; }
.about-facts dt { font-size: .85rem; color: var(--gray-500); }
.about-facts dd { color: var(--gray-700); }
.about-page #contact-form { margin-top: 2rem; }
.about-page .btn-submit { width: auto; display: flex; margin-left: auto; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer { background: var(--black); color: var(--white); padding: 3rem 1.5rem 1.5rem; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; max-width: 1200px; margin: 0 auto 2.5rem; }
/* Both languages: 2 real columns (BSM3D info + Contact). Categories and Quick Links
   were dropped - the top nav and the Articles page already cover them. */
.footer-grid-2 { grid-template-columns: repeat(2, 1fr); }
/* Two equal-width columns in a 1200px footer leaves the short Contact block
   sitting at the left edge of its own half - a wide dead gap in the middle
   instead of one at each side. Right-align it so both columns anchor to their
   outer edge instead. text-align handles the heading/plain text; the icon rows
   are flexboxes, which need their own justify-content since text-align doesn't
   reposition flex children. */
.footer-grid-2 .footer-col:last-child { text-align: right; }
.footer-grid-2 .footer-col:last-child .footer-contact-item,
.footer-grid-2 .footer-col:last-child .footer-social { justify-content: flex-end; }
.footer-col h3 { font-size: 1.1rem; font-weight: 700; color: var(--orange); margin-bottom: 1rem; }
.footer-col p { color: var(--gray-400); font-size: .9rem; line-height: 1.7; }
.footer-col ul { display: flex; flex-direction: column; gap: .6rem; }
.footer-col ul li a { color: var(--gray-400); font-size: .9rem; transition: color .3s; }
.footer-col ul li a:hover { color: var(--orange); }
.footer-contact-item { display: flex; align-items: flex-start; gap: .6rem; margin-bottom: .75rem; }
.footer-contact-item i { color: var(--orange); margin-top: .15rem; width: 16px; text-align: center; font-size: .9rem; }
.footer-contact-item span { color: var(--gray-400); font-size: .9rem; }
.footer-contact-item a { color: var(--gray-400); font-size: .9rem; transition: color .3s; }
.footer-contact-item a:hover { color: var(--orange); }
/* 6 icons (github/linkedin/facebook/instagram/music/envelope) in a 4-column footer:
   at 44px each + gap, they need more width than the column has even at full desktop
   size, so the last one (envelope) always wrapped to its own line. Narrower icons
   and a tighter gap fit all 6 on one row - the 44px tap-target height stays, from
   the shared min-height rule, so mobile tapping isn't affected, only the width. */
.footer-social { display: flex; gap: .35rem; margin-top: 1.25rem; flex-wrap: wrap; }
.footer-social a { color: var(--gray-400); font-size: 1.1rem; width: 34px; justify-content: center; transition: color .3s, transform .3s; }
.footer-social a:hover { color: var(--orange); transform: scale(1.15); }
.footer-bottom { max-width: 1200px; margin: 0 auto; border-top: 1px solid #1f2937; padding-top: 1.25rem; display: flex; flex-direction: column; gap: .5rem; align-items: center; justify-content: space-between; }
.footer-bottom p { color: var(--gray-400); font-size: .8rem; }
.footer-legal { display: flex; gap: 1.5rem; }
.footer-legal a { color: var(--gray-400); font-size: .8rem; transition: color .3s; }
.footer-legal a:hover { color: var(--orange); }

/* ============================================================
   Scroll animations (only when JS is present; reduced motion respected)
   ============================================================ */
.js .animate-on-scroll { opacity: 0; transition: opacity .7s ease, transform .7s ease; }
.js .animate-on-scroll.animated { opacity: 1; }
.js .fade-in { transform: translateY(18px); }
.js .fade-in.animated { transform: translateY(0); }
.js .fade-in-left { transform: translateX(-18px); }
.js .fade-in-left.animated { transform: translateX(0); }
.js .fade-in-right { transform: translateX(18px); }
.js .fade-in-right.animated { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .js .animate-on-scroll { opacity: 1; transform: none; transition: none; }
    .card, .project-card-dev, .cat-tile, .tool-card, .btn-primary, .btn-outline, .footer-social a { transition: none; }
    .card:hover, .project-card-dev:hover, .cat-tile:hover, .tool-card:hover, .btn-primary:hover, .btn-outline:hover, .footer-social a:hover { transform: none; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .docs-grid { grid-template-columns: 1fr; }
    .doc-layout { flex-direction: column; gap: 1.5rem; align-items: stretch; }
    .doc-sidebar { position: static; width: 100%; max-height: none; overflow: visible; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: .6rem; padding: .9rem 1rem; }
    .doc-sidebar-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: none; font: inherit; font-weight: 700; color: var(--gray-800); cursor: pointer; padding: .2rem 0; min-height: 44px; }
    .doc-sidebar-toggle i { color: var(--orange); transition: transform .25s; }
    .doc-sidebar.collapsed > :not(.doc-sidebar-toggle) { display: none; }
    .doc-sidebar:not(.collapsed) .doc-sidebar-toggle i { transform: rotate(180deg); }
    .doc-sidebar:not(.collapsed) .doc-sidebar-toggle { margin-bottom: .75rem; border-bottom: 1px solid var(--gray-200); }
    .doc-sidebar-toggle + h3 { display: none; } /* the toggle already says "On this page" */
    .doc-content { max-width: none; }
}
@media (max-width: 768px) {
    .menu-toggle { display: flex; }
    .nav-links { display: none; }
    .header-banner { min-height: 170px; }
    .header-content { padding: 1.75rem 1.25rem; }
    .header-content p { font-size: 1rem; }
    .section { padding: 3rem 0; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    /* Once the 2-column footer stacks to one column here, both blocks are full-width
       and left-aligned like everything else on the page - the right-align above only
       exists to close the side-by-side gap, which no longer exists once stacked. */
    .footer-grid-2 .footer-col:last-child { text-align: left; }
    .footer-grid-2 .footer-col:last-child .footer-contact-item,
    .footer-grid-2 .footer-col:last-child .footer-social { justify-content: flex-start; }
    .feature-row, .feature-row.reverse { flex-direction: column; align-items: stretch; }
    .feature-row + .feature-row { margin-top: 3rem; }
    .feature-img { height: 200px; }
    .bio-layout { flex-direction: column; }
    .bio-photo { width: 200px; height: 200px; }
    .about-layout { flex-direction: column; }
    .form-row { grid-template-columns: 1fr; }
    .about-row { grid-template-columns: 1fr; gap: 1rem; padding: 2rem 0; }
    .about-facts > div { grid-template-columns: 1fr; gap: .15rem; }
    .footer-bottom { flex-direction: column; text-align: center; }
    .docs-grid { grid-template-columns: 1fr; }
    .doc-nav { flex-direction: column; }
    .doc-nav a, .doc-nav a:last-child { max-width: none; text-align: left; margin-left: 0; }
    .site-main { padding: 1.75rem 1.25rem; }
    .doc-content h1 { font-size: 1.6rem; }
    .doc-content pre { font-size: .8rem; padding: 1rem; }
    .back-to-top { right: .9rem; bottom: .9rem; }
}
@media (min-width: 768px) {
    .footer-bottom { flex-direction: row; }
}
