/**
 * Front-end styling for the course programme, registration form and confirmation.
 *
 * Deliberately self-contained and theme-agnostic: it inherits font and colour
 * from the theme through `inherit` and `currentColor` wherever it can, and only
 * brings its own values for things a theme has no opinion about (status colours,
 * table density, the responsive table collapse). The site theme can override
 * everything, or replace the templates entirely.
 *
 * Sizing note: the audience skews older and fills this in under time pressure,
 * so form controls are 48px tall, hit areas are generous and nothing depends on
 * hover or colour alone.
 */

.cdrv {
  --cdrv-border: #d5d7da;
  --cdrv-muted: #5c6169;
  --cdrv-surface: #f7f8f9;
  --cdrv-ok: #1a7f4b;
  --cdrv-ok-bg: #e8f6ee;
  --cdrv-warn: #8a5a00;
  --cdrv-warn-bg: #fdf3e2;
  --cdrv-error: #b32020;
  --cdrv-error-bg: #fdeaea;
  --cdrv-info-bg: #eaf2fb;
  --cdrv-radius: 6px;
  --cdrv-accent: #1d2327;
  --cdrv-accent-contrast: #ffffff;

  font-size: 1rem;
  line-height: 1.55;
}

@media (prefers-color-scheme: dark) {
  .cdrv {
    --cdrv-border: #444a52;
    --cdrv-muted: #a8adb5;
    --cdrv-surface: #23262b;
    --cdrv-ok-bg: #14301f;
    --cdrv-warn-bg: #34270d;
    --cdrv-error-bg: #3a1717;
    --cdrv-info-bg: #16283d;
    --cdrv-accent: #f0f0f1;
    --cdrv-accent-contrast: #1d2327;
  }
}

/* --------------------------------------------------------------- banners --- */

.cdrv-banner {
  border: 1px solid var(--cdrv-border);
  border-left-width: 4px;
  border-radius: var(--cdrv-radius);
  padding: 1rem 1.25rem;
  margin: 0 0 1.5rem;
  background: var(--cdrv-surface);
}

.cdrv-banner__message { margin: 0; }
.cdrv-banner--success { border-left-color: var(--cdrv-ok); background: var(--cdrv-ok-bg); }
.cdrv-banner--waitlist,
.cdrv-banner--upcoming { border-left-color: var(--cdrv-warn); background: var(--cdrv-warn-bg); }
.cdrv-banner--error { border-left-color: var(--cdrv-error); background: var(--cdrv-error-bg); }
.cdrv-banner--info { border-left-color: #2271b1; background: var(--cdrv-info-bg); }

.cdrv-countdown {
  margin: 0.5rem 0 0;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.25rem;
}

.cdrv-errorlist { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.cdrv-errorlist a { color: inherit; }

.cdrv-notice,
.cdrv-hint {
  color: var(--cdrv-muted);
  font-size: 0.9375rem;
  margin: 1rem 0;
}

/* ---------------------------------------------------------------- tables --- */

.cdrv-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
}

.cdrv-table__caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  padding-bottom: 0.5rem;
}

.cdrv-table th,
.cdrv-table td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--cdrv-border);
  vertical-align: top;
}

.cdrv-table thead th {
  border-bottom-width: 2px;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cdrv-table tfoot th,
.cdrv-table tfoot td {
  border-bottom: none;
  border-top: 2px solid currentColor;
  font-size: 1.0625rem;
}

.cdrv-col-number { width: 4.5rem; white-space: nowrap; }
.cdrv-col-price { width: 8rem; text-align: right; white-space: nowrap; }
.cdrv-col-seats { width: 8rem; white-space: nowrap; }
.cdrv-table .cdrv-col-price { text-align: right; }

.cdrv-course__title { font-weight: 600; }

.cdrv-course__meta {
  margin: 0.25rem 0 0;
  color: var(--cdrv-muted);
  font-size: 0.9375rem;
}

.cdrv-course__meta dd { margin: 0; display: inline; }
.cdrv-course__meta dd::after { content: " · "; }
.cdrv-course__meta dd:last-child::after { content: ""; }

/* ---------------------------------------------------------- seat status --- */

.cdrv-seats { font-weight: 600; white-space: nowrap; }
.cdrv-seats--full { color: var(--cdrv-error); }
.cdrv-seats--open { color: var(--cdrv-ok); }
.cdrv-seats--low { color: var(--cdrv-warn); }

.cdrv-waiting,
.cdrv-line__status {
  display: block;
  font-size: 0.875rem;
  color: var(--cdrv-muted);
}

.cdrv-status {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.cdrv-status--confirmed { background: var(--cdrv-ok-bg); color: var(--cdrv-ok); }
.cdrv-status--waitlisted { background: var(--cdrv-warn-bg); color: var(--cdrv-warn); }

/* ------------------------------------------------------------------ form --- */

.cdrv-fieldset {
  border: 1px solid var(--cdrv-border);
  border-radius: var(--cdrv-radius);
  padding: 1.25rem 1.5rem 1.5rem;
  margin: 0 0 1.5rem;
  min-width: 0;
}

.cdrv-legend {
  font-weight: 700;
  font-size: 1.125rem;
  padding: 0 0.5rem;
  margin-left: -0.5rem;
}

.cdrv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem 1.25rem;
}

.cdrv-field { margin: 0; display: flex; flex-direction: column; gap: 0.3125rem; }
.cdrv-field--wide { grid-column: 1 / -1; }
.cdrv-field--salutation,
.cdrv-field--infix,
.cdrv-field--postcode,
.cdrv-field--housenumber { max-width: 12rem; }

.cdrv-field label { font-weight: 600; }
.cdrv-req { color: var(--cdrv-error); }

.cdrv-field input[type="text"],
.cdrv-field input[type="email"],
.cdrv-field input[type="tel"],
.cdrv-field input[type="number"],
.cdrv-field select,
.cdrv-field textarea,
.cdrv-table select,
.cdrv-table input[type="number"] {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--cdrv-border);
  border-radius: var(--cdrv-radius);
  padding: 0.625rem 0.75rem;
  min-height: 48px;
  width: 100%;
  box-sizing: border-box;
}

.cdrv-field input:focus-visible,
.cdrv-field select:focus-visible,
.cdrv-field textarea:focus-visible,
.cdrv-table select:focus-visible,
.cdrv-table input:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 1px;
}

.cdrv-field [aria-invalid="true"] { border-color: var(--cdrv-error); border-width: 2px; }

.cdrv-field--check label {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  font-weight: 400;
  cursor: pointer;
}

.cdrv-field--check input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  margin-top: 0.125rem;
}

.cdrv-help { color: var(--cdrv-muted); font-size: 0.875rem; }
.cdrv-error { color: var(--cdrv-error); font-size: 0.9375rem; font-weight: 600; }

.cdrv-table--lines .cdrv-col-seats input { max-width: 6rem; }
.cdrv-total { font-weight: 700; }

/* The honeypot must be invisible to people but present for bots, so it is moved
   off-canvas rather than hidden with display:none (which some bots skip). */
.cdrv-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.cdrv-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------- buttons --- */

.cdrv-actions { margin: 1.25rem 0 0; }
.cdrv-actions--submit { margin-top: 1.75rem; }

.cdrv-button {
  font: inherit;
  font-weight: 600;
  display: inline-block;
  padding: 0.75rem 1.5rem;
  min-height: 48px;
  border: 2px solid currentColor;
  border-radius: var(--cdrv-radius);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

/* Two variables are the whole theming surface for the filled button. The site
   theme sets --cdrv-accent / --cdrv-accent-contrast (from its own Bootstrap
   tokens) and never has to touch this file. */
.cdrv-button--primary {
  background: var(--cdrv-accent);
  border-color: var(--cdrv-accent);
  color: var(--cdrv-accent-contrast);
}

.cdrv-button--ghost { background: transparent; }
.cdrv-button:disabled { opacity: 0.55; cursor: progress; }
.cdrv-button:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }

/* ------------------------------------------------------------ responsive --- */

@media (max-width: 47.9375em) {
  .cdrv-table thead { display: none; }

  .cdrv-table tr {
    display: block;
    border: 1px solid var(--cdrv-border);
    border-radius: var(--cdrv-radius);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
  }

  .cdrv-table td,
  .cdrv-table tfoot th {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: none;
    padding: 0.3125rem 0;
    text-align: left !important;
  }

  .cdrv-table td::before {
    content: attr(data-label);
    font-weight: 600;
    flex: 0 0 auto;
  }

  .cdrv-table td:not([data-label])::before { content: none; }
  .cdrv-col-number,
  .cdrv-col-price,
  .cdrv-col-seats { width: auto; }
  .cdrv-table--lines .cdrv-col-seats input { max-width: 8rem; }
}

@media print {
  .cdrv-actions,
  .cdrv-banner--info { display: none; }
  .cdrv-table { font-size: 11pt; }
}
