/* Thywan — site d'accueil.
 * Toutes les couleurs sont ici : changer de thème = changer ces valeurs. */

/* Noir (thème principal) */
:root {
  --bg: #000000;
  --panel: #0c0c0d;
  --panel-2: #151517;
  --line: #222225;
  --line-2: #34343a;
  --text: #ededef;
  --muted: #8d8d94;
  --faint: #5c5c63;
  --accent: #ffffff;        /* couleur des survols et du signe */
  --accent-ink: #000000;    /* texte posé sur l'accent */
  --accent-2: #8d8d94;      /* seconde teinte (dégradés, lueurs) */
  --glow: rgba(255, 255, 255, .07);
  --shadow: rgba(0, 0, 0, .75);
  --ok: #1fc77e;
  --danger: #f2545b;
  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

/* Halloween : noir, rouge bordeaux et orange citrouille (mêmes couleurs que le terminal) */
:root[data-theme="halloween"] {
  --bg: #0b0405;
  --panel: #160809;
  --panel-2: #210d10;
  --line: #3a1419;
  --line-2: #5a1e27;
  --text: #f4e7e4;
  --muted: #b78c8a;
  --faint: #7c5552;
  --accent: #ff7a1a;
  --accent-ink: #160809;
  --accent-2: #800020;
  --glow: rgba(255, 122, 26, .12);
  --shadow: rgba(0, 0, 0, .8);
  --ok: #ff9a3c;
  --danger: #e0314f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s, color .4s;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ── En-tête ────────────────────────────────────────────────── */
.entete {
  position: sticky; top: 0; z-index: 50;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.marque { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; justify-self: start; }
/* Le logo TY : sa forme sert de masque, la couleur vient du thème */
.marque-signe {
  width: 54px; height: 30px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--text) 20%, color-mix(in srgb, var(--text) 45%, var(--bg)));
  -webkit-mask: url("img/logo-ty.png") center / contain no-repeat;
  mask: url("img/logo-ty.png") center / contain no-repeat;
  transition: background .4s;
}
:root[data-theme="halloween"] .marque-signe { background: linear-gradient(180deg, var(--accent) 30%, color-mix(in srgb, var(--accent) 55%, var(--accent-2))); }
.marque-signe + .marque-nom { padding-left: 12px; border-left: 1px solid var(--line-2); }
.marque-nom { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; }

.nav { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; }
.nav a {
  text-decoration: none; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 6px 14px; border-radius: 999px; transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }

.entete-droite { display: flex; align-items: center; gap: 10px; justify-self: end; }
/* Sur le lien public, pas de lien vers l'admin */
.sans-admin a[href="/admin"] { display: none !important; }

/* La roue des paramètres et son menu */
.reglages { position: relative; }
.reglages-bouton {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; padding: 0;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  transition: color .2s, border-color .2s, background .2s;
}
.reglages-bouton svg { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.reglages-bouton:hover, .reglages-bouton.ouvert { color: var(--text); border-color: var(--line-2); background: var(--panel); }
.reglages-bouton:hover svg, .reglages-bouton.ouvert svg { transform: rotate(60deg); }
.menu-reglages {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 80; min-width: 220px;
  display: grid; gap: 2px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: 0 24px 60px -12px var(--shadow);
  transform-origin: top right; animation: menu-entre .18s cubic-bezier(.2, .7, .2, 1);
}
@keyframes menu-entre { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
.menu-ligne {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 11px;
  background: none; color: var(--text); text-decoration: none; text-align: left; font: 500 14px var(--sans);
}
.menu-ligne:hover, .menu-ligne:focus-visible { background: var(--panel-2); outline: none; }
.menu-ligne > svg:first-child { color: var(--muted); flex-shrink: 0; }
.menu-ligne span { flex: 1; }
.menu-ligne em { font: normal 11px var(--mono); letter-spacing: .04em; color: var(--faint); }
.menu-ligne > svg:last-child { color: var(--faint); }

/* La petite fenêtre du thème */
.fenetre-theme {
  width: min(420px, calc(100vw - 32px)); padding: 0; margin: auto;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 22px;
  box-shadow: 0 40px 120px -30px #000, 0 0 0 6px var(--glow);
}
.fenetre-theme[open] { animation: fenetre-entre .25s cubic-bezier(.2, .7, .2, 1); }
@keyframes fenetre-entre { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.fenetre-theme::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ft-corps { padding: 20px; }
.ft-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.ft-tete h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 18px; text-transform: uppercase; letter-spacing: .02em; }
.ft-fermer {
  width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--muted); font-size: 12px;
}
.ft-fermer:hover { color: var(--text); }
.ft-choix { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ft-option {
  display: grid; align-content: start; gap: 2px; padding: 8px 8px 12px; text-align: left;
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.ft-option:hover { border-color: var(--line-2); transform: translateY(-2px); }
.ft-option.actif { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ft-option b { margin: 8px 4px 0; font-family: var(--display); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.ft-option small { margin: 0 4px; font: 11px var(--mono); color: var(--faint); }
/* Aperçu miniature de chaque thème (ses propres couleurs, quel que soit le thème affiché) */
.ft-apercu { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; border: 1px solid; }
.ft-apercu i { position: absolute; display: block; border-radius: 4px; }
.ft-apercu i:nth-child(1) { left: 10%; top: 14%; width: 28%; height: 9%; border-radius: 999px; }
.ft-apercu i:nth-child(2) { left: 10%; top: 34%; width: 80%; height: 38%; }
.ft-apercu i:nth-child(3) { left: 10%; bottom: 12%; width: 80%; height: 10%; border-radius: 999px; }
.ft-noir { background: #000; border-color: #222225; }
.ft-noir i:nth-child(1) { background: #ededef; }
.ft-noir i:nth-child(2) { background: linear-gradient(160deg, #151517, #0c0c0d); border: 1px solid #34343a; }
.ft-noir i:nth-child(3) { border: 1px solid #ededef; }
.ft-halloween { background: radial-gradient(80% 70% at 70% 30%, #3a1419, #0b0405); border-color: #3a1419; }
.ft-halloween i:nth-child(1) { background: #ff7a1a; }
.ft-halloween i:nth-child(2) { background: linear-gradient(160deg, #210d10, #160809); border: 1px solid #5a1e27; }
.ft-halloween i:nth-child(3) { background: #ff7a1a; }

/* ── Vitrine ────────────────────────────────────────────────── */
.vitrine {
  position: relative;
  height: clamp(560px, 88vh, 900px);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(60% 50% at 70% 40%, var(--glow), transparent 70%),
    radial-gradient(40% 40% at 15% 85%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 70%);
}
/* Grain léger, pour ne pas avoir un noir trop plat */
.vitrine::after {
  content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: .09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vitrine-infos { position: absolute; z-index: 4; top: clamp(24px, 5vh, 48px); left: clamp(16px, 4vw, 40px); max-width: 420px; pointer-events: none; }
.etiquette {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.point { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.accroche { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(18px, 2vw, 24px); line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; }

/* Le nom géant, en contour, derrière les captures */
.geant {
  position: absolute; z-index: 1; left: 0; right: 0; bottom: -0.12em;
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: 16vw; line-height: 1; letter-spacing: -.04em; text-align: center; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px var(--line-2);
  pointer-events: none; user-select: none;
}
.geant span {
  background: linear-gradient(180deg, transparent 30%, color-mix(in srgb, var(--accent-2) 22%, transparent));
  -webkit-background-clip: text; background-clip: text;
}

/* La scène : les fenêtres flottantes */
.scene { position: absolute; inset: 0; z-index: 3; perspective: 1400px; }
.fen-place {
  position: absolute; left: var(--x); top: var(--y); width: var(--w);
  transform: translate3d(calc(var(--mx, 0) * var(--d) * 1px), calc(var(--my, 0) * var(--d) * 1px), 0);
  transition: transform .9s cubic-bezier(.2, .7, .2, 1);
  z-index: var(--z);
}
.fen {
  display: block; text-decoration: none; color: inherit;
  transform: rotate(var(--r)) rotateY(var(--ry, 0deg));
  animation: flotte var(--t) ease-in-out var(--delai) infinite alternate;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), box-shadow .5s, border-color .3s;
  border-radius: 12px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line-2);
  box-shadow: 0 30px 80px -20px var(--shadow), 0 0 0 1px rgba(255, 255, 255, .02);
}
@keyframes flotte {
  from { translate: 0 -10px; }
  to   { translate: 0 12px; }
}
a.fen:hover { transform: rotate(0deg) scale(1.04); border-color: var(--accent); box-shadow: 0 40px 100px -20px var(--shadow), 0 0 0 4px var(--glow); }
.fen-place:has(a.fen:hover) { z-index: 20; }

.fen-barre { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.fen-barre i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.fen-barre i:first-child { background: var(--accent); opacity: .8; }
.fen-adresse { flex: 1; margin-left: 8px; font: 10px/1 var(--mono); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fen-ecran { position: relative; aspect-ratio: 16 / 10; background: var(--bg); overflow: hidden; }
.fen-ecran img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
.fen-legende {
  position: absolute; left: 10px; bottom: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 8px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 999px;
  font: 500 11px/1 var(--mono); letter-spacing: .04em;
}
.fen-legende::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* Écran dessiné quand il n'y a pas encore de capture */
.maquette { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr; padding: 14px; gap: 10px; }
.maquette-haut { display: flex; justify-content: space-between; align-items: baseline; }
.maquette-nom { font-family: var(--display); font-weight: 800; font-size: clamp(14px, 1.6vw, 22px); text-transform: uppercase; letter-spacing: .02em; }
.maquette-chiffre { font: 500 11px var(--mono); color: var(--ok); }
.maquette svg { width: 100%; height: 100%; display: block; }
.maquette .grille { stroke: var(--line); stroke-width: 1; }
.maquette .courbe { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.maquette .aire { fill: var(--accent); opacity: .08; }
.maquette .barre { fill: var(--line-2); }

/* Fenêtre « à venir » */
.fen.vide { background: transparent; border: 1px dashed var(--line-2); box-shadow: none; }
.fen.vide .fen-ecran { background: transparent; display: grid; place-items: center; }
.fen.vide .fen-barre { background: transparent; border-bottom-style: dashed; }
.vide-texte { font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }

/* Braises (thème Halloween uniquement) */
.braises { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: none; }
:root[data-theme="halloween"] .braises { display: block; }
.braise {
  position: absolute; bottom: -10px; width: var(--s); height: var(--s); border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent), 0 0 18px var(--accent-2);
  left: var(--l); opacity: 0;
  animation: monte var(--t) linear var(--delai) infinite;
}
@keyframes monte {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: .9; }
  100% { transform: translate(var(--dx), -95vh); opacity: 0; }
}

/* ── Séparation ─────────────────────────────────────────────── */
.separation {
  position: relative; overflow: hidden;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 0;
}
.defile { display: flex; width: max-content; animation: defile 40s linear infinite; }
.defile span {
  display: inline-flex; align-items: center; gap: 28px; padding-right: 28px;
  font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap;
}
.defile b { color: var(--accent); font-weight: 400; }
@keyframes defile { to { transform: translateX(-50%); } }

/* ── Bulles d'accès ─────────────────────────────────────────── */
.acces { padding: clamp(40px, 7vw, 88px) clamp(16px, 4vw, 40px) clamp(56px, 8vw, 104px); }
.acces-titre { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.acces-titre h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(26px, 4vw, 44px); letter-spacing: -.02em; text-transform: uppercase; }
.acces-titre p { margin: 0; font: 12px var(--mono); color: var(--faint); letter-spacing: .04em; }

.bulles { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bulle {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: clamp(14px, 3vw, 36px);
  min-height: 92px; padding: 16px 16px 16px clamp(22px, 3vw, 36px);
  border: 1px solid var(--line-2); border-radius: 999px;
  text-decoration: none; color: var(--text);
  transition: color .45s cubic-bezier(.6, .1, .2, 1), border-color .3s;
}
.bulle::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--accent);
  clip-path: circle(0% at var(--cx, 0%) 50%);
  transition: clip-path .6s cubic-bezier(.6, .1, .2, 1);
}
a.bulle:hover, a.bulle:focus-visible { color: var(--accent-ink); border-color: var(--accent); }
a.bulle:hover::before, a.bulle:focus-visible::before { clip-path: circle(150% at var(--cx, 0%) 50%); }
.bulle-num { font: 500 12px var(--mono); color: var(--faint); transition: color .45s; }
.bulle-texte { min-width: 0; display: flex; align-items: baseline; gap: clamp(12px, 2.5vw, 32px); }
.bulle-nom { font-family: var(--display); font-weight: 800; font-size: clamp(22px, 3.4vw, 40px); letter-spacing: -.02em; text-transform: uppercase; line-height: 1; white-space: nowrap; }
.bulle-desc { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .45s; }
.bulle-statut {
  font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap;
  transition: color .45s, border-color .45s;
}
.bulle-fleche {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line-2);
  transition: transform .5s cubic-bezier(.6, .1, .2, 1), background .45s, color .45s, border-color .45s;
}
.bulle-fleche svg { width: 22px; height: 22px; }
a.bulle:hover .bulle-num, a.bulle:hover .bulle-desc, a.bulle:hover .bulle-statut { color: var(--accent-ink); }
a.bulle:hover .bulle-statut { border-color: color-mix(in srgb, var(--accent-ink) 35%, transparent); }
a.bulle:hover .bulle-fleche { transform: rotate(-45deg); background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }
.bulle.vide { border-style: dashed; color: var(--faint); }
.bulle.vide .bulle-nom { color: var(--faint); }

/* ── Pied de page ───────────────────────────────────────────── */
.pied {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px clamp(16px, 4vw, 40px);
  border-top: 1px solid var(--line);
  font: 12px var(--mono); color: var(--faint);
}
.pied a { text-decoration: none; }
.pied a:hover { color: var(--text); }

/* ── Petits écrans ──────────────────────────────────────────── */
@media (max-width: 760px) {
  .entete { grid-template-columns: 1fr auto; }
  .nav { display: none; }
  .vitrine { height: clamp(520px, 92vh, 720px); }
  .geant { font-size: 15.5vw; }
  .bulle { grid-template-columns: minmax(0, 1fr) auto; min-height: 76px; padding-left: 24px; }
  .bulle-num, .bulle-statut { display: none; }
  .bulle-texte { flex-direction: column; gap: 6px; }
  .bulle-desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; font-size: 13px; }
  .bulle-fleche { width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
