/* ==========================================================================
   Nytotik — design system
   Thème sombre : fond #0d1117, accent bleu #58a6ff.
   ========================================================================== */

:root {
  /* Couleurs */
  --paper: #0d1117;
  --paper-2: #11161d;
  --surface: #161b22;
  --surface-2: #1c2128;
  --panel: #101a2a;
  --ink: #f0f6fc;
  --ink-2: #b1bac4;
  --muted: #8b949e;
  --line: rgba(240, 246, 252, 0.09);
  --line-strong: rgba(240, 246, 252, 0.18);

  /* Accent : texte (--brand) et aplats de boutons (--accent-solid) */
  --brand: #58a6ff;
  --brand-ink: #79b8ff;
  --accent-solid: #1f6feb;
  --accent-solid-hover: #388bfd;
  --sky: #58a6ff;
  --sky-soft: rgba(88, 166, 255, 0.12);

  --night: #090c10;
  --night-line: rgba(240, 246, 252, 0.08);
  --night-text: #9da7b3;

  --success: #3fb950;
  --success-soft: rgba(63, 185, 80, 0.14);
  --danger: #f85149;
  --danger-soft: rgba(248, 81, 73, 0.12);

  --accent-gradient: linear-gradient(135deg, #58a6ff, #1f6feb);

  /* Typographie */
  --font-display: 'Bricolage Grotesque Variable', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter Variable', 'Segoe UI', system-ui, sans-serif;

  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.45vw, 1.4rem);
  --step-2: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);
  --step-3: clamp(2rem, 1.6rem + 1.9vw, 3rem);
  --step-4: clamp(2.6rem, 1.8rem + 3.8vw, 4.9rem);

  /* Espacements & formes */
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section: clamp(4.5rem, 9vw, 8rem);
  --container: 1180px;
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 16px 36px -14px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.25), 0 34px 70px -24px rgba(0, 0, 0, 0.8);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 72px;

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: var(--header-h);
}

/* Menu mobile ouvert : la page derrière ne défile plus */
html.menu-open {
  overflow: hidden;
}

/* Pas de délai ni de zoom au double-tap sur les contrôles */
a,
button,
summary,
label,
input,
textarea,
[role='tab'] {
  touch-action: manipulation;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  /* Transition entre les pages (navigateurs récents, ignoré ailleurs) :
     l'ancienne page s'efface en reculant, la nouvelle monte en se défloutant.
     L'en-tête reste en place pendant le changement. */
  @view-transition {
    navigation: auto;
  }

  .site-header {
    view-transition-name: site-header;
  }

  ::view-transition-old(root) {
    animation: page-out 0.2s ease both;
  }

  ::view-transition-new(root) {
    animation: page-in 0.35s var(--ease) 0.05s both;
  }

  @keyframes page-out {
    to {
      opacity: 0;
    }
  }

  @keyframes page-in {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
  }
}

body {
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul[role='list'],
ol[role='list'] {
  list-style: none;
  padding: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
  font-variation-settings: 'wdth' 92;
}

p {
  text-wrap: pretty;
}

strong {
  font-weight: 650;
  color: var(--ink);
}

::selection {
  background: var(--sky);
  color: #fff;
}

:focus-visible {
  outline: 2.5px solid var(--sky);
  outline-offset: 3px;
  border-radius: 6px;
}

.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;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--accent-solid);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 1rem;
}

/* --------------------------------------------------------------------------
   Mise en page
   -------------------------------------------------------------------------- */

/* Marges latérales : jamais sous l'encoche d'un téléphone en mode paysage (safe-area) */
.container,
.container-narrow {
  width: 100%;
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.container {
  max-width: calc(var(--container) + 2 * var(--gutter));
}

.container-narrow {
  max-width: calc(820px + 2 * var(--gutter));
}

.section {
  padding-block: var(--section);
}

.section-alt {
  background: var(--surface);
  border-block: 1px solid var(--line);
}

/* Téléphone en paysage : écran très bas, on resserre les espaces et on abandonne le « plein écran » */
@media (max-height: 520px) and (orientation: landscape) {
  :root {
    --section: 3rem;
    --header-h: 60px;
  }

  .screen {
    min-height: auto;
  }
}

/* Section ciblée par un lien d'ancre : elle remplit tout l'écran sous l'en-tête,
   sans laisser dépasser un bout de la section précédente. */
.screen {
  min-height: calc(100svh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(2.5rem, 7svh, 5rem);
}

/* En-têtes de section */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.eyebrow::before {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--sky-soft);
}

.section-head {
  display: grid;
  gap: 1rem;
  max-width: 720px;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-head.center {
  margin-inline: auto;
  text-align: center;
  justify-items: center;
}

.section-head h2 {
  font-size: var(--step-3);
}

.section-head p {
  color: var(--ink-2);
  font-size: var(--step-1);
  line-height: 1.5;
}

/* Mot mis en avant dans un titre */
.accent-text {
  color: var(--brand);
}

/* --------------------------------------------------------------------------
   Boutons
   -------------------------------------------------------------------------- */

.btn {
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3.1rem;
  padding: 0.8rem 1.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.2;
  white-space: nowrap;
  transition:
    transform 0.25s var(--ease),
    box-shadow 0.25s var(--ease),
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.btn svg {
  width: 1.1em;
  height: 1.1em;
  transition: transform 0.25s var(--ease);
}

/* Effets de survol uniquement avec une souris : sur écran tactile ils restent « collés » après le toucher */
@media (hover: hover) {
  .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px -10px rgba(31, 111, 235, 0.55);
  }

  .btn:hover svg {
    transform: translateX(3px);
  }
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  --btn-bg: var(--accent-solid);
}

.btn-primary:hover {
  --btn-bg: var(--accent-solid-hover);
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  --btn-bg: var(--surface);
  border-color: var(--ink);
  box-shadow: none;
}

.btn-light {
  --btn-bg: #f0f6fc;
  --btn-fg: #0d1117;
}

.btn-block {
  width: 100%;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  font-weight: 600;
  color: var(--brand);
}

.link-arrow svg {
  width: 1.05em;
  height: 1.05em;
  transition: transform 0.25s var(--ease);
}

.link-arrow:hover svg {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Cartes & éléments récurrents
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.icon-tile {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  background: var(--sky-soft);
  color: var(--brand);
  flex-shrink: 0;
}

.icon-tile svg {
  width: 1.45rem;
  height: 1.45rem;
}

.check-list {
  display: grid;
  gap: 0.65rem;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0.7rem;
  align-items: start;
  color: var(--ink-2);
  font-size: 0.97rem;
  line-height: 1.5;
}

.check-list svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.1rem;
  padding: 0.2rem;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  stroke-width: 3;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--ink-2);
}

.dot-live {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* Fond quadrillé discret */
.grid-bg {
  background-image:
    linear-gradient(to right, rgba(88, 166, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(88, 166, 255, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
}

/* --------------------------------------------------------------------------
   Apparition au défilement
   -------------------------------------------------------------------------- */

/* États de départ : Motion (src/scripts/motion.ts) les anime vers leur place finale */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal],
  .js .hero-copy > *,
  .js .page-hero .copy > *,
  .js .hero-visual,
  .js .page-hero .panel {
    opacity: 0;
  }
}

/* Barre de progression de lecture */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 300;
  height: 3px;
  background: var(--accent-gradient);
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.7);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
