/* m4tt.de – shared stylesheet for all generated pages.
 * Colors come from CSS variables (assets/themes.css, generated from themes.yaml).
 * Replaces the Tailwind CDN: the few utility classes still used in the markup are defined at the end. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5;
       transition: background-color .2s, color .2s; }
img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: underline; transition: color .2s; }
a:hover { color: var(--link-hover); }
h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.25; margin: 0; }
h1 { color: var(--heading); font-size: 1.9rem; font-weight: 700; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
button, input, select, textarea { font: inherit; }
ul { margin: 0; padding: 0; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 200; background: var(--surface); color: var(--heading); padding: .5rem 1rem; }
.skip:focus { left: .5rem; top: .5rem; }

/* ------------------------------------------------------------------ shell + navigation */
:root { --side-w: 228px; --side-w-collapsed: 64px; --topbar-h: 56px; }
.shell { display: flex; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: 0 0 var(--side-w);
        background: var(--nav-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column;
        transition: width .2s, flex-basis .2s; z-index: 50; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .9rem .8rem .7rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--heading) !important; min-width: 0; }
.brand-logo { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
              background: var(--primary-soft); color: var(--primary-text); font-weight: 800; font-family: ui-monospace, monospace; font-size: .85rem; }
.brand-text { font-weight: 800; line-height: 1.1; white-space: nowrap; overflow: hidden; }
.brand-text small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }
.side-toggle { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; width: 28px; height: 28px;
               cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; }
.side-toggle:hover { color: var(--heading); border-color: var(--border-accent); }
.side-nav { flex: 1; overflow-y: auto; padding: .3rem .5rem; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; border-radius: 9px; text-decoration: none;
            color: var(--text-soft) !important; font-weight: 500; white-space: nowrap; }
.nav-item svg { width: 20px; height: 20px; flex: 0 0 20px; stroke: currentColor; fill: none; stroke-width: 1.8;
                stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav-item:hover { background: var(--surface); color: var(--heading) !important; }
.nav-item.active { background: var(--nav-active); color: var(--heading) !important; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.active svg { opacity: 1; stroke: var(--accent); }
.nav-sep { height: 1px; background: var(--border); margin: .5rem .7rem; }
.nav-ext::after { content: "\2197"; font-size: .75rem; color: var(--faint); margin-left: auto; }
.side-foot { padding: .7rem .8rem 1rem; border-top: 1px solid var(--border); }
.theme-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin-bottom: .35rem; }
.theme-swatches { display: flex; gap: .4rem; margin-bottom: .55rem; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0;
          background: linear-gradient(135deg, var(--sw-a) 0 50%, var(--sw-b) 50% 100%); }
.swatch.on { border-color: var(--heading); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.mode-seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.mode-seg button { flex: 1; background: none; border: none; color: var(--muted); padding: .3rem 0; cursor: pointer; font-size: .8rem; }
.mode-seg button.on { background: var(--surface); color: var(--heading); font-weight: 700; }
.mode-cycle { display: none; }

/* collapsed sidebar (desktop) */
html[data-nav="collapsed"] .side { width: var(--side-w-collapsed); flex-basis: var(--side-w-collapsed); }
html[data-nav="collapsed"] .brand-text, html[data-nav="collapsed"] .nav-label, html[data-nav="collapsed"] .nav-ext::after,
html[data-nav="collapsed"] .theme-label, html[data-nav="collapsed"] .theme-swatches, html[data-nav="collapsed"] .mode-seg { display: none; }
html[data-nav="collapsed"] .side-head { flex-direction: column; padding: .8rem .4rem .5rem; }
html[data-nav="collapsed"] .nav-item { justify-content: center; padding: .6rem 0; }
html[data-nav="collapsed"] .side-toggle { transform: rotate(180deg); }
html[data-nav="collapsed"] .mode-cycle { display: grid; place-items: center; width: 100%; background: none; border: 1px solid var(--border);
                                         color: var(--muted); border-radius: 8px; padding: .35rem 0; cursor: pointer; }

/* top bar + dropdown menu (phones, tablets) */
.topbar { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.2rem 1.4rem; flex: 1; }
.wrap.narrow { max-width: 980px; }
.site-foot { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; padding: 1rem 1.4rem 1.6rem;
             display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center; max-width: 1240px; width: 100%; margin: 0 auto; }
.site-foot .spacer { flex: 1; }

@media (max-width: 900px) {
  .shell { display: block; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 60; height: var(--topbar-h); align-items: center; justify-content: space-between;
            padding: 0 .9rem; background: var(--nav-bg); border-bottom: 1px solid var(--border); }
  .burger { background: none; border: 1px solid var(--border); color: var(--heading); border-radius: 9px; width: 42px; height: 38px;
            cursor: pointer; display: grid; place-items: center; }
  .burger svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
  .side { position: fixed; top: var(--topbar-h); left: 0; right: 0; height: auto; max-height: calc(100vh - var(--topbar-h));
          width: 100% !important; flex-basis: auto !important; border-right: none; border-bottom: 1px solid var(--border);
          transform: translateY(-110%); opacity: 0; pointer-events: none; transition: transform .2s, opacity .2s;
          box-shadow: 0 12px 30px rgba(0,0,0,.35); }
  html.menu-open .side { transform: none; opacity: 1; pointer-events: auto; }
  .side-head { display: none; }
  .side-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: .6rem; }
  html[data-nav="collapsed"] .nav-label, html[data-nav="collapsed"] .theme-label,
  html[data-nav="collapsed"] .theme-swatches, html[data-nav="collapsed"] .mode-seg { display: revert; }
  html[data-nav="collapsed"] .theme-swatches { display: flex; } html[data-nav="collapsed"] .mode-seg { display: flex; }
  html[data-nav="collapsed"] .nav-item { justify-content: flex-start; padding: .55rem .7rem; }
  html[data-nav="collapsed"] .mode-cycle { display: none; }
  .side-foot { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
  .theme-swatches { margin: 0; }
  .wrap { padding: 1rem .9rem; }
  h1 { font-size: 1.5rem; }
}
@media (max-width: 520px) { .side-nav { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ common components */
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.lead { color: var(--text-soft); margin: .4rem 0 1.2rem; max-width: 70ch; }
.dl-h2, .h2 { font-size: 1.45rem; font-weight: 700; color: var(--accent); margin: 2rem 0 1rem; }
.dl-section { font-size: 1.1rem; font-weight: 700; color: var(--accent-soft); margin: 1.25rem 0 .5rem; }
.card, .dl-card { background: var(--surface); border: 1px solid var(--border); border-radius: .6rem; padding: 1rem; margin-bottom: .75rem; color: var(--text-soft); }
.dl-card.dl-muted { border-style: dashed; }
.dl-card.dl-warn { border-color: var(--warn); }
.dl-title { color: var(--heading); font-weight: 600; }
.dl-links { list-style: none; margin-top: .4rem; padding: 0; }
.dl-links li { margin: .25rem 0; }
.dl-primary { display: inline-block; background: var(--primary-soft); color: var(--primary-text) !important; text-decoration: none;
              padding: .35rem .8rem; border-radius: .35rem; font-weight: 700; }
.dl-primary:hover { background: var(--primary); }
.intro { color: var(--text-soft); margin-top: .5rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1rem 0 1.5rem; }
.stat { background: var(--surface2); border: 1px solid var(--border-accent); border-radius: .55rem; padding: .75rem 1rem; }
.stat-v { font-size: 1.6rem; font-weight: 800; color: var(--heading); line-height: 1.1; }
.stat-l { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.btn { display: inline-block; text-align: center; color: var(--primary-text) !important; font-weight: 700; padding: .5rem 1rem;
       border-radius: .35rem; text-decoration: none; cursor: pointer; border: none; background: var(--surface); }
.btn-join, .btn.primary { background: var(--primary); } .btn-join:hover, .btn.primary:hover { background: var(--primary-hover); }
.btn-invite, .btn.secondary { background: var(--secondary); } .btn-invite:hover, .btn.secondary:hover { background: var(--secondary-hover); }
.btn-sm { display: inline-block; padding: .3rem .7rem; border-radius: .3rem; background: var(--surface2); color: var(--heading) !important;
          text-decoration: none; font-weight: 600; font-size: .85rem; border: 1px solid var(--border); }
.btn-sm.btn-join { background: var(--primary); color: var(--primary-text) !important; border-color: transparent; }
.btn-more { margin-top: .5rem; color: var(--link); text-decoration: underline; background: none; border: none; cursor: pointer; }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: .1rem .45rem; border-radius: .3rem; white-space: nowrap; }
.badge-kind { background: var(--surface2); color: var(--text-soft); border: 1px solid var(--border); }
.badge-new { background: var(--warn); color: #000; }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .3rem .8rem; text-decoration: none; color: var(--text-soft) !important; }
.chip:hover { border-color: var(--accent); }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
input[type=search], input[type=text], select, textarea { background: var(--input-bg); border: 1px solid var(--input-border); color: var(--input-text);
       padding: .55rem .8rem; border-radius: .35rem; }
input::placeholder, textarea::placeholder { color: var(--faint); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* download pages */
.server-item { background: var(--surface); border: 1px solid var(--border); border-radius: .5rem; padding: 1rem; color: var(--text-soft); }
.server-item:hover, .server-item.is-target { border-color: var(--live); }
.related-item { padding: .2rem 0; }
#join-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: none; align-items: center; justify-content: center; z-index: 900; }
#join-overlay.open { display: flex; }
#join-overlay .box { background: var(--surface); border: 2px solid var(--primary); border-radius: .5rem; padding: 1.5rem; max-width: 520px; width: 92%; color: var(--text-soft); }

/* portal */
.controls { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.controls input { flex: 1; min-width: 240px; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab { background: var(--surface); border: 1px solid var(--border); color: var(--text-soft); padding: .35rem .8rem; border-radius: 999px; cursor: pointer; }
.tab.on { border-color: var(--accent); color: var(--heading); background: var(--chip-on); }
.tab-n { color: var(--muted); font-size: .8rem; margin-left: .2rem; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .9rem; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: .6rem; padding: 1rem; display: flex; flex-direction: column; color: var(--text-soft); }
.pcard:hover { border-color: var(--accent); }
.pcard-title { color: var(--heading); font-weight: 700; font-size: 1.05rem; }
.pcard-title a { color: var(--heading) !important; text-decoration: none; }
.pcard-title a:hover { text-decoration: underline; }
.pcard-meta { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.pcard-live { color: var(--accent); font-size: .9rem; margin-top: .35rem; }
.pcard-actions { margin-top: auto; padding-top: .8rem; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.goto { font-size: .9rem; }
.srv-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; }
.srv-row { background: var(--surface); border: 1px solid var(--border); border-radius: .5rem; padding: .75rem 1rem; color: var(--text-soft); }
.srv-row.live { border-color: var(--live); }
.more-list { list-style: none; }
.more-list li { padding: .5rem 0; border-bottom: 1px solid var(--border); }

/* report flags (report.js) */
.rp-flag { background: none; border: none; color: var(--faint); cursor: pointer; font-size: .85rem; padding: 0 .25rem; }
.rp-flag:hover { color: var(--warn); }
.rp-page { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: .35rem; padding: .3rem .7rem; cursor: pointer; font-size: .85rem; }
.rp-page:hover { border-color: var(--warn); color: var(--warn); }

/* ------------------------------------------------------------------ utilities (former Tailwind classes) */
.flex { display: flex; } .grid { display: grid; } .flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }
.items-start { align-items: flex-start; } .items-center { align-items: center; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-6 { gap: 1.5rem; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .col-span-2 { grid-column: span 2 / span 2; }
.space-y-4 > * + * { margin-top: 1rem; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; } .mt-10 { margin-top: 2.5rem; } .mt-12 { margin-top: 3rem; }
.mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.ml-4 { margin-left: 1.25rem; } .pt-2 { padding-top: .5rem; }
.list-disc { list-style: disc; } ul.ml-4 { padding-left: .25rem; }
.text-xs { font-size: .75rem; } .text-sm { font-size: .875rem; } .text-lg { font-size: 1.125rem; } .text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; } .text-3xl { font-size: 1.875rem; }
@media (min-width: 768px) { .md\:text-3xl { font-size: 1.875rem; } .md\:text-2xl { font-size: 1.5rem; } }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; } .whitespace-nowrap { white-space: nowrap; }
.underline { text-decoration: underline; } .cursor-pointer { cursor: pointer; }
.text-white { color: var(--heading); } .text-gray-300 { color: var(--text-soft); } .text-gray-400 { color: var(--muted); }
.text-gray-500 { color: var(--faint); } .text-green-400 { color: var(--accent); }
.border-t { border-top: 1px solid var(--border); } .border-gray-700 { border-color: var(--border); }

/* ------------------------------------------------------------------ start page */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.5rem; align-items: center;
        background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%); border: 1px solid var(--border);
        border-radius: .9rem; padding: 1.6rem 1.8rem; margin-bottom: 1.5rem; }
.hero h1 { font-size: 2.1rem; }
.hero p { color: var(--text-soft); margin: .6rem 0 1rem; max-width: 60ch; }
.hero-cta { display: flex; gap: .6rem; flex-wrap: wrap; }
.hero-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.hero-facts .stat { margin: 0; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; padding: 1.2rem; } .hero h1 { font-size: 1.6rem; } }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.section-head .h2 { margin-bottom: .6rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: .7rem; padding: 1rem 1.1rem;
        text-decoration: none; color: var(--text-soft) !important; }
.tile:hover { border-color: var(--accent); }
.tile b { display: block; color: var(--heading); font-size: 1.05rem; margin-bottom: .2rem; }
.tile svg { width: 26px; height: 26px; stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: .4rem; }

/* ------------------------------------------------------------------ news */
.nw-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: .55rem;
           padding: .9rem 1.1rem; margin-bottom: .9rem; color: var(--text-soft); }
.nw-card.nw-target { box-shadow: 0 0 0 2px var(--accent); }
.nw-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .85rem; margin-bottom: .4rem;
           padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.nw-author { color: var(--accent); font-weight: 700; }
.nw-date { color: var(--muted) !important; text-decoration: none; }
.nw-date:hover { text-decoration: underline; }
.nw-body { overflow-wrap: anywhere; }
.nw-body p { margin: .4rem 0; }
.nw-body h3, .nw-body h4, .nw-body h5 { color: var(--heading); margin: .6rem 0 .3rem; }
.nw-body pre, .prose pre { background: var(--surface2); border: 1px solid var(--border); border-radius: .4rem; padding: .6rem .8rem; overflow-x: auto; }
.nw-body code, .prose code { background: var(--surface2); border-radius: .25rem; padding: .05rem .3rem; }
.nw-body pre code, .prose pre code { background: none; padding: 0; }
.nw-body ul, .nw-body ol { padding-left: 1.4rem; margin: .4rem 0; }
.nw-body blockquote, .prose blockquote { border-left: 3px solid var(--border-accent); margin: .5rem 0; padding: .2rem .8rem; color: var(--muted); }
.nw-mention { color: var(--link); font-weight: 600; }
.nw-img { display: block; max-height: 420px; width: auto; max-width: 100%; border-radius: .4rem; border: 1px solid var(--border); margin-top: .5rem; }
.nw-card.compact .nw-img { max-height: 180px; }
.nw-card.compact .nw-body { max-height: 9.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }

/* ------------------------------------------------------------------ hall of fame */
.hof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.hof-card { background: var(--surface); border: 1px solid var(--border); border-radius: .7rem; padding: 1rem 1.1rem; }
.hof-card h3 { color: var(--heading); font-size: 1.05rem; margin-bottom: .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.hof-list { list-style: none; margin: 0; padding: 0; }
.hof-row { display: grid; grid-template-columns: 2.4rem 1fr auto; gap: .2rem .5rem; align-items: center; padding: .3rem 0; color: var(--text-soft); }
.hof-row.top .hof-name { color: var(--heading); font-weight: 700; }
.hof-rank { color: var(--warn); font-weight: 700; }
.hof-val { color: var(--accent); font-variant-numeric: tabular-nums; }
.hof-bar { grid-column: 2 / 4; height: 4px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.hof-bar span { display: block; height: 100%; background: var(--accent); opacity: .7; }

/* ------------------------------------------------------------------ knowledge base / faq / prose */
.prose { color: var(--text-soft); max-width: 75ch; }
.prose h2, .prose h3, .prose h4 { color: var(--heading); margin: 1.4rem 0 .5rem; }
.prose h2 { font-size: 1.35rem; } .prose h3 { font-size: 1.15rem; }
.prose p { margin: .6rem 0; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: .6rem 0; }
.prose li { margin: .2rem 0; }
.prose img { border-radius: .4rem; border: 1px solid var(--border); }
.kb-cats { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0 1rem; }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; }
.kb-card { display: flex; flex-direction: column; gap: .3rem; background: var(--surface); border: 1px solid var(--border); border-radius: .6rem;
           padding: 1rem; text-decoration: none; color: var(--text-soft) !important; }
.kb-card:hover { border-color: var(--accent); }
.kb-card b { color: var(--heading); font-size: 1.02rem; }
.kb-meta { font-size: .8rem; color: var(--muted); }
.faq-group { margin-bottom: 1.4rem; }
.faq-group > h2 { font-size: 1.15rem; color: var(--accent-soft); margin: 1rem 0 .5rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: .55rem; margin-bottom: .5rem; }
.faq-item > summary { cursor: pointer; padding: .8rem 1rem; color: var(--heading); font-weight: 600; list-style: none; display: flex; gap: .6rem; }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::before { content: "+"; color: var(--accent); font-weight: 800; width: 1rem; flex: 0 0 1rem; }
.faq-item[open] > summary::before { content: "\2212"; }
.faq-item[open] { border-color: var(--border-accent); }
.faq-answer { padding: 0 1rem .9rem 2.6rem; }
.faq-answer .prose { max-width: none; }
.faq-link { font-size: .8rem; margin-left: auto; color: var(--faint) !important; text-decoration: none; }
.toc { background: var(--surface2); border: 1px solid var(--border); border-radius: .5rem; padding: .7rem 1rem; font-size: .9rem; }
.toc ul { list-style: none; padding: 0; margin: .3rem 0 0; }
.toc li { margin: .15rem 0; }
.kb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 2rem; align-items: start; }
.kb-side { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 1000px) { .kb-layout { grid-template-columns: 1fr; } .kb-side { position: static; } }

/* ------------------------------------------------------------------ gallery */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.album { display: block; text-decoration: none; color: var(--text-soft) !important; background: var(--surface); border: 1px solid var(--border);
         border-radius: .7rem; overflow: hidden; }
.album:hover { border-color: var(--accent); }
.album-cover { aspect-ratio: 16 / 10; background: var(--surface2); overflow: hidden; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.album:hover .album-cover img { transform: scale(1.04); }
.album-info { padding: .7rem .9rem .9rem; }
.album-info b { display: block; color: var(--heading); font-size: 1.05rem; }
.photos { columns: 4 260px; column-gap: .7rem; }
.photo { break-inside: avoid; margin: 0 0 .7rem; position: relative; border-radius: .5rem; overflow: hidden; background: var(--surface2);
         border: 1px solid var(--border); display: block; cursor: zoom-in; padding: 0; width: 100%; }
.photo img { display: block; width: 100%; height: auto; transition: transform .3s, opacity .3s; }
.photo:hover img { transform: scale(1.03); }
.photo figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: .9rem .6rem .45rem; font-size: .8rem; color: #fff; text-align: left;
                    background: linear-gradient(transparent, rgba(0,0,0,.75)); opacity: 0; transition: opacity .2s; }
.photo:hover figcaption, .photo:focus figcaption { opacity: 1; }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 220px); gap: .6rem; overflow-x: auto; padding-bottom: .4rem; }
.strip a { display: block; border-radius: .5rem; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 4 / 3; }
.strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.94); display: none; flex-direction: column; color: #e5e7eb; }
.lb.open { display: flex; }
.lb-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 1rem; font-size: .9rem; }
.lb-top a, .lb-top button { color: #e5e7eb !important; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
                            border-radius: .4rem; padding: .3rem .7rem; cursor: pointer; text-decoration: none; font-size: .85rem; }
.lb-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; touch-action: pan-y; }
.lb-stage img { max-width: 96vw; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.2);
          color: #fff; width: 48px; height: 64px; border-radius: .5rem; font-size: 1.6rem; cursor: pointer; }
.lb-prev { left: .8rem; } .lb-next { right: .8rem; }
.lb-cap { padding: .6rem 1rem 1rem; text-align: center; font-size: .95rem; min-height: 2.6rem; }
.lb-cap small { display: block; color: #9ca3af; }
@media (max-width: 700px) { .lb-nav { display: none; } }
