/* =========================================================================
   Maison Ipuin — Collection Mia
   Direction : minimalisme éditorial raffiné (Apple x Medium).
   Le décor reste neutre et clair ; la couleur vient des couvertures et de
   petites touches terracotta. Les livres font le spectacle.
   ========================================================================= */

:root {
  /* Neutres chauds */
  --ink: #181513;          /* presque noir, légèrement chaud */
  --ink-soft: #5b554f;     /* texte secondaire */
  --ink-faint: #9a938b;    /* détails, méta */
  --paper: #ffffff;        /* cartes */
  --bg: #f6f4f0;           /* fond neutre clair (pas de couleur dominante) */
  --bg-elev: #fbfaf8;
  --line: #e7e3dc;         /* filets */
  --line-soft: #efece6;

  /* Accents jeunesse (par petites touches) */
  --terracotta: #d65a2c;
  --terracotta-deep: #b8461d;
  --teal: #1f6f74;
  --gold: #e9a83a;

  /* Ombres très douces */
  --shadow-xs: 0 1px 2px rgba(24, 21, 19, 0.04);
  --shadow-sm: 0 2px 10px -4px rgba(24, 21, 19, 0.10);
  --shadow-md: 0 18px 40px -24px rgba(24, 21, 19, 0.28);

  --max-width: 1140px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;

  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.65;
  font-weight: 400;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Grain très discret pour la texture (papier), sans couleur dominante */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body > * {
  position: relative;
  z-index: 1;
}

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

a {
  color: inherit;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Layout ---------- */
.site-header,
.hero,
.section,
.footer {
  width: min(var(--max-width), calc(100% - 3rem));
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.15rem 0;
  width: min(var(--max-width), calc(100% - 3rem));
}

/* fond léger qui s'étend sur toute la largeur quand on défile */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0 calc((var(--max-width) - 100vw) / 2);
  inset-inline: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid var(--line-soft);
  z-index: -1;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 2.9rem;
  height: 2.9rem;
  flex-shrink: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 0.25rem;
  color: var(--ink-faint);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem 1.6rem;
}

.nav a {
  position: relative;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 200ms var(--ease);
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.3rem;
  width: 100%;
  height: 1.5px;
  background: var(--terracotta);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms var(--ease);
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--ink);
  outline: none;
}

.nav a:hover::after,
.nav a:focus-visible::after {
  transform: scaleX(1);
}

/* ---------- Typographie ---------- */
h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.4rem;
  color: var(--terracotta-deep);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  background: var(--terracotta);
  border-radius: 50%;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(17rem, 0.72fr);
  align-items: center;
  gap: clamp(2.5rem, 7vw, 6rem);
  padding: clamp(4rem, 12vw, 9rem) 0 clamp(3.5rem, 9vw, 7rem);
}

.hero-copy {
  max-width: 42rem;
}

h1 {
  margin-bottom: 1.6rem;
  font-size: clamp(2.9rem, 6.5vw, 5.4rem);
  line-height: 1.02;
  font-optical-sizing: auto;
}

h1 .accent {
  color: var(--terracotta);
  font-style: italic;
  font-weight: 500;
}

.intro {
  max-width: 33rem;
  margin-bottom: 2.4rem;
  color: var(--ink-soft);
  font-size: clamp(1.1rem, 1.7vw, 1.28rem);
  line-height: 1.62;
}

.intro strong {
  color: var(--ink);
  font-weight: 600;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
}

/* ---------- Boutons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.1rem;
  padding: 0 1.7rem;
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  text-decoration: none;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease),
    background-color 220ms var(--ease), color 220ms var(--ease),
    border-color 220ms var(--ease);
}

.button::after {
  content: "→";
  font-size: 1.05em;
  line-height: 1;
  transition: transform 220ms var(--ease);
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: #000;
  outline: none;
}

.button:hover::after,
.button:focus-visible::after {
  transform: translateX(4px);
}

.button:active {
  transform: translateY(0);
  box-shadow: none;
}

.button.ghost {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.button.ghost::after {
  content: none;
}

.button.ghost:hover,
.button.ghost:focus-visible {
  background: var(--bg-elev);
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}

:focus-visible {
  outline: 2.5px solid var(--teal);
  outline-offset: 3px;
}

/* ---------- Carte produit du hero ---------- */
.hero-product {
  position: relative;
}

.book-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.hero-product-info {
  padding: 1.4rem 0.15rem 0;
}

.hero-product-info h2 {
  margin: 0.5rem 0 0.2rem;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  line-height: 1.05;
}

/* ---------- Étiquette pré-commande ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-faint);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.badge::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  background: var(--terracotta);
  border-radius: 50%;
}

/* ---------- Sections ---------- */
.section {
  padding: clamp(3.5rem, 8vw, 6.5rem) 0;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  flex-direction: column;
  max-width: 42rem;
  margin-bottom: clamp(2.5rem, 5vw, 3.6rem);
}

.section h2 {
  margin-bottom: 1rem;
  font-size: clamp(2.1rem, 4.5vw, 3.3rem);
  line-height: 1.06;
}

.section-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(1.02rem, 1.7vw, 1.18rem);
}

/* ---------- Grille catalogue ---------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1.6rem, 3vw, 2.6rem) clamp(1.4rem, 2.5vw, 2rem);
}

.book-card {
  display: flex;
  flex-direction: column;
  transition: transform 320ms var(--ease);
}

.book-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 320ms var(--ease);
}

.book-card:hover {
  transform: translateY(-6px);
}

.book-card:hover img {
  box-shadow: var(--shadow-md);
}

.book-card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 1.1rem;
}

.book-card .badge {
  order: -1;
  margin-bottom: 0.7rem;
}

.book-card h3 {
  margin-bottom: 0.45rem;
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  line-height: 1.12;
}

.book-card p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}

.price {
  margin: 1rem 0 0.85rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
}

/* CTA carte : lien texte raffiné avec flèche animée */
.buy-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  color: var(--terracotta-deep);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: gap 200ms var(--ease), color 200ms var(--ease);
}

.buy-link::after {
  content: "→";
  transition: transform 220ms var(--ease);
}

.buy-link:hover,
.buy-link:focus-visible {
  color: var(--terracotta);
  gap: 0.55rem;
  outline: none;
}

.buy-link:hover::after,
.buy-link:focus-visible::after {
  transform: translateX(3px);
}

/* ---------- La maison ---------- */
.story {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.story-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.6rem;
}

.story-logo {
  width: clamp(5.5rem, 12vw, 8rem);
  height: auto;
}

.story h2 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.08;
}

.story p:last-child {
  max-width: 40rem;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.6;
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  margin-block: clamp(3rem, 7vw, 5rem) 2.5rem;
  padding-top: clamp(2.5rem, 5vw, 3.5rem);
  border-top: 1px solid var(--line);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer-logo {
  width: 3.4rem;
  height: 3.4rem;
  flex-shrink: 0;
}

.footer strong {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
}

.footer p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.footer a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 1.6rem;
  color: var(--paper);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--ink);
  border-radius: var(--radius-pill);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease);
}

.footer a:hover,
.footer a:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  outline: none;
}

/* ---------- Apparition orchestrée (progressive enhancement) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 800ms var(--ease), transform 800ms var(--ease);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

/* Séquence du hero au chargement */
.js .hero-copy .reveal:nth-child(1) { transition-delay: 60ms; }
.js .hero-copy .reveal:nth-child(2) { transition-delay: 140ms; }
.js .hero-copy .reveal:nth-child(3) { transition-delay: 220ms; }
.js .hero-copy .reveal:nth-child(4) { transition-delay: 300ms; }
.js .hero-product.reveal { transition-delay: 220ms; }

/* Léger décalage des cartes par colonne */
.js .book-grid .book-card.reveal:nth-child(4n + 2) { transition-delay: 80ms; }
.js .book-grid .book-card.reveal:nth-child(4n + 3) { transition-delay: 160ms; }
.js .book-grid .book-card.reveal:nth-child(4n + 4) { transition-delay: 240ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  * { animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .js .book-grid .book-card.reveal:nth-child(n) { transition-delay: 0ms; }
  .js .book-grid .book-card.reveal:nth-child(3n + 2) { transition-delay: 80ms; }
  .js .book-grid .book-card.reveal:nth-child(3n + 3) { transition-delay: 160ms; }
}

@media (max-width: 800px) {
  body {
    font-size: 17px;
  }

  .hero,
  .story {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 3rem 0 3.5rem;
  }

  .hero-product {
    width: min(100%, 420px);
    margin-inline: auto;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem 1.4rem;
  }
  .js .book-grid .book-card.reveal:nth-child(n) { transition-delay: 0ms; }
  .js .book-grid .book-card.reveal:nth-child(2n) { transition-delay: 80ms; }
}

@media (max-width: 560px) {
  .site-header,
  .hero,
  .section,
  .footer {
    width: min(100% - 1.75rem, var(--max-width));
  }

  .site-header {
    gap: 1rem;
  }

  .brand small {
    display: none;
  }

  .nav {
    gap: 0.4rem 1.1rem;
  }

  .nav a {
    font-size: 0.86rem;
  }

  h1 {
    font-size: clamp(2.5rem, 11vw, 3.4rem);
  }

  .hero-actions .button {
    width: 100%;
  }

  .book-grid {
    grid-template-columns: 1fr;
    gap: 2.4rem;
  }

  .hero-product,
  .book-card {
    width: min(100%, 430px);
    margin-inline: auto;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer a {
    word-break: break-word;
  }
}
