/* The app's design tokens and components, on top of Pico CSS (screens.md,
   "Design system"). Moon Mioni has no brand yet: these colours are neutral
   placeholders, and rebranding means changing the token values only. Every
   text pairing meets WCAG AA contrast (4.5:1, 3:1 for large text and UI). */

:root {
  /* Colour roles */
  --color-bg: #ffffff;
  --color-surface: #f5f6f8;
  --color-text: #1b1f24;
  --color-text-muted: #545c66;
  --color-border: #8a939e;
  --color-primary: #1d4f91;
  --color-primary-text: #ffffff;
  --color-focus: #b8500b;
  --color-success: #1d6b3a;
  --color-warning: #8a5300;
  --color-danger: #b3261e;
  --color-info: #1d4f91;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Type scale */
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;

  /* Shape */
  --radius: 8px;
  --tap-target: 44px;
}

/* Pico's own variables, mapped to ours. Pico sets its theme's on
   :root:not([data-theme=dark]), which outranks a plain :root, so these use
   the same selector, after Pico's. Pages are light only (<html
   data-theme="light">): the tokens have no dark values. The clinic's
   colours (/brand.css) change --color-primary and --color-focus, and these
   follow; the hover is the primary darkened, so it stands out as much. */
:root:not([data-theme=dark]) {
  --pico-background-color: var(--color-bg);
  --pico-color: var(--color-text);
  --pico-muted-color: var(--color-text-muted);
  --pico-primary: var(--color-primary);
  --pico-primary-background: var(--color-primary);
  --pico-primary-underline: color-mix(in srgb, var(--color-primary) 50%, transparent);
  --pico-primary-hover: color-mix(in srgb, var(--color-primary) 80%, black);
  --pico-primary-hover-background: color-mix(in srgb, var(--color-primary) 80%, black);
  --pico-primary-focus: color-mix(in srgb, var(--color-focus) 50%, transparent);
  --pico-primary-inverse: var(--color-primary-text);
  --pico-border-radius: var(--radius);
  --pico-line-height: 1.5;
}

/* A visible focus outline on every interactive element; never removed. */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* The skip link is the first thing a keyboard reaches. */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg);
  color: var(--color-primary);
  z-index: 10;
}

.skip-link:focus {
  top: var(--space-2);
}

a, button, input, select, textarea, summary {
  min-height: var(--tap-target);
}

.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* On a phone the header's links wrap onto more lines, rather than run off
   the screen over each other. */
.site-header nav,
.site-header nav ul {
  flex-wrap: wrap;
}

.site-header form.sign-out {
  margin: 0;
}

.brand {
  font-weight: 600;
}

/* The clinic's logo, when the repository has one (web.layout). */
.brand img {
  display: block;
  height: 2.5rem;
  width: auto;
}

.site-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.site-footer ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* Pico gives every list item a bullet. */
.site-footer li {
  list-style: none;
}

/* Side navigation: beside the content on desktops, above it on phones. */
.with-side-nav {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 768px) {
  .with-side-nav {
    grid-template-columns: 14rem minmax(0, 1fr);
  }
}

/* A grid's column is as wide as its widest content unless told it may
   shrink, so a wide table would widen the page. */
.with-side-nav > main {
  min-width: 0;
}

/* A table wider than the screen scrolls on its own, not the page. */
.table-wrapper {
  overflow-x: auto;
}

/* Pico lays a nav out in one row; the side navigation is a column on
   desktops, and wraps onto more lines above the content on phones. */
.side-nav {
  display: block;
}

.side-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-direction: column;
  align-items: flex-start;
}

@media (max-width: 767px) {
  .side-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.side-nav-heading {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: var(--space-4) 0 var(--space-2);
}

[aria-current="page"] {
  font-weight: 600;
  text-decoration: underline;
}

/* Authenticator setup (screens.md V6): the QR code at a size phones scan
   easily, never wider than the page; its white border is part of it. */
.qr-code {
  display: block;
  width: 14rem;
  max-width: 100%;
  height: auto;
  margin: var(--space-2) 0 var(--space-4);
}

/* The manual key and the recovery codes, in groups that can be read out
   and typed, and that wrap on a narrow phone rather than overflow. */
.secret-key,
.recovery-codes code {
  font-size: var(--text-lg);
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
}

.recovery-codes {
  columns: 2 12rem;
}

/* An intake question's texts, each language labelled. */
.both-languages {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0 var(--space-4);
  margin-bottom: var(--space-2);
}

.both-languages dt {
  color: var(--color-text-muted);
  font-weight: normal;
}

.both-languages dd {
  margin: 0;
}

/* What an answer does: stops the booking, or is shown to the doctor. */
.marker {
  display: inline-block;
  margin-left: var(--space-2);
  padding: 0 var(--space-2);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-size: var(--text-sm);
}

.marker.red-flag {
  color: var(--color-danger);
}

.marker.warning {
  color: var(--color-warning);
}

.questions > li {
  margin-bottom: var(--space-6);
}
