/* UC8 Wiki – public design system, default theme "gitbook" (WIKI_THEME=gitbook).
   Clean documentation look in the style of GitBook sites: light header with a search field, flat sidebar with
   small group labels, a calm reading column, rounded cards and call-outs. The structure and feel are similar;
   no GitBook code, fonts or assets are used. Brand colour: the green of the UC8 logo.
   The earlier Minecraft/Create design is kept as a complete theme in static/css/theme-minecraft.css
   (WIKI_THEME=minecraft; also tagged design-minecraft-2026-10-21 in git).
   All colours are custom properties in :root. System fonts only: nothing is loaded from third parties (privacy + CSP). */

:root {
  --bg: #ffffff; --bg-soft: #f6f8fa; --fg: #1c2330; --muted: #5f6b7a;
  --border: #e3e7ec; --accent: #2f7a1f; --accent-soft: #eaf5e4; --accent-fg: #ffffff;
  --code-bg: #f1f4f7; --shadow: 0 1px 2px rgb(16 24 40 / .06);
  --note: #2f6fde; --tip: #1f8a4c; --warning: #b7791f; --danger: #c0392b;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --header-h: 64px; --sidebar-w: 288px; --toc-w: 240px;
  --drawer-top: var(--header-h);   /* phone drawer offset; site.js sets it to the header's real bottom edge */
  color-scheme: light;
}
/* Dark theme: explicit choice, or OS preference when nothing is chosen. */
:root[data-theme="dark"] {
  --bg: #12161c; --bg-soft: #1a2029; --fg: #e7eaee; --muted: #9aa5b4;
  --border: #29313c; --accent: #86d16a; --accent-soft: #1d2b1c; --accent-fg: #0f1a0c;
  --code-bg: #1b222c; --shadow: none;
  --note: #6ea0ff; --tip: #5fcf8b; --warning: #e6b450; --danger: #f0867a; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #12161c; --bg-soft: #1a2029; --fg: #e7eaee; --muted: #9aa5b4;
    --border: #29313c; --accent: #86d16a; --accent-soft: #1d2b1c; --accent-fg: #0f1a0c;
    --code-bg: #1b222c; --shadow: none;
    --note: #6ea0ff; --tip: #5fcf8b; --warning: #e6b450; --danger: #f0867a; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; font: 16px/1.7 var(--font); background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-fg); padding: 8px 12px; z-index: 100; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; top: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.demo-banner { background: color-mix(in srgb, var(--warning) 16%, var(--bg)); color: var(--fg); text-align: center; padding: 8px 12px; font-size: 14px; border-bottom: 1px solid color-mix(in srgb, var(--warning) 35%, var(--bg)); }

/* --- header --- */
.site-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: var(--header-h); padding: 0 24px; background: var(--bg); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.05rem; color: var(--fg); text-decoration: none; white-space: nowrap; }
.brand-logo { width: 32px; height: 32px; display: block; border-radius: 8px; }
.brand-sub { color: var(--muted); font-weight: 500; }
.search-form { flex: 1; max-width: 360px; margin-left: auto; display: flex; gap: 8px; }
.search-form input { width: 100%; padding: 8px 14px; font: inherit; font-size: 14px; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.search-form input::placeholder { color: var(--muted); }
.search-form input:focus-visible { border-color: var(--accent); outline-offset: 0; }
.icon-button { border: 1px solid var(--border); background: var(--bg); color: var(--fg); border-radius: 10px; width: 38px; height: 38px; font-size: 17px; cursor: pointer; }
.icon-button:hover { background: var(--bg-soft); }
.nav-toggle { display: none; }
button, .button { font: inherit; }
.search-form button, .button { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 10px; padding: 8px 16px; cursor: pointer; text-decoration: none; display: inline-block; font-weight: 600; }
.search-form button:hover, .button:hover { filter: brightness(1.08); }
/* The header search has no button (Enter submits); the large search on the home page keeps it. */
.site-header .search-form button { display: none; }

/* --- layout --- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); max-width: 1440px; margin: 0 auto; }
.layout:has(.toc) { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); }
.sidebar { position: sticky; top: var(--header-h); align-self: start; height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 24px 16px 32px 24px; background: var(--bg); }
.content { grid-column: 2; padding: 32px 48px 72px; min-width: 0; width: 100%; max-width: 860px; margin-inline: auto; }
.toc { grid-column: 3; position: sticky; top: var(--header-h); align-self: start; max-height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 32px 16px; font-size: 14px; }
.site-footer { text-align: center; color: var(--muted); font-size: 14px; padding: 32px 24px; border-top: 1px solid var(--border); margin-top: 24px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* --- sidebar navigation: flat links, small uppercase group labels --- */
.nav-category { margin: 0 0 20px; }
.nav-category > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 4px 12px; margin-bottom: 4px; user-select: none; }
.nav-category > summary::-webkit-details-marker { display: none; }
.nav-category > summary a { color: var(--fg); text-decoration: none; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.nav-category > summary::after { content: "▾"; color: var(--muted); font-size: 12px; transition: transform .15s; }
.nav-category:not([open]) > summary::after { transform: rotate(-90deg); }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list li { margin: 1px 0; }
.nav-list a { display: block; padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14.5px; line-height: 1.4; }
.nav-list a:hover { background: var(--bg-soft); color: var(--fg); }
.nav-list a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-list .nav-list { margin: 2px 0 4px 14px; padding-left: 8px; border-left: 1px solid var(--border); }
.nav-empty { padding: 0 12px; }
.nav-backdrop { display: none; }

/* --- table of contents ("On this page") --- */
.toc-title { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--fg); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 4px 12px; margin-left: -1px; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; }
.toc a:hover { color: var(--fg); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }
.toc-level-3 a { padding-left: 26px; }

/* --- home and cards --- */
.hero { position: relative; margin: 0 0 32px; padding: 40px 40px 36px; border-radius: 16px; border: 1px solid var(--border); overflow: hidden; background: var(--bg-soft); }
.hero::before { content: ""; position: absolute; inset: 0 0 0 auto; width: 46%; background: url("../images/uc8-hero.jpg") center / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 40%); mask-image: linear-gradient(90deg, transparent 0, #000 40%); }
.hero > * { position: relative; max-width: 54%; }
.hero h1 { font-size: 2.5rem; margin: 0 0 12px; }
.hero-kicker { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.lead { font-size: 1.1rem; color: var(--muted); }
.search-form-large { max-width: 520px; margin: 20px 0 0; }
.search-form-large input { padding: 12px 16px; font-size: 16px; }
.search-form-large button { display: inline-block; }

.card-grid, .tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 12px 0 32px; }
.card, .tile { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); color: var(--fg); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.card:hover, .tile:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgb(16 24 40 / .08); }
.tile { padding: 0; }
.tile-art { display: none; }   /* textures belong to the Minecraft theme */
.tile-body { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; }
.card-title, .tile-title { font-weight: 600; font-size: 1.05rem; color: var(--fg); }
.card:hover .card-title, .tile:hover .tile-title { color: var(--accent); }
.card-text, .tile-text { color: var(--muted); font-size: 14px; }
.card-meta, .tile-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.recent-list { list-style: none; padding: 0; margin: 0 0 24px; }
.recent-list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.breadcrumbs { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.article-meta { margin-top: -4px; font-size: 14px; }
.results { list-style: none; padding: 0; }
.results li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.results p { margin: 4px 0 0; color: var(--muted); }
.result-title { font-weight: 600; font-size: 1.1rem; margin-right: 8px; }

.content h1 { font-size: 2.2rem; margin: 0 0 12px; }
.content h2 { font-size: 1.55rem; margin: 2em 0 .6em; }
.content h3 { font-size: 1.2rem; margin: 1.6em 0 .5em; }

/* --- rendered article content (.prose) --- */
.prose img { max-width: 100%; height: auto; border-radius: 10px; }
.prose blockquote { margin: 1em 0; padding: .1em 1em; border-left: 3px solid var(--border); color: var(--muted); }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: .15em .4em; border-radius: 6px; }
.prose pre { position: relative; overflow-x: auto; background: var(--code-bg); padding: 16px 18px; border-radius: 10px; border: 1px solid var(--border); }
.prose pre code { background: none; padding: 0; }
.copy-button { position: absolute; top: 8px; right: 8px; font-size: 12px; padding: 3px 10px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.copy-button:hover { color: var(--fg); }
.prose table { border-collapse: separate; border-spacing: 0; display: block; overflow-x: auto; max-width: 100%; margin: 1.2em 0; border: 1px solid var(--border); border-radius: 10px; }
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.prose tr:last-child td { border-bottom: 0; }
.prose th { background: var(--bg-soft); font-weight: 600; }
.prose th[align="right"], .prose td[align="right"] { text-align: right; }
.prose th[align="center"], .prose td[align="center"] { text-align: center; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose kbd { font-family: var(--mono); font-size: .85em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: .1em .45em; background: var(--bg-soft); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .25em 0; }

/* Admonitions: `!!! warning "Title"` in Markdown, drawn as call-out boxes. */
.admonition { margin: 1.2em 0; padding: 4px 18px 10px; border: 1px solid color-mix(in srgb, var(--note) 30%, var(--bg)); border-radius: 12px; background: color-mix(in srgb, var(--note) 8%, var(--bg)); }
.admonition-title { font-weight: 600; margin-bottom: 0; color: var(--note); }
.admonition.tip, .admonition.hint, .admonition.success { border-color: color-mix(in srgb, var(--tip) 30%, var(--bg)); background: color-mix(in srgb, var(--tip) 8%, var(--bg)); }
.admonition.tip .admonition-title, .admonition.hint .admonition-title, .admonition.success .admonition-title { color: var(--tip); }
.admonition.warning, .admonition.caution, .admonition.important { border-color: color-mix(in srgb, var(--warning) 40%, var(--bg)); background: color-mix(in srgb, var(--warning) 10%, var(--bg)); }
.admonition.warning .admonition-title, .admonition.caution .admonition-title, .admonition.important .admonition-title { color: var(--warning); }
.admonition.danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--bg)); background: color-mix(in srgb, var(--danger) 8%, var(--bg)); }
.admonition.danger .admonition-title { color: var(--danger); }

/* Placeholders in the legal pages (templates/wiki/legal_*.html): fill them in, then remove the markup. */
.placeholder { background: #ffd24d; color: #1a1200; padding: 0 4px; font-weight: 600; border-radius: 4px; }

/* Responsive video embed (`{{youtube:ID}}`). */
.embed-responsive { position: relative; aspect-ratio: 16 / 9; margin: 1em 0; }
.embed-responsive iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 10px; }

/* --- narrow content column: the banner becomes a faint backdrop behind the text --- */
@media (max-width: 1000px) {
  .hero::before { width: 100%; opacity: .14; -webkit-mask-image: none; mask-image: none; }
  .hero > * { max-width: none; }
}
/* --- tablet: drop the table of contents --- */
@media (max-width: 1100px) {
  .layout, .layout:has(.toc) { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
  .content { padding: 28px 32px 64px; }
}
/* --- phone: sidebar becomes an off-canvas drawer --- */
@media (max-width: 900px) {
  .layout { display: block; }
  .site-header { padding: 0 14px; }
  .nav-toggle { display: inline-block; }
  .brand-text { display: none; }
  .content { padding: 20px 18px 56px; }
  .content h1 { font-size: 1.8rem; }
  .sidebar { position: fixed; left: 0; top: var(--drawer-top); bottom: 0; width: min(85vw, 320px); height: auto; z-index: 40; transform: translateX(-100%); transition: transform .2s; border-right: 1px solid var(--border); box-shadow: 0 8px 30px rgb(16 24 40 / .18); }
  .nav-open .sidebar { transform: none; }
  .nav-open .nav-backdrop { display: block; position: fixed; inset: var(--drawer-top) 0 0 0; background: rgb(16 24 40 / .45); z-index: 35; }
  .search-form { max-width: none; }
  .hero { padding: 26px 20px; }
  .hero h1 { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --- gallery (public page /gallery/) and sidebar extra link --- */
.gallery-grid { list-style: none; padding: 0; margin: 20px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.gallery-grid li { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-soft); }
.gallery-grid img { display: block; width: 100%; height: 160px; object-fit: cover; }
.gallery-caption { display: block; padding: 8px 12px; font-size: 13px; color: var(--muted); }
.nav-extra { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 14px; }
.nav-extra a { color: var(--fg); text-decoration: none; font-weight: 600; }
.nav-extra a:hover { color: var(--accent); }
