/* ==========================================================================
   Planner Winter Arc — base commune (landing + app)
   Tokens et règles : brand-os/instructions.md §2 et §3
   ========================================================================== */

/* Polices hébergées sur le site (pas d'appel à Google : plus rapide, plus respectueux des visiteurs) */
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../polices/inter-tight-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../polices/inter-tight-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../polices/instrument-serif-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../polices/instrument-serif-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Fonds */
  --nuit: #060912;
  --nuit-2: #0B1120;
  --nuit-3: #121A2E;
  /* Textes */
  --givre: #EEF4FF;
  --brume: #9AA7BD;
  --ombre: #5E6A82;
  /* Accents */
  --glacier: #8CD8FF;
  --aurore: #B9A3FF;
  --braise: #FFB38A;
  /* États */
  --succes: #7EE6B8;
  --alerte: #FFD48A;
  --erreur: #FF8A9B;
  /* Dégradé signature */
  --aurore-grad: linear-gradient(120deg, #8CD8FF 0%, #B9A3FF 55%, #FFB38A 100%);
  --sur-accent: #060912;

  /* Verre */
  --verre-1: rgba(255, 255, 255, 0.08);
  --verre-2: rgba(255, 255, 255, 0.03);
  --verre-bord: rgba(255, 255, 255, 0.10);
  --verre-reflet: rgba(255, 255, 255, 0.14);
  --portee: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
  --plein: rgba(18, 26, 46, 0.92);
  --trait: rgba(255, 255, 255, 0.08);
  --survol: rgba(255, 255, 255, 0.06);

  /* Ciel */
  --halo-1: #8CD8FF;
  --halo-2: #B9A3FF;
  --halo-3: #FFB38A;
  --halo-force: 0.5;
  --ciel-haut: #0E1A33;

  /* Formes et mouvement */
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* Typo */
  --police: 'Inter Tight', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;

  color-scheme: dark;
}

/* Thèmes Premium ---------------------------------------------------------- */
[data-theme="aurore"] {
  --halo-1: #7FB6FF;
  --halo-2: #C49BFF;
  --halo-3: #7EE6B8;
  --halo-force: 0.7;
  --ciel-haut: #160F33;
}
[data-theme="braise"] {
  --glacier: #FFC59E;
  --halo-1: #FFB38A;
  --halo-2: #FF8A9B;
  --halo-3: #B9A3FF;
  --halo-force: 0.5;
  --ciel-haut: #2A1420;
}
[data-theme="neige"] {
  color-scheme: light;
  --nuit: #F4F7FC;
  --nuit-2: #EAF0F9;
  --nuit-3: #FFFFFF;
  --givre: #0B1120;
  --brume: #4A5670;
  --ombre: #6E7A92;
  --glacier: #1F7FB8;
  --aurore: #6E52D9;
  --braise: #D9713D;
  --succes: #138A5E;
  --alerte: #A86A00;
  --erreur: #C9364F;
  --aurore-grad: linear-gradient(120deg, #1F7FB8 0%, #6E52D9 55%, #D9713D 100%);
  --sur-accent: #FFFFFF;
  --verre-1: rgba(255, 255, 255, 0.78);
  --verre-2: rgba(255, 255, 255, 0.52);
  --verre-bord: rgba(11, 17, 32, 0.08);
  --verre-reflet: rgba(255, 255, 255, 0.9);
  --portee: 0 24px 60px -24px rgba(30, 50, 90, 0.28);
  --plein: rgba(255, 255, 255, 0.94);
  --trait: rgba(11, 17, 32, 0.08);
  --survol: rgba(11, 17, 32, 0.04);
  --halo-1: #9CDCFF;
  --halo-2: #CDBDFF;
  --halo-3: #FFD2B8;
  --halo-force: 0.55;
  --ciel-haut: #E3ECFA;
}

/* Reset ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--nuit);
  color: var(--givre);
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-feature-settings: "ss01", "cv11";
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; }
p { text-wrap: pretty; }
::selection { background: color-mix(in srgb, var(--glacier) 35%, transparent); }

:focus-visible {
  outline: 2px solid var(--glacier);
  outline-offset: 3px;
  border-radius: 8px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Typo ------------------------------------------------------------------- */
.serif {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.grad {
  background: var(--aurore-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.06em; /* l'italique déborde */
}
.chiffre { font-variant-numeric: tabular-nums; }
.surtitre {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--glacier);
}
.discret { color: var(--brume); }

/* Ciel : aurore + grain --------------------------------------------------- */
.ciel {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(120% 80% at 50% -10%, var(--ciel-haut) 0%, var(--nuit) 62%);
  transition: background .6s var(--ease);
}
.halo {
  position: absolute;
  border-radius: 50%;
  opacity: var(--halo-force);
  will-change: transform;
  transition: opacity .6s var(--ease);
}
.halo-1 {
  width: 70vmax; height: 70vmax; left: -22vmax; top: -34vmax;
  background: radial-gradient(circle, color-mix(in srgb, var(--halo-1) 55%, transparent) 0%, transparent 62%);
  animation: derive-1 48s ease-in-out infinite alternate;
}
.halo-2 {
  width: 60vmax; height: 60vmax; right: -20vmax; top: -18vmax;
  background: radial-gradient(circle, color-mix(in srgb, var(--halo-2) 50%, transparent) 0%, transparent 62%);
  animation: derive-2 56s ease-in-out infinite alternate;
}
.halo-3 {
  width: 46vmax; height: 46vmax; left: 30vw; bottom: -30vmax;
  background: radial-gradient(circle, color-mix(in srgb, var(--halo-3) 30%, transparent) 0%, transparent 62%);
  animation: derive-3 40s ease-in-out infinite alternate;
}
@keyframes derive-1 { to { transform: translate3d(14vmax, 10vmax, 0) scale(1.12); } }
@keyframes derive-2 { to { transform: translate3d(-12vmax, 14vmax, 0) scale(0.92); } }
@keyframes derive-3 { to { transform: translate3d(-16vmax, -8vmax, 0) scale(1.18); } }

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  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");
}
[data-theme="neige"] .grain { opacity: 0.05; mix-blend-mode: multiply; }

/* Verre ------------------------------------------------------------------ */
.verre {
  position: relative;
  background: linear-gradient(180deg, var(--verre-1), var(--verre-2));
  border: 1px solid var(--verre-bord);
  box-shadow: inset 0 1px 0 var(--verre-reflet), var(--portee);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  border-radius: var(--r-lg);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .verre { background: var(--plein); }
}

/* Reflet qui suit la souris (fx.js pose --mx / --my) */
.lueur { isolation: isolate; }
.lueur::before,
.lueur::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s var(--ease);
}
.lueur::before {
  z-index: -1;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--glacier) 13%, transparent), transparent 45%);
}
.lueur::after {
  inset: -1px;
  padding: 1px;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--glacier) 70%, transparent), transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
@media (hover: hover) and (pointer: fine) {
  .lueur:hover::before,
  .lueur:hover::after { opacity: 1; }
}

[data-tilt] {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s var(--ease-out);
  transform-style: preserve-3d;
}

/* Logo ------------------------------------------------------------------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: 17px;
}
.logo svg { width: 28px; height: 28px; flex: none; }
.logo .serif { font-size: 19px; }

/* Boutons ---------------------------------------------------------------- */
.btn {
  --h: 48px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--h);
  padding: 0 22px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform .16s var(--ease), box-shadow .24s var(--ease), background-color .16s var(--ease), border-color .16s var(--ease), opacity .16s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn-petit { --h: 40px; padding: 0 14px; font-size: 14px; border-radius: var(--r-sm); }
.btn-primaire {
  background: var(--glacier);
  color: var(--sur-accent);
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--glacier) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.45);
}
.btn-premium {
  background: var(--aurore-grad);
  color: #0A0E1A;
  box-shadow: 0 12px 34px -12px color-mix(in srgb, var(--aurore) 80%, transparent), inset 0 1px 0 rgba(255,255,255,.5);
}
[data-theme="neige"] .btn-premium { color: #fff; }
/* Reflet qui balaie au survol */
.btn-primaire::after,
.btn-premium::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform .7s var(--ease-out);
}
@media (hover: hover) {
  .btn-primaire:hover, .btn-premium:hover { transform: translateY(-1px); }
  .btn-primaire:hover::after, .btn-premium:hover::after { transform: translateX(120%); }
}
.btn-verre {
  background: linear-gradient(180deg, var(--verre-1), var(--verre-2));
  border-color: var(--verre-bord);
  box-shadow: inset 0 1px 0 var(--verre-reflet);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.btn-verre:hover { border-color: color-mix(in srgb, var(--glacier) 40%, var(--verre-bord)); }
.btn-fantome { background: transparent; color: var(--brume); }
.btn-fantome:hover { color: var(--givre); background: var(--survol); }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* Pastilles / badges ----------------------------------------------------- */
.pastille {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--brume);
  background: linear-gradient(180deg, var(--verre-1), var(--verre-2));
  border: 1px solid var(--verre-bord);
  box-shadow: inset 0 1px 0 var(--verre-reflet);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.pastille svg { width: 16px; height: 16px; color: var(--glacier); }
.point-vivant {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--succes);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--succes) 60%, transparent);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.badge-sommet {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--aurore);
  background: color-mix(in srgb, var(--aurore) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--aurore) 30%, transparent);
}
.badge-sommet svg { width: 12px; height: 12px; }

/* Apparition au scroll --------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  filter: blur(6px);
  transition:
    opacity .6s var(--ease-out),
    transform .6s var(--ease-out),
    filter .6s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 60ms);
}
.js [data-reveal].visible { opacity: 1; transform: none; filter: none; }

/* Anneaux et jauges ------------------------------------------------------ */
.anneau-prog, .jauge-prog {
  transition: stroke-dashoffset 1.1s var(--ease-out);
}

.jauge { width: 100%; height: auto; overflow: visible; }
.jauge-point { transform-box: fill-box; transform-origin: center; }
.jauge-point--anim { transform: scale(0); animation: pop .5s 1s var(--ease-out) forwards; }
@keyframes pop { to { transform: scale(1); } }
.courbe { width: 100%; height: 100%; overflow: visible; }

/* Givre (petite gerbe à la validation) */
.givre-particule {
  position: fixed;
  width: 6px; height: 6px;
  pointer-events: none;
  z-index: 999;
  background: var(--glacier);
  border-radius: 1px;
  box-shadow: 0 0 8px var(--glacier);
  animation: givre .65s var(--ease-out) forwards;
}
@keyframes givre {
  from { transform: translate(-50%, -50%) rotate(45deg) scale(1); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(225deg) scale(.2); opacity: 0; }
}

/* Mouvement réduit ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; filter: none; }
  [data-tilt] { transform: none !important; }
}
