/* ==========================================================================
   Tokens. Dark is the default; <html data-theme="light"> switches to light.
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #0e1016;
  --surface: #161922;
  --surface-2: #1e222d;
  --border: #2a2f3d;
  --fg: #e8eaf0;
  --muted: #9aa1b2;
  --accent: #9b87ff;
  --accent-strong: #b8a9ff;
  --accent-fg: #0e1016;
  --accent-soft: rgb(155 135 255 / 0.14);
  --danger: #ff7070;
  --danger-bg: #e5484d;
  --danger-fg: #fff;
  --shadow: 0 12px 32px rgb(0 0 0 / 0.35);
  --header-bg: rgb(14 16 22 / 0.8);
  --backdrop-opacity: 0.45;

  --radius: 10px;
  --radius-sm: 6px;
  --content: 54rem;
  --wide: 76rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --border: #dedad2;
  --fg: #1b1c21;
  --muted: #62656f;
  --accent: #5b3fd9;
  --accent-strong: #4a2fc4;
  --accent-fg: #ffffff;
  --accent-soft: rgb(91 63 217 / 0.1);
  --danger: #c62828;
  --danger-bg: #c62828;
  --shadow: 0 12px 32px rgb(30 25 60 / 0.1);
  --header-bg: rgb(246 245 242 / 0.85);
  --backdrop-opacity: 0.3;
}

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 var(--font);
  overflow-x: clip;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.4rem); font-weight: 800; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-strong); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--accent-fg); }

img, video { max-width: 100%; }

code { font-family: var(--mono); font-size: 0.9em; }

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

/* ==========================================================================
   Layout
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner, main, .footer-inner {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 1rem;
}

body.admin .header-inner, body.admin main { max-width: var(--wide); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}
.logo svg { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.logo:hover { color: var(--fg); }

.site-nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; justify-content: flex-end; }
.site-nav > a {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.site-nav > a:hover { color: var(--fg); background: var(--surface-2); }
.site-nav > a[aria-current="page"] { color: var(--fg); }

main { flex: 1; padding-top: 1.5rem; padding-bottom: 3rem; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1.25rem; padding-bottom: 1.25rem; }
.site-footer a { color: var(--muted); }

/* Theme toggle: shows a sun in the dark theme and a moon in the light one. */
.theme-toggle { display: inline-flex; margin: 0 0 0 0.25rem; }
.theme-toggle button {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.theme-toggle button:hover { color: var(--fg); background: var(--surface-2); }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; }
.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

/* ==========================================================================
   Components
   ========================================================================== */

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button:hover, .button:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-fg); }
button:disabled { opacity: 0.6; cursor: progress; }

button.secondary, .button.secondary { background: transparent; color: var(--fg); border-color: var(--border); }
button.secondary:hover, .button.secondary:hover { background: var(--surface-2); color: var(--fg); }
button.danger { background: var(--danger-bg); border-color: var(--danger-bg); color: var(--danger-fg); }
button.danger:hover { filter: brightness(1.1); background: var(--danger-bg); border-color: var(--danger-bg); color: var(--danger-fg); }
button.small, .button.small { padding: 0.3rem 0.65rem; font-size: 0.85rem; }
button.link {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-weight: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
button.link:hover { background: none; color: var(--accent-strong); }

input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="file"] { padding: 0.45rem; background: var(--surface-2); }
textarea { resize: vertical; }
label { font-weight: 600; font-size: 0.95rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.9rem 0.75rem; margin: 0.5rem 0 0; }
legend { font-weight: 600; font-size: 0.95rem; padding: 0 0.35rem; }
label.radio, label.checkbox { display: inline-flex; gap: 0.4rem; align-items: center; margin-right: 1rem; font-weight: 400; }

form.stacked { display: grid; gap: 0.4rem; max-width: 30rem; }
form.stacked button { justify-self: start; margin-top: 0.75rem; }
form.inline { display: inline; }

.tag {
  display: inline-block;
  margin: 0 0.3rem 0.3rem 0;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  text-decoration: none;
}
.tag-game, .tag-movie { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
a.tag:hover { border-color: var(--accent); color: var(--accent); }

.notice, .error[role="alert"] { padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); }
.notice { border-left: 3px solid var(--accent); background: var(--accent-soft); }
.error { color: var(--danger); margin: 0.2rem 0; }
.error[role="alert"] { background: color-mix(in srgb, var(--danger) 12%, transparent); }

.empty, .hint, .muted { color: var(--muted); }
.hint { font-size: 0.85rem; }
.meta { margin: 0.15rem 0; color: var(--muted); font-size: 0.9rem; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.72rem; font-weight: 700; color: var(--accent); }
.tags { margin: 0.5rem 0 0; }

/* A blurred copy of a cover behind a panel. */
.backdrop { position: absolute; inset: 0; z-index: -1; overflow: hidden; border-radius: inherit; }
.backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(40px) saturate(1.5);
  transform: scale(1.3);
  opacity: var(--backdrop-opacity);
}

/* ==========================================================================
   Public pages
   ========================================================================== */

/* Game picker */
.game-picker {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.25rem 0.25rem 1rem;
  margin: 0 -0.25rem 0.5rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.pick { flex: 0 0 5.75rem; display: grid; gap: 0.4rem; text-decoration: none; color: var(--muted); scroll-snap-align: start; }
.pick-cover {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  outline: 2px solid transparent;
  outline-offset: 2px;
  background: var(--surface-2);
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  padding: 0.3rem;
  overflow: hidden;
  transition: transform 0.15s, outline-color 0.15s;
}
img.pick-cover { padding: 0; }
.pick-all .pick-cover { background: linear-gradient(160deg, var(--accent-soft), var(--surface-2)); font-size: 0.95rem; }
.pick-name { font-size: 0.8rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick:hover { color: var(--fg); }
.pick:hover .pick-cover { transform: translateY(-2px); }
.pick.active { color: var(--accent); }
.pick.active .pick-cover { outline-color: var(--accent); }
.pick.active .pick-name { font-weight: 700; }

.list-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.list-heading h1 { margin: 0.25rem 0; }

/* Post cards */
.post-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.post-card {
  position: relative;
  isolation: isolate;
  display: flex;
  gap: 1.1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s, transform 0.15s;
}
.post-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.post-card-cover { flex: 0 0 5.5rem; align-self: flex-start; }
.post-card-cover img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.post-card-body { min-width: 0; }
.post-card h2 { margin: 0; font-size: 1.25rem; }
.post-card h2 a { color: var(--fg); text-decoration: none; }
.post-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.post-card h2 a:hover { color: var(--accent); }
.post-card .tags { position: relative; }
.summary { margin: 0.4rem 0 0; }

.post-card.featured { padding: 1.5rem; gap: 1.5rem; overflow: hidden; background: color-mix(in srgb, var(--surface) 75%, transparent); }
.post-card.featured .post-card-cover { flex-basis: 9rem; }
.post-card.featured h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem); }
.post-card.featured .summary { font-size: 1.05rem; }

.load-more { text-align: center; padding-top: 0.5rem; }
.load-more a { display: inline-block; padding: 0.55rem 1.4rem; border: 1px solid var(--border); border-radius: 999px; color: var(--fg); text-decoration: none; font-weight: 600; }
.load-more a:hover { border-color: var(--accent); color: var(--accent); }
.load-more a.htmx-request { opacity: 0.6; }

/* Game grid */
.game-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 1.5rem 1.25rem; }
.game-card { display: grid; gap: 0.3rem; text-decoration: none; color: var(--fg); }
.game-card img, .game-card-placeholder {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.game-card-placeholder { display: grid; place-items: center; padding: 0.75rem; text-align: center; font-weight: 700; background: linear-gradient(160deg, var(--accent-soft), var(--surface-2)); }
.game-card:hover { color: var(--accent); }
.game-card:hover img, .game-card:hover .game-card-placeholder { transform: translateY(-4px); }
.game-card-name { font-weight: 700; line-height: 1.3; margin-top: 0.35rem; }
.game-card-count { font-size: 0.85rem; color: var(--muted); }

/* Heroes on tag and post pages */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  padding: 1.5rem;
  margin: 0 0 2rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  overflow: hidden;
}
.hero h1 { margin: 0.2rem 0 0.25rem; }
.hero-cover { flex: 0 0 9rem; align-self: flex-start; }
.hero-cover img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-text { min-width: 0; }
.hero .lead { margin: 0.75rem 0 0; }

.lead { font-size: 1.15rem; color: var(--muted); }

/* Review scores */
.score-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--accent-fg);
  background: var(--accent);
  white-space: nowrap;
}
.score-badge-large { font-size: 0.9rem; }
td > .score-badge { margin-left: 0.4rem; }
.hero .score {
  margin-left: auto;
  align-self: center;
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  min-width: 7.5rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.hero .score:hover { transform: translateY(-2px); }
.score-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.score-value { font-size: 2.4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.score-value small { font-size: 1rem; font-weight: 700; opacity: 0.75; }
.score-link { font-size: 0.8rem; font-weight: 600; }
.game-card { position: relative; }
.game-card-score {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--accent-fg);
  background: var(--accent);
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.game-card:hover .game-card-score { transform: translateY(-4px); }
.review-fields { margin-top: 0.75rem; }
.review-fields label[for] { display: block; margin-top: 0.4rem; }
.score-input { max-width: 8rem; }

/* Article text */
.prose { max-width: 42rem; overflow-wrap: break-word; }
.post .prose { margin: 0 auto; }
.prose h2 { margin-top: 2.25rem; font-size: 1.5rem; }
.prose h3 { margin-top: 1.75rem; font-size: 1.2rem; }
.prose img, .prose video { display: block; height: auto; margin: 1.5rem 0; border-radius: var(--radius); }
.prose video { width: 100%; background: #000; }
.prose pre { overflow-x: auto; padding: 0.9rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.9rem; }
.prose :not(pre) > code { padding: 0.1em 0.35em; border-radius: 4px; background: var(--surface-2); }
.prose blockquote { margin: 1.5rem 0; padding: 0.25rem 0 0.25rem 1rem; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.35rem 0.7rem; }
.prose th { background: var(--surface-2); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ==========================================================================
   Admin
   ========================================================================== */

.title-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.admin-card {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.admin-card h2 { margin-top: 0; font-size: 1.2rem; }
.admin-card.danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { text-align: left; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--surface-2); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.admin-table td a { font-weight: 600; }
.admin-table small { display: block; color: var(--muted); }
.status { font-weight: 600; font-size: 0.9rem; }
.status-published { color: #3fb950; }
:root[data-theme="light"] .status-published { color: #1a7f37; }
.status-draft { color: var(--muted); }

.cover-col { width: 4.5rem; }
.cover-thumb { width: 3rem; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; display: block; }
.cover { width: 12rem; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }

.login { max-width: 24rem; margin: 3rem auto; padding: 2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.login h1 { margin-top: 0; font-size: 1.6rem; }
.login form { display: grid; gap: 0.5rem; }
.login button { margin-top: 0.5rem; }

/* Post editor */
.editor { display: grid; gap: 1.5rem; }
@media (min-width: 64rem) {
  .editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .editor-preview { position: sticky; top: 4.5rem; max-height: calc(100vh - 6rem); overflow: auto; }
}
form.editor-form { max-width: none; }
textarea.mono { font-family: var(--mono); font-size: 0.9rem; line-height: 1.55; }
.tag-choices { margin: 0.25rem 0 0.5rem; }
.tag-choices strong { display: block; margin-bottom: 0.15rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.editor-preview { border: 1px solid var(--border); border-radius: var(--radius); padding: 0 1.25rem 1rem; background: var(--surface); }
.editor-preview > h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.upload-controls { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; margin: 0.25rem 0 0.5rem; }
.upload-status { font-size: 0.9rem; color: var(--muted); }
textarea.drop-target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* SteamGridDB cover picker */
.search-row { display: flex; gap: 0.75rem; align-items: center; margin: 0.4rem 0 1rem; }
.search-row input { flex: 1; max-width: 30rem; }
.sgdb-games { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.sgdb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.75rem; }
.cover-option { padding: 0; border: 2px solid transparent; background: none; border-radius: var(--radius-sm); overflow: hidden; }
.cover-option:hover, .cover-option:focus-visible { border-color: var(--accent); background: none; }
.cover-option img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }

/* Media library */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; }
.media-item { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; background: var(--surface); }
.media-item img, .media-item video { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #000; }
.media-meta { padding: 0.6rem 0.85rem 0; display: grid; gap: 0.1rem; }
.media-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta small { color: var(--muted); }
.media-actions { padding: 0.6rem 0.85rem 0.85rem; display: flex; gap: 0.5rem; margin-top: auto; }

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 40rem) {
  body { font-size: 16px; }
  .post-card { padding: 0.85rem; gap: 0.85rem; }
  .post-card-cover { flex-basis: 4.25rem; }
  .post-card.featured { padding: 1rem; gap: 1rem; }
  .post-card.featured .post-card-cover { flex-basis: 6rem; }
  .hero { flex-direction: column; align-items: flex-start; padding: 1.25rem; gap: 1rem; }
  .hero-cover { flex-basis: auto; width: 7rem; }
  .hero .score { margin-left: 0; align-self: flex-start; grid-auto-flow: column; align-items: baseline; gap: 0.6rem; padding: 0.6rem 0.9rem; }
  .score-value { font-size: 1.8rem; }
  .admin-table th:nth-child(n+3), .admin-table td:nth-child(n+3) { display: none; }
  .admin-card { padding: 1rem; }
}

.skip-link { position: absolute; left: 1rem; top: -3rem; z-index: 20; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-fg); }
.skip-link:focus { top: 0.5rem; }
.logo svg .cut { fill: var(--bg); }

/* htmx indicators (htmx's own inline styles are disabled for the CSP). */
.htmx-indicator { opacity: 0; transition: opacity 0.2s ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Language switcher */
.lang-switch {
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.lang-switch:hover { color: var(--fg); background: var(--surface-2); }
.lang-switch.unavailable { opacity: 0.6; text-decoration: line-through; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Post editor language tabs */
.lang-tabs { display: none; gap: 0.25rem; border-bottom: 1px solid var(--border); margin: 0 0 1.25rem; }
.tabs-ready .lang-tabs { display: flex; }
.lang-tabs button {
  display: grid;
  gap: 0;
  justify-items: start;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--muted);
  margin-bottom: -1px;
}
.lang-tabs button small { font-weight: 400; font-size: 0.75rem; }
.lang-tabs button:hover { background: var(--surface-2); color: var(--fg); }
.lang-tabs button[aria-selected="true"] { background: var(--surface); color: var(--fg); border-color: var(--border); }
.lang-panel { margin-bottom: 1.5rem; }
.tabs-ready .panel-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.version { display: inline-block; margin: 0 0.35rem 0.2rem 0; padding: 0 0.45rem; border-radius: 4px; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--border); }

@media (max-width: 40rem) {
  .header-inner { gap: 0.5rem; }
  .logo { font-size: 1rem; gap: 0.35rem; }
  .logo svg { width: 1.35rem; height: 1.35rem; }
  .site-nav { flex-wrap: nowrap; gap: 0.15rem; }
  .site-nav > a { padding: 0.35rem 0.45rem; }
  .theme-toggle { margin-left: 0.1rem; }
}

/* Comments and votes */
.comments { max-width: 42rem; margin: 3rem auto 0; padding-top: 2rem; border-top: 1px solid var(--border); }
.comments-head { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.comments-head h2 { margin: 0; font-size: 1.35rem; display: flex; align-items: center; gap: 0.5rem; }
.comment-count {
  min-width: 1.6rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.85rem;
  line-height: 1.6;
  text-align: center;
  background: var(--surface-2);
  color: var(--muted);
}
.comment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.comment-list:not(:empty) + .comments-empty { display: none; }
.comment, .admin-comment {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.comment:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.comment-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; align-items: baseline; font-size: 0.85rem; color: var(--muted); }
.comment-name { color: var(--fg); font-size: 0.95rem; overflow-wrap: anywhere; }
.comment-body { margin: 0.35rem 0 0.5rem; white-space: pre-line; overflow-wrap: anywhere; }
.votes { display: inline-flex; gap: 0.35rem; }
.vote {
  padding: 0.25rem 0.6rem;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}
.vote:hover { background: var(--surface-2); border-color: var(--accent); color: var(--fg); }
.vote[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--fg); }
.vote-count { font-variant-numeric: tabular-nums; }
.votes.htmx-request { opacity: 0.6; }
.comments-empty, .comments-closed { color: var(--muted); }
.comment-form { display: grid; gap: 0.4rem; margin-top: 1.75rem; }
.comment-form h3 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.comment-form button { justify-self: start; margin-top: 0.5rem; }
.comment-form .hint { margin: 0; }
.comment-counter.over { color: var(--danger); font-weight: 600; }
.comment-form.htmx-request button { opacity: 0.6; }
/* The honeypot field, off screen for people but still in the form. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Admin comment moderation */
.admin-comments { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.75rem; max-width: 50rem; }
.admin-comment.comment-hidden { opacity: 0.65; }
.admin-comment.comment-pending { border-color: var(--accent); }
.comment-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.status-hidden { color: var(--muted); }
.status-pending { color: var(--accent); }
.date-input { display: block; max-width: 16rem; margin-top: 0.25rem; }
.date-input + .hint { display: block; margin-top: 0.25rem; }
.footer-credit { width: 100%; max-width: var(--content); margin: -0.5rem auto 0; padding: 0 1rem 1.25rem; font-size: 0.75rem; }
.footer-credit a { color: inherit; }
