/* 3railhobby – public stylesheet. Neutral light palette with a subtle rail motif. */
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("../fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("../fonts/source-sans-3-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Sans 3"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url("../fonts/source-sans-3-latin-wght-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("../fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("../fonts/source-serif-4-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/barlow-semi-condensed-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #23262b;
  --muted: #6a6e75;
  --line: #e2ded4;
  --line-strong: #cfc9bc;
  --accent: #2f4f6f;        /* deep rail blue */
  --accent-soft: #e8eef4;
  --signal: #d9a521;        /* signal yellow, used sparingly */
  --signal-soft: #fbf3dc;
  --danger: #a33a2f;
  --ok: #3d7a4f;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(30, 30, 20, .06), 0 4px 16px rgba(30, 30, 20, .05);
  --font: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Source Serif 4", Georgia, serif;
  --font-brand: "Barlow Semi Condensed", "Arial Narrow", "Source Sans 3", sans-serif;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
}
img { max-width: 100%; height: auto; display: block; background: #e7e3da; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- Header with rail motif ---------- */
.site-header { background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 68px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-brand); font-size: 1.6rem; font-weight: 700; letter-spacing: .01em; line-height: 1; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo img { width: 32px; height: 32px; flex: none; }
/* Barlow sits low in its line box; lift it so its letters centre on the same line as the menu text. */
.logo-text { position: relative; top: -3px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--ink); padding: 8px 12px; border-radius: 6px; font-weight: 500; }
.nav a:hover { background: var(--accent-soft); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.search { margin-left: auto; display: flex; }
.search input { border: 1px solid var(--line-strong); border-radius: 6px 0 0 6px; padding: 8px 12px; font: inherit; width: 220px; background: var(--surface-2); }
.search button { border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 0 6px 6px 0; padding: 0 14px; font: inherit; cursor: pointer; }
/* Two rails with sleepers underneath the header */
.rails {
  height: 12px;
  background:
    linear-gradient(var(--line-strong), var(--line-strong)) 0 2px / 100% 2px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) 0 8px / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 14px, #e4dfd3 14px 20px);
  background-color: var(--surface);
  border-bottom: 1px solid var(--line);
}

/* ---------- Admin strip (local admin copy of the site) ---------- */
.admin-strip { background: #2b2f36; color: #f1efe9; font-size: .9rem; }
.admin-strip .wrap { display: flex; gap: 16px; align-items: center; min-height: 40px; flex-wrap: wrap; }
.admin-strip strong { color: var(--signal); }
.admin-strip a { color: #f1efe9; }
.admin-strip .right { margin-left: auto; display: flex; gap: 16px; }

/* ---------- Generic blocks ---------- */
main { padding: 28px 0 56px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 36px 0 14px; }
.section-head h2 { margin: 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.secondary { background: var(--surface); color: var(--accent); }
.btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); font-weight: 500; }
.btn.danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: .875rem; }
.tag { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.signal { background: var(--signal-soft); color: #7a5a06; }
.tag.grey { background: #eeebe4; color: var(--muted); }
.breadcrumbs { font-size: .9rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs span { margin: 0 6px; }
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
@media (max-width: 900px) { .layout-side { grid-template-columns: 1fr; } }

/* ---------- Hero carousel (home) ---------- */
.hero { position: relative; overflow: hidden; border-radius: 0 0 var(--radius) var(--radius); background: #d8d3c8; }
.hero-track { display: flex; transition: transform .6s ease; }
.hero-slide { min-width: 100%; position: relative; aspect-ratio: 21 / 8; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 48px 32px 26px;
  background: linear-gradient(transparent, rgba(20, 22, 26, .65)); color: #fff;
}
.hero-caption h2 { margin: 0 0 4px; font-size: 1.8rem; }
.hero-caption a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.car-btn {
  position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .85); color: var(--ink); font-size: 1.3rem; cursor: pointer; box-shadow: var(--shadow);
}
.car-btn.prev { left: 14px; } .car-btn.next { right: 14px; }
.dots { position: absolute; right: 24px; bottom: 22px; display: flex; gap: 8px; }
.dots button { width: 10px; height: 10px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .5); cursor: pointer; padding: 0; }
.dots button.on { background: #fff; }
@media (max-width: 700px) {
  .hero-slide { aspect-ratio: 4 / 3; }
  .hero-caption { padding: 40px 16px 40px; }
  .hero-caption h2 { font-size: 1.3rem; }
  .dots { right: 50%; transform: translateX(50%); bottom: 12px; }
}

/* ---------- Collection cards ---------- */
.coll-card { overflow: hidden; display: flex; flex-direction: column; color: var(--ink); }
.coll-card:hover { text-decoration: none; border-color: var(--line-strong); }
.coll-card img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.coll-card .body { padding: 14px 16px 16px; }
.coll-card h3 { margin: 0 0 4px; }
.coll-card p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.list li:first-child { border-top: 0; }
.list .thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 4px; flex: none; }
.list .meta { font-size: .85rem; color: var(--muted); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); font-weight: 600; }
.table th.sortable::after { content: " ↕"; color: var(--line-strong); }
.table tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- Wiki page ---------- */
.wiki-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.wiki-head h1 { margin-bottom: 10px; }
.tabs { display: flex; gap: 2px; }
.tabs a { padding: 8px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; color: var(--muted); margin-bottom: -1px; }
.tabs a.on { background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 600; }
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; }
.article::after { content: ""; display: table; clear: both; }
.article h2 { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-top: 1.6em; }
.article p { margin: 0 0 1em; }
@media (max-width: 700px) { .article { padding: 18px 16px; } }

.infobox {
  float: right; width: 360px; margin: 0 0 20px 28px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); overflow: hidden; font-size: .92rem;
}
@media (max-width: 760px) { .infobox { float: none; width: 100%; margin: 0 0 20px; } }
.infobox-title { padding: 10px 14px; font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; background: var(--accent); color: #fff; }
.ib-carousel { position: relative; background: #ddd8cd; }
.ib-carousel .hero-track { display: flex; transition: transform .45s ease; }
.ib-carousel .hero-slide { aspect-ratio: 4 / 3; }
.ib-carousel .car-btn { width: 32px; height: 32px; font-size: 1rem; }
.ib-carousel .count { position: absolute; right: 8px; top: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .75rem; padding: 2px 8px; border-radius: 99px; }
.ib-caption { padding: 8px 14px; font-size: .82rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.ib-thumbs { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ib-thumbs img { width: 56px; height: 40px; object-fit: cover; border-radius: 3px; cursor: pointer; opacity: .65; border: 2px solid transparent; }
.ib-thumbs img.on { opacity: 1; border-color: var(--accent); }
.ib-group { padding: 6px 14px; background: #efece5; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.infobox dl { margin: 0; display: grid; grid-template-columns: 44% 56%; }
.infobox dt, .infobox dd { margin: 0; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.infobox dt { color: var(--muted); }
.infobox dd { font-weight: 500; }

.toc { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 20px 12px 16px; margin: 0 0 16px; font-size: .92rem; }
.toc strong { display: block; margin-bottom: 4px; }
.toc ol { margin: 0; padding-left: 20px; }
figure.thumb-right { float: right; clear: right; width: 280px; margin: 4px 0 14px 20px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
/* Left-aligned variant, used next to the infobox so text doesn't get squeezed */
figure.thumb-left { float: left; width: 280px; margin: 4px 20px 14px 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
figure.thumb-right figcaption, figure.thumb-left figcaption { font-size: .82rem; color: var(--muted); padding: 6px 2px 0; }
@media (max-width: 560px) { figure.thumb-right, figure.thumb-left { float: none; width: 100%; margin: 0 0 14px; } }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gallery img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: 4px; }
.page-foot { margin-top: 18px; font-size: .85rem; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }

/* ---------- Forum ---------- */
.forum-cat { margin-bottom: 22px; overflow: hidden; }
.forum-cat-head { padding: 10px 16px; background: var(--accent); color: #fff; font-weight: 700; font-family: var(--font-head); }
.board { display: grid; grid-template-columns: 40px minmax(0, 1fr) 110px 260px; gap: 14px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); }
.board:first-of-type { border-top: 0; }
.board .icon { width: 36px; height: 36px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); }
.board .icon.new { background: var(--signal-soft); color: #7a5a06; }
.board h3 { margin: 0; font-family: var(--font); font-size: 1.02rem; }
.board p { margin: 2px 0 0; font-size: .88rem; color: var(--muted); }
.board .stats { font-size: .85rem; color: var(--muted); text-align: right; }
.board .last { font-size: .85rem; color: var(--muted); }
.board .last a { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .board { grid-template-columns: 36px minmax(0, 1fr); }
  .board .stats, .board .last { grid-column: 2; text-align: left; }
}
.topic-row td:first-child { width: 36px; }
.pin { color: var(--signal); }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 5px 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-size: .9rem; }
.pagination .on { background: var(--accent); color: #fff; border-color: var(--accent); }
.toolbar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }

.post { display: grid; grid-template-columns: 170px minmax(0, 1fr); margin-bottom: 14px; overflow: hidden; }
.post-author { padding: 16px; background: var(--surface-2); border-right: 1px solid var(--line); font-size: .9rem; }
.post-author .name { font-weight: 700; display: block; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: #e4dfd3; display: grid; place-items: center; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.avatar.admin { background: var(--accent); color: #fff; }
.post-body { padding: 14px 20px 16px; }
.post-meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.post-body blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--line-strong); background: var(--surface-2); color: var(--muted); font-size: .92rem; }
.post-actions { margin-top: 10px; display: flex; gap: 8px; }
@media (max-width: 640px) {
  .post { grid-template-columns: 1fr; }
  .post-author { border-right: 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; padding: 10px 14px; }
  .avatar { width: 32px; height: 32px; margin: 0; font-size: .8rem; }
}

/* ---------- Forms ---------- */
.form label { display: block; font-weight: 600; margin: 14px 0 6px; }
.form .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.form input[type=text], .form input[type=email], .form input[type=search], .form input[type=date], .form input[type=password], .form input[type=number], .form select, .form textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; background: var(--surface);
}
.form textarea { min-height: 160px; resize: vertical; }
.form input:focus, .form textarea:focus, .form select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.editor-bar { display: flex; gap: 2px; padding: 6px; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--surface-2); flex-wrap: wrap; }
.editor-bar button { border: 1px solid transparent; background: none; padding: 4px 9px; border-radius: 4px; cursor: pointer; font: inherit; font-size: .9rem; }
.editor-bar button:hover { background: var(--surface); border-color: var(--line); }
.editor-bar .sep { width: 1px; background: var(--line); margin: 2px 4px; }
.editor-bar + textarea { border-radius: 0 0 6px 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.notice { padding: 12px 16px; border-radius: 6px; background: var(--signal-soft); border: 1px solid #efdca6; font-size: .92rem; }
.notice.info { background: var(--accent-soft); border-color: #cddbe8; }
.hp { position: absolute; left: -9999px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0; font-size: .9rem; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }


/* ---------- Additions for the application ---------- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.notice { margin: 0 0 16px; }
.notice.ok { background: #eaf4ec; border-color: #c6e0cc; color: #24502f; }
.notice.error { background: #fbecea; border-color: #efc9c4; color: var(--danger); }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); }
.nav-account { display: flex; gap: 2px; align-items: center; }
.nav-account a, .nav-account button { color: var(--ink); padding: 8px 10px; border-radius: 6px; font: inherit; background: none; border: 0; cursor: pointer; }
.nav-account a:hover, .nav-account button:hover { background: var(--accent-soft); text-decoration: none; }
.nav-account form { display: inline; }
@media (max-width: 700px) {
  .search { margin-left: 0; width: 100%; order: 5; }
  .search input { flex: 1; width: auto; min-width: 0; }
  .site-header .wrap { gap: 6px 14px; padding-top: 8px; padding-bottom: 10px; }
}
.hero-empty { padding: 56px 32px; background: linear-gradient(120deg, #e9e4d8, #f3efe6); border-radius: 0 0 var(--radius) var(--radius); }
.hero-empty h1 { margin: 0 0 6px; }
.hero-caption { pointer-events: none; }
.hero-caption a, .hero-caption button { pointer-events: auto; }

/* Images that open in the lightbox */
[data-lightbox] { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(15, 16, 18, .92); display: none; align-items: center; justify-content: center; flex-direction: column; padding: 20px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; background: none; }
.lightbox .lb-caption { color: #e8e6e1; margin-top: 12px; font-size: .92rem; text-align: center; max-width: 900px; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0; width: 46px; height: 46px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; }
.lightbox button:hover { background: rgba(255, 255, 255, .25); }
.lightbox .lb-close { top: 16px; right: 16px; }
.lightbox .lb-prev { left: 16px; top: 50%; }
.lightbox .lb-next { right: 16px; top: 50%; }

/* Wiki content */
.article figure { margin: 0 0 14px; }
.article figure img { width: 100%; height: auto; border-radius: 4px; }
.article figure figcaption { font-size: .82rem; color: var(--muted); padding: 6px 2px 0; }
.article figure.img-right, .article figure.img-left { width: 280px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
.article figure.img-right { float: right; margin: 4px 0 14px 20px; }
.article figure.img-left { float: left; margin: 4px 20px 14px 0; }
.article figure.img-center { max-width: 640px; margin: 8px auto 16px; text-align: center; }
@media (max-width: 560px) { .article figure.img-right, .article figure.img-left { float: none; width: 100%; margin: 0 0 14px; } }
.article table:not(.table) { width: auto; max-width: 100%; border-collapse: collapse; margin: 0 0 1em; font-size: .95rem; display: block; overflow-x: auto; }
.article table:not(.table) th, .article table:not(.table) td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.article table:not(.table) th { background: var(--surface-2); }
.article .gallery { margin: 0 0 1em; }
.article .gallery figure { margin: 0; }
.article .gallery img { aspect-ratio: 4 / 3; object-fit: cover; }
.article blockquote { margin: 0 0 1em; padding: 8px 16px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.article h2[id] { scroll-margin-top: 16px; }
.article ul, .article ol { padding-left: 24px; }
.article .models-table { clear: none; }
.unpublished { background: var(--signal-soft); border: 1px solid #efdca6; color: #7a5a06; padding: 8px 14px; border-radius: 6px; margin-bottom: 14px; font-size: .92rem; }
.infobox dd a { font-weight: 600; }
.ib-proto { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ib-proto img { width: 64px; height: 44px; object-fit: cover; border-radius: 4px; flex: none; }
.ib-placeholder { aspect-ratio: 4 / 3; display: grid; place-items: center; color: var(--muted); background: #ebe7de; font-size: .9rem; }
.thumb-cell { width: 72px; height: 48px; object-fit: cover; border-radius: 4px; }
.thumb-empty { width: 72px; height: 48px; border-radius: 4px; background: #e7e3da; }
.tile-empty { aspect-ratio: 16 / 10; background: #e7e3da; }
mark { background: #fbe9a8; color: inherit; padding: 0 1px; border-radius: 2px; }
.revision-list li { justify-content: space-between; flex-wrap: wrap; }

/* Forum */
.post-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.post-images img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: 4px; }
.post-body p { margin: 0 0 .8em; }
.post-body ul { margin: 0 0 .8em; padding-left: 22px; }
.post-body a { word-break: break-word; }
.post.hidden-post { opacity: .65; border-style: dashed; }
.post { scroll-margin-top: 16px; }
.post-actions form { display: inline; }
.preview-box { border: 1px dashed var(--line-strong); border-radius: 6px; padding: 12px 14px; margin-top: 10px; background: var(--surface-2); }
.preview-box[hidden] { display: none; }
.member { color: var(--ok); font-weight: 600; }
.file-input { padding: 10px; border: 1px dashed var(--line-strong); border-radius: 6px; background: var(--surface-2); width: 100%; font: inherit; }
.quota { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.mod-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 14px; background: #2b2f36; color: #f1efe9; border-radius: var(--radius); margin-bottom: 14px; font-size: .9rem; }
.mod-bar form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.mod-bar select { padding: 4px 6px; border-radius: 4px; border: 0; font: inherit; }
.mod-bar .btn.sm { border-color: #59606b; background: #3a3f48; color: #f1efe9; }
.mod-bar strong { color: var(--signal); }

/* Search */
.search-big { display: flex; gap: 8px; max-width: 640px; margin-bottom: 20px; }
.search-big input { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; font-size: 1.05rem; }
.hit { padding: 14px 16px; border-top: 1px solid var(--line); }
.hit:first-child { border-top: 0; }
.hit p { margin: 4px 0 0; font-size: .92rem; color: var(--muted); }

/* Account */
.narrow { max-width: 480px; margin: 0 auto; }
.field-error { color: var(--danger); font-size: .85rem; margin-top: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.linklike { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.linklike:hover { text-decoration: underline; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; background: var(--surface); width: auto; max-width: 100%; }
.filter-bar input[type=search], .filter-bar input[type=text] { width: 280px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* Sticky footer: on short pages the footer stays at the bottom of the window. */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }
body > .site-footer { flex-shrink: 0; }

/* Wiki page header: edit button on its own row, right-aligned above the tabs. */
.wiki-head-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; margin-left: auto; }

/* ---------- Videos ---------- */
.article video, .post-video { display: block; width: 100%; max-height: 75vh; background: #111; border-radius: 6px; }
.article figure video { border-radius: 4px; }
.post-video { margin-top: 12px; max-width: 720px; }
.video-embed { position: relative; aspect-ratio: 16 / 9; margin: 0 0 1em; background: #111; border-radius: 6px; overflow: hidden; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.article figure.img-wide { clear: both; }

/* ---------- Collections: subcollections, view switch, tree ---------- */
.view-switch { display: inline-flex; gap: 4px; }
.sub-head { font-size: 1.15rem; margin: 6px 0 12px; }
.tree-tools { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 8px; }
.tree-list { list-style: none; margin: 0; padding: 0 0 0 22px; }
.tree-root { padding-left: 0; }
.tree-node > details > summary { cursor: pointer; padding: 7px 8px; border-radius: 6px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; list-style: none; }
.tree-node > details > summary::-webkit-details-marker { display: none; }
.tree-node > details > summary::before { content: "\25B8"; color: var(--muted); width: 12px; flex: none; transition: transform .15s; }
.tree-node > details[open] > summary::before { transform: rotate(90deg); }
.tree-node > details > summary:hover { background: var(--surface-2); }
.tree-name a { font-weight: 600; font-family: var(--font-head); font-size: 1.02rem; }
.tree-count { font-size: .85rem; color: var(--muted); }
.tree-list > .tree-node { border-left: 1px solid var(--line); }
.tree-root > .tree-node { border-left: 0; }
.tree-page { padding: 5px 8px 5px 30px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: relative; }
.tree-page::before { content: ""; position: absolute; left: 12px; top: 50%; width: 10px; border-top: 1px solid var(--line-strong); }
.tree-empty { margin: 0 0 6px 32px; font-size: .85rem; color: var(--muted); }

/* ---------- Projects (blog) ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; margin-top: 20px; }
.project-card { overflow: hidden; color: var(--ink); display: flex; flex-direction: column; }
.project-card:hover { text-decoration: none; border-color: var(--line-strong); }
.project-card-img img, .project-card-img .tile-empty { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.project-card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.project-card h2 { margin: 0; font-size: 1.3rem; }
.project-card p { margin: 0; color: var(--muted); }
.project-card .read-more { margin-top: auto; padding-top: 8px; color: var(--accent); font-weight: 600; font-size: .92rem; }
.project-meta { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
@media (min-width: 900px) {
  .project-card.featured { grid-column: 1 / -1; flex-direction: row; }
  .project-card.featured .project-card-img { flex: 1.4; }
  .project-card.featured .project-card-img img { height: 100%; aspect-ratio: auto; min-height: 320px; }
  .project-card.featured .body { flex: 1; padding: 32px; justify-content: center; }
  .project-card.featured h2 { font-size: 1.8rem; }
}

/* Project page: full-width cover, wider centered reading column, no infobox. */
.project-hero { position: relative; min-height: 340px; max-height: 70vh; aspect-ratio: 21 / 8; width: 100%; overflow: hidden; background: #2b2f36; }
.project-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.project-hero.no-cover { aspect-ratio: auto; min-height: 0; background: linear-gradient(120deg, #2f4f6f, #23262b); }
.project-hero-text { position: absolute; inset: auto 0 0 0; padding: 80px 0 34px; background: linear-gradient(transparent, rgba(15, 16, 20, .78)); color: #fff; }
.project-hero.no-cover .project-hero-text { position: static; padding: 56px 0 40px; background: none; }
.project-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 10px 0 8px; color: #fff; }
.project-lead { font-size: 1.15rem; max-width: 760px; margin: 0 0 10px; color: #f1efe9; }
.project-hero-meta { font-size: .9rem; color: #d9d6cf; }
.project-wrap { max-width: 1100px; margin: 0 auto; }
.wrap.project-wrap { padding: 0 16px; }
.project-models { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 auto 18px; max-width: 860px; }
.project-body { max-width: 860px; margin: 0 auto; padding: 40px 48px; font-size: 1.06rem; line-height: 1.75; }
.project-body h2 { font-size: 1.55rem; border-bottom: 0; padding-bottom: 0; margin-top: 1.8em; }
.project-body h3 { font-size: 1.2rem; margin-top: 1.5em; }
.project-body figure.img-wide { margin: 28px -48px; width: calc(100% + 96px); max-width: none; background: none; border: 0; padding: 0; }
.project-body figure.img-wide img, .project-body figure.img-wide video { border-radius: 0; }
.project-body figure.img-wide figcaption { padding: 8px 48px 0; }
.project-body figure.img-center { max-width: 100%; }
.project-body .toc { display: none; }
@media (max-width: 760px) {
  .project-body { padding: 22px 16px; font-size: 1rem; }
  .project-body figure.img-wide { margin: 20px -16px; width: calc(100% + 32px); }
  .project-body figure.img-wide figcaption { padding: 8px 16px 0; }
  .project-hero { aspect-ratio: 4 / 3; min-height: 260px; }
}
.project-linked { max-width: 1100px; margin: 36px auto 0; }
.project-linked h2 { font-size: 1.3rem; }
.linked-projects .project-mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.project-mini { display: flex; gap: 12px; align-items: center; color: var(--ink); padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.project-mini:hover { text-decoration: none; border-color: var(--line-strong); }
.project-mini img, .project-mini .thumb-empty { width: 96px; height: 60px; object-fit: cover; border-radius: 4px; flex: none; }

/* Copyright notice under the forum upload field */
.upload-rights { margin-top: 10px; font-size: .9rem; }
.upload-rights .check { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; margin: 8px 0 0; }
.upload-rights .check input { margin-top: 4px; }

/* ---------- Editor layout features (alignment, widths, columns, callouts) ---------- */
.ta-left { text-align: left; }
.ta-center { text-align: center; }
.ta-right { text-align: right; }
.ta-justify { text-align: justify; hyphens: auto; }
/* Figure widths chosen in the editor (5% steps). Without one, floats use 280px. */
.article figure.w-10 { width: 10%; }
.article figure.w-15 { width: 15%; }
.article figure.w-20 { width: 20%; }
.article figure.w-25 { width: 25%; }
.article figure.w-30 { width: 30%; }
.article figure.w-35 { width: 35%; }
.article figure.w-40 { width: 40%; }
.article figure.w-45 { width: 45%; }
.article figure.w-50 { width: 50%; }
.article figure.w-55 { width: 55%; }
.article figure.w-60 { width: 60%; }
.article figure.w-65 { width: 65%; }
.article figure.w-70 { width: 70%; }
.article figure.w-75 { width: 75%; }
.article figure.w-80 { width: 80%; }
.article figure.w-85 { width: 85%; }
.article figure.w-90 { width: 90%; }
.article figure.w-95 { width: 95%; }
.article figure.w-100 { width: 100%; }
.article figure[class*="w-"].img-center { margin-left: auto; margin-right: auto; }
.article figure.img-center:not([class*="w-"]) { max-width: 640px; }
.article figure.img-wide { width: 100%; max-width: none; clear: both; }
@media (max-width: 560px) { .article figure[class*="w-"] { width: 100%; } }
.cols { display: grid; gap: 24px; margin: 0 0 1em; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.cols-12 { grid-template-columns: 1fr 2fr; }
.cols-21 { grid-template-columns: 2fr 1fr; }
.col { min-width: 0; display: flow-root; }
.col > :last-child { margin-bottom: 0; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 12px 16px; margin: 0 0 1em; display: flow-root; }
.callout > :last-child { margin-bottom: 0; }
.callout-warn { border-left-color: var(--signal); background: var(--signal-soft); }
.article hr { border: 0; border-top: 1px solid var(--line-strong); margin: 1.6em 0; clear: both; }
.article mark { background: #fbe9a8; }

/* Project page: one column width for breadcrumb, text, page navigation and linked models. */
.project-wrap { max-width: 960px; }
.project-body { max-width: none; padding: 40px 56px; }
.project-body figure.img-wide { margin-left: -56px; margin-right: -56px; width: calc(100% + 112px); }
.project-body figure.img-wide figcaption { padding: 8px 56px 0; }
.project-linked { max-width: none; }
.project-pages { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; }
.project-pages ol { margin: 6px 0 0; padding-left: 22px; columns: 2; column-gap: 32px; }
.project-pages li { padding: 2px 0; break-inside: avoid; }
.project-pages [aria-current] { font-weight: 700; color: var(--ink); }
.project-pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-top: 16px; }
.project-pager a { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.project-pager a:hover { text-decoration: none; border-color: var(--accent); }
.project-pager .pager-next { text-align: right; }
@media (max-width: 760px) {
  .project-body { padding: 22px 16px; }
  .project-body figure.img-wide { margin-left: -16px; margin-right: -16px; width: calc(100% + 32px); }
  .project-body figure.img-wide figcaption { padding: 8px 16px 0; }
  .project-pages ol { columns: 1; }
  .project-pager { grid-template-columns: 1fr 1fr; }
  .project-pager .pager-pos { display: none; }
}
.project-body > :first-child { margin-top: 0; }
.project-hero .wrap.project-wrap { max-width: 992px; }
.project-pages { scroll-margin-top: 16px; }
.project-pages { scroll-margin-top: 16px; }
