/* ==========================================================================
   Bien Connu - design system (hand-written CSS, no build)
   Contents
   1.  Variables
   2.  Reset & base
   3.  Typography
   4.  Layout & utilities
   5.  Page transitions
   6.  Cascading reveal
   7.  Buttons
   8.  Cards, notices, list items
   9.  Badges, labels
   10. Form fields
   11. Choices (radio cards)
   12. Toasts
   13. Modals
   14. Header & navigation
   15. Miscellaneous components (logo, stepper, thumb, chip, empty, stat, pulse-bar)
   16. Guest layout
   17. Reduced motion
   ========================================================================== */

/* 1. Variables */
/* Colours, spacings, fonts and delays: tokens.css, loaded before. Here, only what belongs to the site. */
:root {
  --card: var(--paper-3);

  --radius: 0;
  --bw: 2px;            /* structuring outline */
  --bw-thin: 2px;       /* regular outline */

  --content: 960px;
  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --nav-h: 64px;
  --header-h: 64px;
  --selection: #FFD9C2;   /* text selection colour, in the brand colours */
}

/* 2. Reset & base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
[hidden] { display: none; }
::selection { background: var(--selection); color: var(--ink); }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.card--ink :focus-visible, .toast :focus-visible, :is(.on-ink, .lp-ink) :focus-visible { outline-color: var(--paper); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: var(--space-3) var(--space-4);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: var(--space-3); }

/* 3. Typography */
.display, .headline--loud .headline__title {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: .005em;
}
.headline { display: grid; gap: var(--space-3); }
/* Regular heading: legible, in normal case. */
.headline__title {
  font-family: var(--font-text); font-weight: 800; line-height: 1.1; letter-spacing: -.01em;
  font-size: clamp(1.9rem, 6.5vw, 2.75rem); text-wrap: balance;
}
/* Poster heading: reserved for highlights (home state, first steps). */
.headline--loud .headline__title { font-size: clamp(2.6rem, 10vw, 4.75rem); }
.headline__sub { font-size: 1.1875rem; color: var(--muted); max-width: 36em; }
.headline--ink .headline__sub { color: inherit; }

.h2 { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.h3 { font-size: 1.1875rem; font-weight: 700; line-height: 1.3; }
.eyebrow { font-size: .875rem; font-weight: 600; color: var(--muted); }
.text-muted { color: var(--muted); }
.text-sm { font-size: 1rem; }
.text-xs { font-size: .875rem; }
.text-strong { font-weight: 700; }
/* Level 3: the action link. A thick ink stroke; on hover and focus, an orange stroke covers it from left to right. */
.link {
  position: relative; display: inline-block; padding-bottom: 4px; font-weight: 800; text-decoration: none;
  background: linear-gradient(var(--ink), var(--ink)) 0 100% / 100% 3px no-repeat;
}
.link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--orange);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform var(--t-med) var(--ease);
}
.link:hover::after, .link:focus-visible::after { transform: scaleX(1); }
:is(.on-ink, .lp-ink) .link { background-image: linear-gradient(var(--paper), var(--paper)); }

/* 4. Layout & utilities */
.container { width: 100%; max-width: calc(var(--content) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.page { padding-block: var(--space-6) var(--space-8); display: grid; gap: var(--space-6); align-content: start; }
.stack { display: grid; gap: var(--space-4); align-content: start; }
.stack--sm { gap: var(--space-2); }
.stack--lg { gap: var(--space-6); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--nowrap { flex-wrap: nowrap; }
.grow { flex: 1 1 0; min-width: 0; }
.grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.center { text-align: center; }
.divider { border: 0; border-top: var(--bw-thin) solid var(--line); margin: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 5. Page transitions */
@view-transition { navigation: auto; }
.page, .guest__inner { view-transition-name: page; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(page) { animation: vt-out 180ms var(--ease) both; }
::view-transition-new(page) { animation: vt-in 320ms var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }

/* Fallback without View Transitions (class set by the script in the <head>) */
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }
.fx-fade .page, .fx-fade .guest__inner { animation: page-in var(--t-slow) var(--ease) both; }
.fx-fade.is-leaving .page, .fx-fade.is-leaving .guest__inner {
  opacity: 0; transform: translateY(-8px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

/* 7. Buttons: three levels, specific to Bien Connu
   1. main: orange fill, ink outline, the megaphone's three sound strokes;
   2. secondary: paper, ink outline, bold Archivo, fills with ink on hover;
   3. action link: bold text, thick stroke that draws itself in orange on hover (.link).
   On an orange background (.on-orange), the main one turns ink (orange strokes); on an ink background (.on-ink), it stays orange. */
.btn {
  --btn-bg: var(--paper); --btn-fg: var(--ink); --btn-bd: var(--ink); --waves: var(--ink);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 52px; padding: 10px 24px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: var(--bw) solid var(--btn-bd); border-radius: var(--radius);
  font-family: var(--font-text); font-size: 1.125rem; font-weight: 800; line-height: 1.2;
  text-decoration: none; text-align: center;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-fast) var(--ease), transform 90ms var(--ease), color var(--t-fast) var(--ease);
}
.btn:hover { --btn-bg: var(--ink); --btn-fg: var(--paper); }
.btn:active:not(:disabled):not(.is-disabled):not(.is-loading) { transform: translate(2px, 2px); }
.btn .icon { flex: none; }

/* Level 1: the main one. */
.btn--primary {
  --btn-bg: var(--orange); --btn-fg: var(--ink); --waves: var(--ink);
  min-height: 60px; padding-inline: 28px;
  font-size: 1.1875rem; font-weight: 700;
}
.btn--primary:hover, .btn--primary:focus-visible { --btn-bg: var(--orange-hover); --btn-fg: var(--ink); }
/* The three sound strokes: in place of the arrow, they lengthen on hover and focus. */
.btn--primary > .icon { display: none; }
.btn--primary::before {
  content: ""; order: 2; flex: none; width: 24px; height: 24px; margin-left: 2px;
  background: var(--waves);
  -webkit-mask: var(--waves-mask) center / contain no-repeat; mask: var(--waves-mask) center / contain no-repeat;
  transform-origin: 0 50%; transition: transform var(--t-fast) var(--ease);
}
.btn--primary:hover::before, .btn--primary:focus-visible::before { transform: scaleX(1.35); }
.btn--primary.is-loading::before { display: none; }
.btn--primary.btn--sm { min-height: 48px; padding-inline: 20px; font-size: 1.1875rem; }
.btn--primary.btn--lg { min-height: 64px; padding-inline: 32px; font-size: 1.5rem; }
/* On an orange background: ink, orange strokes. */
:is(.on-orange, .lp-orange) .btn--primary, .btn--primary.btn--ink { --btn-bg: var(--ink); --btn-fg: var(--paper); --btn-bd: var(--ink); --waves: var(--orange); }
:is(.on-orange, .lp-orange) .btn--primary:hover, :is(.on-orange, .lp-orange) .btn--primary:focus-visible, .btn--primary.btn--ink:hover { --btn-bg: var(--ink-hover); --btn-fg: var(--paper); box-shadow: 4px 4px 0 var(--paper); }
/* On an ink background: the offset shadow is paper. */
:is(.on-ink, .lp-ink) .btn--primary:hover, :is(.on-ink, .lp-ink) .btn--primary:focus-visible { box-shadow: 4px 4px 0 var(--paper); }

/* Level 2: the secondary one. */
.btn--secondary { --btn-bg: var(--paper); }
:is(.on-ink, .lp-ink) .btn:not(.btn--primary):not(.btn--ghost) { --btn-bg: transparent; --btn-fg: var(--paper); --btn-bd: var(--paper); }
:is(.on-ink, .lp-ink) .btn:not(.btn--primary):not(.btn--ghost):hover { --btn-bg: var(--paper); --btn-fg: var(--ink); }
:is(.on-orange, .lp-orange) .btn:not(.btn--primary):not(.btn--ghost) { --btn-bg: transparent; }
:is(.on-orange, .lp-orange) .btn:not(.btn--primary):not(.btn--ghost):hover { --btn-bg: var(--ink); --btn-fg: var(--paper); }

.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; }
.btn--ghost:hover { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--ink); text-decoration: none; }
.btn--danger { --btn-bg: var(--paper); --btn-fg: var(--err); --btn-bd: var(--err); }
.btn--danger:hover { --btn-bg: var(--err); --btn-fg: var(--white); }
.btn--danger.btn--solid { --btn-bg: var(--err); --btn-fg: var(--white); }
.btn--ink { --btn-bg: var(--ink); --btn-fg: var(--paper); --btn-bd: var(--ink); }
.btn--ink:hover { --btn-bg: var(--ink-hover); }

.btn--sm { min-height: 48px; padding: 8px 18px; font-size: 1.0625rem; }
.btn--lg { min-height: 60px; padding: 14px 30px; font-size: 1.25rem; }
.btn--block { display: flex; width: 100%; }

.btn:disabled, .btn.is-disabled {
  --btn-bg: var(--disabled-bg); --btn-fg: var(--disabled-fg); --btn-bd: var(--disabled-bd); --waves: var(--disabled-fg);
  cursor: not-allowed; pointer-events: none; text-decoration: none; box-shadow: none;
}
/* In progress: the label stays legible, an indicator spins after it (ellipsis dots with reduced motion). */
.btn.is-loading { pointer-events: none; }
.btn.is-loading .icon { display: none; }
.btn.is-loading::after {
  content: ""; flex: none; width: 16px; height: 16px;
  border: 3px solid currentColor; border-top-color: transparent; border-radius: 0;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon { flex: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; background: transparent;
  border: var(--bw-thin) solid transparent; border-radius: var(--radius);
  transition: border-color var(--t-fast) var(--ease), transform 90ms var(--ease);
}
.icon-btn:hover { border-color: currentColor; }
.icon-btn:active { transform: translate(2px, 2px); }

/* 8. Cards, notices, list items */
.card {
  background: var(--card); color: var(--ink);
  border: var(--bw) solid var(--ink); border-radius: var(--radius);
  padding: var(--space-5);
}
.card--lg { padding: var(--space-6); }
.card--tight { padding: var(--space-4); }
.card--flat { border: var(--bw-thin) solid #8F887A; background: transparent; }
.card--ink { background: var(--ink); color: var(--paper); }
.card--ink .text-muted, .card--ink .eyebrow { color: var(--on-ink); }
a.card, button.card { display: block; text-decoration: none; text-align: left; width: 100%; transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
a.card:hover { background: var(--white); }
a.card:active { transform: translate(2px, 2px); }

/* 9. Badges, labels */
.badge {
  --b-fg: var(--ink); --b-bg: var(--paper); --b-bd: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px; min-height: 28px;
  background: var(--b-bg); color: var(--b-fg);
  border: var(--bw-thin) solid var(--b-bd); border-radius: var(--radius);
  font-size: .875rem; font-weight: 700; line-height: 1.2; white-space: nowrap;
}
.badge--active  { --b-fg: var(--ok);    --b-bg: var(--ok-bg);    --b-bd: var(--ok); }
.badge--pending { --b-fg: var(--warn);  --b-bg: var(--warn-bg);  --b-bd: var(--warn); }
.badge--error   { --b-fg: var(--err);   --b-bg: var(--err-bg);   --b-bd: var(--err); }
.badge--paused  { --b-fg: var(--pause); --b-bg: var(--pause-bg); --b-bd: var(--pause); }
.badge--done    { --b-fg: var(--paper); --b-bg: var(--ink);      --b-bd: var(--ink); }
.badge--neutral { --b-fg: var(--muted); --b-bg: var(--paper);    --b-bd: var(--line); }

/* Counter pill (nav) */
.count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  background: var(--warn-solid); color: var(--ink);
  border: 2px solid var(--ink); font-size: .75rem; font-weight: 800; line-height: 1;
}

/* The brand megaphone (x-megaphone component): the body, and its three sound strokes that spread apart on hover. */
.megaphone { position: relative; display: inline-block; flex: none; width: var(--mega-w, 96px); aspect-ratio: 296 / 263; }
.megaphone img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.megaphone__wave { transition: transform var(--t-med) var(--ease); }
a:hover .megaphone__wave--1, .megaphone:hover .megaphone__wave--1 { transform: translate(3%, -3%); }
a:hover .megaphone__wave--2, .megaphone:hover .megaphone__wave--2 { transform: translate(4%, 0); }
a:hover .megaphone__wave--3, .megaphone:hover .megaphone__wave--3 { transform: translate(3%, 3%); }
/* On an orange background: the megaphone in paper; on paper or ink, it stays orange. */
.megaphone--paper img { filter: brightness(0) invert(1); }
.megaphone--ink img { filter: brightness(0); }

/* 10. Form fields */
.field { display: grid; gap: var(--space-2); }
.field__label { font-weight: 800; font-size: 1rem; }
.field__control {
  width: 100%; min-height: 56px; padding: 12px 16px;
  background: var(--white); color: var(--ink);
  border: var(--bw-thin) solid var(--ink); border-radius: var(--radius);
  font-size: 1.125rem; line-height: 1.4;
  appearance: none; -webkit-appearance: none;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.field__control::placeholder { color: #7B766C; opacity: 1; }
.field__control:hover { background: #FFFEFC; }
.field__control:focus { outline: 3px solid var(--orange); outline-offset: 0; }
select.field__control {
  padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2.5' stroke-linecap='square'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 20px;
}
textarea.field__control { min-height: 120px; resize: vertical; }
textarea[data-autogrow] { resize: none; overflow: hidden; }
.field__error { display: flex; gap: 6px; align-items: flex-start; font-size: 1rem; font-weight: 700; color: var(--err); }
.field__error .icon { margin-top: 2px; }
.field--error .field__control { border-color: var(--err); border-width: 3px; }
.field__counter { font-size: .875rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.field__counter.is-over { color: var(--err); font-weight: 700; }

/* 11. Choices (radio cards) */
.choices { display: grid; gap: var(--space-3); }
.choice { position: relative; display: block; cursor: pointer; }
.choice__input { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer; }
.choice__body {
  display: grid; gap: 2px; padding: var(--space-4) 56px var(--space-4) var(--space-4); min-height: 64px;
  background: var(--card); color: var(--ink);
  border: var(--bw-thin) solid var(--ink);
  transition: background-color var(--t-med) var(--ease), color var(--t-med) var(--ease), transform 90ms var(--ease);
}
.choice__title { font-weight: 800; font-size: 1.125rem; }
.choice__text { font-size: .9375rem; color: var(--muted); transition: color var(--t-med) var(--ease); }
.choice:hover .choice__body { background: var(--white); }
.choice__input:active + .choice__body { transform: translate(2px, 2px); }
.choice__input:checked + .choice__body { background: var(--ink); color: var(--paper); }
.choice__input:checked + .choice__body .choice__text { color: #D9D3C8; }
.choice__input:focus-visible + .choice__body { outline: 3px solid var(--ink); outline-offset: 3px; }
.choice.is-pop .choice__body { animation: pop var(--t-med) var(--ease); }
@keyframes pop { 40% { transform: scale(1.015); } }

/* 12. Toasts */
.toasts {
  position: fixed; z-index: 90; left: 0; right: 0;
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom));
  display: grid; gap: var(--space-2); justify-items: center;
  padding-inline: var(--gutter); pointer-events: none;
}
.toasts--guest { bottom: calc(16px + env(safe-area-inset-bottom)); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: var(--space-3);
  width: 100%; max-width: 480px; min-height: 52px; padding: 8px 8px 8px 14px;
  background: var(--ink); color: var(--paper); border: var(--bw-thin) solid var(--ink);
  border-left: 10px solid var(--ok-bg);
  animation: toast-in var(--t-med) var(--ease) both;
}
.toast--ok { border-left-color: #6BC48A; }
.toast--err { background: var(--err); border-color: var(--ink); border-left-color: var(--ink); color: var(--white); }
.toast--info { border-left-color: var(--warn-solid); }
.toast__msg { flex: 1; font-weight: 600; }
.toast__close { color: inherit; }
.toast.is-leaving { animation: toast-out 220ms var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(16px); } }

/* 13. Modals */
dialog.modal {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; color: var(--ink);
  overflow: hidden;
}
dialog.modal[open] { display: flex; align-items: flex-end; justify-content: center; }
dialog.modal::backdrop { background: rgba(17, 17, 17, .6); }
dialog.modal[open]::backdrop { animation: fade-in var(--t-med) var(--ease) both; }
dialog.modal.is-closing::backdrop { animation: fade-out 220ms var(--ease) both; }
.modal__panel {
  width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto;
  background: var(--card); border: var(--bw) solid var(--ink); border-bottom-width: 0;
  padding: var(--space-5) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom));
  display: grid; gap: var(--space-4);
}
dialog.modal[open] .modal__panel { animation: sheet-in var(--t-med) var(--ease) both; }
dialog.modal.is-closing .modal__panel { animation: sheet-out 220ms var(--ease) both; }
.modal--lg .modal__panel { max-width: 720px; }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.modal__title { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.modal__body { display: grid; gap: var(--space-3); }
.modal__foot { display: flex; gap: var(--space-3); flex-wrap: wrap; justify-content: flex-end; }
.modal__foot .btn { flex: 1 1 140px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(32px); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(24px); } }
body:has(dialog.modal[open]) { overflow: hidden; }

/* 14. Header & navigation */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper); border-bottom: var(--bw) solid var(--ink);
  padding-top: env(safe-area-inset-top);
}
.app-header__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  min-height: var(--header-h); padding-block: var(--space-2);
}
.app-header__brand { display: inline-flex; text-decoration: none; }
.app-header__action { margin-left: auto; }

.app-nav {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--paper); border-top: var(--bw) solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
.app-nav__link {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--nav-h); padding: 6px 4px;
  font-size: .875rem; font-weight: 600; text-decoration: none;
  color: var(--muted);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.app-nav__link:hover { background: var(--paper-dark); color: var(--ink); }
.app-nav__link[aria-current="page"] { color: var(--ink); font-weight: 800; }
.app-nav__link[aria-current="page"]::before {
  content: ""; position: absolute; left: 12px; right: 12px; top: -3px; height: 6px; background: var(--ink);
}
.app-nav__icon { position: relative; }
.app-nav__icon .count { position: absolute; top: -10px; left: 12px; }
.app-nav__link > .count { display: none; }
.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }

@media (min-width: 900px) {
  .has-nav { padding-bottom: 0; }
  .app-header__bar { gap: var(--space-6); }
  .app-nav {
    position: static; display: flex; gap: var(--space-2); border: 0; background: transparent; padding: 0;
    margin-right: auto; align-self: stretch;
  }
  .app-nav__link {
    flex-direction: row; gap: var(--space-2); min-height: 44px; padding: 0 14px;
    font-size: 1rem; align-self: center;
  }
  .app-nav__link:hover { background: transparent; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
  .app-nav__icon { display: none; }
  .app-nav__link[aria-current="page"]::before { left: 14px; right: 14px; top: auto; bottom: -3px; height: 5px; }
  .app-nav__link[aria-current="page"] { align-self: stretch; }
  .app-nav__link > .count { display: inline-flex; }
  .toasts { bottom: 24px; }
  dialog.modal[open] { align-items: center; }
  .modal__panel { border-bottom-width: var(--bw); padding-bottom: var(--space-5); }
  dialog.modal[open] .modal__panel { animation-name: pop-in; }
  dialog.modal.is-closing .modal__panel { animation-name: pop-out; }
  .page { padding-block: var(--space-7) var(--space-8); }
}
@keyframes pop-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* 15. Miscellaneous components */
/* Logo */
.logo { display: block; flex: none; width: var(--logo-w, 120px); }
.logo img { width: 100%; height: auto; }

/* Stepper */
.stepper { display: flex; align-items: center; gap: var(--space-3); }
.stepper__count { font-size: .8125rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.stepper__bars { display: flex; gap: 4px; flex: 1; max-width: 200px; }
.stepper__bar { flex: 1; height: 8px; border: 2px solid var(--ink); background: transparent; transition: background-color var(--t-med) var(--ease); }
.stepper__bar.is-done { background: var(--ink); }

/* Property photo */
.thumb { position: relative; display: block; aspect-ratio: var(--ratio, 4/3); overflow: hidden; background: var(--pause-bg); border: var(--bw-thin) solid var(--ink); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb__fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted);
  background-color: var(--pause-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M-2 2l4-4M0 16L16 0M14 18l4-4' stroke='%23CFC8BA' stroke-width='2'/%3E%3C/svg%3E");
}
.thumb__fallback .icon { background: var(--paper); border: 2px solid var(--muted); padding: 8px; width: 44px; height: 44px; }
.thumb--lg { --ratio: 16/10; }

/* Network pill */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-3); min-height: 52px;
  padding: 8px 14px 8px 12px; background: var(--card); color: var(--ink);
  border: var(--bw-thin) solid var(--ink); text-decoration: none;
}
a.chip { transition: background-color var(--t-fast) var(--ease), transform 90ms var(--ease); }
a.chip:hover { background: var(--white); }
a.chip:active { transform: translate(2px, 2px); }
.chip__text { display: grid; line-height: 1.25; }
.chip__name { font-weight: 800; }
.chip__state { display: inline-flex; align-items: center; gap: 4px; font-size: .875rem; font-weight: 700; }
.chip--on .chip__state { color: var(--ok); }
.chip--off { border-style: dashed; }
.chip--off .chip__state { color: var(--err); }
.chip__cta { margin-left: var(--space-2); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Empty state */
.empty {
  display: grid; gap: var(--space-3); justify-items: start; padding: var(--space-6) var(--space-5);
  border: var(--bw-thin) dashed var(--ink); background: transparent;
}
.empty__title { font-family: var(--font-display); font-weight: 400; font-size: 1.75rem; line-height: 1.1; }
.empty__text { color: var(--muted); max-width: 32em; }

/* Preparation bar (indeterminate by default, or --value: 60%) */
.pulse-bar { position: relative; height: 14px; border: var(--bw-thin) solid var(--ink); background: var(--card); overflow: hidden; }
.pulse-bar::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: var(--ink);
  animation: pulse-run 1.4s var(--ease) infinite;
}
.pulse-bar[style*="--value"]::before { width: var(--value); animation: none; transition: width var(--t-slow) var(--ease); }
@keyframes pulse-run { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* 16. Guest layout */
.guest { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.guest__main { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--space-6) var(--gutter); }
.guest__inner { width: 100%; max-width: 520px; display: grid; gap: var(--space-6); justify-items: start; padding-block: var(--space-4); }
.guest__inner--wide { max-width: 720px; }
.guest__brand { display: inline-flex; text-decoration: none; }
.guest__foot { padding: var(--space-4) var(--gutter) calc(var(--space-4) + env(safe-area-inset-bottom)); font-size: .875rem; color: var(--muted); }
.guest__inner > * { min-width: 0; max-width: 100%; }
.guest__inner .btn--block, .guest__inner form { width: 100%; }

/* 17. Reduced motion */
/* Decorative entrances, slides and bounces stop; what says "in progress" stays, fixed. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .megaphone__wave { transition: none; }
  .fx-fade .page, .fx-fade .guest__inner, .choice.is-pop .choice__body, .toast, .toast.is-leaving,
  dialog.modal[open]::backdrop, dialog.modal.is-closing::backdrop,
  dialog.modal[open] .modal__panel, dialog.modal.is-closing .modal__panel { animation: none; }
  .fx-fade.is-leaving .page, .fx-fade.is-leaving .guest__inner { transform: none; transition: none; }
  .btn, a.card, button.card, a.chip, .choice__body { transition: none; }
  .btn:active:not(:disabled):not(.is-disabled):not(.is-loading) { transform: none; box-shadow: none; }
  .btn--primary:hover, .btn--primary:focus-visible { transform: none; }
  .btn--primary::before, .link::after { transition: none; }
  .btn--primary:hover::before, .btn--primary:focus-visible::before { transform: none; }
  .btn.is-loading::after { content: "…"; width: auto; height: auto; border: 0; animation: none; }
  .pulse-bar::before { animation: none; width: 40%; transform: translateX(80%); }
}

/* High contrast (Windows): colours are imposed; outlines and states stay legible. */
@media (forced-colors: active) {
  :focus-visible { outline-color: Highlight; }
  .btn, .card, .choice__body { border-color: CanvasText; }
  .btn.is-loading::after { border-color: CanvasText; border-top-color: transparent; }
}

/* 18. Readability and clarity */
/* The hidden attribute must always win, even over a grid or a flex. */
[hidden] { display: none !important; }

/* A long capitalised heading is heavy: it is reduced, and stays dominant. */
.headline--loud.headline--long .headline__title { font-size: clamp(2rem, 7.2vw, 3.5rem); line-height: 1; }

/* Link with pictogram: on the same line, well aligned. */
.link:has(> svg) { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; }
.link:has(> svg):hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Entry screens: start at the top on phone, without a big gap before the heading. */
@media (max-width: 899px) {
  .guest__main { align-items: flex-start; padding-top: var(--space-5); }
  .guest__inner { gap: var(--space-5); }
}
