/* rA Vault by Chaos92: one stylesheet for the public site and the admin area. */

:root {
  --bg: #0d0f15;
  --bg-soft: #11141c;
  --surface: #161a24;
  --surface-2: #1d2230;
  --border: #272d3d;
  --border-strong: #363e53;
  --text: #e8eaf0;
  --muted: #9aa2b5;
  --faint: #6c7489;

  --accent: #f4b740;
  --accent-2: #f07f2a;
  --accent-ink: #231603;
  --accent-soft: rgba(244, 183, 64, .12);
  --link: #f6c568;
  --grad: linear-gradient(100deg, #ffd76e 0%, #f4b740 40%, #f07f2a 100%);

  --ok: #3ccf8e;      --ok-bg: rgba(60, 207, 142, .12);
  --danger: #f26464;  --danger-bg: rgba(242, 100, 100, .12);
  --info: #64aefc;    --info-bg: rgba(100, 174, 252, .12);
  --warn: #f4b740;    --warn-bg: rgba(244, 183, 64, .09);
  --warn-border: rgba(244, 183, 64, .42);
  --warn-text: #f8d995;
  --re: #7cc4ff;      --re-bg: rgba(124, 196, 255, .12);
  --pre: #d7a6ff;     --pre-bg: rgba(215, 166, 255, .12);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .28);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6fa;
    --bg-soft: #eef0f6;
    --surface: #ffffff;
    --surface-2: #f2f4f9;
    --border: #e0e4ed;
    --border-strong: #c9cfdc;
    --text: #1a1e29;
    --muted: #5b6377;
    --faint: #8a91a3;
    --accent: #e3a01b;
    --accent-2: #e06a12;
    --accent-ink: #2a1a02;
    --accent-soft: rgba(227, 160, 27, .14);
    --link: #a5620a;
    --ok: #12895a;      --ok-bg: rgba(18, 137, 90, .1);
    --danger: #c93838;  --danger-bg: rgba(201, 56, 56, .09);
    --info: #1f6fc5;    --info-bg: rgba(31, 111, 197, .09);
    --warn-bg: #fff7e3;
    --warn-border: #ecc46a;
    --warn-text: #6e4a00;
    --re: #1865b3;      --re-bg: rgba(24, 101, 179, .1);
    --pre: #7c3cbf;     --pre-bg: rgba(124, 60, 191, .1);
    --shadow: 0 1px 2px rgba(20, 25, 40, .06), 0 8px 24px rgba(20, 25, 40, .08);
    color-scheme: light;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: .05em .35em; }
pre { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto; line-height: 1.5; }
pre code { background: none; border: 0; padding: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.req { color: var(--danger); }
.hl {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Risk bar ---------- */
.riskbar {
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-border);
  color: var(--warn-text);
  font-size: .84rem;
}
.riskbar-inner { display: flex; gap: 10px; align-items: flex-start; padding-top: 8px; padding-bottom: 8px; }
.riskbar p { margin: 0; }
.riskbar a { color: inherit; text-decoration: underline; font-weight: 600; }
.riskbar-icon { font-size: 1rem; line-height: 1.3; }
.risk-short { display: none; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-icon { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 3px 8px rgba(240, 130, 42, .35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-by { font-size: .74rem; color: var(--muted); letter-spacing: .02em; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a, .admin-nav a {
  color: var(--muted); padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; gap: 6px;
}
.main-nav a:hover, .admin-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.main-nav a.active, .admin-nav a.active { color: var(--text); background: var(--accent-soft); }
.count {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center;
}

.admin-bar { border-top: 1px solid var(--border); background: var(--bg-soft); }
.admin-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.admin-nav { display: flex; gap: 2px; flex-wrap: wrap; }
.admin-nav a { font-size: .86rem; padding: 6px 10px; }
.logout-form { display: flex; align-items: center; gap: 10px; margin: 0; }

.site-main { flex: 1; padding-top: 24px; padding-bottom: 48px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0; margin-top: auto; }
.footer-inner { display: grid; grid-template-columns: 1.2fr 1.2fr auto; gap: 28px; align-items: start; }
.footer-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.footer-brand .brand-name { font-size: 1.15rem; }
.footer-icon { width: 24px; height: 24px; }
.footer-risk { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); border-radius: var(--radius-sm); padding: 10px 14px; }
.footer-risk p { margin: 0; }
.footer-nav { display: flex; flex-direction: column; gap: 4px; }
.footer-nav a { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--grad); color: var(--accent-ink); font: inherit; font-weight: 700; font-size: .92rem;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-strong); }
.btn-ok { background: var(--ok); color: #04170e; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; border-color: var(--border); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .8rem; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 16px; border: 1px solid; font-size: .92rem; }
.alert-success { background: var(--ok-bg); border-color: var(--ok); }
.alert-error { background: var(--danger-bg); border-color: var(--danger); }
.alert-info { background: var(--info-bg); border-color: var(--info); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.admin-strip { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.page-head { margin-bottom: 20px; }
.page-head.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head .lead { max-width: 760px; }
.lead { font-size: 1.06rem; color: var(--muted); }
.section-title { font-size: 1.1rem; margin: 0; }
.side-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; font-weight: 700; }

/* ---------- Hero & search ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  text-align: center; padding: 34px 16px 30px; margin-bottom: 26px;
  border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; transform-origin: 50% 0;
  background: radial-gradient(600px 220px at 50% -40px, rgba(244, 183, 64, .18), transparent 70%);
}
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .74rem; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.hero-title { font-size: clamp(2.4rem, 7vw, 3.8rem); font-weight: 900; letter-spacing: -.035em; margin: 0 0 4px; line-height: 1.05; }
.hero-by { display: block; font-size: .9rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); margin-top: 6px; }
.hero-tagline { color: var(--muted); font-size: 1.05rem; margin: 10px auto 20px; max-width: 560px; }
.search { display: flex; gap: 8px; max-width: 620px; margin: 0 auto; }
.search input {
  flex: 1; min-width: 0; padding: 13px 16px; font-size: 1rem; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--bg-soft); color: var(--text);
}
.search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.search .btn { padding: 0 22px; border-radius: 12px; }
.hero-stats { margin: 14px 0 0; color: var(--muted); font-size: .88rem; }
.hero-stats strong { color: var(--text); }

/* ---------- Browse layout ---------- */
.browse { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 26px; align-items: start; }
.sidebar { position: sticky; top: 16px; }
.side-block { margin-bottom: 22px; }
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-list a {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 9px;
  color: var(--text); font-size: .92rem;
}
.cat-list a:hover { background: var(--surface-2); text-decoration: none; }
.cat-list a.active { background: var(--accent-soft); font-weight: 700; }
.cat-icon { width: 20px; text-align: center; flex: none; }
.cat-name { flex: 1; min-width: 0; }
.cat-count { color: var(--muted); font-size: .78rem; background: var(--surface-2); border-radius: 999px; padding: 0 8px; }
.cat-list a.active .cat-count { background: var(--accent); color: var(--accent-ink); }
.seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg a { flex: 1 1 auto; text-align: center; padding: 6px 8px; border-radius: 8px; color: var(--muted); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.active { background: var(--accent-soft); color: var(--text); }
.side-cta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.side-cta p { margin-bottom: 12px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-info { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sort-form { display: flex; align-items: center; gap: 8px; margin: 0; }
.cat-desc { margin-top: -6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--text); font-size: .82rem; border: 1px solid var(--warn-border);
}
.chip:hover { text-decoration: none; filter: brightness(1.1); }
.chip span { color: var(--muted); }
.chip-clear { background: transparent; border-color: var(--border); color: var(--muted); }

.featured { margin-bottom: 30px; }
.featured .section-title { margin-bottom: 12px; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-featured { border-color: var(--warn-border); }
.card-media { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.ribbon {
  position: absolute; top: 10px; left: 10px; background: var(--grad); color: var(--accent-ink);
  font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px;
}
.card-body { padding: 14px 16px 14px; display: flex; flex-direction: column; flex: 1; }
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.card-title { font-size: 1.02rem; margin: 0 0 6px; }
.card-title a { color: var(--text); }
.ver { font-size: .74rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; vertical-align: middle; white-space: nowrap; }
.card-summary {
  color: var(--muted); font-size: .88rem; margin: 0 0 12px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--faint); border-top: 1px solid var(--border); padding-top: 10px; }
.card-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  white-space: nowrap;
}
a.badge:hover { color: var(--text); text-decoration: none; }
.badge-re { background: var(--re-bg); color: var(--re); border-color: transparent; }
.badge-pre { background: var(--pre-bg); color: var(--pre); border-color: transparent; }
.badge-featured { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-report { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.status-pending { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.status-approved { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.status-rejected { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

/* ---------- Pagination & empty ---------- */
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: 26px; }
.pagination a, .pagination span {
  min-width: 38px; padding: 7px 11px; border-radius: 9px; text-align: center; font-size: .88rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.pagination a:hover { border-color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.pagination .disabled { color: var(--faint); }
.pagination .gap { border: 0; background: none; color: var(--faint); }
.empty { text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty-icon { font-size: 2.4rem; margin-bottom: 6px; }

/* ---------- Detail page ---------- */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; font-size: .86rem; color: var(--faint); margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb [aria-current] { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 26px; align-items: start; }
.detail-head { margin-bottom: 18px; }
.detail-title { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 4px 0 8px; }
.detail-title .ver { font-size: .9rem; }
.detail-image { margin: 0 0 22px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.detail-image img { width: 100%; max-height: 520px; object-fit: contain; }
.prose { font-size: .98rem; overflow-wrap: anywhere; }
.prose p { margin-bottom: 1em; }
.prose h2 { margin-top: 1.6em; }
.prose ol, .prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: .35em; }
.doc { max-width: 820px; margin: 0 auto; padding: 28px 32px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 22px; }
.tag { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: .82rem; }
.tag:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.detail-side { position: sticky; top: 16px; }
.download-box .btn-lg { margin-bottom: 8px; font-size: 1.05rem; }
.download-box p { margin-bottom: 0; }
.link-list { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; font-size: .9rem; }
.link-list a { color: var(--text); overflow-wrap: anywhere; }
.risk-box { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.risk-box a { color: inherit; text-decoration: underline; font-weight: 600; }
.risk-title { font-size: 1rem; margin-bottom: 8px; }
.risk-box ol, .risk-box ul { padding-left: 1.2em; margin: 0 0 10px; }
.risk-box li { margin-bottom: 4px; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: .88rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.report summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); }
.report[open] summary { margin-bottom: 12px; color: var(--text); }
.report .field { margin-bottom: 10px; }
.related { margin-top: 36px; }
.related .section-title { margin-bottom: 12px; }

/* ---------- Forms ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; }
.form-aside { position: sticky; top: 16px; }
.form-aside ul, .form-aside ol { padding-left: 1.15em; margin: 0; }
.form-aside li { margin-bottom: 6px; }
.bookmarklet { cursor: grab; }
.form-section { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 18px 20px 6px; margin: 0 0 18px; min-width: 0; }
.form-section legend { padding: 0 8px; margin-left: -8px; font-weight: 800; font-size: .95rem; }
.admin-only { border-color: var(--warn-border); }
.field { margin-bottom: 16px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
label, .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
input[type=text], input[type=url], input[type=search], input[type=password], input[type=number], input[type=email], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--bg-soft); color: var(--text); font: inherit; font-size: .94rem;
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=file] { font-size: .86rem; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: 10px; padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.hint { font-size: .8rem; color: var(--muted); margin: 5px 0 0; }
.field-error { font-size: .82rem; color: var(--danger); margin: 5px 0 0; font-weight: 600; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: .9rem; margin-bottom: 10px; cursor: pointer; }
.check input { margin-top: 4px; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.captcha input { max-width: 120px; }
.image-inputs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.image-inputs .or { color: var(--faint); font-size: .82rem; padding-bottom: 10px; }
.image-preview { margin-top: 12px; max-height: 200px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.image-preview[hidden] { display: none; }
.current-image { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.current-image img { width: 160px; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.stack .field:last-of-type { margin-bottom: 20px; }
.char-counter { float: right; font-size: .76rem; color: var(--faint); font-weight: 400; }
.success-panel h1 { font-size: 1.5rem; }
.login-panel { max-width: 420px; margin-top: 30px; }
.checklist { list-style: none; padding: 0; margin: 0 0 18px; }
.checklist li { padding: 4px 0; }
.checklist .ok { color: var(--ok); }
.checklist .fail { color: var(--danger); font-weight: 700; }

/* ---------- Admin ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { display: flex; flex-direction: column; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
a.stat:hover { border-color: var(--border-strong); text-decoration: none; }
.stat-num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .84rem; }
.stat-warn { border-color: var(--warn-border); background: var(--warn-bg); }
.stat-danger { border-color: var(--danger); background: var(--danger-bg); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.panel .table-wrap { border: 0; border-radius: 0; margin: 0 -20px -20px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--bg-soft); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.thumb-col { width: 80px; }
.thumb { width: 72px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.actions-col { width: 1%; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions form { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.report-details { max-width: 360px; overflow-wrap: anywhere; }
.report-list { list-style: none; margin: 0; padding: 0; }
.report-list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-list li:last-child { border-bottom: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { background: var(--surface-2); color: var(--muted); }
.tabs a.active .count { background: var(--accent); color: var(--accent-ink); }
.inline-search { display: flex; gap: 8px; margin-bottom: 16px; max-width: 520px; }
.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.quick-actions .side-title { margin-bottom: 4px; }
.cat-rows { display: flex; flex-direction: column; gap: 10px; }
.cat-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.cat-row:last-child { border-bottom: 0; padding-bottom: 0; }
.cat-row > form.cat-form { flex: 1; }
.cat-row-meta { display: flex; align-items: center; gap: 10px; }
.cat-row-meta form { margin: 0; }
.cat-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.cat-form .in-icon { width: 58px; text-align: center; }
.cat-form .in-name { width: 190px; }
.cat-form .in-slug { width: 170px; }
.cat-form .in-desc { flex: 1; min-width: 200px; }
.cat-form .in-order { width: 80px; }

/* ---------- Issues & fixes ---------- */
.issue-search { margin-bottom: 22px; }
.issue-search label { font-weight: 600; }
.issue-search textarea, textarea.mono { font-family: var(--mono); font-size: .86rem; }
.issue-list { list-style: none; padding: 0; margin: 10px 0 16px; }
.issue-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.issue-item:last-child { border-bottom: 0; }
.issue-title { font-size: 1.05rem; margin: 6px 0 4px; }
.issue-snippet { font-family: var(--mono); font-size: .8rem; color: var(--muted); margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.issue-item .small { margin: 0; }
.badge-solved { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-open { background: var(--surface-2); color: var(--muted); }
.error-block { border-left: 3px solid var(--danger); white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 18px; }
.answers { margin-top: 28px; }
.answers .section-title { margin-bottom: 12px; }
.answer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.answer-accepted { border-color: var(--ok); box-shadow: inset 3px 0 0 var(--ok); }
.answer-flag { color: var(--ok); font-weight: 700; font-size: .85rem; margin: 0 0 8px; }
.answer .prose p:last-child { margin-bottom: 0; }
.answer-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px; }
.helpful-form { margin: 0; }
.answer-excerpt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .88rem; margin: 4px 0; }
.answer .actions { margin-top: 8px; }
.answer-form { margin-top: 24px; }
.side-links { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.side-links li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.side-links li:last-child { border-bottom: 0; }
.known-issues { margin-top: 28px; }
.answer-rows { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.answer-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--bg-soft); }
.answer-row.has-error { border-color: var(--danger); }
.answer-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 8px; }
.answer-row-head .check { margin: 0; }
.answer-row textarea { margin-bottom: 8px; }
.answer-row .field-row { gap: 8px; }
.form-section > .btn { margin-bottom: 12px; }

/* ---------- Motion ---------- */
/* Entrances only set a start state and fill backwards, so content is visible
   without them and the end state never overrides hover transforms. */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes glow { from { opacity: .55; } to { opacity: 1; transform: scale(1.15); } }
@keyframes shimmer { to { background-position: 200% 0; } }

@view-transition { navigation: auto; }

.hero::before { animation: glow 6s ease-in-out infinite alternate; }
.hero-title .hl {
  background-image: linear-gradient(100deg, #ffd76e 0%, #f4b740 20%, #f07f2a 50%, #f4b740 80%, #ffd76e 100%);
  background-size: 200% 100%;
  animation: shimmer 9s linear infinite;
}
.hero-intro > * { animation: rise .55s cubic-bezier(.2, .7, .2, 1) backwards; }
.hero-intro > :nth-child(2) { animation-delay: 70ms; }
.hero-intro > :nth-child(3) { animation-delay: 140ms; }
.hero-intro > :nth-child(4) { animation-delay: 210ms; }
.hero-intro > :nth-child(5) { animation-delay: 280ms; }

.grid > .card { animation: rise .5s cubic-bezier(.2, .7, .2, 1) backwards; }
.grid > .card:nth-child(2) { animation-delay: 50ms; }
.grid > .card:nth-child(3) { animation-delay: 100ms; }
.grid > .card:nth-child(4) { animation-delay: 150ms; }
.grid > .card:nth-child(5) { animation-delay: 200ms; }
.grid > .card:nth-child(6) { animation-delay: 250ms; }
.grid > .card:nth-child(7) { animation-delay: 300ms; }
.grid > .card:nth-child(8) { animation-delay: 350ms; }
/* Set by app.js on cards below the fold, until they scroll into view. */
@media not print { .grid > .card.reveal-wait { opacity: 0; animation: none; } }

.card-media img { transition: transform .35s ease; }
.brand-icon { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.cat-icon { transition: transform .15s ease; }
.cat-list a, .seg a, .main-nav a, .pagination a, .tag, .chip {
  transition: background-color .15s, border-color .15s, color .15s, filter .15s, transform .1s;
}
.cat-list a:active, .seg a:active, .chip:active { transform: scale(.97); }

@media (hover: hover) {
  .card:hover .card-media img { transform: scale(1.04); }
  .brand:hover .brand-icon { transform: rotate(90deg); }
  .cat-list a:hover .cat-icon { transform: scale(1.2); }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .detail, .form-layout { grid-template-columns: minmax(0, 1fr); }
  .detail-side, .form-aside { position: static; }
  .footer-inner { grid-template-columns: 1fr; gap: 18px; }
  .footer-nav { flex-direction: row; flex-wrap: wrap; gap: 14px; }
}

@media (max-width: 820px) {
  .browse { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .sidebar { position: static; }
  .side-block { margin-bottom: 14px; }
  .side-title { margin-bottom: 8px; }
  /* Categories: a swipe row that runs to the screen edges, so chips slide off
     the side of the screen instead of being cut at the page padding. The fade
     hints at more to the right; the end padding lets the last chip clear it.
     The block padding leaves room for the focus ring. */
  .cat-list {
    flex-direction: row; overflow-x: auto; gap: 8px; margin: -4px -16px; padding: 4px 36px 4px 16px;
    scroll-padding: 0 16px; scroll-snap-type: x proximity; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
  }
  .cat-list::-webkit-scrollbar { display: none; }
  .cat-list li { flex: none; scroll-snap-align: start; }
  .cat-list a {
    white-space: nowrap; min-height: 40px; padding: 6px 12px 6px 10px; gap: 7px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface);
  }
  .cat-list a:hover { background: var(--surface); }
  .cat-list a.active { background: var(--accent-soft); border-color: var(--warn-border); }
  /* Server mode: three equal segments across the full width. */
  .seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seg a { display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 6px 4px; }
  .seg a.active { box-shadow: inset 0 0 0 1px var(--warn-border); }
  .side-cta { display: none; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .risk-long { display: none; }
  .risk-short { display: inline; }
  .header-inner { justify-content: center; }
  .main-nav { justify-content: center; }
  .hero { padding: 26px 14px 22px; border-radius: 16px; }
  .search { flex-direction: column; }
  .search .btn { padding: 12px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .image-inputs { grid-template-columns: 1fr; }
  .image-inputs .or { padding: 0; }
  .panel { padding: 16px; }
  .panel .table-wrap { margin: 0 -16px -16px; }
  .doc { padding: 20px 18px; }
  .admin-bar-inner { justify-content: center; }
  .logout-form .muted { display: none; }
}

@media print, (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
