/*
 * Shared styles.
 *
 * Councillors will mostly use this on a phone, standing outside whatever they
 * just filmed, so touch targets are generous and nothing depends on hover.
 */

:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-sunk: #f4f6f9;
  --ink: #11151b;
  --ink-soft: #38414e;
  --muted: #626d7d;
  --rule: #d8dee7;
  --rule-strong: #bcc5d2;
  --accent: #10357f;
  --accent-hover: #0b2760;
  --accent-soft: #e6ecf8;
  --accent-ink: #10357f;
  --warn: #9a4a06;
  --warn-soft: #fdf0e2;
  --warn-rule: #f0cfa8;
  --bad: #a52318;
  --bad-soft: #fdecea;
  --bad-rule: #f2c3bd;
  --good: #0d6b39;
  --good-soft: #e4f3ea;
  --good-rule: #b3ddc4;
  --shadow: 0 1px 2px rgba(17, 21, 27, 0.06), 0 10px 28px -16px rgba(17, 21, 27, 0.25);

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1015;
    --surface: #161b22;
    --surface-sunk: #10151b;
    --ink: #e8ecf2;
    --ink-soft: #c3cbd6;
    --muted: #8d97a6;
    --rule: #262d38;
    --rule-strong: #3a4350;
    --accent: #7d9bf0;
    --accent-hover: #9db3f5;
    --accent-soft: #1a2540;
    --accent-ink: #a8bdf7;
    --warn: #f0a95e;
    --warn-soft: #2a1e12;
    --warn-rule: #4a361f;
    --bad: #f08c82;
    --bad-soft: #2c1614;
    --bad-rule: #532723;
    --good: #5fd394;
    --good-soft: #10251a;
    --good-rule: #1f4432;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 28px -16px rgba(0, 0, 0, 0.8);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1015;
  --surface: #161b22;
  --surface-sunk: #10151b;
  --ink: #e8ecf2;
  --ink-soft: #c3cbd6;
  --muted: #8d97a6;
  --rule: #262d38;
  --rule-strong: #3a4350;
  --accent: #7d9bf0;
  --accent-hover: #9db3f5;
  --accent-soft: #1a2540;
  --accent-ink: #a8bdf7;
  --warn: #f0a95e;
  --warn-soft: #2a1e12;
  --warn-rule: #4a361f;
  --bad: #f08c82;
  --bad-soft: #2c1614;
  --bad-rule: #532723;
  --good: #5fd394;
  --good-soft: #10251a;
  --good-rule: #1f4432;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 28px -16px rgba(0, 0, 0, 0.8);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem 5rem;
}

/* ------------------------------------------------------------------ header */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.masthead-inner {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.wordmark span {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.who {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: right;
}

/* ------------------------------------------------------------- typography */

h1 {
  font-size: clamp(1.6rem, 4.5vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 0.6rem;
  text-wrap: balance;
}

/* Heading and intro above the first card. */
.page-head {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 2.25rem 0 1.5rem;
}

.page-head h1 {
  margin: 0;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

/*
 * No measure cap: the cards below run the full width of the shell, and a
 * narrower intro left a ragged column of short lines sitting above them.
 * Consistency with what follows beats the ideal line length here.
 */
.lede {
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 0.5rem;
}

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card > h2 + p {
  margin-top: -0.7rem;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

/* ------------------------------------------------------------------ forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label.label,
.field > label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.req {
  color: var(--bad);
  font-weight: 400;
}

input[type="text"],
input[type="email"],
select,
textarea {
  font: inherit;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface-sunk);
  color: var(--ink);
}

textarea {
  min-height: 8rem;
  resize: vertical;
  line-height: 1.55;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
.filedrop:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--bad);
}

.field-error {
  font-size: 0.82rem;
  color: var(--bad);
  margin: 0;
}

/* ---------------------------------------------------------------- buttons */

button {
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.7rem 1.15rem;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  min-height: 2.75rem;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule-strong);
}

button.secondary:hover:not(:disabled) {
  background: var(--surface-sunk);
  border-color: var(--muted);
}

button.quiet {
  background: none;
  color: var(--muted);
  border-color: transparent;
  padding: 0.4rem 0.5rem;
  min-height: auto;
  font-weight: 500;
  font-size: 0.85rem;
}

button.quiet:hover:not(:disabled) {
  background: none;
  color: var(--bad);
  text-decoration: underline;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ------------------------------------------------------------- choice grid */

.choices {
  display: grid;
  gap: 0.6rem;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--rule-strong);
  border-radius: 9px;
  background: var(--surface-sunk);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice input {
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
}

.choice-text strong {
  display: block;
  font-size: 0.95rem;
}

.choice-text span {
  display: block;
  font-size: 0.83rem;
  color: var(--muted);
}

.choices.inline {
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

/* ------------------------------------------------------------------ files */

.filedrop {
  border: 1px dashed var(--rule-strong);
  border-radius: 9px;
  background: var(--surface-sunk);
  padding: 1rem;
  text-align: center;
}

.filedrop input[type="file"] {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.filelist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filelist li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface-sunk);
  font-size: 0.87rem;
}

.filelist .name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.filelist .size {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.82rem;
}

.filelist li.bad {
  border-color: var(--bad-rule);
  background: var(--bad-soft);
  color: var(--bad);
}

/* ---------------------------------------------------------------- stories */

.story {
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  overflow: hidden;
}

.story-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface-sunk);
  border-bottom: 1px solid var(--rule);
}

.story-head h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.story-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ----------------------------------------------------------------- notice */

.notice {
  display: flex;
  gap: 0.7rem;
  padding: 0.8rem 0.95rem;
  border-radius: 9px;
  font-size: 0.9rem;
  border: 1px solid var(--rule);
  background: var(--surface-sunk);
  color: var(--ink-soft);
}

.notice.bad {
  background: var(--bad-soft);
  border-color: var(--bad-rule);
  color: var(--bad);
}

.notice.good {
  background: var(--good-soft);
  border-color: var(--good-rule);
  color: var(--good);
}

.notice.warn {
  background: var(--warn-soft);
  border-color: var(--warn-rule);
  color: var(--warn);
}

.notice strong {
  color: var(--ink);
}

.note-mark {
  flex: 0 0 auto;
  line-height: 1.55;
}

/* ---------------------------------------------------------------- example */

/*
 * The example lives inside the guidance note, so the picture and its caption
 * line up with the advice they illustrate rather than sitting in a second box
 * with its own margins and its own measure.
 */
.notice-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.notice-body p {
  margin: 0;
}

.example {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.example img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--rule-strong);
  display: block;
}

/* Inherits the note's size, colour and measure, so both read as one block. */
.example figcaption strong {
  color: var(--ink);
}

/* --------------------------------------------------------------- progress */

.progress-file {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

.progress-file:last-child {
  border-bottom: none;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.87rem;
}

.progress-top .state {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar {
  height: 7px;
  border-radius: 99px;
  background: var(--rule);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.2s linear;
}

.progress-file.done .bar > i {
  background: var(--good);
}

.progress-file.failed .bar > i {
  background: var(--bad);
}

/*
 * Imprint.
 *
 * Legally required on political material, so it is plain HTML on every page
 * rather than injected by script, and it sits outside the app container so it
 * still renders while the page is loading or if the script fails.
 */
.imprint {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  border-top: 1px solid var(--rule);
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
