/* ============================================================
   Tramesta — système visuel
   Conforme à docs/Charte_de_design.png
   ------------------------------------------------------------
   Couleurs, typographie et composants repris de la charte à
   l'identique. Les écrans qui n'existent pas encore (collections,
   saisons, recherche, favoris) ne sont pas simulés : mieux vaut
   une navigation courte et vraie qu'un décor qui ne mène nulle part.
   ============================================================ */

:root {
  /* Charte des couleurs */
  --creme: #fbf6ef;
  --sable: #f2e9dc;
  --olive: #6f7b57;
  --sauge-fonce: #4e5a43;
  --terracotta: #c7743a;
  --caramel: #d9a16b;
  --menthe-douce: #9bc49a;
  --charbon: #1f2a23;

  /* Déclinaisons de service (survol, actif, filets) */
  --terracotta-survol: #b96a33;
  --terracotta-actif: #9e5628;
  --olive-survol: #61694b;
  --blanc: #ffffff;
  --trait: #e6dbc9;
  --texte-doux: #6b7166;

  /* Typographie de la charte */
  --titres: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --interface: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --rayon: 16px;
  --rayon-s: 10px;
  --rayon-pilule: 999px;
  --ombre-carte: 0 1px 2px rgba(31, 42, 35, 0.03),
    0 10px 30px rgba(31, 42, 35, 0.05);
  --largeur: 64rem;
  --largeur-texte: 42rem;
}

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

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

body {
  margin: 0;
  background: var(--creme);
  color: var(--charbon);
  font-family: var(--interface);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Typographie ─────────────────────────────────────────── */

h1 {
  font-family: var(--titres);
  font-weight: 700;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 2.75rem); /* 32 → 44 */
  line-height: 1.27; /* 44/56 */
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

h2 {
  font-family: var(--titres);
  font-weight: 600;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); /* 22 → 28 */
  line-height: 1.29; /* 28/36 */
  margin: 0 0 1rem;
}

.surtitre {
  font-family: var(--interface);
  font-size: 0.8125rem; /* 13/18 */
  line-height: 1.38;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--texte-doux);
  margin: 0 0 0.35rem;
}

.chapeau {
  color: var(--texte-doux);
  margin: 0 0 1.75rem;
}

.meta {
  font-size: 0.8125rem;
  line-height: 1.38;
  color: var(--texte-doux);
}

a {
  color: var(--sauge-fonce);
}

/* ─── Ossature ────────────────────────────────────────────── */

.page {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 2rem 1.25rem 6rem;
}

.page--etroite {
  max-width: var(--largeur-texte);
}

.pied {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 0 1.25rem 6rem;
  font-size: 0.8125rem;
  color: var(--texte-doux);
}

/* ─── En-tête ─────────────────────────────────────────────── */

.entete {
  background: var(--blanc);
  border-bottom: 1px solid var(--trait);
  position: sticky;
  top: 0;
  z-index: 20;
}

.entete__interieur {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.marque {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--sauge-fonce);
  flex-shrink: 0;
}

.marque svg {
  display: block;
  width: 28px;
  height: 28px;
}

/* Logo complet dans l'en-tête, identique à la page de connexion. */
.marque__logo {
  display: block;
  height: 34px;
  width: auto;
}

.marque__mot {
  font-family: var(--titres);
  font-weight: 600;
  font-size: 1.375rem;
  line-height: 1;
}

/* Onglets de navigation — pastilles, actif en olive plein */
.onglets {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.onglet {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--charbon);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--rayon-pilule);
  background: var(--sable);
  white-space: nowrap;
}

.onglet:hover {
  background: #e9dfcd;
}

.onglet[aria-current="page"] {
  background: var(--olive);
  color: var(--blanc);
  font-weight: 600;
}

.onglet[aria-current="page"]:hover {
  background: var(--olive-survol);
}

.onglet--nu {
  background: transparent;
  color: var(--texte-doux);
}

.onglet--nu:hover {
  background: var(--sable);
  color: var(--charbon);
}

/* ─── Barre d'onglets mobile (pouce en cuisine) ───────────── */

.barre-mobile {
  display: none;
}

/* ─── Boutons ─────────────────────────────────────────────── */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--interface);
  font-size: 1rem; /* 16/20 */
  font-weight: 600;
  line-height: 1.25;
  padding: 0.8125rem 1.5rem;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--rayon-s);
  background: var(--terracotta);
  color: var(--blanc);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.bouton:hover {
  background: var(--terracotta-survol);
}

.bouton:active {
  background: var(--terracotta-actif);
}

.bouton--secondaire {
  background: var(--blanc);
  color: var(--charbon);
  border-color: var(--trait);
}

.bouton--secondaire:hover {
  background: var(--creme);
  border-color: var(--olive);
}

.bouton--texte {
  background: transparent;
  color: var(--charbon);
  padding: 0.5rem 0;
  min-height: 0;
}

.bouton--texte:hover {
  background: transparent;
  color: var(--sauge-fonce);
}

.bouton--pleine-largeur {
  width: 100%;
}

/* Suppression : rouge terreux, clairement distinct des actions bénignes. */
.bouton--danger {
  background: #9e2f22;
  color: var(--blanc);
}

.bouton--danger:hover {
  background: #872619;
}

.bouton--danger-texte {
  background: transparent;
  color: #9e2f22;
  border-color: transparent;
}

.bouton--danger-texte:hover {
  background: #f7e9e6;
}

.actions-fiche {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 2rem;
}

/* ─── Cartes ──────────────────────────────────────────────── */

.carte {
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}

.carte > :first-child {
  margin-top: 0;
}

.carte--sable {
  background: var(--sable);
  border-color: transparent;
}

/* ─── Liste des recettes ──────────────────────────────────── */

.recettes {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.recette-carte {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 1.35rem 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.recette-carte:hover {
  border-color: var(--olive);
  transform: translateY(-2px);
}

/* Carte avec photo : image en tête, texte dessous. */
.recette-carte--photo {
  padding: 0;
  overflow: hidden;
}

.recette-carte__photo {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: var(--sable);
}

.recette-carte--photo .recette-carte__titre,
.recette-carte--photo .recette-carte__meta {
  padding-left: 1.35rem;
  padding-right: 1.35rem;
}

.recette-carte--photo .recette-carte__titre {
  padding-top: 1rem;
}

.recette-carte--photo .jeton {
  margin-left: 1.35rem;
  margin-bottom: 1.35rem;
}

.recette-carte__titre {
  font-family: var(--titres);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.3;
}

.recette-carte__meta {
  font-size: 0.8125rem;
  color: var(--texte-doux);
}

.jeton {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--sauge-fonce);
  background: var(--sable);
  border-radius: var(--rayon-pilule);
  padding: 0.2rem 0.65rem;
  margin-top: 0.5rem;
  align-self: flex-start;
}

/* ─── Fiche : photo en tête + cartouche du titre (charte) ─── */

.fiche__hero {
  margin-bottom: 2rem;
}

.fiche__photo {
  width: 100%;
  max-height: 26rem;
  object-fit: cover;
  border-radius: var(--rayon);
  display: block;
  background: var(--sable);
}

/* Le titre et la note vivent dans un cadre crème posé sur le bas de la
   photo — comme la charte. Fond opaque = contraste garanti, quelle que soit
   l'image. */
.fiche__cartouche {
  position: relative;
  margin: -3.75rem 1.25rem 0;
  background: var(--creme);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: 0 14px 34px -20px rgba(31, 42, 35, 0.55);
  padding: 1.25rem 1.6rem;
}

.fiche__cartouche h1 {
  margin: 0;
}

/* Sans photo : le cartouche redevient un simple bloc de titre. */
.fiche__hero--sans-photo .fiche__cartouche {
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.fiche__note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.55rem 0 0;
  font-family: var(--interface);
  font-size: 0.95rem;
  color: var(--texte-doux);
}

.fiche__note .etoiles {
  font-size: 1.1rem;
}

.fiche__note-valeur {
  font-weight: 600;
  color: var(--charbon);
}

.photo-edition img {
  width: 100%;
  max-width: 20rem;
  border-radius: var(--rayon-s);
  display: block;
  margin-bottom: 0.5rem;
}

input[type="file"] {
  min-height: 0;
  padding: 0.55rem 0.6rem;
  font-size: 0.9rem;
  background: var(--blanc);
}

/* ─── Fiche : bandeau de repères ──────────────────────────── */

.reperes {
  display: flex;
  flex-wrap: wrap;
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 1.1rem 0.5rem;
  margin: 1.5rem 0 2rem;
}

.repere {
  flex: 1 1 7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  text-align: center;
  padding: 0 0.75rem;
  border-right: 1px solid var(--trait);
}

.repere:last-child {
  border-right: 0;
}

.repere svg {
  width: 26px;
  height: 26px;
  color: var(--caramel);
  margin-bottom: 0.15rem;
}

.repere__valeur {
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
}

.repere__nom {
  font-size: 0.75rem;
  color: var(--texte-doux);
}

/* ─── Fiche : deux colonnes ───────────────────────────────── */

.fiche-corps {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
}

.section__entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.section__entete h2 {
  margin: 0;
}

/* Ingrédients : liste à puces, comme la charte */
.ingredients {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ingredients li {
  position: relative;
  padding: 0 0 0.9rem 1.15rem;
}

.ingredients li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--olive);
}

/* Titre de section d'ingrédients (« VINAIGRETTE », « SALADE ») — charte. */
.ingredients__section {
  font-family: var(--interface);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--olive);
  margin: 1.4rem 0 0.8rem;
}

.section__entete + .ingredients__section {
  margin-top: 0.25rem;
}

.qte {
  font-weight: 600;
}

.origine {
  display: block;
  font-size: 0.75rem;
  color: var(--texte-doux);
  margin-top: 0.1rem;
}

/* Préparation : pastilles olive numérotées */
.etapes {
  counter-reset: etape;
  list-style: none;
  margin: 0;
  padding: 0;
}

.etapes li {
  counter-increment: etape;
  position: relative;
  padding: 0 0 1.35rem 2.85rem;
}

.etapes li::before {
  content: counter(etape);
  position: absolute;
  left: 0;
  top: -0.05rem;
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--olive);
  color: var(--blanc);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* Astuce */
.astuce {
  background: var(--sable);
  border-radius: var(--rayon-s);
  padding: 1.1rem 1.25rem;
  margin-top: 1.5rem;
}

.astuce h3 {
  font-family: var(--interface);
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.astuce p {
  font-size: 0.8125rem;
  color: var(--texte-doux);
  margin: 0;
}

/* Provenance */
.provenance {
  background: var(--sable);
  border-radius: var(--rayon-s);
  padding: 1rem 1.25rem;
  margin-top: 1.25rem;
}

.provenance .surtitre {
  margin-bottom: 0.2rem;
}

/* ─── Avis : notation et notes personnelles ───────────────── */

.avis {
  margin-top: 2.5rem;
}

.etoiles {
  color: var(--terracotta);
  letter-spacing: 1px;
}

/* Sélecteur d'étoiles : radios accessibles, remplissage en survol/sélection.
   L'ordre inversé (row-reverse) permet à « ~ » de teindre les étoiles à
   gauche de celle qu'on désigne. */
.etoiles-choix {
  display: inline-flex;
  flex-direction: row-reverse;
  border: 0;
  padding: 0;
  margin: 0 0 0.5rem;
}

.etoiles-choix input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.etoiles-choix label {
  font-size: 2rem;
  line-height: 1;
  color: var(--trait);
  cursor: pointer;
  padding: 0 1px;
  transition: color 0.12s ease;
}

.etoiles-choix label:hover,
.etoiles-choix label:hover ~ label,
.etoiles-choix input:checked ~ label {
  color: var(--terracotta);
}

.etoiles-choix input:focus-visible + label {
  outline: 2px solid var(--sauge-fonce);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Les notes personnelles des autres membres s'affichent comme des post-it
   épinglés sur la recette : la mémoire familiale, écrite à la main. */
.postits {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin-top: 1.5rem;
}

.postit {
  flex: 1 1 14rem;
  max-width: 20rem;
  margin: 0;
  padding: 1rem 1.15rem 0.9rem;
  background: #fbf3d9;
  border-radius: 3px;
  box-shadow: 0 8px 16px -10px rgba(31, 42, 35, 0.5);
  transform: rotate(-1deg);
}

.postit:nth-child(even) {
  background: #e9f1e0;
  transform: rotate(1.2deg);
}

.postit blockquote {
  margin: 0 0 0.6rem;
  font-family: var(--interface);
  color: var(--charbon);
}

.postit__auteur {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--sauge-fonce);
}

.postit__auteur .etoiles {
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Bascule métrique / impérial ─────────────────────────── */

.unites {
  display: inline-flex;
  background: var(--sable);
  border-radius: var(--rayon-pilule);
  padding: 4px;
  gap: 2px;
}

.unites button {
  font-family: var(--interface);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 0;
  background: transparent;
  color: var(--texte-doux);
  padding: 0.45rem 1rem;
  border-radius: var(--rayon-pilule);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.unites button:hover {
  color: var(--charbon);
}

.unites button[aria-pressed="true"] {
  background: var(--olive);
  color: var(--blanc);
}

/* ─── Formulaires ─────────────────────────────────────────── */

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin: 1.25rem 0 0.4rem;
}

.aide {
  font-size: 0.8125rem;
  color: var(--texte-doux);
  margin: 0.45rem 0 0;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  font-family: var(--interface);
  font-size: 1rem;
  color: var(--charbon);
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon-s);
  padding: 0.7rem 0.85rem;
  min-height: 48px;
}

textarea {
  line-height: 1.6;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #9a9c93;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--sauge-fonce);
  outline-offset: 2px;
}

/* Case à cocher : la légende à côté, pas au-dessus. */
.case {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 400;
  cursor: pointer;
}

.case input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  accent-color: var(--olive);
  flex-shrink: 0;
}

.rangee {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.rangee > * {
  flex: 1 1 7rem;
}

/* ─── Messages ────────────────────────────────────────────── */

.messages {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
}

.messages li {
  font-size: 0.9375rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--rayon-s);
  margin-bottom: 0.6rem;
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-left: 3px solid var(--menthe-douce);
}

.messages .error {
  border-left-color: var(--terracotta-actif);
}
.messages .warning {
  border-left-color: var(--caramel);
}
.messages .success {
  border-left-color: var(--olive);
}

/* ─── Écran vide ──────────────────────────────────────────── */

.vide {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
}

.vide svg {
  width: 46px;
  height: 46px;
  color: var(--olive);
  opacity: 0.55;
  margin-bottom: 0.75rem;
}

.vide p {
  color: var(--texte-doux);
  margin: 0 0 1.5rem;
}

/* ─── Connexion ───────────────────────────────────────────── */

.accueil {
  max-width: 24rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
  text-align: center;
}

.accueil__logo {
  max-width: 100%;
  height: auto;
}

.accueil__devise {
  font-family: var(--titres);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--texte-doux);
  margin: 0.25rem 0 2rem;
}

.accueil form {
  text-align: left;
}

.accueil .bouton {
  width: 100%;
  margin-top: 1.75rem;
}

.accueil ul {
  list-style: none;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--terracotta-actif);
}

/* ─── Mobile ──────────────────────────────────────────────── */

@media (max-width: 52rem) {
  .fiche-corps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 40rem) {
  .entete__interieur {
    padding: 0.6rem 1rem;
    gap: 0.75rem;
    justify-content: center;
  }

  .marque__logo {
    height: 30px;
  }

  /* La navigation passe en barre basse : à portée du pouce en cuisine. */
  .onglets {
    display: none;
  }

  .page {
    padding: 1.5rem 1rem 6.5rem;
  }

  .pied {
    padding: 0 1rem 6.5rem;
  }

  .reperes {
    padding: 1rem 0.25rem;
  }

  .repere {
    flex-basis: 25%;
    padding: 0 0.35rem;
  }

  .barre-mobile {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: var(--blanc);
    border-top: 1px solid var(--trait);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .barre-mobile a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.6rem 0.25rem 0.7rem;
    text-decoration: none;
    color: var(--texte-doux);
    font-size: 0.6875rem;
  }

  .barre-mobile a[aria-current="page"] {
    color: var(--olive);
    font-weight: 600;
  }

  .barre-mobile svg {
    width: 22px;
    height: 22px;
  }
}

/* ─── Confort et impression ───────────────────────────────── */

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

@media print {
  .entete,
  .onglets,
  .barre-mobile,
  .unites,
  .pied,
  .bouton {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .page {
    max-width: none;
    padding: 0;
  }
  .fiche-corps {
    grid-template-columns: 1fr 1fr;
  }
  .carte,
  .reperes {
    border-color: #ddd;
    break-inside: avoid;
  }
}
