/* Horalia public pages: tokens, reset and the shared components (public design spec, ticket 01).
   Area sheets (practice, booking, manage, access, operator) use only the custom properties defined here.
   Contrast: the accent is only used on white or under white text (TEXT_ON_ACCENT guarantees 4.5:1). */

:root {
  /* colours */
  --accent: #1f5f8b; /* DEFAULT_ACCENT of apps/practices/presentation.py; the body overrides it per practice */
  --on-accent: #ffffff;
  --page: #ffffff;
  --text: #1e293b;
  --muted: #475569;
  --surface: #f5f7fa;
  --line: #dde3ea; /* decorative borders (cards, separators) */
  --control: #64748b; /* borders of form controls: 4.7:1 on white */
  --info-bg: #eef4f9;
  --info-line: #1f5f8b;
  --success-bg: #edf7f0;
  --success-line: #1d7a46;
  --warning-bg: #fdf6e7;
  --warning-line: #a15c07;
  --danger: #b42318;
  --danger-bg: #fdf1f0;

  /* type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-lg: 1.375rem;
  --text-xl: 1.75rem;
  --leading: 1.5;

  /* space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  /* shape */
  --radius: 8px;
  --radius-sm: 6px;
  --target: 2.75rem; /* 44 px touch targets */
  --focus: 3px solid var(--accent);
  --shadow: 0 1px 2px rgb(15 23 42 / 0.06), 0 1px 3px rgb(15 23 42 / 0.08);

  /* layout */
  --column: 40rem; /* booking flow and manage pages; `body.wide` widens it for the practice page */
  --gutter: var(--space-4);
}

/* --- reset ------------------------------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--leading);
  overflow-wrap: break-word;
}

body.wide {
  --column: 64rem;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

img {
  display: block;
}

[hidden] {
  display: none;
}

/* --- typography -------------------------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-3);
  line-height: 1.25;
  font-weight: 650;
  color: var(--text);
}

h1 {
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--text-lg);
  margin-top: var(--space-6);
}

h3 {
  font-size: var(--text-md);
  margin-top: var(--space-5);
}

h4 {
  font-size: var(--text-base);
  margin-top: var(--space-4);
}

p,
ul,
ol,
dl,
address,
fieldset,
table {
  margin: 0 0 var(--space-4);
}

ul,
ol {
  padding-left: var(--space-5);
}

li + li {
  margin-top: var(--space-1);
}

address {
  font-style: normal;
}

small,
.hint,
.muted {
  color: var(--muted);
  font-size: var(--text-sm);
}

strong,
b {
  font-weight: 650;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-6) 0;
}

/* --- links ------------------------------------------------------------------------------------------------- */

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* --- focus ------------------------------------------------------------------------------------------------- */

:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
}

/* --- skip link (hidden until focused) ---------------------------------------------------------------------- */

.skip {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 10;
  padding: var(--space-3) var(--space-4);
  background: var(--page);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- frame: header, main, footer --------------------------------------------------------------------------- */

.frame {
  width: 100%;
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-header {
  background: var(--page);
  border-bottom: 1px solid var(--line);
}

.site-header .frame {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  min-height: var(--target);
  margin: 0;
  color: var(--text);
  font-weight: 650;
  font-size: var(--text-md);
  line-height: 1.25;
}

.brand-logo {
  width: auto;
  height: 2.5rem;
  max-width: 10rem;
  object-fit: contain;
}

.brand-mark {
  flex: none;
  width: 2rem;
  height: 2rem;
}

.languages {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-left: auto;
  font-size: var(--text-sm);
}

.languages a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  min-width: var(--target);
  justify-content: center;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
}

.languages a:hover {
  color: var(--text);
  text-decoration: underline;
}

.languages a[aria-current="page"] {
  color: var(--text);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.incident-banners {
  background: var(--warning-bg);
  border-bottom: 1px solid var(--warning-line);
}

.incident-banner {
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--space-3) var(--gutter);
  font-weight: 600;
}

.incident-banner + .incident-banner {
  border-top: 1px solid var(--line);
}

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--space-6) var(--gutter) var(--space-7);
}

main > :last-child,
main > * > :last-child {
  margin-bottom: 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-sm);
}

.site-footer .frame {
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.site-footer p {
  margin: 0;
}

/* --- buttons ----------------------------------------------------------------------------------------------- */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 3rem;
  min-width: var(--target);
  padding: var(--space-2) var(--space-5);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

button:hover,
.button:hover {
  box-shadow: inset 0 0 0 100vmax rgb(0 0 0 / 0.12);
  text-decoration: none;
}

button:active,
.button:active {
  box-shadow: inset 0 0 0 100vmax rgb(0 0 0 / 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.button-secondary,
button.button-secondary {
  background: var(--page);
  color: var(--accent);
}

.button-secondary:hover {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.button-quiet,
button.button-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  font-weight: 500;
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.button-quiet:hover {
  box-shadow: none;
  background: var(--surface);
}

.button-danger,
button.button-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-accent);
}

/* --- forms ------------------------------------------------------------------------------------------------- */

form {
  margin: 0 0 var(--space-4);
}

label {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
}

input:not([type="radio"], [type="checkbox"], [type="hidden"]),
select,
textarea {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--control);
  border-radius: var(--radius-sm);
  background: var(--page);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

/* A text field shows its ring on any focus, its inner parts included: the date field's calendar button takes
   the focus of its own, which only `:focus-within` sees in Chromium. */
input:not([type="radio"], [type="checkbox"]):focus-within,
select:focus,
textarea:focus {
  outline: var(--focus);
  outline-offset: 1px;
  border-color: var(--accent);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border: 2px solid var(--danger);
}

input[type="radio"],
input[type="checkbox"] {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.125rem 0 0;
  accent-color: var(--accent);
}

/* A radio or a checkbox inside its label is a large tappable row. */
label:has(> input[type="radio"]),
label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: 3rem;
  margin: 0 0 var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--control);
  border-radius: var(--radius);
  background: var(--page);
  font-weight: 500;
  cursor: pointer;
}

label:has(> input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

label:has(> input:focus-visible) {
  outline: var(--focus);
  outline-offset: 2px;
}

label:has(> input:focus-visible) > input {
  outline: none;
}

fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: var(--space-3);
  padding: 0;
  font-weight: 650;
  font-size: var(--text-md);
}

.field-error,
.errorlist {
  display: block;
  margin-top: var(--space-1);
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: 600;
}

.errorlist {
  padding: 0;
  list-style: none;
}

/* --- alerts ------------------------------------------------------------------------------------------------ */

/* One family everywhere: information (blue), done (green), a time running (amber), a refusal or an error (red).
   The plain statements of the booking and manage pages ("please contact the practice") are information. */
.notice,
.info,
.neutral,
.nothing,
.unconfirmed,
.too-late,
.contact-to-move,
.sent,
.hold,
.draft,
.error,
.refused,
main p[role="alert"]:not([class]) {
  margin: 0 0 var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-left: 4px solid var(--info-line);
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  color: var(--text);
}

.sent {
  border-left-color: var(--success-line);
  background: var(--success-bg);
}

.hold,
.draft {
  border-left-color: var(--warning-line);
  background: var(--warning-bg);
}

.error,
.refused,
main p[role="alert"]:not([class]) {
  border-left-color: var(--danger);
  background: var(--danger-bg);
  font-weight: 600;
}

:is(.notice, .info, .neutral, .nothing, .unconfirmed, .too-late, .contact-to-move, .sent, .hold, .draft, .error, .refused) a {
  color: inherit;
}

/* A short tag beside a name (conventioned, existing patients only, ...). */
.mark {
  display: inline-block;
  padding: 0 var(--space-2);
  border: 1px solid var(--control);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.6;
}

/* --- summaries (definition lists), cards, details ---------------------------------------------------------- */

.card,
dl {
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card a:not(.button),
dl a {
  color: var(--text);
}

dl {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 var(--space-4);
}

dt {
  color: var(--muted);
  font-size: var(--text-sm);
}

dd {
  margin: 0 0 var(--space-3);
}

dd:last-child {
  margin-bottom: 0;
}

@media (min-width: 40rem) {
  dl {
    grid-template-columns: minmax(7rem, max-content) 1fr;
  }

  dt {
    padding: var(--space-1) 0;
    font-size: var(--text-base);
  }

  dd {
    margin: 0;
    padding: var(--space-1) 0;
  }
}

details {
  margin: 0 0 var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

details > summary {
  display: flex;
  align-items: center;
  min-height: var(--target);
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: var(--space-3);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

details[open] > summary::before {
  transform: rotate(45deg);
}

details > :not(summary) {
  margin-left: var(--space-4);
  margin-right: var(--space-4);
}

details > :last-child:not(summary) {
  margin-bottom: var(--space-4);
}

details dl {
  padding: 0;
  border: 0;
  background: none;
}

/* --- tables ------------------------------------------------------------------------------------------------ */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th,
td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
}

/* A list of choices (radio or checkbox rows) is not a bulleted list. */
ul:has(> li > label > input[type="radio"], > li > label > input[type="checkbox"]) {
  padding-left: 0;
  list-style: none;
}

/* The Back / Abandon strip under a step: side by side, each a 44 px target, Abandon quiet. */
.booking-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-5);
}

.booking-actions a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
}

.booking-actions form {
  margin: 0;
}

.booking-actions button {
  background: var(--page);
  color: var(--text);
  border-color: var(--control);
  font-weight: 500;
}

/* --- wider screens ----------------------------------------------------------------------------------------- */

@media (min-width: 40rem) {
  :root {
    --gutter: var(--space-5);
  }

  h1 {
    font-size: 2rem;
  }

  main {
    padding-top: var(--space-7);
  }
}

/* --- reduced motion ---------------------------------------------------------------------------------------- */

@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;
  }
}
