/* =========================================================================
   Accueil et pages publiques de Qrible, dans l'esprit de l'application iPhone :
   barre de navigation translucide, grand titre, listes groupées façon
   Réglages, pastilles colorées. Mêmes tokens que l'application (couleurs
   système Apple, variantes « contraste élevé » pour rester AA).
   ========================================================================= */

@font-face {
  font-family: 'Geist';
  src: url('../fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

@property --halo-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

:root {
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Geist', system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Geist', system-ui, sans-serif;

  --large-title: 2.125rem;
  --title-2: 1.375rem;
  --body: 1.0625rem;
  --subhead: 0.9375rem;
  --footnote: 0.8125rem;

  --bg: #f2f2f7;
  --bg-cell: #ffffff;
  --label: #000000;
  --label-2: #6c6c70;
  --separator: rgb(60 60 67 / 0.2);
  --fill: rgb(120 120 128 / 0.14);
  --bar: rgb(242 242 247 / 0.8);
  /* Bleu interactif assombri pour rester AA (≥ 4,5) sur les fonds gris. */
  --blue: #005fbf;
  --green: #248a3d;
  --orange: #c93400;
  --red: #d70015;
  --gray: #6c6c70;
  --indigo: #3634a3;
  --todo-bg: #fff4d6;
  --todo-fg: #6b4b00;

  --radius: 16px;
  --gutter: max(16px, env(safe-area-inset-left));
  --page: 1180px;
  --ease-spring: cubic-bezier(0.22, 1.1, 0.36, 1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-cell: #1c1c1e;
    --label: #ffffff;
    --label-2: #98989f;
    --separator: rgb(84 84 88 / 0.55);
    --fill: rgb(118 118 128 / 0.24);
    --bar: rgb(0 0 0 / 0.82);
    --blue: #409cff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff6961;
    --gray: #98989f;
    --indigo: #7d7aff;
    --todo-bg: #3a2d00;
    --todo-fg: #ffd66b;
  }
}

@media (min-width: 768px) {
  :root {
    --large-title: 3rem;
    --gutter: 32px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: var(--body);
  line-height: 1.4;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
/* Un lien dans un texte se distingue autrement que par sa couleur. */
.prose a,
.group-footer a,
.faq details a,
.card a,
.row-text small a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 8px;
}

.visually-hidden {
  position: absolute !important;
  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(--gutter);
  top: -100px;
  z-index: 30;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg-cell);
}
.skip-link:focus {
  top: calc(env(safe-area-inset-top) + 8px);
}

/* ---------- Pictogrammes (js/icons.js) ---------- */

.symbol {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
[data-icon] {
  display: inline-grid;
  place-items: center;
}

/* ---------- Barre de navigation ---------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: calc(52px + env(safe-area-inset-top));
  /* Contenu aligné sur la largeur de la page, fond sur toute la largeur. */
  padding: env(safe-area-inset-top) max(var(--gutter), calc((100% - var(--page)) / 2)) 0;
  background: var(--bar);
  border-bottom: 1px solid transparent;
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
}
.navbar.is-scrolled {
  border-bottom-color: var(--separator);
}

.nav-back,
.brand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  color: var(--blue);
  font-size: var(--body);
}
.nav-back .symbol {
  font-size: 1.35rem;
  stroke-width: 2.4;
  scale: -1 1;
}
.brand {
  gap: 10px;
  color: var(--label);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}
.logo {
  display: block;
  width: auto;
  height: 34px;
}
.footer-logo {
  display: inline-flex;
  margin: 16px 0 4px;
}
.footer-logo .logo {
  height: 28px;
}
.nav-back:hover,
.brand:hover {
  text-decoration: none;
}

.nav-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: var(--subhead);
  font-weight: 600;
}
.nav-action:hover {
  text-decoration: none;
  opacity: 0.9;
}
@media (prefers-color-scheme: dark) {
  .nav-action {
    background: #0071e3;
  }
}

/* ---------- Page ---------- */

.page {
  width: min(100%, var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 12px var(--gutter) calc(48px + env(safe-area-inset-bottom));
}

.large-title {
  margin: 4px 4px 10px;
  font-family: var(--font-display);
  font-size: var(--large-title);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-wrap: balance;
}

.updated {
  margin: 0 4px 14px;
  color: var(--label-2);
  font-size: var(--footnote);
}

.prose {
  max-width: 46rem;
  margin: 0 4px 16px;
  font-size: var(--body);
  line-height: 1.45;
  text-wrap: pretty;
}
.lead {
  font-size: 1.1875rem;
  color: var(--label-2);
}

.section-title {
  margin: 36px 4px 12px;
  font-family: var(--font-display);
  font-size: var(--title-2);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-wrap: balance;
}

.group-header {
  margin: 24px 16px 7px;
  color: var(--label-2);
  font-size: var(--footnote);
  font-weight: 400;
  letter-spacing: 0;
}
.group-footer {
  max-width: 46rem;
  margin: 8px 16px 0;
  color: var(--label-2);
  font-size: var(--footnote);
  line-height: 1.35;
}

/* ---------- Listes groupées (Réglages) ---------- */

.group {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius);
  background: var(--bg-cell);
  overflow: hidden;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 12px 16px;
  line-height: 1.3;
}
.row + .row::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 60px; /* séparateur aligné sur le texte, comme iOS */
  height: 1px;
  background: var(--separator);
  transform: scaleY(0.5);
  transform-origin: top;
}
.row.plain {
  grid-template-columns: 1fr auto;
}
.row.plain + .row.plain::before {
  left: 16px;
}
.row-text {
  min-width: 0;
  text-wrap: pretty;
}
.row-text strong {
  display: block;
  font-weight: 600;
}
.row-text small,
.row-detail {
  display: block;
  margin-top: 3px;
  color: var(--label-2);
  font-size: var(--subhead);
  line-height: 1.35;
}
.row-value {
  color: var(--label-2);
  text-align: right;
}
.row-chevron {
  color: var(--label-2);
  font-size: 0.95rem;
}
.row-chevron .symbol {
  stroke-width: 2.4;
}

/* Ligne entièrement cliquable (lien étiré). */
.link-row a,
.link-row button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--label);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.link-row a:hover {
  text-decoration: none;
}
.link-row a::after,
.link-row button::after {
  content: '';
  position: absolute;
  inset: 0;
}
.link-row:hover {
  background: var(--fill);
}
.link-row a:focus-visible,
.link-row button:focus-visible {
  outline: none;
}
.link-row:focus-within {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
  border-radius: var(--radius);
}

.squircle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #fff;
  font-size: 1.15rem;
  align-self: start;
}
.row .squircle {
  margin-top: 1px;
}
.squircle .symbol {
  stroke-width: 2.2;
}
.squircle.red {
  background: var(--red);
}
.squircle.orange {
  background: var(--orange);
}
.squircle.green {
  background: var(--green);
}
.squircle.blue {
  background: var(--blue);
}
.squircle.gray {
  background: var(--gray);
}
.squircle.indigo {
  background: var(--indigo);
}
@media (prefers-color-scheme: dark) {
  .squircle.green,
  .squircle.orange {
    color: #000;
  }
}

/* Plusieurs groupes côte à côte sur grand écran. */
.columns {
  display: grid;
  gap: 0 24px;
}
@media (min-width: 900px) {
  .columns {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* Carte de texte libre (même matière qu'un groupe). */
.card {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--bg-cell);
}
.card > :first-child {
  margin-top: 0;
}
.card > :last-child {
  margin-bottom: 0;
}
.card p {
  max-width: 46rem;
}

dl.facts {
  margin: 0;
}
dl.facts dt {
  font-weight: 600;
}
dl.facts dd {
  margin: 2px 0 14px;
  color: var(--label-2);
}
dl.facts dd:last-child {
  margin-bottom: 0;
}

/* ---------- Questions fréquentes : lignes dépliables ---------- */

.faq details + details {
  border-top: 1px solid var(--separator);
}
.faq summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 14px 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary:hover {
  background: var(--fill);
}
.faq .chevron {
  color: var(--label-2);
  font-size: 0.95rem;
  transition: rotate 0.25s var(--ease-spring);
}
.faq .chevron .symbol {
  stroke-width: 2.4;
}
.faq details[open] .chevron {
  rotate: 90deg;
}
.faq details > :not(summary) {
  max-width: 46rem;
  margin: 0 16px 16px;
  color: var(--label-2);
}

/* ---------- Boutons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 24px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease-spring),
    opacity 0.18s;
}
.button:hover {
  text-decoration: none;
  opacity: 0.92;
}
.button:active {
  transform: scale(0.97);
}
.button-filled {
  background: var(--blue);
  color: #fff;
}
.button-gray {
  background: var(--fill);
  color: var(--blue);
}
@media (prefers-color-scheme: dark) {
  .button-filled {
    background: #0071e3;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 4px 0;
}

/* Feuille modale façon iOS (instructions d'installation sur iPhone) */
dialog.sheet {
  width: min(100%, 34rem);
  max-height: calc(100dvh - 24px);
  margin: auto auto 0;
  padding: 28px 16px calc(24px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 28px 28px 0 0;
  background: var(--bg);
  color: var(--label);
  overflow: auto;
}
@media (min-width: 640px) {
  dialog.sheet {
    margin: auto;
    border-radius: 28px;
    padding-bottom: 24px;
  }
}
dialog.sheet::backdrop {
  background: rgb(0 0 0 / 0.4);
}
.sheet-title {
  margin: 0 48px 8px 4px;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--label-2);
  font-size: 1.1rem;
  cursor: pointer;
}
.sheet-close::after {
  content: '';
  position: absolute;
  inset: -6px;
}
.steps {
  margin-top: 8px;
}

/* ---------- Accueil : hero ---------- */

.hero {
  display: grid;
  gap: 28px;
  align-items: center;
  padding: 24px 0 8px;
}
@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1.15fr 1fr;
    gap: 48px;
    padding: 48px 0 24px;
  }
}
.hero .large-title {
  font-size: clamp(2.5rem, 7vw, 4.25rem);
  line-height: 1.02;
}
.baseline {
  margin: 0 4px 6px;
  color: var(--label-2);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.hero-visual {
  --halo-colors: #5b8cff, #8f6bff, #e45cff, #ff5f8f, #ff9a4d, #ffd36b, #6be0ff, #5b8cff;
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: min(100%, 26rem);
  margin: 0 auto;
  border-radius: 40px;
  background:
    radial-gradient(circle at 30% 20%, rgb(91 140 255 / 0.35), transparent 55%),
    radial-gradient(circle at 75% 80%, rgb(228 92 255 / 0.3), transparent 55%), #0b0c10;
  overflow: hidden;
}
.hero-halo {
  position: absolute;
  inset: 22%;
  border-radius: 44px;
}
.hero-halo span {
  position: absolute;
  border-radius: inherit;
  background: conic-gradient(from var(--halo-angle), var(--halo-colors));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
}
.hero-halo .ring {
  inset: 0;
  padding: 4px;
}
.hero-halo .glow {
  inset: -16px;
  padding: 20px;
  border-radius: 60px;
  filter: blur(14px);
  opacity: 0.9;
}
/* Le QR code décoratif, puis la ligne de lecture qui le parcourt. */
.hero-qr {
  position: relative;
  width: 46%;
  height: auto;
  border-radius: 6px;
}
.hero-scan {
  position: absolute;
  inset: 27%;
  overflow: hidden;
  border-radius: 6px;
  pointer-events: none;
}
.hero-scan::after {
  content: '';
  position: absolute;
  left: -10%;
  right: -10%;
  top: -20%;
  height: 20%;
  background: linear-gradient(
    to bottom,
    transparent,
    rgb(107 224 255 / 0.55) 70%,
    rgb(255 255 255 / 0.9) 92%,
    transparent
  );
  opacity: 0;
}
.hero-chip {
  position: absolute;
  bottom: 9%;
  left: 50%;
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.16);
  color: #fff;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: var(--footnote);
  font-weight: 600;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(18px) saturate(1.8);
  backdrop-filter: blur(18px) saturate(1.8);
}
.hero-chip .symbol {
  color: rgb(255 255 255 / 0.75);
}
/* Le verdict, comme le panneau de l'application : octogone rouge, un mot. */
.hero-verdict {
  position: absolute;
  top: 9%;
  left: 50%;
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.94);
  color: #d70015;
  font-size: var(--subhead);
  font-weight: 700;
  box-shadow: 0 8px 30px rgb(215 0 21 / 0.35);
}
.hero-verdict .symbol {
  font-size: 1.15rem;
  stroke-width: 2.2;
}

/* Une boucle de 8 s, dans l'ordre de l'application : lecture du code, le halo
   s'y accroche, l'adresse apparaît, puis le verdict. Sans animation (réglage
   « réduire les animations »), l'état final reste affiché, immobile. */
@media (prefers-reduced-motion: no-preference) {
  .hero-visual {
    animation: hero-in 0.9s var(--ease-spring) both;
  }
  .hero-halo {
    animation:
      halo-spin 3.2s linear infinite,
      hero-lock 8s var(--ease-spring) infinite;
  }
  .hero-qr {
    animation: hero-code 8s ease-in-out infinite;
  }
  .hero-scan::after {
    animation: hero-sweep 8s ease-in-out infinite;
  }
  .hero-chip {
    animation: hero-chip 8s var(--ease-spring) infinite;
  }
  .hero-verdict {
    animation: hero-verdict 8s var(--ease-spring) infinite;
  }
  @keyframes halo-spin {
    to {
      --halo-angle: 360deg;
    }
  }
  @keyframes hero-in {
    from {
      opacity: 0;
      scale: 0.94;
    }
  }
  @keyframes hero-sweep {
    0%,
    6% {
      opacity: 0;
      translate: 0 0;
    }
    9% {
      opacity: 1;
    }
    30% {
      opacity: 1;
      translate: 0 600%;
    }
    33%,
    100% {
      opacity: 0;
      translate: 0 600%;
    }
  }
  @keyframes hero-lock {
    0%,
    32% {
      scale: 1.04;
    }
    40%,
    86% {
      scale: 0.88;
    }
    96%,
    100% {
      scale: 1.04;
    }
  }
  @keyframes hero-code {
    0%,
    4% {
      opacity: 0.85;
      scale: 0.97;
    }
    10%,
    46% {
      opacity: 1;
      scale: 1;
    }
    54%,
    86% {
      opacity: 0.6;
      scale: 0.97;
    }
    96%,
    100% {
      opacity: 0.85;
      scale: 0.97;
    }
  }
  @keyframes hero-chip {
    0%,
    36% {
      opacity: 0;
      translate: -50% 14px;
    }
    44%,
    88% {
      opacity: 1;
      translate: -50% 0;
    }
    96%,
    100% {
      opacity: 0;
      translate: -50% 6px;
    }
  }
  @keyframes hero-verdict {
    0%,
    48% {
      opacity: 0;
      scale: 0.6;
    }
    54% {
      opacity: 1;
      scale: 1.08;
    }
    58%,
    88% {
      opacity: 1;
      scale: 1;
    }
    96%,
    100% {
      opacity: 0;
      scale: 0.9;
    }
  }
}

/* ---------- Accueil : cartes ---------- */

.tiles {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) {
  .tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1000px) {
  .tiles {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tile {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  border-radius: 20px;
  background: var(--bg-cell);
}
.tile h3 {
  margin: 0;
  font-size: var(--body);
  font-weight: 600;
  line-height: 1.25;
}
.tile p {
  margin: 0;
  color: var(--label-2);
  font-size: var(--subhead);
  line-height: 1.35;
}
.tile .squircle {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 1.45rem;
}
.tile a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.tile a {
  color: var(--label);
}
.tile:has(a):hover {
  background: color-mix(in srgb, var(--bg-cell) 92%, var(--label));
}
.tile:has(a:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.tile a:focus-visible {
  outline: none;
}

.verdict-pill {
  justify-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--footnote);
  font-weight: 600;
}
.verdict-pill.danger {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: #b8000f;
}
.verdict-pill.caution {
  background: color-mix(in srgb, var(--orange) 12%, transparent);
  color: #b02d00;
}
.verdict-pill.safe {
  background: color-mix(in srgb, var(--green) 12%, transparent);
  color: #1d7533;
}
@media (prefers-color-scheme: dark) {
  .verdict-pill.danger {
    color: var(--red);
  }
  .verdict-pill.caution {
    color: var(--orange);
  }
  .verdict-pill.safe {
    color: var(--green);
  }
}
.verdict-pill.local {
  background: color-mix(in srgb, var(--blue) 14%, transparent);
  color: var(--blue);
}

/* Appel final */
.closing {
  margin-top: 40px;
  padding: 32px 24px;
  border-radius: 28px;
  background: var(--bg-cell);
  text-align: center;
}
.closing .section-title {
  margin-top: 0;
}
.closing .actions {
  justify-content: center;
}

/* Information manquante, bloquée par scripts/check-release.mjs avant mise en ligne. */
.todo {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--todo-bg);
  color: var(--todo-fg);
  font-weight: 600;
}

/* ---------- Pied de page ---------- */

.site-footer {
  color: var(--label-2);
  font-size: var(--footnote);
}
.site-footer .inner {
  width: min(100%, var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 8px var(--gutter) calc(32px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--separator);
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  margin: 8px 0;
  padding: 0;
  list-style: none;
}
.site-footer a,
.site-footer button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--label-2);
  font: inherit;
  cursor: pointer;
}
.site-footer a:hover,
.site-footer button:hover {
  color: var(--label);
  text-decoration: none;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
