/* Inspiré du parcours johnniewalker.com : fond crème, titres condensés, texte serif, boutons noirs. */
:root {
  --bg: #fdf4de;
  --fg: #111;
  --muted: #5e584c;
  --line: #d8ccb1;
  --field: #fff;
  --btn: #111;
  --btn-fg: #fff;
  --accent: #b8913f;
  --stage: #8a867e;
  --err: #b3261e;
  --pad: 20px;
  --h: Antonio, "Oswald", Impact, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --caps: Montserrat, system-ui, sans-serif;
  color-scheme: light;
}
body[data-brand="cr"] { --btn: #3c1260; --accent: #b8913f; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 17px/1.5 var(--serif);
  min-height: 100dvh; -webkit-tap-highlight-color: transparent;
  transition: background-color .45s ease, color .45s ease;
}
/* Changement de marque (JW ↔ CR) : couleurs animées */
.btn, .dots button, .round, .chk input, .zoom input, .pick-name {
  transition: background-color .45s ease, color .45s ease, border-color .45s ease, opacity .25s;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* En-tête */
.top {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
}
.logo { grid-column: 2; text-align: center; font: 600 12px/1 var(--caps); letter-spacing: .28em; text-transform: uppercase; }
.back, .lang { width: 44px; height: 40px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.back { grid-column: 1; }
.lang { grid-column: 3; font: 600 12px/1 var(--caps); letter-spacing: .12em; }

main { max-width: 620px; margin: 0 auto; padding: 4px var(--pad) calc(env(safe-area-inset-bottom) + 32px); }
.screen { animation: in .3s ease; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }

/* Typo */
h1 { font: 700 clamp(34px, 9.5vw, 48px)/1.02 var(--h); text-transform: uppercase; letter-spacing: .005em; margin: 18px 0 14px; }
h2 { font: 700 26px/1.1 var(--h); text-transform: uppercase; margin: 0; }
.eyebrow { display: block; font: 500 12px/1 var(--caps); letter-spacing: .2em; text-transform: uppercase; margin: 22px 0 0; }
.eyebrow + h1 { margin-top: 10px; }
.lead { margin: 0 0 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.fine { color: var(--muted); font-size: 14px; text-align: center; margin-top: 28px; }
.err { color: var(--err); font: 500 14px/1.4 var(--caps); margin: 10px 0 0; }
.hint { font: 500 12px/1.4 var(--caps); color: var(--muted); margin: 6px 0 0; letter-spacing: .02em; }
.hint.right { text-align: right; margin-top: 14px; }

/* Boutons */
.btn {
  display: block; width: 100%; margin-top: 12px; padding: 18px 16px; border: 1px solid var(--btn);
  background: transparent; color: var(--btn); cursor: pointer; border-radius: 0;
  font: 600 13px/1 var(--caps); letter-spacing: .2em; text-transform: uppercase;
}
.btn.primary { background: var(--btn); color: var(--btn-fg); }
.btn:disabled { opacity: .3; cursor: default; }
.stack { margin-top: 18px; }
.actions { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 18px; }
.actions:has(#change-photo:not([hidden])), #s-preview .actions { grid-template-columns: 1fr 1.4fr; gap: 10px; }
.actions .btn { margin-top: 0; }

/* Âge */
.dob { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 10px; margin: 10px 0 16px; }
.dob input, .line {
  width: 100%; min-width: 0; padding: 16px 14px; background: var(--field); border: 1px solid #a49b88; border-radius: 0;
  font: 500 18px/1.2 var(--caps); letter-spacing: .08em;
}
.dob input { text-align: center; font-size: 20px; }
.dob input:focus, .line:focus { outline: 2px solid var(--fg); outline-offset: -1px; }

/* Choix de la bouteille (tap) */
.bottles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; margin: 18px 0 6px; }
.pick { display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: end; gap: 12px; padding: 10px 4px 14px; border: 0; background: none; cursor: pointer;
  transition: opacity .25s, transform .25s; }
.pick img { height: min(46vh, 420px); max-width: 100%; object-fit: contain; display: block;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,.18)); }
.pick-name { font: 700 19px/1.1 var(--h); text-transform: uppercase; text-align: center; padding-bottom: 6px;
  border-bottom: 2px solid transparent; min-height: 2.6em; align-self: start; display: flex; align-items: flex-start; }
.bottles.has-sel .pick:not(.on) { opacity: .4; transform: scale(.95); }
.pick.on .pick-name { border-bottom-color: var(--fg); }
.nav { width: 44px; height: 44px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }

/* Conditions */
.terms { margin: 0 0 18px; padding-left: 20px; font-size: 15px; line-height: 1.45; }
.terms li { margin-bottom: 6px; }
.chk { display: flex; gap: 12px; align-items: flex-start; font: 500 14px/1.45 var(--caps); cursor: pointer; }
.chk input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--fg); }

/* Éditeur */
.stage {
  position: relative; margin: 6px calc(var(--pad) * -1) 0;
  touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden;
}
.stage.photo { background: var(--stage); }
#cv { display: block; width: 100%; }
.add-photo {
  position: absolute; display: grid; place-content: center; justify-items: center; gap: 2px;
  border: 2px dashed rgba(255,255,255,.75); background: rgba(0,0,0,.28); cursor: pointer; color: #fff;
  font: 600 11px/1.2 var(--caps); letter-spacing: .16em; text-transform: uppercase;
}
.add-photo .plus { font: 300 30px/1 var(--caps); }
.designs { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
.designs .nav svg { width: 24px; height: 24px; }
.dots { display: flex; gap: 8px; }
.dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 1px solid var(--fg); background: transparent; cursor: pointer; }
.dots button.on { background: var(--fg); }
.zoom { display: flex; align-items: center; gap: 14px; margin-top: 10px; font: 400 26px/1 var(--caps); }
.zoom input { flex: 1; -webkit-appearance: none; appearance: none; height: 30px; background: transparent; }
.zoom input::-webkit-slider-runnable-track { height: 2px; background: var(--fg); }
.zoom input::-moz-range-track { height: 2px; background: var(--fg); }
.zoom input::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--fg); margin-top: -11px; border: 0; }
.zoom input::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--fg); border: 0; }
.line-lbl { display: block; margin: 18px 0 8px; font: 500 12px/1 var(--caps); letter-spacing: .3em; text-transform: uppercase; }
select.line { font-size: 16px; letter-spacing: .02em; appearance: none; -webkit-appearance: none;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23111' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center / 20px; }

/* Alerte « photo trop petite » posée sur la zone photo */
.lowres { position: absolute; pointer-events: none; display: flex; align-items: flex-start; justify-content: center; padding: 6px; border: 2px solid #ffc53d; }
.lowres .pill { display: flex; gap: 8px; align-items: center; max-width: 100%; padding: 5px 10px 5px 6px; border-radius: 999px;
  background: rgba(20, 14, 0, .88); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4); font-family: var(--caps); }
.lowres .ico { flex: none; width: 0; height: 0; position: relative; font-size: 0;
  border-left: 11px solid transparent; border-right: 11px solid transparent; border-bottom: 19px solid #ffc53d; }
.lowres .ico::after { content: "!"; position: absolute; left: -3px; top: 4px; font: 800 13px/1 system-ui, sans-serif; color: #2a1e00; }
.lowres b { display: block; font-size: 12px; line-height: 1.2; }
.lowres small { display: block; font-size: 10.5px; line-height: 1.25; opacity: .85; }

/* Aperçu bouteille */
.mock { position: relative; margin: 0 calc(var(--pad) * -1); height: min(52vh, 600px); overflow: hidden; }
#mock-cv { width: 100%; height: 100%; display: block; }
.round { position: absolute; top: 50%; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--fg);
  background: transparent; cursor: pointer; font: 400 20px/1 var(--caps); display: grid; place-items: center; }
.round.out { left: 14px; } .round.in { right: 14px; }

/* Code */
.code { margin: 10px 0 12px; text-align: center; font: 700 76px/1 var(--h); letter-spacing: .14em; padding-left: .14em; }
.status { display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center;
  font: 500 15px/1.4 var(--caps); min-height: 3em; padding: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.status[data-st="pending"] .dot, .status[data-st="approved"] .dot { background: #d79a12; animation: pulse 1.6s infinite; }
.status[data-st="queued"] .dot, .status[data-st="printing"] .dot { background: #2a6fd6; animation: pulse 1s infinite; }
.status[data-st="printed"] .dot { background: #2e9d5b; }
.status[data-st="failed"] .dot, .status[data-st="rejected"] .dot { background: var(--err); }
@keyframes pulse { 50% { opacity: .3; } }
.done-img { display: block; margin: 20px auto 8px; max-width: 100%; max-height: 34vh; filter: drop-shadow(0 6px 14px rgba(0,0,0,.25)); }

/* Attente */
.busy { position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: rgba(253,244,222,.85); backdrop-filter: blur(3px); font: 500 14px/1 var(--caps); letter-spacing: .1em; }
.spin { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(0,0,0,.12); border-top-color: var(--fg); animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.busy p { margin: 0; }

/* Modale d'alerte (ne décale jamais la mise en page) */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px;
  background: rgba(17,17,17,.45); animation: in .2s ease; }
.modal-box { width: min(420px, 100%); background: var(--bg); padding: 28px 24px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal-box p { margin: 0 0 8px; font: 400 18px/1.45 var(--serif); }
