/* The design system: tokens first, then one component per job.
   Pages lay these out; they never restyle a control or write a colour of their own. */

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/assets/fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  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: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/assets/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  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;
}

:root {
  color-scheme: light;

  /* Ink and surfaces, from the navy and the sky blue of the programme's identity. */
  --ink: #16304f;
  --ink-2: #41566f;
  --ink-3: #5b6f88;
  --surface: #ffffff;
  --surface-2: #f3f8fc;
  --surface-3: #e3f0fa;
  --line: #d3e0ec;
  --line-strong: #a9bdd1;
  --on-accent: #ffffff;
  --scrim: rgb(22 48 79 / 0.45);

  /* The programme's blue-to-green sweep. */
  --accent: #0f6fb7;
  --accent-strong: #0b5a96;
  --accent-soft: #e2f1fb;
  --blue: #1583c9;
  --cyan: #0f8fb8;
  --teal: #12897c;
  --green: #3f9a2f;
  --lime: #6f9d1d;
  --amount: #2f7d22;
  --brand-sweep: linear-gradient(100deg, #1277c2 0%, #12a5cf 38%, #14998a 66%, #5fae3a 100%);

  --star: #f2a900;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --ok: #1c7c43;
  --ok-soft: #e4f5ea;
  --wait: #b26a00;
  --wait-soft: #fff3dc;

  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 22px;
  --shadow-1: 0 1px 2px rgb(22 48 79 / 0.06), 0 4px 14px rgb(22 48 79 / 0.06);
  --shadow-2: 0 2px 6px rgb(22 48 79 / 0.08), 0 18px 40px rgb(22 48 79 / 0.14);
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);

  --font: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --text-xs: 0.8125rem;
  --text-s: 0.875rem;
  --text-m: 1rem;
  --text-l: 1.125rem;
  --text-xl: 1.375rem;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --quick: 140ms;
  --base: 240ms;
  --slow: 480ms;
}

/* Staff work on their own phones, often outdoors or at night: the staff page follows the phone. */
@media (prefers-color-scheme: dark) {
  :root[data-theme='auto'] {
    color-scheme: dark;
    --ink: #e8f0f8;
    --ink-2: #b9c8d8;
    --ink-3: #93a6ba;
    --surface: #101c2b;
    --surface-2: #0b1521;
    --surface-3: #1a2b3f;
    --line: #26384d;
    --line-strong: #41566f;
    --on-accent: #06121f;
    --scrim: rgb(0 0 0 / 0.6);
    --accent: #5db6f2;
    --accent-strong: #8accf7;
    --accent-soft: #14304a;
    --amount: #7fd16f;
    --danger: #ff8a80;
    --danger-soft: #3a1917;
    --ok: #6fd49a;
    --ok-soft: #12301f;
    --wait: #f5b451;
    --wait-soft: #3a2a0c;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 18px 40px rgb(0 0 0 / 0.5);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-m);
  line-height: 1.45;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
p,
ul,
fieldset {
  margin: 0;
  padding: 0;
}
ul {
  list-style: none;
}
fieldset {
  border: 0;
  min-width: 0;
}
img,
svg {
  display: block;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.is-locked {
  overflow: hidden;
}

/* Link */
.link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  border-radius: 4px;
}
.link:hover {
  color: var(--accent-strong);
}

/* Button */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-m);
  font: 650 var(--text-m) / 1 var(--font);
  text-decoration: none;
  color: #fff;
  background: var(--brand-sweep);
  box-shadow: 0 1px 2px rgb(22 48 79 / 0.2), 0 8px 20px rgb(18 137 124 / 0.28);
  cursor: pointer;
  transition:
    transform var(--quick) var(--ease-out),
    filter var(--quick) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.button:hover {
  filter: brightness(1.06);
}
.button:active {
  transform: scale(0.98);
}
.button[disabled] {
  cursor: default;
  filter: saturate(0.6) brightness(1.05);
  opacity: 0.75;
}
.button--quiet {
  min-height: 44px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.button--quiet:hover {
  filter: none;
  background: var(--surface-2);
}
.button--stop {
  color: var(--danger);
  background: var(--surface);
  border: 1.5px solid currentColor;
  box-shadow: none;
}
.button__spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgb(255 255 255 / 0.45);
  border-top-color: #fff;
  animation: spin 700ms linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: var(--ink-2);
  background: transparent;
  cursor: pointer;
}
.icon-button:hover {
  background: var(--surface-3);
}

/* Field: label, control, error */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field__label {
  font-size: var(--text-s);
  font-weight: 600;
  color: var(--ink);
}
.req {
  color: var(--danger);
}
.field__control {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-m);
  font: 500 var(--text-m) / 1.3 var(--font);
  color: var(--ink);
  background: var(--surface);
  appearance: none;
  transition:
    border-color var(--quick) var(--ease-out),
    background-color var(--quick) var(--ease-out);
}
.field__control::placeholder {
  color: var(--ink-3);
  opacity: 1;
}
.field__control:hover {
  border-color: var(--ink-3);
}
.field__control:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field__control[aria-invalid='true'] {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.field__error {
  display: flex;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 550;
  line-height: 1.35;
  color: var(--danger);
}
.field__error::before {
  content: '!';
  flex: none;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  color: var(--surface);
  background: var(--danger);
}

/* Picker: the control that opens the sheet with a searchable list */
.picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-block: 12px;
  text-align: left;
  cursor: pointer;
}
.picker__value {
  min-width: 0;
  overflow-wrap: anywhere;
}
.picker__value[data-empty] {
  color: var(--ink-3);
}
.picker__chevron {
  flex: none;
  color: var(--ink-3);
}
.picker[disabled] {
  cursor: default;
  background: var(--surface-2);
  border-color: var(--line);
}

/* Sheet: a full-height panel; from the bottom on a phone, from the right on a wide screen */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
}
.sheet__scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity var(--base) var(--ease-out);
}
.sheet__panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  transform: translateY(100%);
  transition: transform var(--slow) var(--ease-out);
}
.sheet[data-open] .sheet__scrim {
  opacity: 1;
}
.sheet[data-open] .sheet__panel {
  transform: none;
}
.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 8px 6px 20px;
}
.sheet__title {
  font-size: var(--text-l);
  font-weight: 700;
}
.sheet__search {
  position: relative;
  margin: 0 16px 10px;
}
.sheet__search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  color: var(--ink-3);
  pointer-events: none;
}
.sheet__search .field__control {
  padding-left: 44px;
}
.sheet__list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 8px max(16px, env(safe-area-inset-bottom));
}
.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-s);
  font: 500 var(--text-m) / 1.3 var(--font);
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.option:hover {
  background: var(--surface-2);
}
.option[aria-selected='true'] {
  font-weight: 650;
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.option__check {
  flex: none;
  visibility: hidden;
}
.option[aria-selected='true'] .option__check {
  visibility: visible;
}
.sheet__empty {
  padding: 28px 20px;
  color: var(--ink-2);
  text-align: center;
}
/* A list short enough to read at a glance rises only as far as it needs. */
@media (max-width: 719.98px) {
  .sheet[data-fit] .sheet__panel {
    top: auto;
    max-height: 85dvh;
    border-radius: var(--radius-l) var(--radius-l) 0 0;
  }
  .sheet[data-fit] .sheet__head {
    padding-top: 12px;
  }
}
@media (min-width: 720px) {
  .sheet__panel {
    inset: 0 0 0 auto;
    width: min(460px, 100%);
    transform: translateX(100%);
    box-shadow: var(--shadow-2);
  }
}

/* Checkbox */
.check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.check__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.check__box {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  color: transparent;
  background: var(--surface);
  transition:
    background-color var(--quick) var(--ease-out),
    border-color var(--quick) var(--ease-out);
}
.check__box svg {
  scale: 0.6;
  transition: scale var(--base) var(--ease-out);
}
.check__input:checked + .check__box {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.check__input:checked + .check__box svg {
  scale: 1;
}
.check__input:focus-visible + .check__box {
  box-shadow: var(--focus);
}
.check__input[aria-invalid='true'] + .check__box {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.check__text {
  padding-top: 2px;
  font-size: var(--text-s);
  line-height: 1.45;
  color: var(--ink-2);
}

/* Stars: a 1 to 5 rating */
.stars {
  display: flex;
  gap: 2px;
}
.star {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--line-strong);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--base) var(--ease-out);
}
.star svg {
  fill: transparent;
  transition:
    fill var(--quick) var(--ease-out),
    color var(--quick) var(--ease-out);
}
.star[data-lit] {
  color: var(--star);
}
.star[data-lit] svg {
  fill: var(--star);
}
.star:active {
  transform: scale(0.88);
}
.star[data-pop] {
  animation: star-pop var(--slow) var(--ease-out);
}
@keyframes star-pop {
  40% {
    transform: scale(1.22) rotate(-6deg);
  }
}

/* Notice: one line about what just happened or what to do */
.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-m);
  font-size: var(--text-s);
  font-weight: 550;
  line-height: 1.4;
  color: var(--ink);
  background: var(--surface-3);
}
.notice--wait {
  color: var(--wait);
  background: var(--wait-soft);
}
.notice--error {
  color: var(--danger);
  background: var(--danger-soft);
}

/* Live dot: something is being checked or is running */
.live-dot {
  position: relative;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}
.live-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  animation: live-ping 1.8s var(--ease-out) infinite;
}
@keyframes live-ping {
  to {
    transform: scale(3.2);
    opacity: 0;
  }
}

/* Skeleton: the shape of content that is on its way */
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s linear infinite;
}
@keyframes skeleton {
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
