/* =====================================================================
   Portail CFR Digital — feuille de style unique
   ---------------------------------------------------------------------
   Style « glassmorphism » : panneaux translucides, flou d'arrière-plan,
   bordure claire d'un côté, ombre portée douce. Le fond sombre est
   indispensable : le verre dépoli n'a aucun relief sur fond clair.

   Palette : rouge d'entreprise en accent, gris anthracite translucide
   pour les boutons.
   ===================================================================== */

:root {
  /* --- Couleurs d'entreprise --- */
  --red: #d8232a;          /* rouge principal */
  --red-soft: #ff5a5f;     /* rouge éclairci, pour les dégradés */
  --red-deep: #8f1216;     /* rouge sombre, pour les halos du fond */

  /* --- Fond --- */
  --bg: #14161c;
  --bg-2: #1c1f27;

  /* --- Verre --- */
  --glass: rgba(255, 255, 255, 0.06);
  --glass-hover: rgba(255, 255, 255, 0.10);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shine: rgba(255, 255, 255, 0.30);

  /* --- Boutons gris foncé translucides --- */
  --btn: rgba(38, 41, 50, 0.62);
  --btn-border: rgba(255, 255, 255, 0.16);

  /* --- Texte --- */
  --text: #f2f4f8;
  --muted: #a8adba;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  padding: 64px 24px 40px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  /* léger dégradé de base sous les halos */
  background-image: linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-font-smoothing: antialiased;
}

/* --- Halos colorés du fond ------------------------------------------
   Ce sont eux qui donnent au verre quelque chose à diffracter : sans
   couleur derrière, le flou ne se voit pas.                            */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
}
.glow-a {
  width: 620px; height: 620px;
  top: -180px; left: -120px;
  background: radial-gradient(circle, var(--red) 0%, transparent 68%);
}
.glow-b {
  width: 540px; height: 540px;
  bottom: -200px; right: -120px;
  background: radial-gradient(circle, var(--red-deep) 0%, transparent 70%);
  opacity: 0.65;
}
.glow-c {
  width: 460px; height: 460px;
  top: 45%; left: 52%;
  background: radial-gradient(circle, #3a4256 0%, transparent 70%);
  opacity: 0.5;
}

/* --- En-tête --------------------------------------------------------- */
.head {
  width: 100%;
  max-width: 1080px;
  margin-bottom: 40px;
  text-align: center;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  margin-bottom: 26px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.logo-mark {
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 15px;
  color: var(--red-soft);
}
.logo-word {
  font-weight: 500;
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.head h1 {
  margin: 0 0 12px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);        /* repli : titre lisible sans le dégradé */
}

/* Dégradé blanc → rouge sur le texte, appliqué SEULEMENT si le navigateur
   sait découper un fond selon les glyphes. Sans cette garde, un navigateur
   sans support afficherait un titre entièrement transparent (invisible). */
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .head h1 {
    background: linear-gradient(100deg, #ffffff 30%, var(--red-soft) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.lede {
  margin: 0 auto;
  max-width: 560px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

/* --- Grille de cartes ------------------------------------------------ */
.grid {
  width: 100%;
  max-width: 1080px;
  display: grid;
  /* auto-fit : une carte seule occupe toute la largeur, deux se partagent,
     puis la grille se remplit d'elle-même à mesure qu'on ajoute des blocs */
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

/* --- Carte de service (le « verre ») --------------------------------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  text-decoration: none;
  color: inherit;

  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.34);

  transition: transform 0.22s ease, box-shadow 0.22s ease,
              background 0.22s ease, border-color 0.22s ease;
}

/* Reflet clair sur l'arête supérieure : signature du verre dépoli */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-shine), transparent);
}

a.card:hover {
  transform: translateY(-4px);
  background: var(--glass-hover);
  border-color: rgba(255, 122, 126, 0.45);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.42),
              0 0 0 1px rgba(216, 35, 42, 0.18);
}
a.card:focus-visible {
  outline: 2px solid var(--red-soft);
  outline-offset: 3px;
}

/* --- Zone illustration ----------------------------------------------
   Tant qu'aucune image n'est fournie, on affiche un dégradé rouge avec
   l'initiale du service (attribut data-initial). Dès qu'on renseigne
   la variable --shot, l'image prend le dessus.                          */
.card-shot {
  position: relative;
  height: 168px;
  flex-shrink: 0;
  background-color: #23262f;
  background-image:
    var(--shot, none),
    linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--glass-border);
}
/* Voile sombre : garantit la lisibilité quelle que soit l'image */
.card-shot::after {
  content: attr(data-initial);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 62px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.34);
  background: linear-gradient(180deg, rgba(0,0,0,0.10), rgba(0,0,0,0.42));
}

/* --- Contenu de la carte --------------------------------------------- */
.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 22px 24px 20px;
}

.card-body h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 650;
}

.card-sub {
  margin: 0 0 20px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;   /* colle le pied en bas, cartes alignées entre elles */
}

/* Adresse du service, en petit et en mono pour la lisibilité */
.addr {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--muted);
}

/* --- Bouton gris foncé translucide ----------------------------------- */
.btn {
  flex-shrink: 0;
  padding: 9px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--btn);
  border: 1px solid var(--btn-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s ease, border-color 0.2s ease;
}
a.card:hover .btn {
  background: rgba(216, 35, 42, 0.78);
  border-color: rgba(255, 122, 126, 0.55);
}

.btn-off {
  opacity: 0.5;
  font-weight: 500;
}

/* --- Carte inerte « à venir » ---------------------------------------- */
.card-soon {
  opacity: 0.62;
}
.card-soon .card-shot {
  background-image: linear-gradient(135deg, #4a4f5c 0%, #2a2d36 100%);
}

/* --- Pied de page ----------------------------------------------------- */
.foot {
  margin-top: 48px;
  font-size: 13px;
  color: var(--muted);
  opacity: 0.75;
}

/* --- Adaptations petits écrans ---------------------------------------- */
@media (max-width: 640px) {
  body { padding: 40px 16px 32px; }
  .head h1 { font-size: 30px; }
  .lede { font-size: 15px; }
  .grid { grid-template-columns: 1fr; gap: 18px; }
  .card-shot { height: 140px; }
}

/* Respect du réglage système « animations réduites » */
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  a.card:hover { transform: none; }
}

/* Repli pour les navigateurs sans backdrop-filter (anciens Firefox) :
   on opacifie les panneaux pour garder du contraste. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, .logo { background: rgba(32, 35, 43, 0.92); }
  .btn { background: rgba(38, 41, 50, 0.95); }
}
