/* Winer · fiche de dégustation. Ivoire, encre, bordeaux ; serif pour les titres ; mobile-first. */
:root {
  --paper: #f7f3ec; --paper-2: #efe8dd; --card: #fffdf9; --line: #e3dbcf; --line-2: #cdc2b3;
  --ink: #1e1a1b; --ink-2: #5d5455; --ink-3: #8d8384;
  --wine: #6b1f2e; --wine-2: #521521; --wine-tint: #f1e6e6;
  --haute: #3d7a4e; --moyenne: #b6851f; --basse: #c3612f; --aucune: #a9a09a;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 12px; --r-lg: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; margin: 0; }
h1 { font-size: clamp(1.7rem, 2.4vw + 1rem, 2.6rem); line-height: 1.12; }
h2 { font-size: 1.35rem; }
p { margin: 0; }
.muted { color: var(--ink-3); }
[hidden] { display: none !important; }
a { color: var(--wine); }

/* barre */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 14px 20px; background: rgba(247,243,236,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--sans); font-weight: 700; font-size: .95rem; color: var(--ink); text-decoration: none; letter-spacing: .14em; text-transform: uppercase; }
.bar-title { color: var(--ink-2); font-size: .95rem; flex: 1; min-width: 0; }
@media (max-width: 560px) { .bar-title { display: none; } }
.small { font-size: .85rem; }
.link { background: none; border: 0; color: var(--wine); font: inherit; font-size: .95rem; cursor: pointer; padding: 6px 0; margin-left: auto; white-space: nowrap; }
.link:hover { text-decoration: underline; }

/* vues */
.view { max-width: 860px; margin: 0 auto; padding: 20px 16px 120px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--wine); margin-bottom: 10px; }
.hero { padding: 18px 0 20px; }
.lead { color: var(--ink-2); font-size: 1.05rem; max-width: 60ch; margin-top: 12px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }

/* accueil */
.upload { display: block; }
.upload input { display: none; }
.upload-tile { width: 100%; min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 18px; text-align: center; cursor: pointer; color: var(--ink-2); transition: border-color .15s, background .15s; }
.upload-tile:hover, .upload.over .upload-tile { border-color: var(--wine); background: var(--wine-tint); }
.upload-tile svg { color: var(--wine); margin-bottom: 2px; }
.upload-tile strong { color: var(--ink); font-weight: 600; }
.upload-hint { font-size: .82rem; color: var(--ink-3); }
.thumbs-row { margin-top: 12px; }
.thumbs-label { display: block; font-size: .82rem; color: var(--ink-3); margin-bottom: 8px; }
.thumbs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.thumbs .thumb { position: relative; }
.thumbs .thumb { flex: none; }
.thumbs img { height: 96px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.12); display: block; }
.thumbs .rm { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(30,26,27,.75); color: #fff; font-size: .8rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.form-msg { color: var(--basse); font-size: .9rem; margin: 10px 0 0; }
.field { display: block; margin: 18px 0 16px; }
.field span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.field em { font-style: normal; font-weight: 400; color: var(--ink-3); }
input[type=text], textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); }
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--wine); box-shadow: 0 0 0 3px var(--wine-tint); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 24px; border-radius: 999px; border: 1px solid var(--wine); background: var(--wine); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--wine-2); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: transparent; color: var(--wine); }
.btn.ghost:hover { background: var(--wine-tint); }
.btn.small { padding: 9px 16px; font-size: .9rem; }
#go { width: 100%; }
@media (min-width: 640px) { #go { width: auto; } }

/* analyse */
.analysis { text-align: center; padding-top: 24px; }
.glass { width: 96px; margin: 0 auto 14px; }
.glass svg { width: 100%; height: auto; }
.glass-line { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; }
.wine-fill { fill: var(--wine); opacity: .18; }
.wave { fill: var(--wine); animation: wave 2.4s linear infinite; }
@keyframes wave { from { transform: translateX(-120px); } to { transform: translateX(0); } }
.analysis.done .wave, .analysis.failed .wave { animation: none; }
.analysis.failed .wave, .analysis.failed .wine-fill { opacity: .35; }
.tasks { list-style: none; margin: 26px auto 0; padding: 0; max-width: 460px; text-align: left; display: grid; gap: 4px; }
.tasks li { display: flex; align-items: center; gap: 12px; padding: 8px 4px; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.tasks li .dur { margin-left: auto; font-size: .78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tasks li:last-child { border-bottom: 0; }
.tasks .ico { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; }
.tasks li.running { color: var(--ink); }
.tasks li.running .ico { border-color: var(--wine); border-top-color: transparent; animation: spin .8s linear infinite; }
.tasks li.done { color: var(--ink-2); }
.tasks li.done .ico { background: var(--ink); border-color: var(--ink); color: #fff; }
.tasks li.error .ico { background: var(--basse); border-color: var(--basse); color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.findings { list-style: none; margin: 22px auto 0; padding: 0; max-width: 460px; text-align: left; display: grid; gap: 8px; color: var(--ink-2); font-size: .95rem; }
.findings li { padding-left: 18px; position: relative; animation: rise .35s ease; }
.findings li::before { content: ""; position: absolute; left: 0; top: .6em; width: 8px; height: 8px; border-radius: 50%; background: var(--wine); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.error { color: var(--basse); font-weight: 600; margin-top: 16px; }
#retry { margin-top: 12px; }

/* relecture */
.wine-head { padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.wine-head .eyebrow { margin-bottom: 6px; }
.wine-head .facts { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); margin-top: 8px; font-size: .95rem; }
.wine-head .facts b { color: var(--ink); font-weight: 600; }
.wine-head .note { margin-top: 12px; color: var(--ink-2); font-size: .92rem; border-left: 2px solid var(--wine); padding-left: 12px; }
.sections { display: none; position: sticky; top: 57px; z-index: 15; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; margin: 0 -18px; padding-left: 18px; padding-right: 18px; background: var(--paper); scrollbar-width: none; }
.sections::-webkit-scrollbar { display: none; }
.sections a { flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); text-decoration: none; font-size: .9rem; background: var(--card); }
.sections a small { color: var(--ink-3); margin-left: 4px; }
.sections a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.sections a.active small { color: rgba(255,255,255,.7); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ink-3); font-size: .76rem; margin: 6px 0 0; }
.c { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.c.haute { background: var(--haute); } .c.moyenne { background: var(--moyenne); } .c.basse { background: var(--basse); } .c.aucune { background: var(--aucune); }
.review h2 { margin: 22px 0 8px; font-size: 1.15rem; }
.review h2 small { font-family: var(--sans); font-size: .85rem; color: var(--ink-3); margin-left: 10px; font-weight: 400; }
.q { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px 10px; margin-bottom: 6px; }
.q.hidden { display: none; }
.q.changed { border-color: var(--wine); }
.q .head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.q .enonce { font-weight: 600; line-height: 1.35; font-size: .95rem; }
.q .conf { flex: none; font-size: .72rem; color: var(--ink-3); white-space: nowrap; }
.q .conf .c { margin-right: 5px; }
.q .opts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; align-items: center; }
.q .opts label { position: relative; }
.q .opts input { position: absolute; opacity: 0; width: 0; height: 0; }
.q .opts span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-size: .86rem; line-height: 1.25; transition: background .12s, border-color .12s, color .12s; }
.q .opts span:hover { border-color: var(--ink-3); }
.q .opts input:checked + span { background: var(--wine); border-color: var(--wine); color: #fff; }
.q .opts input:focus-visible + span { box-shadow: 0 0 0 3px var(--wine-tint); }
.q .opts .clear { background: none; border: 0; color: var(--ink-3); font: inherit; font-size: .78rem; cursor: pointer; padding: 6px 4px; }
.q .opts .clear:hover { color: var(--wine); }
.q .opts .more-btn { background: none; border: 1px dashed var(--line-2); border-radius: 999px; color: var(--ink-3); font: inherit; font-size: .82rem; padding: 6px 12px; cursor: pointer; }
.q .opts .more-btn:hover { color: var(--wine); border-color: var(--wine); }
.q .why { font-size: .78rem; color: var(--ink-3); line-height: 1.45; overflow-wrap: anywhere; }
.q .why .srcs { color: var(--ink-3); }
.q .why a { color: var(--wine); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.q .why a:hover { border-bottom-color: var(--wine); }
.q blockquote { margin: 5px 0 0; padding: 2px 0 2px 10px; border-left: 2px solid var(--wine); font-family: var(--sans); font-style: normal; color: var(--ink-2); font-size: .84rem; line-height: 1.45; }
.q .warn { color: var(--basse); font-size: .76rem; margin-top: 3px; }
.q .why .sep { margin: 0 .5em; color: var(--line-2); }
.q .why a, .notes a { overflow-wrap: anywhere; word-break: break-word; }
.q .why .sep { white-space: nowrap; }
.q, .notes li { min-width: 0; max-width: 100%; }
.q .note-ref { color: var(--wine); text-decoration: none; border-bottom: 1px dotted var(--wine); }
.notes { margin: 0; padding-left: 22px; font-size: .84rem; color: var(--ink-2); line-height: 1.5; }
.notes li { margin-bottom: 10px; scroll-margin-top: 80px; }
.notes .note-src { display: block; font-size: .78rem; color: var(--ink-3); margin-top: 2px; }
.notes li:target { background: var(--wine-tint); border-radius: 6px; padding: 2px 6px; }
.own { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }
.own h2 { margin-bottom: 4px; }
.own-form { display: grid; gap: 10px; margin-top: 14px; max-width: 640px; }
.cq-options { display: grid; gap: 8px; }
.cq-row { display: flex; gap: 8px; align-items: center; }
.cq-row input { flex: 1; }
.cq-del { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: #fff; color: var(--ink-3); cursor: pointer; font-size: .85rem; }
.cq-del:hover { color: var(--wine); border-color: var(--wine); }
#cq-more { justify-self: start; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--ink-2); font-size: .92rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--wine); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--wine-tint); }
.row { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.row.wrap { flex-wrap: wrap; justify-content: center; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: .92rem; }
.custom-q .remove { float: right; background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 1rem; padding: 0 4px; }
.validate-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: rgba(247,243,236,.92); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.validate-bar > * { max-width: 820px; }
.validate-bar span { font-size: .9rem; }
@media (min-width: 900px) { .validate-bar { padding-left: calc(50% - 410px); padding-right: calc(50% - 410px); } }
@media (max-width: 560px) { .validate-bar span { display: none; } .validate-bar .btn { width: 100%; } }

/* résultat */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(30,26,27,.45); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
@media (min-width: 640px) { .sheet { align-items: center; padding: 20px; } }
.sheet-card { background: var(--card); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 26px 22px calc(22px + env(safe-area-inset-bottom)); text-align: center; animation: rise .3s ease; }
@media (min-width: 640px) { .sheet-card { border-radius: 22px; } }
.sheet-check { width: 56px; height: 56px; border-radius: 50%; background: var(--haute); color: #fff; font-size: 28px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.sheet .row { margin-top: 16px; }
.sheet details { margin-top: 16px; text-align: left; }
.sheet summary { cursor: pointer; color: var(--ink-2); font-size: .9rem; }
.json { background: #1e1a1b; color: #efe6e1; padding: 14px; border-radius: 10px; white-space: pre-wrap; font-size: 12px; max-height: 50vh; overflow: auto; margin-top: 10px; }

/* connexion */
.login { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 20px 16px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 1.6rem; margin-bottom: 4px; }
.login-card .btn { width: 100%; margin-top: 4px; }
input[type=password] { width: 100%; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); }
input[type=password]:focus { outline: none; border-color: var(--wine); box-shadow: 0 0 0 3px var(--wine-tint); }
