/* Sleep & Survive : format vertical, sable et noir */

:root {
  --fond: #d9c29a; /* sable */
  --encre: #000000; /* noir */
  --police: "Hanken Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ecart: clamp(0.625rem, 3vw, 1.375rem);
}

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

body {
  background: var(--fond);
  color: var(--encre);
  font-family: var(--police);
  line-height: 1.5;
}

/* ---------- Structure ---------- */
.app {
  display: flex;
  flex-direction: column;
  gap: var(--ecart);
  width: 100%;
  max-width: 720px;
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(16px, 5vw, 48px);
}

/* ---------- En-tête ---------- */
.entete {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "marque    date"
    "recherche recherche";
  align-items: center;
  gap: var(--ecart);
}

.marque {
  font: 700 clamp(0.75rem, 3.2vw, 1.125rem) var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--encre);
}
.marque span { color: var(--encre); }
.entete .marque { grid-area: marque; }

.date {
  grid-area: date;
  background: var(--encre);
  color: var(--fond);
  font: 500 clamp(0.875rem, 3.6vw, 1.25rem) var(--mono);
  padding: .6em 1.4em;
}

.recherche {
  grid-area: recherche;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 3.25rem;
  padding: 0 18px;
  background: var(--fond);
  border: 2px solid var(--encre);
}
.recherche:focus-within { outline: 3px solid var(--encre); outline-offset: 2px; }
.recherche svg { width: 24px; height: 24px; flex: none; }
.recherche input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--encre);
  font: 400 clamp(0.8125rem, 3.4vw, 1.125rem) var(--mono);
}
.recherche input::placeholder { color: var(--encre); opacity: 1; }

/* ---------- Titre ---------- */
.titre {
  font-size: clamp(2.5rem, min(18vw, 10vh), 9rem);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.035em;
  padding-block: .08em .12em;
}
.titre { overflow-wrap: anywhere; }
.titre span { display: block; }

/* ---------- Grille des tuiles ---------- */
main, main nav { flex: 1; display: flex; flex-direction: column; }
.grille {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(8.5rem, 40%)), 1fr));
  grid-auto-rows: minmax(8.125rem, 1fr);
  gap: var(--ecart);
  list-style: none;
}
.grille li { display: grid; }
.grille li[hidden] { display: none; }

.tuile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(12px, min(4.5vw, 1.5vh), 34px);
  background: var(--fond);
  border: 2px solid var(--encre);
  color: var(--encre);
  text-decoration: none;
  transition: box-shadow .15s, transform .15s;
}
.tuile:hover { box-shadow: inset 0 0 0 4px var(--encre); }
.tuile:active { transform: scale(.98); }
.tuile:focus-visible { outline: 3px solid var(--encre); outline-offset: 2px; }

.tuile-haut {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.icone {
  width: clamp(2.75rem, min(12vw, 4.5vh), 5rem);
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.numero {
  font: 400 clamp(0.75rem, 3vw, 1.125rem) var(--mono);
  color: var(--encre);
}
.nom {
  overflow-wrap: anywhere;
  font-size: clamp(1.125rem, min(5.4vw, 2.2vh), 2.375rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -.01em;
}

/* Tuile sélectionnée */
.tuile[aria-current="page"] {
  background: var(--encre);
  border-color: var(--encre);
  color: var(--fond);
}
.tuile[aria-current="page"] .numero { color: var(--fond); }

/* ---------- Pied de page ---------- */
.pied {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  color: var(--encre);
  font-size: clamp(0.875rem, 3.6vw, 1.25rem);
}

@media (prefers-reduced-motion: reduce) {
  .tuile { transition: none; }
}

/* ---------- Accessibilité ---------- */
.invisible {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.evitement {
  position: absolute;
  left: 1rem;
  top: -10rem;
  padding: 0.75rem 1rem;
  background: var(--encre);
  color: var(--fond);
}
.evitement:focus { top: 1rem; }

@media (forced-colors: active) {
  .tuile[aria-current="page"] { border: 6px double; }
}
