/* Terraclicker — site vitrine. Feuille partagée par index.html et
   index-en.html. L'univers visuel reprend celui du jeu : cadres métalliques
   peints (découpes 9-slice identiques à lib/game/metal_panel.dart), badges
   hexagonaux des monnaies, accents des cinq phases, Orbitron + Roboto. */

@font-face { font-family: 'Orbitron'; src: url('fonts/Orbitron-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Orbitron'; src: url('fonts/Orbitron-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url('fonts/Roboto-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url('fonts/Roboto-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Roboto'; src: url('fonts/Roboto-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --space:   #05070F;
  --space-2: #0B1222;
  --well:    #0E1628;
  --ink:     #E6ECFF;
  --ink-2:   #AEBBDA;
  --ink-3:   #8391B5;
  --cyan:    #00E5FF;
  --orange:  #FF9A3D;

  /* Accents de phase du jeu (TerraformPhase.accent) ; --*-ink est la
     variante lisible en texte sur fond sombre (contraste ≥ 4.5:1). */
  --ph-atmo:  #7BB4CF;
  --ph-temp:  #FF9A3D;
  --ph-water: #3F82C4;  --ph-water-ink: #74AEE6;
  --ph-bio:   #5FB03E;
  --ph-civ:   #FFD54F;

  /* Raretés des commandants (CommanderRarity.color). */
  --epic:      #B36BFF;  --epic-ink: #C99AFF;
  --legendary: #FFC53D;

  --fh: 'Orbitron', 'Roboto', system-ui, sans-serif;
  --fb: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --max: 1160px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--space);
  color: var(--ink);
  font: 400 1rem/1.65 var(--fb);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: rgba(0, 229, 255, .32); color: #fff; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 3px; }
html { scrollbar-color: #2A3A5C var(--space); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 300;
  background: var(--cyan); color: var(--space); padding: .6rem 1rem;
  font-weight: 700; text-decoration: none; border-radius: 4px;
}
.skip:focus { top: 1rem; }

/* ─── Cadres du jeu (9-slice) ──────────────────────────────────────────
   Assets réduits de moitié par rapport à assets/ui/ : les découpes en px
   ci-dessous sont donc la moitié de celles du code Flutter. */
.frame-card {           /* generator_card_background : 921×334, tranche 60 */
  border: 15px solid transparent;
  border-image: url('ui/generator_card_background.webp') 30 fill / 15px stretch;
}
.frame-panel {          /* stats_panel_frame : 788×788, tranche 200/100/188/100 */
  border: solid transparent;
  border-width: 50px 25px 47px;
  border-image: url('ui/stats_panel_frame.webp') 100 50 94 fill / 50px 25px 47px stretch;
}
.frame-reward {         /* reward_frame : 946×412, tranche 120/150/112/150 */
  border: solid transparent;
  border-width: 30px 37px 28px;
  border-image: url('ui/reward_frame.webp') 60 75 56 fill / 30px 37px 28px stretch;
}

/* ─── Barre de navigation ─────────────────────────────────────────────── */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 200;
  height: 60px; padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: rgba(5, 7, 15, .9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(123, 180, 207, .16);
}
.nav-logo {
  display: flex; align-items: center; gap: .6rem; min-height: 44px;
  font: 700 .95rem var(--fh); letter-spacing: .04em; text-decoration: none;
}
.nav-logo { min-width: 44px; }
.nav-logo img { width: 30px; height: 30px; border-radius: 4px; }
.nav-links { display: flex; align-items: center; gap: .25rem; }
.nav-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .7rem;
  color: var(--ink-2); font-size: .9rem; text-decoration: none;
  transition: color .2s;
}
.nav-links a:hover { color: var(--ink); }
.nav-links .nav-lang {
  font: 700 .8rem var(--fh); letter-spacing: .08em; color: var(--ink);
  border: 1px solid rgba(123, 180, 207, .35); border-radius: 4px;
  min-height: 44px; min-width: 44px; justify-content: center; margin-left: .35rem;
}
@media (max-width: 420px) {
  .nav-logo span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ─── Hero : la planète qui se terraforme ─────────────────────────────── */
.hero {
  position: relative; isolation: isolate;
  min-height: min(100svh, 980px);
  padding: 68px var(--gutter) 3rem;
  display: grid; align-content: start; justify-items: center; gap: 1rem;
  background:
    linear-gradient(to bottom, rgba(5, 7, 15, .35), rgba(5, 7, 15, .2) 45%, var(--space) 100%),
    url('bg_home.jpg') center top / cover no-repeat;
}
#starfield { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }

.stage { width: min(100%, 420px); display: grid; gap: .5rem; justify-items: center; }
.planet {
  width: min(58vw, 300px); aspect-ratio: 1; position: relative;
}
.planet canvas { width: 100%; height: 100%; display: block; }
.planet-fallback {
  position: absolute; inset: 12%; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #8a6a4a, #3b2a1d 60%, #120c08);
}
.planet.is-live .planet-fallback { display: none; }

/* Rail des phases : les jauges du jeu, une par phase. */
.rail { width: 100%; display: grid; gap: .4rem; justify-items: center; padding: .1rem .2rem 0; }
.rail-head {   /* tag_frame du jeu : 540×264, tranche 110/90/109/90, ici à 1/8 */
  display: flex; justify-content: center; align-items: baseline; gap: .6rem;
  min-width: 15rem; padding: 0 .6rem;
  border: solid transparent; border-width: 14px 11px;
  border-image: url('ui/tag_frame_current.webp') 55 45 54 fill / 14px 11px stretch;
  font: 700 .8rem/1.2 var(--fh); letter-spacing: .12em; text-transform: uppercase;
}
.rail[data-state="dead"] .rail-head { border-image-source: url('ui/tag_frame_locked.webp'); }
.rail[data-state="done"] .rail-head { border-image-source: url('ui/tag_frame_completed.webp'); }
.rail-step { color: var(--ink-2); font-weight: 400; }
.rail-top { display: flex; align-items: center; justify-content: center; gap: .5rem; }
.rail-toggle {
  width: 44px; height: 44px; display: grid; place-items: center; flex: none;
  color: var(--ink-2); border: 1px solid rgba(123, 180, 207, .35); border-radius: 4px;
  background: rgba(5, 7, 15, .7);
}
.rail-toggle[hidden] { display: none; }
.rail-toggle:hover { color: var(--ink); border-color: var(--ph-atmo); }
.rail-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.rail-toggle[data-playing="true"] .ico-play,
.rail-toggle[data-playing="false"] .ico-pause { display: none; }
.rail-hint { font-size: .85rem; color: var(--ink-2); text-align: center; margin-top: -.45rem; padding: 0 .6rem; background: radial-gradient(closest-side, rgba(5, 7, 15, .8) 40%, rgba(5, 7, 15, 0)); }
.lbl-f { display: none; }
@media (min-width: 900px) { .lbl-s { display: none; } .lbl-f { display: inline; } }
.rail-name { color: var(--rail-ink, var(--ink)); transition: color .4s; }
.rail-bars { width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; list-style: none;
  padding: 12px 22px;
  background: radial-gradient(closest-side, rgba(5, 7, 15, .9) 50%, rgba(5, 7, 15, 0)); }
.rail-bars button {
  width: 100%; min-height: 44px; display: grid; align-content: center; gap: 6px;
  padding: 0 2px;
}
.gauge {
  display: block; height: 8px; border-radius: 2px; overflow: hidden;
  background: rgba(14, 22, 40, .9);
  box-shadow: inset 0 0 0 1px rgba(174, 187, 218, .18);
}
.gauge i {
  display: block; height: 100%; width: calc(var(--fill, 0) * 100%);
  background: var(--c);
}
.rail-bars .lbl {
  font: 500 .85rem var(--fb); color: var(--ink-2); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .3s;
}
.rail-bars button:hover .lbl,
.rail-bars button[aria-current="step"] .lbl { color: var(--ink); }
.ph-atmo  { --c: var(--ph-atmo);  --c-ink: var(--ph-atmo); }
.ph-temp  { --c: var(--ph-temp);  --c-ink: var(--ph-temp); }
.ph-water { --c: var(--ph-water); --c-ink: var(--ph-water-ink); }
.ph-bio   { --c: var(--ph-bio);   --c-ink: var(--ph-bio); }
.ph-civ   { --c: var(--ph-civ);   --c-ink: var(--ph-civ); }

.pitch { display: grid; gap: .7rem; justify-items: center; text-align: center; max-width: 34rem; }
.pitch h1 { line-height: 0; }
.pitch h1 img { width: min(250px, 64vw); height: auto; }
.tagline { font-size: clamp(1.05rem, 3.6vw, 1.3rem); line-height: 1.45; color: var(--ink); text-wrap: balance; }
.lede { color: var(--ink-2); max-width: 30rem; text-wrap: pretty; }
.promise {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.1rem;
  list-style: none; font-weight: 500; font-size: .95rem; color: var(--ink);
}
.promise li { display: inline-flex; align-items: center; gap: .45rem; }
.promise li::before {
  content: ''; width: 7px; height: 7px; transform: rotate(45deg);
  background: var(--ph-bio);
}

.status {
  width: min(100%, 26rem);
  display: grid; gap: .35rem; text-align: center;
  padding: .35rem .4rem .2rem;
}
.status-title { font: 700 .82rem var(--fh); letter-spacing: .14em; text-transform: uppercase; color: var(--orange); }
.status p { color: var(--ink); }
.platforms { display: flex; justify-content: center; gap: 1.1rem; list-style: none; color: var(--ink-2); font-size: .9rem; }
.platforms li { display: inline-flex; align-items: center; gap: .4rem; }
.platforms svg { width: 16px; height: 16px; fill: currentColor; flex: none; }

.hero-more {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .4rem;
  color: var(--ink-2); text-decoration: none; font-size: .95rem;
  border-bottom: 1px solid rgba(174, 187, 218, .3);
}
.hero-more:hover { color: var(--ink); border-bottom-color: var(--ink); }
.hero-more svg { width: 14px; height: 14px; fill: currentColor; }

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-content: center; align-items: center; justify-items: stretch; gap: clamp(2rem, 5vw, 5rem);
    padding-top: 84px; padding-bottom: 3.5rem;
    max-width: none;
    padding-inline: max(var(--gutter), calc((100vw - var(--max)) / 2));
  }
  .stage { justify-self: center; width: min(100%, 560px); }
  .planet { width: min(100%, 540px); }
  .pitch { justify-items: start; text-align: left; gap: 1.1rem; }
  .pitch h1 img { width: min(330px, 76vw); }
  .promise, .platforms { justify-content: flex-start; }
  .status { text-align: left; }
}

/* ─── Sections ────────────────────────────────────────────────────────── */
.section { padding: clamp(4rem, 9vw, 7rem) var(--gutter); }
.wrap { max-width: var(--max); margin: 0 auto; }
.section h2 {
  font: 700 clamp(1.45rem, 4.4vw, 2.3rem)/1.2 var(--fh); letter-spacing: .02em;
  text-wrap: balance; margin-bottom: .8rem;
}
.section-sub { color: var(--ink-2); max-width: 38rem; margin-bottom: 2.6rem; text-wrap: pretty; font-size: 1.05rem; }

/* Phases : une piste de progression, pas une grille de cartes. */
.phases { background: linear-gradient(var(--space), rgba(5, 7, 15, .8) 22%, rgba(5, 7, 15, .86) 70%, var(--space)), url('bg_campaign.jpg') center / cover no-repeat; }
.track { list-style: none; display: grid; gap: 0; counter-reset: ph; }
.track li {
  position: relative; display: grid; align-content: start; grid-template-columns: 2.25rem 1fr; column-gap: 1rem;
  padding-bottom: 1.8rem;
}
.track li::before {   /* nœud */
  content: ''; grid-row: 1 / span 2; justify-self: center; margin-top: .35rem;
  width: 14px; height: 14px; transform: rotate(45deg);
  background: var(--c); outline: 4px solid var(--space);
  position: relative; z-index: 1;
}
.track li::after {    /* liaison vers la phase suivante */
  content: ''; position: absolute; left: calc(1.125rem - 1px); top: 1.3rem; bottom: -.2rem; width: 2px;
  background: linear-gradient(var(--c), var(--c-next, var(--c)));
  opacity: .55;
}
.track li:last-child::after { display: none; }
.track h3 { font: 700 1.05rem/1.4 var(--fh); letter-spacing: .04em; color: var(--c-ink); margin-bottom: .2rem; }
.track p { grid-column: 2; color: var(--ink-2); max-width: 36rem; text-wrap: pretty; }
.track .ph-atmo  { --c-next: var(--ph-temp); }
.track .ph-temp  { --c-next: var(--ph-water); }
.track .ph-water { --c-next: var(--ph-bio); }
.track .ph-bio   { --c-next: var(--ph-civ); }
@media (min-width: 900px) {
  .track { grid-template-columns: repeat(5, 1fr); column-gap: 1.5rem; }
  .track li { grid-template-columns: 1fr; padding: 0; row-gap: .7rem; }
  .track li::before { grid-row: auto; justify-self: start; margin: 0 0 .4rem 3px; }
  .track li::after { left: 26px; right: -1.5rem; top: calc(.35rem + 6px); bottom: auto; width: auto; height: 2px;
    background: linear-gradient(90deg, var(--c), var(--c-next, var(--c))); }
  .track p { grid-column: 1; font-size: .95rem; }
}

/* Vesper dans le jeu : la même progression, en vraies captures. */
.proof { margin-top: clamp(2.5rem, 6vw, 4rem); display: grid; gap: 1rem; }
.proof h3 { font: 700 1rem var(--fh); letter-spacing: .03em; }
.proof ol { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; max-width: 46rem; }
.proof li { display: grid; gap: .5rem; justify-items: center; text-align: center; font-size: .85rem; color: var(--ink-2); line-height: 1.35; }
.proof img { width: 100%; height: auto; max-width: 150px; }

/* Dans le jeu : vraies captures. */
.shots {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(72vw, 260px); gap: 1.25rem;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: .5rem var(--gutter) 1.5rem;
  margin-inline: calc(var(--gutter) * -1);
  list-style: none; scrollbar-width: thin;
}
.shots li { scroll-snap-align: center; display: grid; gap: .85rem; align-content: start; }
.shots figure { display: contents; }
.shot-frame { display: block; }
.shots img { width: 100%; height: auto; border-radius: 3px; }
.shots figcaption { display: grid; gap: .2rem; }
.shots figcaption strong { font: 700 .95rem var(--fh); letter-spacing: .03em; }
.shots figcaption span { color: var(--ink-2); font-size: .95rem; }
@media (min-width: 1100px) {
  .shots { grid-auto-flow: row; grid-template-columns: repeat(var(--n, 4), 1fr); overflow: visible; margin: 0; padding: 0; }
}

/* Systèmes : une console unique, icônes = monnaies du jeu. */
.systems { padding: clamp(1rem, 3vw, 2rem) clamp(.5rem, 2vw, 1.5rem) clamp(.5rem, 2vw, 1rem); }
.systems ul { list-style: none; display: grid; gap: 1.6rem 2.5rem; }
.systems li { display: grid; grid-template-columns: 56px 1fr; gap: 1rem; align-items: start; }
.systems img { width: 56px; height: 56px; }
.systems h3 { font: 700 1rem var(--fh); letter-spacing: .03em; margin-bottom: .25rem; }
.systems p { color: var(--ink-2); text-wrap: pretty; }
@media (min-width: 760px) { .systems ul { grid-template-columns: 1fr 1fr; } }

/* Commandants : l'équipage, avec leurs vrais noms et effets. */
.crew { background: linear-gradient(var(--space), rgba(5, 7, 15, .86) 22%, rgba(5, 7, 15, .9) 70%, var(--space)), url('bg_tech.jpg') center / cover no-repeat; }
.roster { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.cmd { display: grid; gap: .7rem; align-content: start; }
.cmd img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; object-position: 50% 18%; border-radius: 4px; border: 2px solid var(--epic); }
.cmd-legend img { border-color: var(--legendary); }
.cmd-name { font: 700 .95rem/1.3 var(--fh); letter-spacing: .02em; }
.cmd-title { color: var(--ink-2); font-size: .9rem; }
.cmd-meta { display: flex; flex-wrap: wrap; gap: .35rem .7rem; font-size: .85rem; font-weight: 500; }
.cmd-rarity { color: var(--epic-ink); }
.cmd-phase { color: var(--c-ink); }
.cmd-effect { color: var(--ink); font-size: .92rem; }
.cmd-legend .cmd-rarity { color: var(--legendary); }
.cmd-legend { grid-column: 1 / -1; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); column-gap: 1rem; }
.cmd-legend img { grid-row: 1 / span 6; aspect-ratio: 3 / 4; align-self: start; }
.cmd-legend > :not(img) { grid-column: 2; }
.cmd-legend, .roster > li:last-child:nth-child(even) { grid-template-rows: repeat(5, auto) 1fr; }
.roster > li:last-child:nth-child(even) { grid-column: 1 / -1; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); column-gap: 1rem; }
.roster > li:last-child:nth-child(even) img { grid-row: 1 / span 6; align-self: start; }
.roster > li:last-child:nth-child(even) > :not(img) { grid-column: 2; }

.cmd-legend .cmd-name { font-size: 1.15rem; color: var(--legendary); }
@media (min-width: 900px) {
  .roster { grid-template-columns: 1.5fr repeat(5, minmax(0, 1fr)); align-items: start; }
  .cmd img { aspect-ratio: 3 / 4; object-position: 50% 30%; }
  .cmd-legend, .roster > li:last-child:nth-child(even) { grid-column: auto; grid-template-columns: 1fr; }
  .cmd-legend img, .roster > li:last-child:nth-child(even) img { grid-row: auto; }
  .cmd-legend > :not(img), .roster > li:last-child:nth-child(even) > :not(img) { grid-column: auto; }
  .cmd-legend, .roster > li:last-child:nth-child(even) { grid-template-rows: none; }
}

/* Sortie + engagements. */
.launch { background: linear-gradient(var(--space), rgba(5, 7, 15, .8) 30%, rgba(5, 7, 15, .86) 75%, var(--space)), url('bg_galactic.jpg') center / cover no-repeat; }
.launch-panel { max-width: 46rem; margin: 0 auto; padding: clamp(.6rem, 2vw, 1.4rem) clamp(.4rem, 2vw, 1.2rem); display: grid; gap: 1.1rem; }
.launch-panel h2 { margin: 0; }
.launch-panel p { color: var(--ink-2); text-wrap: pretty; }
.commitments { list-style: none; display: grid; gap: .8rem; }
.commitments li { display: grid; grid-template-columns: 22px 1fr; gap: .7rem; color: var(--ink); text-wrap: pretty; }
.commitments li::before {
  content: ''; width: 8px; height: 8px; margin: .55rem 0 0 5px; transform: rotate(45deg);
  background: var(--ph-bio);
}
.legal { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.legal a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--ink); text-underline-offset: 4px; text-decoration-color: rgba(0, 229, 255, .5);
}
.legal a:hover { text-decoration-color: var(--cyan); }

.footer {
  padding: 1.5rem var(--gutter) 2rem; border-top: 1px solid rgba(123, 180, 207, .12);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1.5rem;
  color: var(--ink-3); font-size: .9rem; max-width: var(--max); margin: 0 auto;
}
.footer nav { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--ink); }
