/* ------------------------------------------------------------------
   Polices auto-hébergées.
   Aucun appel à un serveur tiers : l'IP des visiteurs n'est transmise
   à personne, et les fichiers sont mis en cache par le navigateur.
   Sous-ensemble latin uniquement — suffisant pour le français.
   Les caractères japonais (頂, 忍, 湯…) utilisent la police système,
   comme c'était déjà le cas auparavant.
------------------------------------------------------------------ */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/fraunces-var-latin.woff2') format('woff2') tech('variations'),
       url('fonts/fraunces-var-latin.woff2') format('woff2-variations'),
       url('fonts/fraunces-var-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/plex-sans-400-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/plex-sans-600-latin.woff2') format('woff2');
}

/* Le mono n'est jamais appelé avec une graisse explicite : la plage
   400–500 évite que le navigateur synthétise une fausse graisse. */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('fonts/plex-mono-500-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/plex-mono-600-latin.woff2') format('woff2');
}

:root {
  --bg: #14151a;
  --surface: #1c1d24;
  --surface-alt: #24262f;
  --gold: #e8a33d;
  --chili: #c1443d;
  --paper: #f2efe7;
  --muted: #8b8d98;
  --line: #33353f;

  --font-display: 'Fraunces', serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
}

a { color: inherit; }

/* ---------- Layout shell ---------- */

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--gold);
  color: var(--bg);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  z-index: 100;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* ---------- Header ---------- */

header.site-head {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-head .mark {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-transform: uppercase;
}

.site-head .mark span {
  color: var(--muted);
}

/* ---------- Hero ---------- */

.hero {
  padding: 88px 0 64px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.hero .eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.hero .eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--gold);
  display: inline-block;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(48px, 9vw, 104px);
  line-height: 0.92;
  margin: 0 0 24px;
  letter-spacing: -0.01em;
}

.hero p {
  max-width: 520px;
  color: var(--muted);
  font-size: 17px;
  margin: 0;
}

/* ---------- Barre de commande : recherche + filtres ---------- */

.menu-section {
  padding: 56px 0 100px;
}

.controls {
  display: grid;
  gap: 22px;
  padding: 22px 0 24px;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  margin-bottom: 28px;
}

.control-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.search-field input[type="search"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 14px;
  transition: border-color 0.18s ease;
}

.search-field input[type="search"]::placeholder {
  color: var(--muted);
}

.search-field input[type="search"]:focus {
  outline: none;
  border-color: var(--gold);
}

.filter-group {
  min-width: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 14px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.chip:hover {
  color: var(--paper);
  border-color: var(--muted);
}

.chip[aria-pressed="true"] {
  color: var(--bg);
  background: var(--gold);
  border-color: var(--gold);
}

.chip:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (min-width: 861px) {
  .controls {
    grid-template-columns: minmax(240px, 1fr) auto auto;
    align-items: start;
    gap: 32px;
  }
}

.section-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ---------- Recipe grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}

.empty p {
  margin: 0 0 18px;
  font-size: 15px;
}

.btn-reset {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 18px;
  cursor: pointer;
}

.btn-reset:hover {
  background: var(--gold);
  color: var(--bg);
}

/* Ticket card */

.ticket {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px 20px 22px;
  cursor: pointer;
  position: relative;
  text-align: left;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.ticket .blurb { flex: 1; }

.ticket:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  background: var(--surface-alt);
}

.ticket:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* perforated edge, evokes a torn order ticket */
.ticket::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background-image: radial-gradient(circle, var(--bg) 1.5px, transparent 1.6px);
  background-size: 10px 3px;
  background-repeat: repeat-x;
}

.ticket-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stamp {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 1.5px solid var(--chili);
  color: var(--chili);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  transform: rotate(-8deg);
}

.source-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--gold);
  text-align: right;
  text-transform: uppercase;
  line-height: 1.4;
}

.type-tag {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.ticket h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  margin: 0;
  line-height: 1.15;
}

.ticket .blurb {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}

/* ---------- Modal / detail ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 12, 0.72);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  z-index: 50;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  max-width: 640px;
  width: 100%;
  padding: 36px 36px 32px;
  position: relative;
  animation: rise 0.22s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { color: var(--paper); border-color: var(--gold); }

.modal .source-tag { margin-bottom: 10px; text-align: left; }

.modal .type-tag { display: inline; margin-right: 8px; }

.modal h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  margin: 0 0 14px;
  max-width: 88%;
}

.modal-blurb {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 20px;
  max-width: 92%;
}

.modal .meta-row {
  border-top: none;
  border-bottom: 1px dashed var(--line);
  padding: 0 0 18px;
  margin-bottom: 22px;
}

.modal h4 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 12px;
}

.ingredient-list {
  list-style: none;
  margin: 0 0 30px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ingredient-list li {
  display: flex;
  gap: 10px;
  font-size: 14.5px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.ingredient-list .qty {
  font-family: var(--font-mono);
  color: var(--gold);
  min-width: 78px;
  flex-shrink: 0;
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 16px;
}

.step-list li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 12px;
  font-size: 14.5px;
  line-height: 1.55;
}

.step-list li::before {
  content: counter(step);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--chili);
  border: 1px solid var(--chili);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
}

.nav-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 14px;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.nav-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }

.nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.nav-btn-ghost { color: var(--muted); }

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 40px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

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

/* ---------- Impression : seule la recette ouverte part au papier ---------- */

@media print {
  body { background: #fff; color: #000; }
  .site-head, .hero, .menu-section, footer, .skip-link { display: none !important; }

  .modal-backdrop {
    position: static;
    display: block !important;
    background: none;
    padding: 0;
    overflow: visible;
  }

  .modal {
    background: #fff;
    border: none;
    max-width: none;
    padding: 0;
    animation: none;
  }

  .modal-close, .modal-nav { display: none !important; }
  .modal h2, .modal h4, .source-tag, .qty { color: #000 !important; }
  .step-list li::before { color: #000; border-color: #000; }
  .ingredient-list li { border-bottom: 1px solid #ccc; }
}
