/* =============================================================
   21jours — styles
   Ultra minimaliste : fond photo flouté + 21 bulles cliquables.
   ============================================================= */

/* Police Bitcount Single (variable) — chiffres de l'accueil + titres */
@font-face {
  font-family: "Bitcount Single";
  src: url("fonts/BitcountSingle-Variable.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-display: swap;
}

/* Open Sans Light — corps des articles (graisse minimum) */
@font-face {
  font-family: "Open Sans";
  src: url("fonts/OpenSans-Light.ttf") format("truetype");
  font-weight: 300;
  font-display: swap;
}

:root {
  --cream: #ece4d6;
  --cream-dim: rgba(236, 228, 214, 0.55);
  --cream-faint: rgba(236, 228, 214, 0.22);
  --ink: #161c26;
  --bg-base: #1b2330;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden; /* le logo qui sort à droite ne crée pas de scroll */
}

body {
  background: var(--bg-base);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ----------------------------------------------------------------
   Fond : photo floutée + dégradé de repli (si la photo manque)
   Remplace assets/background.jpg par ta vraie photo.
   ---------------------------------------------------------------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--bg-base);
  /* Ordre de priorité : ta photo (background.jpg) si présente,
     sinon le repli SVG, sinon le dégradé. */
  background-image: url("background.jpg"), url("background.svg"),
    linear-gradient(180deg, #2a3647 0%, #28323f 45%, #161d28 100%);
  background-size: cover, cover, cover;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
  /* Le flou + l'agrandissement évitent les bords nets */
  filter: blur(4.5px) brightness(0.66) saturate(1.05);
  transform: scale(1.05);
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
      120% 90% at 50% 30%,
      rgba(10, 14, 20, 0.15) 0%,
      rgba(10, 14, 20, 0.55) 70%,
      rgba(8, 11, 16, 0.78) 100%
    );
}

/* ----------------------------------------------------------------
   Écran d'accueil (splash) : logo centré sur le fond flouté
   ---------------------------------------------------------------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 2rem;
  transform: translateX(0);
  transition: transform 0.55s cubic-bezier(0.5, 0, 0.2, 1);
  will-change: transform;
}

.intro__logo {
  width: clamp(150px, 36vw, 320px);
  height: auto;
  filter: drop-shadow(0 6px 30px rgba(0, 0, 0, 0.45));
  animation: intro-logo 0.8s ease both;
}

/* Le logo file vers la droite et sort de l'écran */
.intro--out {
  transform: translateX(100%);
  pointer-events: none;
}

/* Logo en haut à gauche (page principale) */
.brand {
  position: fixed;
  top: clamp(1rem, 3vw, 1.6rem);
  left: clamp(1rem, 3vw, 1.6rem);
  width: clamp(64px, 10vw, 92px);
  height: auto;
  z-index: 4;
  transform: translateX(0);
  transition: transform 0.55s cubic-bezier(0.5, 0, 0.2, 1);
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.4));
}

/* Pendant le splash : la page principale (bulles + logo coin) attend hors
   écran à gauche, puis entre en glissant vers la droite. */
.intro-active .stage,
.intro-active .brand {
  transform: translateX(-100vw);
}

/* ----------------------------------------------------------------
   Scène / accueil
   ---------------------------------------------------------------- */
.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 6vh, 4rem);
  padding: clamp(2rem, 6vh, 4rem) clamp(1.25rem, 4.5vw, 2rem);
  overflow: hidden; /* évite tout débordement dû au décalage des rangées */
  transform: translateX(0);
  transition: transform 0.55s cubic-bezier(0.5, 0, 0.2, 1);
}

/* ----------------------------------------------------------------
   Le calendrier de 21 bulles (7 colonnes × 3 rangées)
   ---------------------------------------------------------------- */
.calendar {
  display: flex;
  flex-direction: column;
  gap: clamp(0.45rem, 1.6vw, 1.2rem);
  width: 100%;
  max-width: 820px;
}

.row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: clamp(0.45rem, 1.6vw, 1.2rem);
  width: 100%;
  /* Décalage horizontal par rangée (rendu décalé). Activé seulement quand il
     reste de la marge sur les côtés, pour ne jamais rogner les bulles. */
  transform: translateX(var(--shift, 0));
}

/* Décalages en vw (proportionnels) : appliqués aussi sur mobile */
.row--1 { --shift: -3.2vw; }  /* 1re rangée : décalée à gauche */
.row--2 { --shift: 2.8vw; }   /* 2e rangée : décalée à droite */
.row--3 { --shift: 1vw; }     /* 3e rangée : un peu à droite */

.bubble {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0; /* autorise la grille à rétrécir sous la largeur du chiffre */
  display: grid;
  place-items: center;
  border: 1.5px solid var(--cream-dim);
  border-radius: 50%;
  color: var(--cream);
  text-decoration: none;
  font-size: clamp(1.45rem, 7vw, 2.15rem);
  font-weight: 300;
  letter-spacing: 0.02em;
  background: transparent;
  transition: background-color 0.25s ease, color 0.25s ease,
    border-color 0.25s ease, transform 0.25s ease;
}

/* Chiffres dans les cercles (bulles accueil + cercle des articles) */
.num {
  font-family: "Bitcount Single", monospace;
  line-height: 1;
  /* recalage vertical précis selon les métriques de la police (center.js) */
  transform: translateY(var(--num-shift, 0));
}

/* Bulles « 21 » : un tout petit peu plus opaques (fond léger + bord un peu
   plus marqué). Le :hover, plus spécifique, les remplit normalement. */
.bubble--accent {
  background-color: rgba(236, 228, 214, 0.16);
  border-color: rgba(236, 228, 214, 0.88);
}

.bubble:hover,
.bubble:focus-visible {
  background-color: var(--cream);
  color: var(--ink);
  border-color: var(--cream);
  transform: scale(1.08);
  outline: none;
}

.bubble:focus-visible {
  box-shadow: 0 0 0 3px rgba(236, 228, 214, 0.35);
}

/* Jour pas encore publié : cercle verrouillé, non cliquable */
.bubble--locked {
  border-color: var(--cream-faint);
  pointer-events: none;
}

.bubble--locked .num {
  opacity: 0.4;
}

/* ----------------------------------------------------------------
   Page article : fond blanc, en-tête (cercle gauche / titre droite),
   texte, et images patchwork agrandies (pouvant passer derrière le texte)
   ---------------------------------------------------------------- */
body.reading {
  background: #ffffff;
  color: #23272e;
  /* Latin : Open Sans ; japonais : polices système de secours */
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    "Noto Sans JP", "Meiryo", sans-serif;
  font-weight: 300; /* graisse minimum */
}

/* Sélecteur de langue (haut droite des pages article) */
.lang {
  position: fixed;
  top: clamp(1.1rem, 3vw, 1.7rem);
  right: clamp(1.1rem, 3vw, 1.7rem);
  z-index: 10;
  display: flex;
  gap: 0.7rem;
  align-items: center;
}

.lang button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9aa0a7;
  transition: color 0.2s ease;
}

.lang button:hover {
  color: #15191f;
}

.lang button.active {
  color: #15191f;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* La page occupe toute la hauteur pour pouvoir caler le pager en bas */
#article {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* Logo en haut à gauche, en noir (ramène à l'accueil) */
.doc-logo {
  position: fixed;
  top: clamp(1rem, 3vw, 1.6rem);
  left: clamp(1rem, 3vw, 1.6rem);
  z-index: 10;
  width: clamp(60px, 9vw, 88px);
}

.doc-logo img {
  display: block;
  width: 100%;
  height: auto;
  filter: brightness(0);
  opacity: 0.9;
}

/* En-tête : cercle du jour à gauche, titre sur UNE ligne à droite */
.article-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1rem, 3vw, 2.5rem);
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(5.5rem, 15vh, 9rem) clamp(1.25rem, 4vw, 2.5rem)
    clamp(0.5rem, 1.5vh, 1rem);
}

.daymark {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(72px, 11vw, 108px);
  height: clamp(72px, 11vw, 108px);
  border: 1.5px solid rgba(21, 25, 31, 0.6);
  border-radius: 50%;
  font-family: "Bitcount Single", monospace;
  font-size: clamp(1.4rem, 4vw, 2.1rem);
  font-weight: 400;
  color: #15191f;
}

.article-head .title {
  flex: 1;
  min-width: 0; /* autorise la réduction pour tenir sur une ligne */
  margin: 0;
  text-align: right;
  font-family: "Bitcount Single", "Hiragino Sans", "Yu Gothic", "Noto Sans JP",
    "Meiryo", sans-serif;
  font-weight: 400;
  white-space: nowrap; /* une seule ligne ; la taille est ajustée par JS */
  font-size: clamp(1.3rem, 4vw, 3rem);
  line-height: 1.3;
  color: #15191f;
}

/* Lieu · date : ligne à droite, sous l'en-tête */
.article-meta {
  max-width: 1180px;
  margin: 0.7rem auto 0;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  text-align: right;
  font-size: 0.8rem;
  color: #9aa0a7;
  letter-spacing: 0.06em;
}

/* Mobile / petite tablette : en-tête empilé, titre qui passe à la ligne */
@media (max-width: 899px) {
  .article-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.1rem;
  }

  .article-head .title {
    white-space: normal; /* le titre peut passer à la ligne (plus de coupe) */
    text-align: left;
    font-size: clamp(1.8rem, 6.5vw, 2.8rem);
    line-height: 1.25;
  }

  .article-meta {
    text-align: left;
  }
}

/* CORPS : texte (flottant) à gauche, images en patchwork à droite puis dessous */
.article-body {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vh, 3rem) clamp(1.25rem, 4vw, 2.5rem)
    clamp(2.5rem, 6vh, 4rem);
}

/* contient les flottants */
.article-body::after {
  content: "";
  display: block;
  clear: both;
}

/* Colonne texte, à gauche, police réduite */
.content {
  text-align: left;
  margin-bottom: 1.5rem;
}

.content p {
  margin: 0 0 1.05rem;
  line-height: 1.7;
  font-size: 0.9rem;
  color: #2c3138;
}

.content .lead {
  font-size: 1rem;
  line-height: 1.55;
  color: #15191f;
  margin-bottom: 1.4rem;
}

/* Lien vers le site, sous le texte */
.site-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #15191f;
  text-decoration: none;
  border-bottom: 1px solid rgba(21, 25, 31, 0.45);
  padding-bottom: 3px;
  transition: border-color 0.2s ease, gap 0.2s ease;
}

.site-link:hover {
  border-color: #15191f;
  gap: 0.7em;
}

/* Article sans photos : juste le logo (noir), centré sous le texte sur mobile */
.media-logo {
  margin-top: clamp(2rem, 6vh, 3.5rem);
  display: flex;
  justify-content: center;
}

.media-logo img {
  width: clamp(150px, 56vw, 260px);
  height: auto;
  filter: brightness(0);
  opacity: 0.92;
}

/* Images : empilées sur mobile */
.gallery {
  display: flex;
  flex-direction: column;
  gap: clamp(0.9rem, 2vw, 1.5rem);
}

.shot {
  margin: 0;
  width: 100%;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

/* Desktop : le texte flotte à gauche, les images coulent à droite puis dessous */
@media (min-width: 900px) {
  .content {
    float: left;
    width: clamp(280px, 40%, 450px);
    margin: 0 clamp(1.2rem, 3vw, 2rem) 0.6rem 0;
  }

  /* le texte reste au-dessus des images qui le frôlent */
  .content {
    position: relative;
    z-index: 20;
  }

  /* la galerie disparaît : les .shot deviennent enfants directs et flottent */
  .gallery {
    display: contents;
  }

  .shot {
    float: left;
    box-sizing: border-box;
    position: relative;
    padding-left: clamp(0.6rem, 1.4vw, 1rem);
    /* léger chevauchement vertical entre les images */
    margin-bottom: clamp(-2rem, -2.4vw, -1.2rem);
  }

  /* largeurs variées + léger recouvrement horizontal, empilement par z-index */
  .shot:nth-of-type(1) { width: 57%; z-index: 1; }
  .shot:nth-of-type(2) { width: 47%; z-index: 2; margin-left: -3%; }
  .shot:nth-of-type(3) { width: 52%; z-index: 3; }
  .shot:nth-of-type(4) { width: 51%; z-index: 4; margin-left: -3%; }
  .shot:nth-of-type(5) { width: 57%; z-index: 5; }
  .shot:nth-of-type(6) { width: 47%; z-index: 6; margin-left: -3%; }

  /* Article sans photos : texte à gauche, logo (noir) à droite */
  .article-body--logo {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: clamp(2rem, 6vw, 5rem);
  }

  /* le texte ne flotte plus : simple colonne de gauche */
  .article-body--logo::after { display: none; }

  .article-body--logo .content {
    float: none;
    width: auto;
    max-width: 560px;
    margin: 0;
    flex: 1 1 auto;
  }

  .article-body--logo .media-logo {
    margin-top: 0.35rem;
    flex: 0 0 auto;
    width: clamp(200px, 24vw, 320px);
    justify-content: flex-end;
  }

  .article-body--logo .media-logo img {
    width: 100%;
  }
}

/* Navigation jour précédent / suivant — calée tout en bas de la page */
.pager {
  position: relative;
  z-index: 1;
  align-self: center;
  width: 100%;
  max-width: 640px;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.5rem 1.5rem 2.5rem;
  border-top: 1px solid rgba(21, 25, 31, 0.12);
}

.pager a {
  color: #8a8f96;
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  transition: color 0.2s ease;
  max-width: 45%;
}

.pager a:hover {
  color: #15191f;
}

.pager a.next {
  text-align: right;
  margin-left: auto;
}

.pager a .label {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.2rem;
}

.notfound {
  text-align: center;
  color: #8a8f96;
  padding: 6rem 1.5rem;
}

.notfound a {
  color: #15191f;
}

/* ----------------------------------------------------------------
   Lien ARCHIVES (bas-droite de l'accueil)
   ---------------------------------------------------------------- */
.archives-link {
  position: fixed;
  right: clamp(1rem, 3.5vw, 2rem);
  bottom: clamp(1rem, 3.5vw, 1.8rem);
  z-index: 4;
  font-family: "Bitcount Single", monospace;
  font-size: clamp(0.95rem, 2.6vw, 1.25rem);
  letter-spacing: 0.18em;
  color: var(--cream);
  text-decoration: none;
  opacity: 0.85;
  transform: translateX(0);
  transition: opacity 0.2s ease,
    transform 0.55s cubic-bezier(0.5, 0, 0.2, 1);
}

.archives-link:hover {
  opacity: 1;
}

/* masqué (hors écran) pendant le splash, glisse avec la page */
.intro-active .archives-link {
  transform: translateX(-100vw);
}

/* ----------------------------------------------------------------
   Page archives : grille de 100 cercles (21 numérotés)
   ---------------------------------------------------------------- */
.home-logo {
  position: fixed;
  top: clamp(1rem, 3vw, 1.6rem);
  left: clamp(1rem, 3vw, 1.6rem);
  z-index: 4;
  width: clamp(60px, 9vw, 88px);
}

.home-logo img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.4));
}

/* Recherche : encart rectangle minimaliste, même contour que les cercles */
.search {
  position: fixed;
  top: clamp(1rem, 3vw, 1.6rem);
  right: clamp(1rem, 3vw, 1.6rem);
  z-index: 5;
  width: clamp(150px, 32vw, 230px);
  padding: 0.55rem 0.75rem;
  font-family: "Bitcount Single", monospace;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--cream);
  background: transparent;
  border: 1.5px solid var(--cream-dim);
  border-radius: 0; /* bords droits */
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.search::placeholder {
  color: var(--cream-dim);
  opacity: 1;
}

.search:focus {
  border-color: var(--cream);
}

.search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.archives-stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2rem, 5vh, 3rem);
  padding: clamp(5rem, 13vh, 7.5rem) clamp(1.25rem, 4vw, 2rem)
    clamp(3rem, 8vh, 5rem);
}

.archives-title {
  margin: 0;
  font-family: "Bitcount Single", monospace;
  font-weight: 400;
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  letter-spacing: 0.2em;
  color: var(--cream);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

/* même disposition que l'accueil : colonnes de 7, rangées décalées (.row) */
.archives-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(0.45rem, 1.6vw, 1.2rem);
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.arc {
  aspect-ratio: 1 / 1;
  min-width: 0;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--cream-dim);
  border-radius: 50%;
  font-size: clamp(1.45rem, 7vw, 2.15rem);
  font-weight: 300;
  transition: opacity 0.2s ease, background-color 0.25s ease,
    color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

/* non-résultats pendant une recherche : estompés */
.arc--dim {
  opacity: 0.12;
  pointer-events: none;
}

.arc--num {
  color: var(--cream);
  text-decoration: none;
  transition: background-color 0.25s ease, color 0.25s ease,
    border-color 0.25s ease, transform 0.25s ease;
}

.arc--num:hover,
.arc--num:focus-visible {
  background-color: var(--cream);
  color: var(--ink);
  border-color: var(--cream);
  transform: scale(1.08);
  outline: none;
}

/* cercles vides : futurs articles */
.arc--empty {
  border-color: var(--cream-faint);
}

/* ----------------------------------------------------------------
   Animations
   ---------------------------------------------------------------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes intro-logo {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubble,
  .article,
  .intro__logo {
    animation: none;
  }
  .stage,
  .brand,
  .intro {
    transition: none;
  }
}
