/* ==========================================================================
   style.css : feuille de style unique du site Tubacki.fr

   - Mobile-first : la base vise le smartphone, puis un seul
     @media (min-width: 768px) agrandit pour tablette et ordinateur.
   - Polices système uniquement : aucune requête vers un serveur tiers.
   - Pour changer le design : couleurs et rayon dans « 1. Variables ».

   Sommaire
     1. Variables
     2. Base
     3. Barre de marque + bouton menu
     4. Menu latéral
     5. Cartes et boutons
     6. Accueil : en-tête, livres, carte Tangem
     7. Pages de texte (mentions légales, erreur 404)
     8. Pied de page
     9. Bandeau vie privée
    10. Accessibilité
    11. Tablette et ordinateur
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Variables
   -------------------------------------------------------------------------- */
:root {
  --bg: #F7F5F0;       /* fond général */
  --card: #FFFFFF;     /* fond des cartes */
  --ink: #111827;      /* texte principal */
  --sub: #4B5563;      /* texte secondaire */
  --line: #E5E7EB;     /* bordures */
  --action: #0369A1;   /* boutons, liens, focus, bandeau */
  --action-d: #075985; /* survol */
  --gold: #B45309;     /* accents */
  --radius: 14px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(17, 24, 39, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.brand {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.15rem;
  line-height: 1.3;
  overflow-wrap: break-word;
}

h3 {
  font-size: 1.05rem;
  line-height: 1.3;
}

a {
  color: var(--action-d);
}

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left));
}

/* Réserve la place du bandeau fixe tant qu'il est affiché */
html:not(.banner-closed) .wrap {
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

/* --------------------------------------------------------------------------
   3. Barre de marque + bouton menu
   -------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 6px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 1.15rem;
  text-decoration: none;
}

.brand span {
  color: var(--gold);
}

.menu-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.menu-btn svg {
  display: block;
  width: 22px;
  height: 22px;
}

/* --------------------------------------------------------------------------
   4. Menu latéral
   -------------------------------------------------------------------------- */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(17, 24, 39, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.menu-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s;
}

/* Bloque le défilement de la page tant que le menu est ouvert */
html.menu-open,
html.menu-open body {
  overflow: hidden;
}

.menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  width: min(280px, 85vw);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  background: var(--card);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s;
}

.menu-drawer.is-open {
  transform: none;
  visibility: visible;
  box-shadow: -2px 0 16px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 1.05rem;
}

.menu-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.menu-links {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.menu-links a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

.menu-links a[aria-current="page"] {
  color: var(--gold);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   5. Cartes et boutons
   (système de blocs : dupliquer une <section class="card">)
   -------------------------------------------------------------------------- */
.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--action);
  color: #FFFFFF;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(3, 105, 161, 0.25);
}

/* --------------------------------------------------------------------------
   6. Accueil : en-tête, livres, carte Tangem
   -------------------------------------------------------------------------- */

/* En-tête : texte à gauche, photo à droite */
.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.hero-text {
  flex: 1 1 auto;
  min-width: 0;
}

.hero-text h1 {
  margin-bottom: 0.5rem;
}

.hero-quote {
  max-width: 700px;
  margin: 0;
  font-size: 0.92rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--sub);
}

/* Portrait ovale : la photo est déjà recadrée en 4:5 (zoom 1).
   Pour resserrer le cadrage, augmentez --photo-zoom (1.2, 1.5…) et réglez le point avec x / y. */
.portrait {
  --photo-zoom: 1;
  --photo-x: 50%;
  --photo-y: 30%;

  flex: 0 0 auto;
  width: 92px;
  aspect-ratio: 4 / 5;
  margin: 0;
  overflow: hidden;
  border-radius: 50% / 40%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(var(--photo-zoom));
  transform-origin: var(--photo-x) var(--photo-y);
}

/* Empilement des blocs de la page d'accueil */
.stack {
  display: grid;
  gap: 1.5rem;
}

.section-title {
  margin-bottom: 0.75rem;
}

/* Livres : 2 colonnes sur smartphone */
.livres-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.livre {
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.livre img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  margin-bottom: 10px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
}

.livre h3 {
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.livre p {
  flex: 1 1 auto;
  margin: 0 0 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--sub);
}

.livre .btn {
  width: 100%;
  padding: 0 12px;
}

/* Carte mise en avant (Tangem) */
.card--featured {
  border-color: var(--gold);
}

.card--featured .hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--sub);
}

.columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.columns strong {
  font-size: 0.9rem;
  color: var(--gold);
}

.columns ul {
  margin: 0.3rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--sub);
}

.referral {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
  text-align: center;
}

.referral p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--sub);
}

.referral a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: underline;
}

.referral small {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.78rem;
}

/* --------------------------------------------------------------------------
   7. Pages de texte (mentions légales, erreur 404)
   -------------------------------------------------------------------------- */
.page-head p {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--sub);
}

.legal {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.legal .card p {
  margin: 0.6rem 0 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.legal-list {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--sub);
  overflow-wrap: anywhere;
}

.legal-list li + li {
  margin-top: 0.35rem;
}

.legal-list a {
  display: inline-block;
  padding: 10px 0;
  text-decoration: underline;
}

.erreur {
  margin-top: 1.5rem;
  text-align: center;
}

.erreur p {
  margin: 0.75rem 0 1.25rem;
  color: var(--sub);
}

/* --------------------------------------------------------------------------
   8. Pied de page
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: 2rem;
  padding: 1.25rem 1rem 1.5rem;
  border-top: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--card);
  color: var(--sub);
  font-size: 0.78rem;
  text-align: center;
}

.footer-links a,
.footer-copy a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  color: var(--sub);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   9. Bandeau vie privée
   -------------------------------------------------------------------------- */
.privacy-banner {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left));
  background: var(--action);
  color: #FFFFFF;
  font-size: 0.82rem;
  line-height: 1.4;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

.banner-closed .privacy-banner {
  display: none;
}

.privacy-banner button {
  flex: 0 0 auto;
  min-width: 80px;
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--action);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   10. Accessibilité
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.privacy-banner button:focus-visible {
  outline-color: #FFFFFF;
}

@media (hover: hover) {
  .card {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }

  .card:hover {
    border-color: var(--action);
    box-shadow: 0 8px 30px -4px rgba(3, 105, 161, 0.12);
  }

  .card--featured:hover {
    border-color: var(--gold);
  }

  .btn:hover {
    background: var(--action-d);
  }

  .menu-links a:hover,
  .footer-links a:hover,
  .footer-copy a:hover {
    color: var(--action-d);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* --------------------------------------------------------------------------
   11. Tablette et ordinateur
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  html:not(.banner-closed) .wrap {
    padding-bottom: 90px;
  }

  .card {
    padding: 24px;
  }

  .hero {
    gap: 1.25rem;
    padding-top: 1rem;
    margin-bottom: 2.5rem;
  }

  .hero-quote {
    font-size: 1rem;
  }

  .portrait {
    width: 120px;
  }

  .stack {
    gap: 2rem;
  }

  .livres-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .livre {
    padding: 16px;
  }

  .columns {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .legal {
    margin-top: 1.5rem;
  }

  .site-footer {
    margin-top: 3rem;
    padding: 2rem 1rem;
  }

  .privacy-banner {
    font-size: 0.9rem;
  }
}

/* Jeu gratuit : couverture à gauche, texte et bouton à droite */
.jeu {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
}

.jeu-visuel img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
  box-shadow: 0 6px 18px rgba(3, 105, 161, 0.25);
}

.jeu-texte {
  display: grid;
  gap: 8px;
  justify-items: stretch;
  min-width: 0;
}

.jeu-texte h3 {
  font-size: 1.05rem;
}

.jeu-texte p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--sub);
}

/* Lien secondaire « Tester le jeu gratuit » sous le bouton d'un livre */
.lien-jeu {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  color: var(--gold);
}

@media (min-width: 768px) {
  .jeu {
    grid-template-columns: 140px 1fr;
    gap: 20px;
  }

  .jeu-texte {
    justify-items: start;
  }
}

/* Bouton secondaire (contour) : « Installer le jeu » */
.btn--alt {
  border: 2px solid var(--action);
  background: transparent;
  color: var(--action-d);
  box-shadow: none;
}

@media (hover: hover) {
  .btn--alt:hover {
    background: var(--action);
    color: #FFFFFF;
  }
}
/* --------------------------------------------------------------------------
   Ordinateur : accueil en pleine largeur
   À coller tout à la fin de /assets/css/style.css.
   S'applique seulement à la page qui contient le bloc .hero (l'accueil) ;
   les autres pages gardent leur colonne de lecture.
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  /* La page occupe toute la largeur de l'écran, avec une marge sur les côtés */
  .wrap:has(.hero) {
    max-width: none;
    padding-right: clamp(32px, 4vw, 64px);
    padding-left: clamp(32px, 4vw, 64px);
  }

  .wrap:has(.hero) .portrait {
    width: 150px;
  }

  /* Deux colonnes : livres à gauche, jeu puis Tangem à droite */
  .wrap:has(.hero) .stack {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-areas:
      "livres jeux"
      "livres tangem";
    align-items: start;
    gap: 2rem 2.5rem;
  }

  .wrap:has(.hero) #livres {
    grid-area: livres;
  }

  .wrap:has(.hero) #jeux {
    grid-area: jeux;
  }

  .wrap:has(.hero) .stack > .card--featured {
    grid-area: tangem;
  }

  /* Livres : cartes horizontales (couverture à gauche, texte à droite),
     autant par ligne que la largeur le permet */
  .wrap:has(.hero) .livres-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
  }

  .wrap:has(.hero) .livre {
    display: grid;
    grid-template-columns: 140px 1fr;
    grid-template-rows: auto auto auto 1fr;
    align-items: start;
    column-gap: 18px;
    row-gap: 6px;
    padding: 18px;
  }

  .wrap:has(.hero) .livre img {
    grid-column: 1;
    grid-row: 1 / span 4;
    margin-bottom: 0;
  }

  .wrap:has(.hero) .livre > :not(img) {
    grid-column: 2;
  }

  .wrap:has(.hero) .livre h3 {
    font-size: 1.1rem;
  }

  .wrap:has(.hero) .livre p {
    font-size: 0.92rem;
  }

  .wrap:has(.hero) .livre .btn {
    justify-self: start;
    width: auto;
    padding: 0 24px;
  }
}