/* Layout : une colonne centrée ; cartes d'apps en flex-wrap centré ; page stats = onglets, charge serveur, visiteurs */
@font-face { font-family: "Bricolage Grotesque"; src: url(fonts/bricolage-grotesque.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Figtree"; src: url(fonts/figtree.woff2) format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f3f4f7;
  --surface: #ffffff;
  --line: #dfe2ea;
  --ink: #15171d;
  --ink-2: #555b6b;
  --ink-3: #6e7486;
  --accent: #3446c7;
  --limit: #c62f3a;
  --warn: #b26a00;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --load-1: #1baf7a;
  --load-2: #6250d6;
  --load-3: #e87ba4;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121419; --surface: #1b1e25; --line: #2c313c; --ink: #eef0f4; --ink-2: #b4b9c6; --ink-3: #8d93a3;
    --accent: #8d9bff; --limit: #f06a72; --warn: #e0a040;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
    --load-1: #199e70; --load-2: #9085e9; --load-3: #d55181;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-body); }
img { max-width: 100%; }
[hidden] { display: none !important; }

.wrap { max-width: 880px; margin: 0 auto; padding-block: 40px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 28px; }

header { text-align: center; display: flex; flex-direction: column; gap: 4px; }
h1 { font: 700 clamp(28px, 6vw, 40px)/1.1 var(--font-display); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
header p { margin: 0; color: var(--ink-2); }

/* Page publique */
.apps { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
/* Toute la carte ouvre l'app (le lien du nom couvre la carte) ; « Découvrir » passe au-dessus et mène à la fiche. */
.app { position: relative; width: 200px; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px 16px 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: inherit;
  transition: transform .15s ease, border-color .15s ease; }
.app:hover { transform: translateY(-2px); border-color: var(--accent); }
.app:has(.app-open:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }
.app-open { outline: none; }
.app-open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.app-tagline { margin-top: -6px; font-size: 13.5px; line-height: 1.35; color: var(--ink-2); text-align: center; text-wrap: balance; }
.app-more { position: relative; z-index: 1; margin-top: -2px; padding: 6px 14px; font-size: 13px; color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.offline { margin: 0; align-self: center; font-size: 13px; color: var(--ink-2); padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); text-align: center; }
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 7px; font: 500 13.5px var(--font-body); color: var(--ink-2);
  text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px;
  cursor: pointer; }
.pill:hover { border-color: var(--accent); color: var(--ink); }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill.install { color: var(--accent); }
.app-name { font: 600 19px/1.2 var(--font-display); color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-thickness: 1px; text-align: center; }
.app img { width: 112px; height: 112px; border-radius: 24px; }
.app-host { font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; text-align: center; }

/* Page stats */
.stack { display: flex; flex-direction: column; gap: 18px; }
.tabs { display: flex; justify-content: center; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; align-self: center; }
.tabs button { font: 500 14px var(--font-body); color: var(--ink-2); background: none; border: 0; border-radius: 999px;
  padding: 8px 16px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 14px;
  display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.panel h2 { font: 600 17px var(--font-display); margin: 0; }
.panel .sub { margin: 0; color: var(--ink-2); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.dash { height: 0; border-top: 2px dashed var(--limit); border-radius: 0; }
.legend i.dot { height: 0; border-top: 2px dotted var(--warn); border-radius: 0; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart text { fill: var(--ink-3); font: 11px var(--font-body); font-variant-numeric: tabular-nums; }
.chart text.lim { fill: var(--limit); font-weight: 600; }
.chart text.wrn { fill: var(--warn); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.45;
  padding: 7px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 2; }
.tip b { font-weight: 600; }
.empty { padding: 60px 0; text-align: center; color: var(--ink-3); font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; text-align: left; font: inherit; color: inherit; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; font: 600 15px var(--font-display); }
.card-head i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.card-head img { width: 32px; height: 32px; border-radius: 8px; }
.card-head small { margin-left: auto; font: 500 12px var(--font-body); color: var(--ink-3); text-align: right; }
.card .big { font: 700 26px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.card .big span { font: 500 13px var(--font-body); color: var(--ink-2); }
.card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; color: var(--ink-2); }
.card dt { white-space: nowrap; }
.card dd { margin: 0; color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter b { display: block; height: 100%; border-radius: 3px; }
.state { align-self: flex-start; font: 600 11.5px var(--font-body); letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.state.ok { color: var(--ink-2); }
.state.high { color: var(--warn); }

button.card { cursor: pointer; transition: opacity .15s ease, border-color .15s ease; }
button.card:hover { border-color: var(--accent); }
button.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.card[aria-pressed="false"] { opacity: .45; }
button.card[aria-pressed="false"] .card-head i { background: transparent !important; box-shadow: inset 0 0 0 2px var(--ink-3); }
.hint { font-size: 12.5px; color: var(--ink-3); margin: 0; }
.note { font-size: 12.5px; color: var(--ink-3); text-align: center; margin: 0; text-wrap: balance; }

@media (prefers-reduced-motion: reduce) { .app, button.card { transition: none; } }

/* Fiche d'une app (/apps/<id>) */
.show { max-width: 720px; }
.back { align-self: flex-start; }
.show-head { align-items: center; gap: 8px; }
.show-head img { width: 88px; height: 88px; border-radius: 20px; }
.show-tagline { font-size: 17px; color: var(--ink-2); text-wrap: balance; }
.show-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 22px; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--bg); font: 600 15px var(--font-body); text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn-ghost { background: var(--surface); color: var(--accent); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); filter: none; }
.show-media { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.show-media .tabs { position: sticky; top: 10px; z-index: 2; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.show-status { margin: -14px 0 0; min-height: 1.5em; font-size: 13.5px; text-align: center; color: var(--ink-2); }
.show-hint { margin: -4px 0 0; font-size: 13px; color: var(--ink-3); text-align: center; }
.show-head .app-host { margin-top: -4px; }
.show-desc { margin: 0; font-size: 16px; line-height: 1.6; text-wrap: pretty; }
.show-section { align-self: stretch; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.show-section h2 { align-self: stretch; margin: 0; font: 600 19px var(--font-display); }
/* Captures : défilement horizontal, une image calée à la fois */
.shots { align-self: stretch; list-style: none; margin: 0; padding: 4px 2px 12px; display: grid; grid-auto-flow: column;
  grid-auto-columns: min(240px, 68%); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
.shots li { scroll-snap-align: start; }
.shots a { display: block; border-radius: 14px; }
.shots a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.shots img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); background: #1d1510; }
.show-video { width: min(320px, 100%); height: auto; border-radius: 16px; border: 1px solid var(--line); background: #1d1510; }
.show-credits { margin: 0; font-size: 12px; color: var(--ink-3); text-align: center; }
