/* ==========================================================================
   KSOURI — feuille de style

   Sommaire
   1. Variables (couleurs, typographie, mise en page)
   2. Base (réinitialisation, éléments globaux)
   3. Décor animé (grille, halos, sphère)
   4. Mise en page (.page)
   5. En-tête (.hero)
   6. Horloge (.clock)
   7. Liens (.links, .link-group, .link-list)
   8. Pied de page (.site-footer)
   9. Mouvement réduit

   Nommage : blocs (.hero), éléments (.hero__title), variantes (--violet).
   Le JavaScript s'accroche aux attributs data-*, jamais aux classes :
   on peut donc renommer une classe sans casser un script.
   ========================================================================== */


/* 1. Variables
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Couleurs */
  --color-bg: #07080f;
  --color-text: #e9ecf8;
  --color-text-muted: #8b93b0;
  --color-violet: #8b7bff;
  --color-cyan: #4de1ff;
  --color-rule: rgba(255, 255, 255, 0.1);

  /* Typographie */
  --font-sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Mise en page (le point de rupture mobile/bureau est fixé à 640px,
     les media queries n'acceptent pas les variables CSS) */
  --page-max-width: 900px;
  --page-gutter: 24px;
}


/* 2. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* Garde le contenu à l'écart des barres système sur téléphone */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.5;
}

a:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
}


/* 3. Décor animé
   -------------------------------------------------------------------------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.backdrop__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 20%, #000 0%, transparent 70%);
          mask-image: radial-gradient(ellipse at 30% 20%, #000 0%, transparent 70%);
}

.backdrop__halo {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}

.backdrop__halo--violet {
  top: -30vmax;
  left: -20vmax;
  width: 70vmax;
  height: 70vmax;
  background: radial-gradient(closest-side, rgba(139, 123, 255, 0.42), transparent);
  animation: drift-violet 22s ease-in-out infinite alternate;
}

.backdrop__halo--cyan {
  right: -18vmax;
  bottom: -28vmax;
  width: 55vmax;
  height: 55vmax;
  background: radial-gradient(closest-side, rgba(77, 225, 255, 0.26), transparent);
  animation: drift-cyan 26s ease-in-out infinite alternate;
}

/* Le canvas est dessiné par assets/js/sphere.js */
.backdrop__sphere {
  position: absolute;
  top: 50%;
  right: -6vmin;
  width: min(92vmin, 780px);
  height: min(92vmin, 780px);
  transform: translateY(-50%);
  opacity: 0.9;
}

@keyframes drift-violet {
  to { transform: translate(8vmax, 6vmax); }
}

@keyframes drift-cyan {
  to { transform: translate(-7vmax, -5vmax); }
}

@media (max-width: 639px) {
  /* Sur téléphone : sphère centrée derrière le titre, atténuée pour garder le texte lisible */
  .backdrop__sphere {
    top: 42%;
    right: 50%;
    width: 120vw;
    height: 120vw;
    transform: translate(50%, -50%);
    opacity: 0.45;
  }
}


/* 4. Mise en page
   -------------------------------------------------------------------------- */
.page {
  position: relative;
  z-index: 1;
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 72px var(--page-gutter) 56px;
}


/* 5. En-tête
   -------------------------------------------------------------------------- */
.hero__title {
  margin: 0;
  color: var(--color-text);
  font-size: clamp(2.6rem, 13vw, 7rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.14em;
  background: linear-gradient(100deg, #ffffff 25%, #c4bcff 70%, #8fe9ff 100%);
}

/* Le texte en dégradé n'est activé que si le navigateur sait le rendre :
   sinon le titre resterait invisible. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero__title {
    color: transparent;
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
            background-clip: text;
  }
}

.hero__rule {
  width: 100%;
  max-width: 260px;
  height: 2px;
  margin: 1.6rem 0 1.25rem;
  background: linear-gradient(90deg, var(--color-violet), var(--color-cyan));
  transform-origin: left;
  animation: draw-rule 1.4s ease-out both;
}

.hero__tagline {
  margin: 0;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 3.2vw, 1.15rem);
}

.hero__tagline::before {
  content: "> ";
  color: var(--color-cyan);
}

.hero__tagline::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.25em;
  vertical-align: -0.15em;
  background: var(--color-cyan);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes draw-rule {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes blink {
  50% { opacity: 0; }
}


/* 6. Horloge
   -------------------------------------------------------------------------- */
.clock {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--color-rule);
}

.clock__time {
  display: flex;
  align-items: baseline;
  gap: 0.25em;
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 11vw, 4.25rem);
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.clock__seconds {
  color: var(--color-cyan);
  font-size: 0.36em;
}

.clock__date {
  margin: 12px 0 0;
  color: var(--color-text-muted);
  font-size: 1.05rem;
  text-transform: capitalize;
}


/* 7. Liens
   -------------------------------------------------------------------------- */
.links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  margin-top: 44px;
}

@media (min-width: 640px) {
  .links {
    grid-template-columns: 1fr 1fr;
    gap: 56px;
  }
}

.link-group__title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
}

.link-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-list__item {
  border-bottom: 1px solid var(--color-rule);
}

.link-list__item:first-child {
  border-top: 1px solid var(--color-rule);
}

.link-list__anchor {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 2px;
  color: var(--color-text);
  font-size: 1.05rem;
  text-decoration: none;
  transition: padding-left 0.2s ease, color 0.2s ease;
}

.link-list__host {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.link-list__anchor:hover {
  padding-left: 10px;
  color: var(--color-cyan);
}

.link-list__anchor:hover .link-list__host {
  color: var(--color-violet);
}


/* 8. Pied de page
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: 56px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}


/* 9. Mouvement réduit
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .backdrop__halo,
  .hero__rule,
  .hero__tagline::after {
    animation: none;
  }

  .link-list__anchor {
    transition: none;
  }
}
