/* Aozora App — style « Ciel » (tâche 167).
   Thème clair/sombre automatique selon le système ; toutes les couleurs en variables. */

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-latin-wght.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f7fb;
  --text: #0f172a;
  --muted: #475569;
  --card: #ffffff;
  --card-border: #ffffff;
  --tile: #f8fafc;
  --line: #e2e8f0;
  --link: #1d4ed8;
  --link-hover: #1e3a8a;
  --band: #0369a1;
  --band-text: #ffffff;
  --band-soft: #dbe7fb;
  --band-link: #e0ecff;
  --pill-border: #93b4e6;
  --badge-bg: #f1f5f9;
  --badge-text: #475569;
  --button: #0369a1;
  --button-hover: #075985;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --text: #e5edf7;
    --muted: #a7b6cb;
    --card: #131c2e;
    --card-border: #22304a;
    --tile: #182238;
    --line: #22304a;
    --link: #7cc4f2;
    --link-hover: #bfe3fa;
    --band: #0c4a6e;
    --band-soft: #d6ebfa;
    --band-link: #d6ebfa;
    --pill-border: #5b8fb5;
    --badge-bg: #1d2840;
    --badge-text: #c3d0e2;
    --button: #0369a1;
    --button-hover: #0284c7;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 4px; }

/* Largeur fluide jusqu'à 1200 px ; marges qui suivent la taille de l'écran.
   Le contenu s'organise en grilles (tuiles, blocs) pour occuper la place. */
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-left: clamp(16px, 4vw, 40px); padding-right: clamp(16px, 4vw, 40px); }

.skip-link { position: absolute; left: 8px; top: -100px; padding: 8px 12px; background: var(--card); color: var(--text); border-radius: 8px; z-index: 10; }
.skip-link:focus { top: 8px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Bandeau */
.band { background: var(--band); color: var(--band-text); }
.band a:focus-visible { outline-color: var(--band-text); }

.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 20px; padding-bottom: 20px; }
.logo { font-weight: 800; font-size: 18px; color: var(--band-text); text-decoration: none; }
.logo:hover { color: var(--band-text); }

.lang-switch { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 600; border: 1px solid var(--pill-border); border-radius: 999px; padding: 4px 12px; color: var(--band-soft); }
.lang-switch a { color: var(--band-link); text-decoration: none; }
.lang-switch a:hover { color: var(--band-text); text-decoration: underline; }
.lang-switch [aria-current] { color: var(--band-text); }

.hero { padding-top: 56px; padding-bottom: 88px; display: flex; flex-direction: column; gap: 16px; }
.hero h1 { margin: 0; max-width: 680px; font-size: clamp(32px, 6vw, 48px); line-height: 1.1; font-weight: 800; }
.hero .lead { margin: 0; max-width: 600px; font-size: 18px; line-height: 1.6; color: var(--band-soft); }

/* Carte qui chevauche le bandeau */
.main { flex-grow: 1; margin-top: -48px; padding-bottom: 64px; }
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: 20px; padding: 8px clamp(16px, 3vw, 32px); }

/* Liste des apps (accueil) : tuiles en grille, 2 par ligne en grand écran, 1 sur mobile */
.app-list { list-style: none; margin: 0; padding: 16px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.app { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; padding: 18px; background: var(--tile); border: 1px solid var(--line); border-radius: 16px; }
.app-icon { width: 52px; height: 52px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-weight: 800; background: var(--icon-bg); color: var(--icon-fg); }
.app-text { display: flex; flex-direction: column; gap: 2px; }
.app-name { font-weight: 800; font-size: 17px; }
/* Carte cliquable : le lien du nom couvre toute la carte (seulement pour les apps qui ont une page) */
.app { position: relative; }
.app-name a { color: var(--text); text-decoration: none; }
.app-name a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.app:has(.app-name a) { transition: border-color .15s, transform .15s; }
.app:has(.app-name a):hover { border-color: var(--link); transform: translateY(-2px); }
.app:has(.app-name a):hover .app-name a { color: var(--link); }
.app:has(.app-name a:focus-visible) { outline: 3px solid var(--link); outline-offset: 2px; }
.app-name a:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) { .app:has(.app-name a):hover { transform: none; } }
.app-desc { font-size: 14px; line-height: 1.5; color: var(--muted); }
.badge { white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--badge-text); background: var(--badge-bg); border-radius: 999px; padding: 4px 10px; }
/* Badge App Store sur une carte de l'accueil : au-dessus du lien qui couvre la carte */
.app .store-badge { position: relative; z-index: 1; }

@media (max-width: 480px) {
  .app { grid-template-columns: 52px minmax(0, 1fr); align-items: start; }
  .badge, .app .store-badge { grid-column: 2; justify-self: start; }
}

/* Texte courant (contact, mentions légales, support, confidentialité, 404).
   Chaque partie <section class="block"> est un bloc ; les blocs se placent sur 2 colonnes
   quand la place le permet. Le reste prend toute la largeur : un texte sans blocs
   (comme une politique de confidentialité) reste donc sur une seule colonne. */
.prose { padding: 16px 0 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); column-gap: 56px; align-items: start; }
.prose > :not(.block) { grid-column: 1 / -1; }
.block > :last-child { margin-bottom: 0; }
.prose h2 { margin: 32px 0 6px; font-size: 20px; line-height: 1.3; font-weight: 800; }
.prose p, .prose ul { margin: 0 0 12px; }
.prose ul { padding-left: 20px; }
.prose > :first-child { margin-top: 8px; }

.button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 12px; background: var(--button); color: #ffffff; text-decoration: none; font-weight: 600; font-size: 16px; }
.button:hover { background: var(--button-hover); color: #ffffff; }
.button svg { flex: none; }

/* Pages d'app (gabarits src/templates/app-*.html) */
.app-page { padding: 24px 0; }
.app-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; }
.app-head .app-icon { width: 80px; height: 80px; border-radius: 20px; font-size: 24px; }
img.app-icon { display: block; object-fit: cover; }
.app-intro .prose { padding: 16px 0 8px; display: block; }
.store-badge { display: inline-flex; min-height: 44px; align-items: center; }
.store-badge img { display: block; height: 40px; width: auto; }

/* Écran large : icône + badge à gauche, texte à droite. */
@media (min-width: 760px) {
  .app-intro { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 32px; align-items: start; }
  .app-head { flex-direction: column; align-items: flex-start; }
  .app-head .app-icon { width: 120px; height: 120px; border-radius: 28px; font-size: 34px; }
  .app-intro .prose { padding-top: 0; }
}

/* Captures : grille centrée, jamais plus petites que 200 px de large ;
   quand la place manque, elles passent à la ligne (une par ligne sur téléphone). */
.screenshots { list-style: none; margin: 24px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 260px)); justify-content: center; gap: 24px; }
.screenshots img { display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line); }

/* Barre en haut des pages d'app : ← Toutes les apps · Présentation · Support · Confidentialité */
.app-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px 0 12px; border-bottom: 1px solid var(--line); }
.app-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.app-nav a:hover { color: var(--text); background: var(--tile); }
.app-nav a[aria-current="page"] { color: var(--text); background: var(--tile); box-shadow: inset 0 0 0 1px var(--line); }
.app-nav .app-nav-back { padding-left: 0; margin-right: 8px; color: var(--link); }
.app-nav .app-nav-back:hover { background: none; text-decoration: underline; color: var(--link-hover); }

/* Questions du support : 2 colonnes en grand écran ; fermées, toutes de même hauteur (2 lignes) */
.faq { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 12px 16px; align-items: start; margin-top: 8px; }
.faq details { background: var(--tile); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; }
.faq summary { cursor: pointer; font-weight: 600; min-height: 3.3em; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font-size: 20px; font-weight: 800; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details > :not(summary) { margin: 8px 0 4px; color: var(--muted); }

/* Tableaux de données (règles des États de Permit Tally) : défilement horizontal sur téléphone */
.table-scroll { overflow-x: auto; margin: 8px 0 16px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table thead th { font-size: 13px; color: var(--muted); font-weight: 700; }
.data-table tbody tr:nth-child(even) { background: var(--tile); }

/* Pied de page */
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 24px; padding-bottom: 24px; font-size: 14px; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.site-footer a[aria-current="page"] { color: var(--text); font-weight: 600; }
.footer-links { display: flex; gap: 20px; }
