/* Le site de Ma petite bibliothèque : les tokens de l'app (docs/reference/design.md), servis sans rien de tiers.
   Contrastes calculés (WCAG) : texte/fond 11,25:1 clair, 13,97:1 sombre ; atténué/fond 4,68 et 6,53 ;
   lien/fond 5,21 (#964A20, le primary de l'app foncé : le sien tombe à 4,30 sur le fond clair) et 5,30 ;
   texte du héros sur son voile 13,97. */

@font-face {
  font-family: "Fraunces";
  src: url("polices/Fraunces-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("polices/Inter-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --fond: #F3E7D3;
  --surface: #FBF1DF;
  --texte: #3A2A1B;
  --attenue: #7A6249;
  --lien: #964A20;
  --primaire: #A85526;
  --sur-primaire: #FFF3E4;
  --bordure: #E4CFA9;
  --lueur: #F6C87A;
  --nuit: #241A12;
  --creme: #F4E7D2;
  --affiche: "Fraunces", Georgia, "Times New Roman", serif;
  --corps: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mesure: 40rem;
  --large: 68rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #241A12;
    --surface: #33261A;
    --texte: #F4E7D2;
    --attenue: #B79C79;
    --lien: #D07A3C;
    --primaire: #D07A3C;
    --sur-primaire: #2A1B0E;
    --bordure: #46311E;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--corps);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
}
img { max-width: 100%; display: block; }
a { color: var(--lien); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--lien); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 {
  font-family: var(--affiche);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: clamp(2.25rem, 6vw, 4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.25rem); }
h3 { font-size: 1.25rem; }
p { margin: 0; }

.cadre {
  width: 100%;
  max-width: var(--large);
  margin: 0 auto;
  padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
}
.etroit { max-width: calc(var(--mesure) + 2.5rem); }

/* L'en-tête des pages de texte ; celui de l'accueil flotte sur la pièce. */
.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
}
.marque {
  font-family: var(--affiche);
  font-weight: 600;
  font-size: 1.15rem;
  color: inherit;
  text-decoration: none;
}
.langue { font-size: 0.95rem; color: inherit; }

/* Le héros : la pièce, voilée vers le bas pour que le texte tienne. */
.heros {
  position: relative;
  color: var(--creme);
  background: var(--nuit);
  isolation: isolate;
  min-height: min(92vh, 52rem);
  display: flex;
  flex-direction: column;
}
.heros picture, .heros picture img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 50%;
  z-index: -2;
}
.heros::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgb(36 26 18 / 0.55) 0%, rgb(36 26 18 / 0) 22%),
    linear-gradient(0deg, rgb(36 26 18 / 0.96) 8%, rgb(36 26 18 / 0.7) 38%, rgb(36 26 18 / 0) 68%);
}
@media (min-width: 900px) {
  .heros picture img { object-position: 42% 50%; }
  .heros::after {
    background:
      linear-gradient(180deg, rgb(36 26 18 / 0.55) 0%, rgb(36 26 18 / 0) 22%),
      linear-gradient(90deg, rgb(36 26 18 / 0.92) 0%, rgb(36 26 18 / 0.72) 40%, rgb(36 26 18 / 0) 72%),
      linear-gradient(0deg, rgb(36 26 18 / 0.85) 0%, rgb(36 26 18 / 0) 35%);
  }
}
.heros .entete a { color: var(--creme); }
.heros-texte {
  margin-top: auto;
  padding-block: 3rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.heros-texte h1 { max-width: 40rem; }
.heros-texte p { font-size: clamp(1.1rem, 2.2vw, 1.3rem); max-width: 34rem; }
.bientot {
  align-self: flex-start;
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid rgb(246 200 122 / 0.6);
  border-radius: 0.75rem;
  color: var(--lueur);
  font-size: 0.95rem;
  line-height: 1.35;
}
.bientot strong { font-family: var(--affiche); font-weight: 600; font-size: 1.1rem; color: var(--creme); }

/* Les sections de l'accueil. */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); display: flex; flex-direction: column; gap: 2.5rem; }
.section + .section { border-top: 1px solid var(--bordure); }
.chapeau { display: flex; flex-direction: column; gap: 0.9rem; max-width: var(--mesure); }
.chapeau p { color: var(--attenue); font-size: 1.1rem; }

.gestes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 2.25rem 3rem;
}
.gestes li { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.gestes h3::before {
  content: "";
  display: block;
  width: 1.75rem;
  height: 2px;
  background: var(--primaire);
  margin-bottom: 0.9rem;
}

/* « Tes données » : deux colonnes, ce qui reste et ce qui sort. */
.donnees {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.25rem;
}
.colonne {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 1rem;
  padding: 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}
.colonne ul { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.55rem; }
.colonne li::marker { color: var(--primaire); }

/* Les pages de texte : confidentialité, assistance, mentions. */
.page { padding-block: 2rem 5rem; display: flex; flex-direction: column; gap: 2.5rem; }
.page header { display: flex; flex-direction: column; gap: 0.75rem; }
.page header p { color: var(--attenue); }
.texte { display: flex; flex-direction: column; gap: 2.25rem; }
.texte section { display: flex; flex-direction: column; gap: 0.8rem; }
.texte h2 { font-size: 1.5rem; }
.texte ul { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.45rem; }
.texte li::marker { color: var(--primaire); }
.texte dl { margin: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.texte dt { font-weight: 600; }
.texte dd { margin: 0.25rem 0 0; }
.adresse {
  font-family: var(--affiche);
  font-size: 1.35rem;
  font-weight: 600;
  user-select: all;
  overflow-wrap: anywhere;
}
.date { color: var(--attenue); font-size: 0.95rem; }

/* Le pied de page. */
.pied { border-top: 1px solid var(--bordure); padding-block: 2rem 2.5rem; font-size: 0.95rem; color: var(--attenue); }
.pied .cadre { display: flex; flex-wrap: wrap; gap: 0.75rem 1.75rem; justify-content: space-between; }
.pied nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.pied a { color: var(--texte); }

@media (prefers-reduced-motion: no-preference) {
  .heros-texte { animation: monte 900ms cubic-bezier(.2,.7,.2,1) both; }
  @keyframes monte { from { opacity: 0.001; transform: translateY(12px); } }
}

/* Sur téléphone, la pièce entière ne tient pas en hauteur : un bandeau cadré sur la table et le fauteuil, fondu
   dans la nuit, puis le texte. */
@media (max-width: 899px) {
  .heros { min-height: 0; }
  .heros::after { content: none; }
  .heros .entete { position: absolute; inset: 0 0 auto; z-index: 1; }
  .heros .entete::before {
    content: "";
    position: absolute;
    inset: 0 0 -1.5rem;
    z-index: -1;
    background: linear-gradient(180deg, rgb(36 26 18 / 0.75), rgb(36 26 18 / 0));
  }
  .heros picture { position: relative; display: block; }
  .heros picture img {
    position: static;
    height: auto;
    aspect-ratio: 4 / 3.4;
    object-position: 66% 60%;
    -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
  }
  .heros-texte { margin-top: -2.5rem; padding-block: 0 3.5rem; }
}

html { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.evitement {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  background: var(--primaire);
  color: var(--sur-primaire);
  font-weight: 600;
}
.evitement:focus { top: 1rem; }
