/* Ruban — feuille de style unique.
   Une seule colonne étroite, gros contours encre + ombre dure décalée, une couleur vive pour l'action principale.
   Palette « Sapin », claire et sombre (selon le réglage de l'appareil). */

/* Polices auto-hébergées (licence SIL OFL, voir assets/fonts/), sous-ensemble latin. */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/bricolage-grotesque-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 800; font-display: swap; src: url(../fonts/bricolage-grotesque-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/nunito-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/nunito-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 800; font-display: swap; src: url(../fonts/nunito-latin-800-normal.woff2) format("woff2"); }

:root {
  --bg: #F6F7EE;
  --surface: #FFFFFF;
  --panel: #E6EDDA;
  --ink: #163A2E;
  --muted: #55705F;
  --line: #C3D3BC;
  --edge: #163A2E;
  --accent: #FFB547;
  --on-accent: #163A2E;
  --berry: #E8553D;
  --focus: #C2410C;
  --ok-bg: #D3EFD6;
  --ok-fg: #1B5A30;
  --display: "Bricolage Grotesque", "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1F19; --surface: #172E26; --panel: #1F3A30; --ink: #EFF7EC; --muted: #A9C4B2;
    --line: #3D5E50; --edge: #D6EBD3; --accent: #FFB547; --on-accent: #163A2E; --berry: #FF7A62; --focus: #FFB547;
    --ok-bg: #1E4638; --ok-fg: #B5EBCF; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; font-weight: 500; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.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; }

/* Gabarit */
.wrap { max-width: 720px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top { display: flex; align-items: center; gap: 12px; padding-block: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.01em; color: inherit; text-decoration: none; border-radius: 10px; }
.top .btn { margin-left: auto; }
main { display: flex; flex-direction: column; gap: 24px; padding-block: 16px 40px; }
footer { padding-block: 0 32px; font-size: 13px; color: var(--muted); }

.hero { text-align: center; display: flex; flex-direction: column; gap: 10px; padding-block: 12px 4px; }
h1 { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 6.4vw, 46px); line-height: 1.05; letter-spacing: -.025em; text-wrap: balance; overflow-wrap: anywhere; }
h2 { font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -.01em; }
.lead { color: var(--muted); font-size: 17px; text-wrap: balance; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 10px; }
.between { justify-content: space-between; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--edge); border-radius: 16px; background: var(--surface); color: var(--ink); font-weight: 800; padding: 10px 18px; box-shadow: 0 3px 0 var(--edge); cursor: pointer; white-space: nowrap; text-decoration: none; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 0 var(--edge); }
.btn-small { padding: 4px 12px; font-size: 14px; border-radius: 12px; box-shadow: 0 2px 0 var(--edge); }
.btn.on { background: var(--accent); color: var(--on-accent); }
.btn-ghost { background: none; border: 0; padding: 6px 8px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; }
.btn-ghost:hover { color: var(--ink); background: var(--panel); }
.btn-ghost.flush { margin-left: -8px; }
@media (prefers-reduced-motion: reduce) { .btn, .switch .track::after { transition: none; } }

/* Barre « À moi / Favoris » */
.strip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.strip-label { flex: none; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.strip-scroll { display: flex; align-items: center; flex: 1; gap: 8px; overflow-x: auto; min-width: 0; padding: 3px 3px 7px; scrollbar-width: thin; }
.strip .btn-ghost { flex: none; text-decoration: none; }
.fav-tab { flex: none; border: 2px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 5px 14px; font-weight: 800; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; max-width: 16em; overflow: hidden; text-overflow: ellipsis; }
.fav-tab:hover { border-color: var(--edge); }
.fav-tab.own { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.fav-tab[aria-current] { border-color: var(--edge); background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 0 var(--edge); }
.check.star { font-size: 20px; line-height: 1; color: var(--ink); }
.check.star[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* Blocs */
.card { background: var(--surface); border: 2px solid var(--edge); border-radius: 22px; box-shadow: 0 5px 0 var(--edge); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.dashed { border: 2px dashed var(--line); border-radius: 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-weight: 800; font-size: 14px; }
.field label span { font-weight: 500; color: var(--muted); }
.input { width: 100%; min-width: 0; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px 12px; font-weight: 700; }
.input::placeholder { color: var(--muted); opacity: .65; font-weight: 500; }
.input:focus { border-color: var(--edge); outline: none; }
.input[aria-invalid="true"] { border-color: var(--berry); }
/* minmax(0, …) : une colonne ne s'élargit jamais au-delà de sa part, même si son contenu (champ date) est plus large. */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
/* Champ date : sur iOS notamment, le champ natif impose sa propre largeur et déborde du cadre. */
input[type="date"].input { -webkit-appearance: none; appearance: none; display: block; max-width: 100%; height: calc(1.5em + 24px); }
input[type="date"].input::-webkit-date-and-time-value { text-align: start; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.grow { flex: 1 1 200px; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--ok-bg); color: var(--ok-fg); border-radius: 999px; padding: 3px 11px; font-size: 13px; font-weight: 800; }
.pill.plain { background: var(--panel); color: var(--muted); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step { background: var(--panel); border-radius: 18px; padding: 14px 16px; display: flex; gap: 12px; }
.num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.step b { display: block; font-family: var(--display); font-weight: 800; }
.step p { font-size: 14px; color: var(--muted); line-height: 1.35; }

.listhead { display: flex; flex-direction: column; gap: 8px; }
.listhead h1 { font-size: clamp(28px, 5.6vw, 40px); }
.url { font-weight: 800; overflow-wrap: anywhere; }

details summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); width: fit-content; border-radius: 8px; }
details[open] summary { margin-bottom: 14px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 5px; font-weight: 800; font-size: 14px; }

/* Cadeaux */
.gifts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.gift { display: flex; align-items: flex-start; gap: 14px; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.gift-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gift-name { font-weight: 800; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.gift-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 14px; color: var(--muted); }
.gift-meta > span { overflow-wrap: anywhere; }
.gift-meta .price { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.gift-meta a { color: inherit; font-weight: 700; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 2px; }
.tag { display: inline-flex; border-radius: 999px; padding: 0 9px; font-size: 13px; font-weight: 800; background: var(--panel); color: var(--muted); }
.tag.exact { background: var(--ink); color: var(--bg); }
.gift-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; font-weight: 800; margin-top: 6px; }
.gift-actions { display: flex; gap: 2px; flex: none; }
.gift.taken { background: transparent; }
.gift.taken .gift-name { text-decoration: line-through; text-decoration-color: var(--line); color: var(--muted); }
.gift.mine { border-color: var(--edge); box-shadow: 0 4px 0 var(--edge); }
.gift.gone { background: transparent; border-style: dashed; }
.check { flex: none; width: 38px; height: 38px; border-radius: 12px; border: 2px solid var(--edge); background: var(--surface); box-shadow: 0 3px 0 var(--edge); cursor: pointer; display: grid; place-items: center; padding: 0; color: var(--on-accent); }
.check svg { opacity: 0; }
.check[aria-checked="true"] { background: var(--accent); }
.check[aria-checked="true"] svg { opacity: 1; }
.check:disabled { cursor: not-allowed; background: var(--panel); border-color: var(--line); box-shadow: none; color: var(--muted); }
.check:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.who { margin-top: 10px; padding-top: 12px; border-top: 2px dashed var(--line); display: flex; flex-direction: column; gap: 8px; }

.progress { height: 14px; border: 2px solid var(--edge); border-radius: 999px; background: var(--surface); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); border-right: 2px solid var(--edge); }
.progress i.zero { border-right: 0; }
.chips { display: inline-flex; flex-wrap: wrap; background: var(--panel); border-radius: 14px; padding: 4px; gap: 2px; }
.chip { position: relative; border: 0; background: none; border-radius: 10px; padding: 6px 12px; font-weight: 800; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"], .chip:has(input:checked) { background: var(--surface); box-shadow: 0 2px 0 var(--edge); }
.chip input { position: absolute; opacity: 0; }
.chip:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; }
.switch .track { flex: none; width: 46px; height: 28px; border: 2px solid var(--edge); border-radius: 999px; background: var(--surface); position: relative; margin-top: 2px; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--edge); transition: left .12s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { left: 21px; background: var(--on-accent); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }

.empty { text-align: center; color: var(--muted); padding: 18px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); font-weight: 800; padding: 10px 18px; border-radius: 14px; z-index: 20; max-width: calc(100% - 32px); }
.toast:empty { display: none; }

@media (max-width: 600px) {
  .steps, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .gift { padding: 12px; gap: 12px; }
  .gift.owned { flex-direction: column; gap: 6px; }
  .gift.owned .gift-actions { margin-left: -8px; }
}
