/* govposts Studio. Brand tokens from govposts.co.za (docs/DESIGN_SYSTEM.md). */

@font-face {
  font-family: 'Bricolage';
  src: url('/fonts/bricolage-display.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument';
  src: url('/fonts/instrument-text.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --brand: #1c5c3c;
  --brand-hover: #154a30;
  --board: #0e3323;
  --board-2: #1c5c3c;
  --accent: #f5a524;
  --accent-ink: #2a1a00;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef3f0;
  --text: #161a1a;
  --text-2: #4a5252;
  --rule: #dfe4e2;
  --control: #7d8686;
  --error: #b3261e;
  --error-wash: #fdecea;
  --ok: #1c5c3c;
  --ok-wash: #e6f2eb;
  --warn: #8a4500;
  --warn-wash: #fdf1dc;
  --focus: #f5a524;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(14 51 35 / 0.06), 0 4px 16px rgb(14 51 35 / 0.06);
  --display: 'Bricolage', 'Instrument', system-ui, sans-serif;
  --body: 'Instrument', system-ui, -apple-system, 'Segoe UI', sans-serif;
  accent-color: var(--brand);

  @media (prefers-color-scheme: dark) {
    --brand: #3e9466;
    --brand-hover: #4aa874;
    --board: #0b2a1c;
    --board-2: #164a31;
    --bg: #0f1312;
    --surface: #182120;
    --surface-2: #1f2a28;
    --text: #eef2f1;
    --text-2: #b4bdbb;
    --rule: #2c3836;
    --control: #6e7878;
    --error: #ff8a80;
    --error-wash: #3a1a18;
    --ok: #7fd0a0;
    --ok-wash: #15281d;
    --warn: #f5b754;
    --warn-wash: #33260f;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--body);
  font-size-adjust: from-font;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
p { margin: 0; }
a { color: var(--brand); text-underline-offset: 3px; }
code { font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.icon { width: 1.15em; height: 1.15em; flex: none; }
.muted { color: var(--text-2); }
.center { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- shell ---------- */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: grid;
  gap: 16px;
}
.has-nav main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--board); color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-family: var(--display); font-size: 1.2rem; margin-right: auto; }
.brand img { border-radius: 8px; }
.brand .tag { font-family: var(--body); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; background: var(--accent); color: var(--accent-ink); padding: 2px 8px; border-radius: 999px; }
.topbar .btn.ghost { color: #fff; }
/* Phone: tab bar along the bottom, in thumb reach. */
.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: grid; justify-items: center; gap: 2px;
  padding: 8px 2px 10px; min-height: 56px;
  color: var(--text-2); text-decoration: none; font-size: 0.72rem; font-weight: 600;
}
.tabs a .icon { width: 24px; height: 24px; }
.tabs a[aria-current='page'] { color: var(--brand); }
.tabs a[aria-current='page'] .icon { stroke-width: 2.5; }
@media (min-width: 760px) {
  .has-nav main { padding-bottom: 40px; }
  .tabs { position: static; display: flex; gap: 4px; background: none; border: 0; padding: 0; }
  .tabs a { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; border-radius: 10px; color: #d6e4dc; font-size: 0.95rem; }
  .tabs a:hover { background: rgb(255 255 255 / 0.08); color: #fff; }
  .tabs a[aria-current='page'] { background: rgb(255 255 255 / 0.12); color: #fff; }
  .tabs a .icon { width: 18px; height: 18px; }
}
@media (max-width: 420px) { .hide-narrow { display: none; } }

/* ---------- surfaces ---------- */
.page-title { font-size: 1.6rem; margin-top: 4px; }
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card > h2 { margin-bottom: 4px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.stack { display: grid; gap: 14px; }
.empty { display: grid; justify-items: center; gap: 12px; padding: 28px 16px; text-align: center; }
.link-arrow { font-weight: 600; text-decoration: none; }
.link-arrow::after { content: ' →'; }

/* The dashboard's circular, in the site's "closing board" green. */
.board {
  color: #fff;
  background: linear-gradient(160deg, var(--board-2), var(--board) 70%);
  border-radius: calc(var(--radius) + 4px);
  padding: 20px 18px 18px;
  display: grid; gap: 14px;
}
.board .kicker { color: var(--accent); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; }
.board h1 { font-size: clamp(1.6rem, 6vw, 2.3rem); }
.board-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; }
@media (min-width: 640px) { .board-stats { grid-template-columns: repeat(4, 1fr); } }
.board-stats div { background: rgb(255 255 255 / 0.08); border-radius: 12px; padding: 10px 12px; }
.board-stats dt { font-size: 0.8rem; color: #cfe0d6; }
.board-stats dd { margin: 0; font-family: var(--display); font-size: 1.9rem; line-height: 1.1; }
.board-note { font-size: 0.85rem; color: #cfe0d6; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px;
  font: 600 0.95rem/1.2 var(--body); color: var(--text); text-decoration: none;
  background: var(--surface); border: 1px solid var(--control); border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.accent:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.topbar .btn.ghost:hover { background: rgb(255 255 255 / 0.1); color: #fff; }
.btn.small { min-height: 40px; padding: 8px 12px; font-size: 0.875rem; }
.btn.big { min-height: 56px; font-size: 1.1rem; font-family: var(--display); }
.btn.block { width: 100%; }
.btn.danger { color: var(--error); }
.btn.danger-solid { background: var(--error); border-color: var(--error); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.danger-solid { color: #1a0000; } }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions.end { justify-content: flex-end; }
.actions.quiet { gap: 2px; margin-left: -8px; }
.actions form { display: contents; }

/* ---------- alerts and chips ---------- */
.alert { display: flex; gap: 8px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; font-weight: 500; overflow-wrap: anywhere; }
.alert.ok { background: var(--ok-wash); color: var(--ok); }
.alert.error { background: var(--error-wash); color: var(--error); }
.alert .icon { margin-top: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.78rem; font-weight: 700; line-height: 1;
  padding: 6px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.chip .icon { width: 14px; height: 14px; }
.chip.rendering { background: var(--warn-wash); color: var(--warn); }
.chip.failed { background: var(--error-wash); color: var(--error); }
.chip.done { background: var(--ok-wash); color: var(--ok); }
.counts { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 4px; padding: 0; }
.now { display: grid; gap: 6px; margin-top: 12px; }
.now-title { font-weight: 600; }

/* ---------- progress (fully custom, per browser pseudo-element) ---------- */
.progress-row { display: flex; align-items: center; gap: 10px; }
.pct { font-weight: 700; font-size: 0.875rem; min-width: 3.5ch; text-align: right; }
progress {
  --progress-bar-radius: 1e5px;
  appearance: none;
  border: 0 solid;
  overflow: clip;
  flex: 1;
  inline-size: 100%;
  block-size: 10px;
  border-radius: var(--progress-bar-radius);
  background: var(--surface-2);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.1);
}
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: var(--brand); border-radius: var(--progress-bar-radius); transition: inline-size 0.3s; }
progress::-moz-progress-bar { background: var(--brand); border-radius: var(--progress-bar-radius); transition: inline-size 0.3s; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
label, legend { font-weight: 600; font-size: 0.92rem; }
.opt { font-weight: 400; color: var(--text-2); }
.hint { font-size: 0.85rem; color: var(--text-2); }
input, select, textarea {
  font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--control); border-radius: 10px;
  padding: 10px 12px; min-height: 44px; inline-size: 100%;
}
input[type='checkbox'], input[type='radio'] { inline-size: 20px; block-size: 20px; min-height: 0; margin: 2px 0 0; flex: none; }
input[type='color'] { padding: 4px; inline-size: 64px; block-size: 44px; }
textarea { font-size: 0.9rem; line-height: 1.45; resize: vertical; }
textarea[readonly] { background: var(--surface-2); border-color: var(--rule); }
input:user-invalid, select:user-invalid { border-color: var(--error); background: var(--error-wash); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.input-with-button { position: relative; }
.input-with-button input { padding-right: 76px; }
.input-with-button .btn { position: absolute; right: 2px; top: 2px; min-height: 40px; }
.search { display: flex; gap: 8px; margin: 8px 0 14px; }
.search input { flex: 1; }
fieldset { border: 0; padding: 0; margin: 0; }
.choices { display: grid; gap: 8px; }
.choices legend { margin-bottom: 8px; }
/* Choice cards: the radio is visible, so the colour change is not the only cue. */
.choice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border-radius: 12px; border: 2px solid var(--rule); font-weight: 400; cursor: pointer;
}
.choice:has(> :checked) { border-color: var(--brand); background: var(--ok-wash); }
.choice b { display: block; }
.choice small { color: var(--text-2); }
.colors { display: flex; flex-wrap: wrap; gap: 16px; }
.colors label { display: grid; gap: 6px; }
.plain { list-style: none; padding: 0; margin: 6px 0 10px; display: grid; gap: 8px; }

/* ---------- login ---------- */
.login { max-width: 400px; width: 100%; margin: 8vh auto 0; display: grid; gap: 14px; text-align: center; }
.login-mark { justify-self: center; border-radius: 14px; background: var(--board); padding: 8px; }
.login h1 { font-size: 2rem; }
.login h1 span { color: var(--brand); }
.login form { text-align: left; }

/* ---------- new video ---------- */
.templates { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 760px) { .templates { grid-template-columns: repeat(4, 1fr); } }
.templates a {
  display: grid; gap: 2px; height: 100%;
  padding: 12px; border-radius: 12px;
  background: var(--surface); border: 2px solid var(--rule);
  color: var(--text); text-decoration: none;
}
.templates a:hover { border-color: var(--control); }
.templates a[aria-current] { border-color: var(--brand); background: var(--ok-wash); }
.templates b { font-size: 0.95rem; }
.templates small { color: var(--text-2); font-size: 0.8rem; line-height: 1.35; }
.strip { list-style: none; margin: 8px 0 16px; padding: 0 0 8px; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; }
.strip li { flex: 0 0 min(42%, 220px); scroll-snap-align: start; }
.strip img { display: block; inline-size: 100%; block-size: auto; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 12px; border: 1px solid var(--rule); }

/* ---------- queue ---------- */
.rows, .videos { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.row-item { display: grid; gap: 10px; }
.row-item .card-head { margin: 0; }
.row-title b { display: block; }
.row-title small { color: var(--text-2); }
.row-item.failed { border-color: color-mix(in srgb, var(--error) 35%, var(--rule)); }

/* ---------- library ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.filters .field:first-child, .filters .btn { grid-column: 1 / -1; }
@media (min-width: 760px) { .filters { grid-template-columns: 2fr 1.4fr 1.2fr auto; } .filters .field:first-child, .filters .btn { grid-column: auto; } }
/* The card lays itself out by its own width: its list item is the size container,
   because a container query only styles the container's descendants. */
.videos > li { container-type: inline-size; }
.video { display: grid; gap: 14px; }
.video > video {
  justify-self: center;
  inline-size: min(100%, 240px); block-size: auto; aspect-ratio: 9 / 16;
  object-fit: cover; background: #000; border-radius: 12px;
}
.video h2 small { display: block; font-family: var(--body); font-size: 0.9rem; font-weight: 500; color: var(--text-2); margin-top: 2px; }
.video .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; color: var(--text-2); font-size: 0.85rem; }
.video .caption { display: grid; gap: 4px; }
.video footer { display: grid; gap: 8px; }
@container (min-width: 620px) {
  .video:has(> video) { grid-template-columns: 240px 1fr; grid-template-rows: auto auto 1fr; column-gap: 20px; }
  .video > video { grid-row: 1 / -1; inline-size: 100%; }
}

/* ---------- delete confirmation ---------- */
dialog {
  border: 0; border-radius: var(--radius); padding: 20px;
  max-inline-size: min(420px, calc(100vw - 32px));
  background: var(--surface); color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
}
dialog[open] { display: grid; gap: 12px; }
dialog::backdrop { background: rgb(8 20 14 / 0.55); overflow: hidden; overscroll-behavior: contain; }
dialog:modal { overscroll-behavior: contain; }
