/* WaTiFy : feuille de style unique, écrite pour le téléphone d'abord ; les écrans larges ajoutent des
   colonnes (min-width). Polices du système uniquement : aucune requête vers un tiers. */

:root {
  /* Couleurs de Google (bleu, vert, jaune, rouge) en teintes 600 lisibles sur fond clair, gris neutres de
     Google pour les fonds. Le bleu porte l'action ; les trois autres restent des repères ponctuels. */
  --bg: #f8f9fa;
  --surface: #ffffff;
  --ink: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --accent: #1a73e8;
  --accent-hover: #1967d2;
  --accent-soft: #e8f0fe;
  --on-accent: #ffffff;
  --green: #1e8e3e;
  --green-soft: #e6f4ea;
  --yellow: #e37400;
  --yellow-soft: #fef7e0;
  --red: #d93025;
  --red-soft: #fce8e6;
  --band: #202124;
  --band-ink: #ffffff;
  --band-muted: #bdc1c6;
  --band-line: rgba(255, 255, 255, 0.16);
  --band-hover: rgba(255, 255, 255, 0.09);
  --band-accent: #8ab4f8;
  --button: #1a73e8;
  --button-hover: #1b66c9;
  --on-button: #ffffff;
  --scroll-thumb: #bdc1c6;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", Consolas, Menlo, monospace;
  --gutter: 20px;
  color-scheme: light;
}

/* Thème sombre : réglage du système, sauf choix « clair » enregistré (data-theme posé par PHP).
   Teintes 300 de Google, faites pour les fonds sombres. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17181b;
    --surface: #202124;
    --ink: #e8eaed;
    --muted: #9aa0a6;
    --line: #3c4043;
    --accent: #8ab4f8;
    --accent-hover: #aecbfa;
    --accent-soft: #1f2a3d;
    --on-accent: #202124;
    --green: #81c995;
    --green-soft: #1d2f24;
    --yellow: #fdd663;
    --yellow-soft: #342e1a;
    --red: #f28b82;
    --red-soft: #3a2220;
    --band: #26272b;
    --band-ink: #f1f3f4;
    --band-muted: #bdc1c6;
    --band-line: rgba(255, 255, 255, 0.14);
    --band-hover: rgba(255, 255, 255, 0.08);
    --band-accent: #8ab4f8;
    --button: #8ab4f8;
    --button-hover: #aecbfa;
    --on-button: #202124;
    --scroll-thumb: #5f6368;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17181b;
  --surface: #202124;
  --ink: #e8eaed;
  --muted: #9aa0a6;
  --line: #3c4043;
  --accent: #8ab4f8;
  --accent-hover: #aecbfa;
  --accent-soft: #1f2a3d;
  --on-accent: #202124;
  --green: #81c995;
  --green-soft: #1d2f24;
  --yellow: #fdd663;
  --yellow-soft: #342e1a;
  --red: #f28b82;
  --red-soft: #3a2220;
  --band: #26272b;
  --band-ink: #f1f3f4;
  --band-muted: #bdc1c6;
  --band-line: rgba(255, 255, 255, 0.14);
  --band-hover: rgba(255, 255, 255, 0.08);
  --band-accent: #8ab4f8;
  --button: #8ab4f8;
  --button-hover: #aecbfa;
  --on-button: #202124;
  --scroll-thumb: #5f6368;
  color-scheme: dark;
}

/* ---------- Base (téléphone) ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--scroll-thumb) var(--bg); }
html.has-lightbox { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; }

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.band :focus-visible { outline-color: var(--band-ink); }
img { max-width: 100%; height: auto; }

h1, h2, h3 { line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: 1.4rem; font-weight: 750; letter-spacing: -0.015em; margin-bottom: 18px; }
h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
p { margin: 0 0 14px; }

.wrap { max-width: 1040px; margin: 0 auto; padding-inline: var(--gutter); }
.narrow { max-width: 62ch; }
.meta { font: 0.8rem/1.5 var(--mono); color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; }
.contact-line { font: 600 1.05rem/1.6 var(--mono); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 10; background: var(--surface); color: var(--ink); padding: 8px 12px; }

.section { padding-block: 36px; border-top: 1px solid var(--line); }
.wrap > .section:first-child, .shots { border-top: 0; }

/* Bandeau bleu royal : en-tête et haut de page forment un seul bloc. */
.band { background: var(--band); color: var(--band-ink); }
.band a { color: var(--band-ink); }

/* En-tête : marque et réglages sur la première ligne, menu sur la seconde. */
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding-block: 12px 0; }
.brand { font: 700 1.05rem/1 var(--mono); text-decoration: none; margin-right: auto; letter-spacing: -0.01em; }
.topbar nav { order: 3; flex-basis: 100%; display: flex; gap: 22px; }
.topbar nav a {
  color: var(--band-muted); text-decoration: none; font-size: 0.95rem;
  padding-block: 8px 10px; border-bottom: 2px solid transparent;
}
.topbar nav a:hover { color: var(--band-ink); }
.topbar nav a[aria-current="page"] { color: var(--band-ink); border-bottom-color: var(--band-accent); }

.lang-switch { display: inline-flex; border: 1px solid var(--band-line); border-radius: 6px; overflow: hidden; font: 700 0.78rem/1 var(--mono); }
.lang-switch a, .lang-switch span { padding: 8px 10px; }
.lang-switch span { background: var(--button); color: var(--on-button); }
.lang-switch a { color: var(--band-muted); text-decoration: none; }
.lang-switch a:hover { color: var(--band-ink); background: var(--band-hover); }

/* Bouton clair / sombre. Sans choix enregistré, seul le lien vers le thème opposé au système est visible. */
.theme-switch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 30px; border: 1px solid var(--band-line); border-radius: 6px; color: var(--band-ink);
}
.theme-switch svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch:hover { background: var(--band-hover); }
:root[data-theme="dark"] .theme-switch.to-dark,
:root[data-theme="light"] .theme-switch.to-light,
:root:not([data-theme]) .theme-switch.to-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-switch.to-light { display: inline-flex; }
  :root:not([data-theme]) .theme-switch.to-dark { display: none; }
}

/* Boutons */
.button {
  display: inline-flex; align-items: center; min-height: 46px; padding: 10px 20px;
  border-radius: 8px; background: var(--accent); color: var(--on-accent);
  font-weight: 650; text-decoration: none;
}
.button:hover { background: var(--accent-hover); color: var(--on-accent); }
.band .button { background: var(--button); color: var(--on-button); }
.band .button:hover { background: var(--button-hover); color: var(--on-button); }
.band .button.is-disabled {
  background: transparent; color: var(--band-ink); border: 1px dashed var(--band-muted); cursor: default;
}
.band .meta { color: var(--band-muted); }

/* ---------- Accueil ---------- */

.intro { padding-block: 28px 40px; }
.intro h1 { margin-bottom: 12px; }
.intro p { color: var(--band-muted); font-size: 1.1rem; max-width: 46ch; margin: 0; }

.app-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.app-card-media { display: block; }
.app-card-media img { display: block; width: 100%; }
.app-card-body { padding: 18px 20px 20px; border-top: 1px solid var(--line); }
.app-card-body h3 { font-size: 1.3rem; }
.app-card-body h3 a { color: var(--ink); text-decoration: none; }
.app-card-body h3 a:hover { color: var(--accent); }

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

/* Le téléphone sort du bas du bandeau : image rognée en hauteur, arrondie en haut seulement. */
.hero { padding-top: 28px; overflow: hidden; }
.hero-grid { display: grid; gap: 28px; }
.hero-icon { width: 64px; height: 64px; border-radius: 15px; display: block; margin-bottom: 16px; }
.hero h1 { font-size: 2.6rem; }
.hero-sub { font-weight: 600; color: var(--band-accent); margin: 4px 0 16px; }
.hero-text > p:not(.hero-sub):not(.cta) { max-width: 52ch; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 22px 0 0; }
.hero-shot { justify-self: center; width: min(78vw, 300px); height: 340px; overflow: hidden; border-radius: 26px 26px 0 0; }
.hero-shot img { display: block; width: 100%; }

.shots { padding-bottom: 8px; }
.gallery {
  list-style: none; margin: 0; padding: 0 var(--gutter) 12px;
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
}
.gallery { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
.gallery.is-enhanced { scrollbar-width: none; }
.gallery.is-enhanced::-webkit-scrollbar { display: none; }
.gallery.is-dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.gallery li { flex: none; width: 62vw; max-width: 230px; scroll-snap-align: start; }
.gallery figure { margin: 0; }
.gallery img { display: block; width: 100%; border-radius: 16px; border: 1px solid var(--line); }

.features { display: grid; gap: 26px; }
.feature-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px;
}
.feature:nth-child(4n + 2) .feature-icon { background: var(--green-soft); color: var(--green); }
.feature:nth-child(4n + 3) .feature-icon { background: var(--yellow-soft); color: var(--yellow); }
.feature:nth-child(4n + 4) .feature-icon { background: var(--red-soft); color: var(--red); }
.feature-icon svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feature ul { margin: 0; padding-left: 18px; color: var(--muted); }
.feature li + li { margin-top: 5px; }
.feature li::marker { color: var(--accent); }

.specs { margin: 0; border-top: 1px solid var(--line); }
.specs > div { display: grid; gap: 2px; padding-block: 12px; border-bottom: 1px solid var(--line); }
.specs dt { font: 0.8rem/1.5 var(--mono); color: var(--muted); }
.specs dd { margin: 0; font-variant-numeric: tabular-nums; }

.zero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 18px; }
.zero span { font: 0.85rem/1.4 var(--mono); color: var(--muted); }
.zero strong { font: 800 2.4rem/1 var(--mono); color: var(--green); letter-spacing: -0.03em; }

/* ---------- Pages de texte ---------- */

.prose { max-width: 720px; padding-block: 32px 56px; }
.prose h1 { font-size: 1.9rem; margin-bottom: 8px; }
.prose h2 { font-size: 1.15rem; margin: 32px 0 10px; }
.prose ul { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.muted { color: var(--muted); }
.crumbs { font: 0.8rem/1.5 var(--mono); color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.not-found { padding-top: 56px; }
.not-found .code { font: 700 0.9rem/1 var(--mono); color: var(--red); margin-bottom: 12px; }
.not-found .links { margin-top: 24px; }

/* Pied de page */
.footer { border-top: 1px solid var(--line); padding-block: 24px 32px; color: var(--muted); font-size: 0.88rem; }
.footer-inner { display: grid; gap: 8px; }
.footer p { margin: 0; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--ink); }

/* ---------- Enrichissements de site.js ---------- */

/* Boutons ronds : galerie et visionneuse. */
.round-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.round-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.round-btn:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.round-btn:disabled { opacity: 0.35; cursor: default; }

/* Indicateur de position de la galerie, à la place de la barre de défilement. */
.gallery-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.gallery-bar[hidden] { display: none; }
.gallery-track { flex: 1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin-right: 8px; }
.gallery-track span { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: transform 0.08s linear; }

.is-zoomable { cursor: zoom-in; }
.gallery .is-zoomable { transition: transform 0.2s ease, border-color 0.2s ease; }
.gallery .is-zoomable:hover { transform: translateY(-4px); border-color: var(--accent); }
.gallery.is-dragging .is-zoomable { cursor: grabbing; transform: none; }
.hero-shot .is-zoomable { transition: transform 0.25s ease; }
.hero-shot .is-zoomable:hover { transform: translateY(-6px); }

/* Visionneuse plein écran. */
.lightbox {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: transparent; color: #f1f4ff; overflow: hidden;
}
.lightbox::backdrop { background: rgba(16, 17, 19, 0.96); }
.lightbox figure {
  height: 100%; margin: 0; padding: 64px 16px 88px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.lightbox img {
  max-height: calc(100% - 48px); max-width: 100%; width: auto;
  border-radius: 20px; touch-action: pan-y; user-select: none;
}
.lightbox-count { position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); margin: 0; font: 0.85rem/1 var(--mono); color: #bdc1c6; }
.lightbox .round-btn { position: fixed; background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.lightbox .round-btn:hover { background: #fff; border-color: #fff; color: #202124; }
.lightbox-close { top: 14px; right: 14px; }
.lightbox-prev { bottom: 20px; left: 16px; }
.lightbox-next { bottom: 20px; right: 16px; }

/* Bouton « Copier » de l'adresse de contact. */
.copy-btn {
  margin-left: 10px; padding: 3px 10px; vertical-align: 2px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted);
  font: 600 0.75rem/1.4 var(--mono); cursor: pointer;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Mouvement ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* Fondu entre les pages du site (navigateurs récents). */
  @view-transition { navigation: auto; }

  .hero-shot img { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
  .lightbox img.is-entering { animation: pop 0.22s ease-out; }
  .lightbox[open]::backdrop { animation: fade 0.2s ease-out; }
  .topbar { transition: box-shadow 0.2s ease; }
}
@keyframes rise { from { transform: translateY(48px); } to { transform: none; } }
@keyframes pop { from { transform: scale(0.96); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Tablette ---------- */

@media (min-width: 640px) {
  :root { --gutter: 32px; }
  body { font-size: 17px; }
  h1 { font-size: 2.6rem; }
  h2 { font-size: 1.6rem; margin-bottom: 22px; }
  .section { padding-block: 48px; }

  html { scroll-padding-top: 88px; }
  .topbar { position: sticky; top: 0; z-index: 20; }
  .topbar.is-scrolled { box-shadow: 0 1px 0 var(--band-line), 0 8px 24px rgba(0, 0, 0, 0.22); }
  .topbar-inner { flex-wrap: nowrap; gap: 16px; padding-block: 0; min-height: 64px; }
  .brand { margin-right: 0; }
  .topbar nav { order: 0; flex-basis: auto; margin-left: auto; margin-right: 8px; align-self: stretch; }
  .topbar nav a { display: flex; align-items: center; padding-block: 0; }

  .intro { padding-block: 40px 56px; }

  .app-card-body { padding: 22px 28px 26px; }

  .hero-shot { width: 300px; height: 380px; }
  .gallery {
    --gallery-inset: max(var(--gutter), calc((100% - 1040px) / 2 + var(--gutter)));
    padding-inline: var(--gallery-inset); scroll-padding-inline: var(--gallery-inset); gap: 20px;
  }
  .gallery li { width: 220px; }
  .features { grid-template-columns: 1fr 1fr; gap: 32px 48px; }
  .specs > div { grid-template-columns: 220px 1fr; gap: 24px; }
  .specs dt { padding-top: 2px; }

  .footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

  .lightbox figure { padding: 56px 96px; }
  .lightbox-prev, .lightbox-next { bottom: auto; top: 50%; transform: translateY(-50%); }
  .lightbox-prev { left: 24px; }
  .lightbox-next { right: 24px; }
  .lightbox-count { bottom: 22px; }
}

/* ---------- Ordinateur ---------- */

@media (min-width: 900px) {
  .hero { padding-top: 48px; }
  .hero-grid { grid-template-columns: 1fr 320px; gap: 64px; align-items: end; }
  .hero-text { padding-bottom: 64px; }
  .hero h1 { font-size: 3.4rem; }
  .hero-shot { width: 320px; height: 440px; }

  .app-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  /* Fond blanc de la bannière prolongé si le texte est plus haut qu'elle : jamais de rognage. */
  .app-card-media { display: flex; align-items: center; background: #ffffff; }
  .app-card-body { border-top: 0; border-left: 1px solid var(--line); align-self: center; }
}
