/* Quincy Jones — At the Table · editorial system v3 (mobile-first) */
@font-face { font-family: Anuphan; src: url("/assets/fonts/Anuphan-Light.ttf") format("truetype"); font-weight: 300; font-display: swap; }
@font-face { font-family: Anuphan; src: url("/assets/fonts/Anuphan-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Anuphan; src: url("/assets/fonts/Anuphan-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Anuphan; src: url("/assets/fonts/Anuphan-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Noto Serif Thai"; src: url("/assets/fonts/NotoSerifThai-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Serif Thai"; src: url("/assets/fonts/NotoSerifThai-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }

:root {
  --ink: #211e1b; --surface: #2c2722; --paper: #f5f1e9; --paper-2: #ece6da; --paper-3: #e3dccd;
  --muted: #bfb4a5; --brass: #c6aa7a; --brass-deep: #8f7142; --line: #4b4238; --wine: #653541; --danger: #a03431;
  --focus: #987039; --ok: #4f6b4a;
  --serif: "Noto Serif Thai", Georgia, "Times New Roman", serif; --sans: Anuphan, Tahoma, sans-serif;
  --radius: 2px; --radius-dialog: 3px; --nav-height: 64px;
  --text: 16px; --text-sm: 14px; --text-xs: 12px;
  font-family: var(--sans); font-size: var(--text); line-height: 1.75; color: var(--paper); background: var(--ink);
  font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; min-height: 100dvh; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, a, summary, label { touch-action: manipulation; }
button { color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 5px; }
:is(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
input, select, textarea { min-width: 0; max-width: 100%; min-height: 48px; padding: 10px 12px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); font-size: 16px; }
input::placeholder, textarea::placeholder { color: #746b60; }
select { cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.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; }
.icon { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.icon.small { width: 14px; height: 14px; flex-basis: 14px; }
.icon.big { width: 32px; height: 32px; flex-basis: 32px; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h2 { font-size: clamp(24px, 2.2vw, 30px); font-weight: 400; line-height: 1.4; }
h3, h4 { font-weight: 500; line-height: 1.55; }
.page-width { width: min(1240px, calc(100% - 32px)); margin-inline: auto; }
.eyebrow { font-size: 11px; line-height: 1.6; letter-spacing: 0.14em; font-weight: 500; color: var(--muted); text-transform: uppercase; }
.muted, .quiet, .fine, .section-description { color: var(--muted); }
.fine { font-size: var(--text-xs); line-height: 1.7; }
.quiet { font-size: var(--text-sm); }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 200; background: var(--brass); color: var(--ink); padding: 10px 14px; border-radius: var(--radius); }
.skip-link:focus { top: 8px; }

/* Buttons */
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 20px; border: 1px solid transparent; border-radius: var(--radius); font-size: 16px; font-weight: 400; transition: background 0.18s, color 0.18s; text-decoration: none !important; }
.button.small { min-height: 44px; padding: 8px 14px; font-size: var(--text-sm); }
.button.primary { background: var(--brass); color: #241e16; border-color: var(--brass); }
.button.primary:hover:not(:disabled) { background: #d6be96; border-color: #d6be96; }
.button.secondary { background: transparent; border-color: var(--line); }
.button.secondary:hover:not(:disabled) { background: #ffffff10; }
.full { width: 100%; }
.text-button { padding: 10px 8px; min-height: 44px; min-width: 44px; font-size: var(--text-sm); text-align: left; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: #0000; transition: text-decoration-color 0.18s; }
.text-button:hover { text-decoration-color: currentColor; }
.text-button.inline { display: inline-block; min-height: 0; padding: 10px 2px; text-decoration-color: currentColor; }
.link-button { text-align: left; font: inherit; color: inherit; text-decoration: none; }
.link-button:hover { text-decoration: underline; text-underline-offset: 5px; }
.round-button, .close, .icon-button { border: 1px solid var(--line); width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; display: inline-grid; place-items: center; position: relative; }
.round-button.is-selected { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.icon-button[aria-pressed="true"] { color: var(--wine); border-color: var(--wine); }
.icon-button .count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--brass); color: var(--ink); font-size: 11px; font-weight: 600; display: grid; place-items: center; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-inline: 16px; background: #211e1bf2; backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; object-fit: contain; filter: invert(1); mix-blend-mode: screen; }
.brand > span { font-family: var(--serif); font-size: 16px; letter-spacing: 0.08em; line-height: 1.2; }
.brand small { display: block; font: 10px/1.5 var(--sans); letter-spacing: 0.16em; color: var(--muted); }
.desktop-nav { display: none; gap: 28px; font-size: var(--text-sm); }
.header-tools { display: flex; align-items: center; gap: 12px; }
.table-badge { font-size: var(--text-xs); letter-spacing: 0.06em; padding: 6px 10px; border: 1px solid var(--line); border-radius: 20px; color: var(--brass); white-space: nowrap; }
.offline-bar { background: #5d3c1d; color: #fff3e0; text-align: center; font-size: var(--text-sm); padding: 8px 16px; }
.age-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: var(--text-sm); color: #e7dfd1; }
.age-notice p { flex: 1 1 260px; }

/* Hero */
.hero { display: grid; gap: 24px; padding-block: 36px 32px; }
.hero-copy > .eyebrow { color: var(--brass); margin-bottom: 18px; }
h1 { font-family: var(--serif); font-size: clamp(32px, 4.6vw, 56px); font-weight: 500; line-height: 1.4; letter-spacing: 0; }
h1 em { font-style: italic; color: #dcc9a8; }
.intro { margin-top: 18px; font-weight: 300; font-size: 17px; line-height: 1.9; color: #d2c8bc; max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-actions .button { flex: 1 1 220px; }
.hero .quiet { margin-top: 18px; font-size: var(--text-sm); }
.hero .quiet a { display: inline-block; color: var(--paper); border-bottom: 1px solid #756754; padding: 10px 2px 8px; }
.hero-media { position: relative; }
.hero-media img { width: 100%; max-height: 180px; object-fit: cover; object-position: 50% 55%; border-radius: 120px 120px 0 0; }
.hero-media figcaption { position: absolute; left: 20px; bottom: 14px; font: italic 20px var(--serif); color: #fff; text-shadow: 0 1px 8px #000; }

/* Paper canvas */
.paper-canvas, dialog { --muted: #6d6459; --line: #d7cfc2; color: var(--ink); background: var(--paper); color-scheme: light; }
.paper-canvas .button.primary, dialog .button.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.paper-canvas .button.primary:hover:not(:disabled), dialog .button.primary:hover:not(:disabled) { background: #433a30; border-color: #433a30; }
.paper-canvas .button.secondary:hover:not(:disabled), dialog .button.secondary:hover:not(:disabled) { background: var(--paper-2); }
.paper-canvas .icon-button[aria-pressed="true"], dialog .icon-button[aria-pressed="true"] { background: #f1e3e6; }
.context-strip { position: sticky; top: 64px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: var(--text-sm); color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--line); }
.context-strip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section { padding-block: 40px; }
.section + .section { border-top: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.section-heading > div { min-width: 0; }
.section-heading h2 { margin-top: 8px; }
.section-description { font-size: var(--text-sm); margin-top: 8px; max-width: 40em; }

/* Table / tray */
.table-workspace { display: grid; gap: 28px; }
.dish-list { display: grid; }
.dish-row { display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); padding: 12px 0; }
.dish-thumb, .dish-row img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); flex: 0 0 64px; }
.dish-info { flex: 1; min-width: 0; }
.dish-info h3 { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.dish-info small { color: var(--muted); font-size: var(--text-sm); }
.table-empty { padding: 10px 0 18px; }
.empty-mark { font: italic 26px/1.4 var(--serif); color: #887658; }
.table-empty > p:not(.empty-mark) { font-size: var(--text-sm); color: var(--muted); margin-top: 6px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.chip-button { padding: 10px 14px; min-height: 44px; border: 1px solid var(--line); border-radius: 22px; font-size: var(--text-sm); background: #fff; }
.chip-button:hover { background: var(--paper-2); }
.tray-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.tray-actions .button { flex: 1 1 160px; }

/* Preference chips */
.pair-controls { border-top: 1px solid var(--line); padding-top: 20px; }
.chip-group { border: 0; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-group legend { font-size: var(--text-xs); letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; width: 100%; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 22px; background: #fff; font-size: var(--text-sm); transition: background 0.15s, color 0.15s; }
.chip input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.inline-field { flex: 1 1 100%; }
.field { display: flex; flex-direction: column; gap: 6px; margin-block: 10px; font-size: var(--text-sm); }
.field input, .field select { width: 100%; }
.advanced { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.advanced summary { display: flex; justify-content: space-between; align-items: center; min-height: 48px; cursor: pointer; list-style: none; font-size: var(--text-sm); }
.advanced summary::-webkit-details-marker { display: none; }
.summary-hint { color: var(--muted); font-size: var(--text-xs); }
.mode-options { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.mode-options legend { font-size: var(--text-xs); letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.mode-option { display: flex; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; }
.mode-option input { min-height: 0; width: 20px; height: 20px; margin-top: 3px; accent-color: var(--ink); flex: 0 0 20px; }
.mode-option b { display: block; font-weight: 500; font-size: 16px; }
.mode-option small { display: block; color: var(--muted); font-size: var(--text-xs); line-height: 1.6; }
.mode-option:has(input:checked) { border-color: var(--ink); }
#pair-button { margin-top: 6px; }
.pair-controls > .fine { margin-top: 12px; }

/* Status panels */
.status-panel { display: grid; gap: 8px; padding: 16px; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.status-panel.is-running { grid-template-columns: auto 1fr auto; align-items: center; }
.status-panel.is-error { border-color: #d9b7b2; background: #fbf4f2; }
.status-panel.is-note { background: var(--paper-2); }
.status-title { font-weight: 500; font-size: 16px; }
.status-detail { font-size: var(--text-sm); color: #4a433b; }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; align-items: center; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--brass-deep); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(0.8); opacity: 0.6; } 50% { transform: scale(1.1); opacity: 1; } }
.is-stale { opacity: 0.55; }

/* Recommendations */
.pair-result-title { margin: 36px 0 20px; padding-top: 24px; border-top: 1px solid var(--line); }
.pair-result-title h2 { margin: 8px 0; }
.pair-result-title .muted { font-size: var(--text-sm); }
.rec-grid { display: grid; gap: 20px; }
.rec-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.rec-card.is-hero { border-color: var(--brass-deep); box-shadow: 0 10px 40px #211e1b12; }
.rec-label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: var(--text-xs); letter-spacing: 0.04em; color: var(--brass-deep); font-weight: 500; }
.rec-top { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; align-items: center; margin-block: 14px; }
.rec-image { border: 0; padding: 0; background: #fff; }
.rec-image img, .rec-image .img-missing { width: 88px; height: 130px; object-fit: contain; }
.rec-head h3 { font: 22px/1.25 var(--serif); margin: 6px 0; overflow-wrap: anywhere; }
.type-pill { display: inline-block; font-size: 11px; letter-spacing: 0.08em; padding: 3px 8px; border: 1px solid var(--line); border-radius: 12px; color: #5b5146; background: #fff; }
.origin { font-size: var(--text-xs); color: var(--muted); line-height: 1.6; }
.price { font-size: 16px; }
.price b { font-weight: 500; }
.price small { color: var(--muted); font-size: var(--text-xs); }
.price.big b { font-size: 22px; }
.rec-story { font-size: 16px; line-height: 1.85; }
.pairing-notes { display: grid; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.pairing-notes li { display: grid; gap: 2px; font-size: var(--text-sm); }
.pairing-notes b { font-weight: 500; }
.pairing-notes span { color: #4a433b; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.alternatives { margin-top: 20px; }
.alternatives summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-size: var(--text-sm); font-weight: 500; list-style: none; }
.alternatives summary::before { content: "＋"; margin-right: 8px; }
.alternatives[open] summary::before { content: "−"; }
.alternatives summary::-webkit-details-marker { display: none; }
.per-dish-title { margin: 24px 0 12px; font-size: 18px; }
.decision-note { margin-top: 20px; }
.caution { color: #8b542f; }

/* Cellar */
.collection-count { font-size: var(--text-xs); letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; }
.journeys { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 10px; margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
.journey { flex: 0 0 auto; width: 190px; scroll-snap-align: start; display: grid; gap: 4px; align-content: start; text-align: left; padding: 12px 14px; min-height: 76px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.journey b { font-weight: 500; font-size: var(--text-sm); }
.journey small { font-size: var(--text-xs); color: var(--muted); line-height: 1.5; }
.journey.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.journey.is-active small { color: var(--paper-3); }
.journey:hover { text-decoration: none; }
.cellar-toolbar { display: grid; gap: 12px; margin-bottom: 14px; }
.search-field { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding-left: 12px; }
.search-field input { width: 100%; border: 0; padding-left: 0; height: 48px; background: transparent; color: var(--ink); }
.filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; }
.select-field { display: grid; gap: 4px; font-size: var(--text-xs); color: var(--muted); min-width: 0; }
.select-field select { width: 100%; font-size: var(--text-sm); min-height: 44px; padding-block: 6px; }
.check-field { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: var(--text-sm); }
.check-field input { min-height: 0; width: 20px; height: 20px; accent-color: var(--ink); }
.active-filters { font-size: var(--text-sm); color: var(--muted); margin-bottom: 14px; }
.wine-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
.wine-card { min-width: 0; display: flex; flex-direction: column; content-visibility: auto; contain-intrinsic-size: 420px; }
.wine-card.is-unavailable .wine-image { opacity: 0.6; }
.wine-image { width: 100%; position: relative; padding: 18px 12px 28px; height: 210px; background: #fff; border: 1px solid var(--line); border-radius: 48% 48% var(--radius) var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.wine-image img { width: 100%; height: 100%; object-fit: contain; transition: transform 0.3s; }
.wine-image:hover img { transform: scale(1.03); }
.wine-image .type-pill { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.img-missing { display: grid; place-items: center; width: 100%; height: 100%; color: #b7a78a; background: #faf7f1; }
.img-missing .icon { width: 36px; height: 36px; }
.wine-body { flex: 1; padding-top: 12px; }
.wine-card h3 { font: 18px/1.3 var(--serif); margin-top: 4px; overflow-wrap: anywhere; }
.wine-teaser { font-size: var(--text-sm); line-height: 1.7; color: #4a433b; margin: 8px 0; }
.meta-line { margin-top: 4px; }
.wine-card .card-actions { padding-top: 12px; border-top: 1px solid var(--line); margin-top: 10px; }
.wine-card .card-actions .button { flex: 1 1 auto; }
.load-more { display: flex; margin: 32px auto 0; padding-inline: 32px; }
.empty-state { grid-column: 1 / -1; padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; }
.empty-state .status-actions { justify-content: center; }
.compare-bar { position: fixed; z-index: 15; left: 12px; right: 12px; bottom: calc(var(--nav-height) + 10px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--ink); color: var(--paper); border: 1px solid var(--brass); border-radius: var(--radius); box-shadow: 0 10px 40px #0004; font-size: var(--text-sm); }

/* Learn */
.learn-grid { display: grid; gap: 14px; }
.learn-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.learn-card h3 { font-size: 18px; margin-bottom: 6px; }
.learn-card p { font-size: var(--text-sm); line-height: 1.8; color: #4a433b; }
.learn-card.insight { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.learn-card.insight p { color: #d2c8bc; }
.learn-card.insight .eyebrow { color: var(--brass); margin-bottom: 6px; }
.tasting-guide, .tasting-steps { margin-top: 24px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); }
.tasting-guide h3, .tasting-steps h3 { font-size: 18px; margin-bottom: 12px; }
.tasting-guide ol, .tasting-steps ol { display: grid; gap: 12px; }
.tasting-guide li, .tasting-steps li { display: flex; gap: 12px; align-items: start; font-size: var(--text-sm); line-height: 1.75; }
.tasting-guide li .icon, .tasting-steps li .icon { margin-top: 3px; color: var(--brass-deep); }
.tasting-guide li b, .tasting-steps li b { font-weight: 500; }

/* Concierge / footer / nav */
.concierge { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding-block: 44px; }
.concierge-mark { font: italic 56px/1 var(--serif); color: var(--brass); }
.concierge > div { flex: 1 1 260px; }
.concierge h2 { margin-top: 8px; font-size: 22px; }
.concierge p:not(.eyebrow) { font-size: var(--text-sm); color: var(--muted); margin-top: 6px; }
footer { display: grid; gap: 10px; padding-block: 24px calc(var(--nav-height) + 32px); border-top: 1px solid var(--line); color: var(--muted); }
footer > span { font: 14px var(--serif); letter-spacing: 0.08em; }
footer > p { font: italic 15px var(--serif); }
footer small { font-size: var(--text-xs); line-height: 1.7; }
.mobile-nav { position: fixed; z-index: 30; bottom: 0; inset-inline: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: #211e1bf7; backdrop-filter: blur(14px); border-top: 1px solid #514639; padding: 6px 6px max(6px, env(safe-area-inset-bottom)); min-height: var(--nav-height); }
.mobile-nav > * { background: none; border: 0; color: #cfc5b6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 4px; min-height: 48px; border-radius: var(--radius); font-size: 11px; text-decoration: none; }
.mobile-nav > *:hover { text-decoration: none; }
.mobile-nav > [aria-current] { color: var(--brass); }
.mobile-nav b { color: var(--ink); background: var(--brass); border-radius: 10px; padding: 0 6px; font-size: 10px; font-weight: 600; margin-left: 2px; }

/* Dialogs */
dialog { border: 0; width: min(680px, calc(100% - 24px)); max-height: calc(100dvh - 32px); margin: auto; padding: 20px; border-radius: var(--radius-dialog); box-shadow: 0 30px 100px #0005; }
dialog::backdrop { background: #15120ed9; backdrop-filter: blur(6px); }
body:has(dialog[open]) { overflow: hidden; }
.wide-dialog { width: min(1000px, calc(100% - 24px)); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px; position: sticky; top: -20px; z-index: 3; background: var(--paper); padding-top: 4px; }
.dialog-heading h2 { font-size: 20px; margin-top: 4px; }
.dialog-heading .close { border: 0; }
.dialog-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--paper); padding-top: 14px; margin-top: 14px; position: sticky; bottom: -20px; font-size: var(--text-sm); border-top: 1px solid var(--line); }

/* Wine detail */
.detail-hero { display: grid; gap: 18px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-image { position: relative; width: 150px; height: 200px; margin-inline: auto; background: #fff; border: 1px solid var(--line); border-radius: 48% 48% var(--radius) var(--radius); display: grid; place-items: center; padding: 14px 10px 26px; overflow: hidden; }
.detail-image img { width: 100%; height: 100%; object-fit: contain; }
.detail-image .type-pill { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.detail-copy h2 { font: 28px/1.2 var(--serif); margin: 8px 0 10px; overflow-wrap: anywhere; }
.detail-teaser { font-size: 16px; font-weight: 300; line-height: 1.8; margin-bottom: 10px; }
.why { padding-block: 18px; border-bottom: 1px solid var(--line); }
.why h3 { font-size: 17px; margin-bottom: 6px; }
.why p { font-size: 16px; line-height: 1.8; }
.story-panel { border-bottom: 1px solid var(--line); }
.story-panel summary { display: flex; gap: 14px; align-items: center; min-height: 64px; padding: 10px 0; cursor: pointer; list-style: none; }
.story-panel summary::-webkit-details-marker { display: none; }
.story-panel summary > span:last-child { display: grid; min-width: 0; flex: 1; }
.story-panel summary b { font-weight: 500; font-size: 17px; }
.story-panel summary small { color: var(--muted); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-panel summary::after { content: "＋"; font-size: 20px; color: var(--brass-deep); }
.story-panel[open] summary::after { content: "−"; }
.panel-key { font: italic 20px var(--serif); color: #9a8463; flex: 0 0 34px; }
.panel-body { padding: 4px 0 20px; font-size: 16px; line-height: 1.85; font-weight: 300; display: grid; gap: 14px; }
.aroma-story h4 { font-size: var(--text-sm); font-weight: 500; margin-bottom: 4px; color: #786345; }
.aroma-story h4 span { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: var(--text-xs); }
.palate-traits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.palate-traits dt { font-size: var(--text-xs); color: var(--muted); }
.palate-traits dd { font-size: 16px; font-weight: 400; }
.scales { display: grid; gap: 8px; }
.scale { display: grid; grid-template-columns: 80px 1fr; gap: 12px; align-items: center; font-size: var(--text-sm); }
.scale-track { position: relative; height: 10px; background: var(--paper-3); border-radius: 5px; overflow: hidden; display: block; }
.scale-fill { position: absolute; inset: 0 auto 0 0; background: #a58963; border-radius: 5px; }
.scale-fill.s1 { width: 20%; } .scale-fill.s2 { width: 40%; } .scale-fill.s3 { width: 60%; } .scale-fill.s4 { width: 80%; } .scale-fill.s5 { width: 100%; }
.service-note { font-size: var(--text-sm); color: var(--muted); padding-left: 14px; border-left: 1px solid #a68b60; }
.vintage-note { padding: 14px 16px; background: var(--paper-2); font-size: var(--text-sm); }
.vintage-note b { display: block; margin-bottom: 4px; font-weight: 500; }
.food-pair-grid { display: grid; }
.mini-food { display: flex; align-items: start; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mini-food:last-child { border-bottom: 0; }
.mini-food > div { min-width: 0; flex: 1; }
.mini-food h4 { font-size: var(--text-sm); font-weight: 500; }
.mini-food p { font-size: var(--text-xs); color: #4a433b; line-height: 1.7; margin-top: 2px; }
.more-foods summary { min-height: 44px; padding: 10px 0; font-size: var(--text-sm); cursor: pointer; }
.journal-invitation { padding-top: 12px; color: #786345; font-size: var(--text-sm); font-style: italic; }
.external-links { display: grid; gap: 8px; }
.external-link { display: flex; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; font-size: var(--text-sm); }
.external-link:hover { text-decoration: none; background: var(--paper-2); }
.external-link b { font-weight: 500; display: block; }
.external-link small { color: var(--muted); font-size: var(--text-xs); line-height: 1.5; }
.external-link .icon { margin-top: 2px; }
.term { position: relative; text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.term .tip { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 5; width: min(280px, 80vw); padding: 10px 12px; background: var(--ink); color: var(--paper); font-size: var(--text-xs); line-height: 1.6; border-radius: var(--radius); box-shadow: 0 10px 30px #0004; opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity 0.15s, transform 0.15s; font-weight: 400; font-style: normal; }
.term:hover .tip, .term:focus .tip, .term:focus-visible .tip { opacity: 1; transform: none; }

/* Shortlist / compare */
.shortlist { display: grid; }
.shortlist-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 44px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.shortlist-row img, .shortlist-row .img-missing { width: 64px; height: 90px; object-fit: contain; background: #fff; }
.shortlist-row h3 { font: 17px/1.3 var(--serif); overflow-wrap: anywhere; }
.staff-sheet { display: grid; gap: 10px; font-size: 18px; }
.staff-table { font: 40px/1 var(--serif); }
.staff-note { font-size: 16px; padding: 12px; background: #fff7e6; border: 1px solid #e8d7b0; }
.staff-sheet h3 { font-size: var(--text-sm); letter-spacing: 0.06em; color: var(--muted); margin-top: 8px; text-transform: uppercase; }
.staff-list li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.staff-list li b { display: block; font-weight: 500; }
.staff-list li span { font-size: 16px; color: #4a433b; }
.staff-list.plain li { font-size: 17px; }
.staff-thumb { width: 44px; height: 64px; object-fit: contain; background: #fff; }
.compare-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.compare-table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: var(--text-sm); }
.compare-table th, .compare-table td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.compare-table thead th { font-weight: 500; }
.compare-table thead img, .compare-table thead .img-missing { width: 70px; height: 100px; object-fit: contain; background: #fff; margin-bottom: 6px; }
.compare-table tbody th { font-weight: 500; color: var(--muted); width: 130px; font-size: var(--text-xs); }
.mini-scale { display: block; width: 80px; height: 6px; background: var(--paper-3); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.mini-scale span { display: block; height: 100%; background: #a58963; }

/* Taste finder */
.taste-progress { font-size: var(--text-xs); letter-spacing: 0.06em; color: var(--muted); }
.taste-question { font-size: 22px; font-weight: 400; margin: 6px 0 16px; line-height: 1.4; }
.taste-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.taste-option { display: grid; gap: 4px; text-align: left; align-content: start; min-height: 88px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.taste-option b { font-weight: 500; font-size: 17px; }
.taste-option small { color: var(--muted); font-size: var(--text-xs); line-height: 1.5; }
.taste-option.is-active, .taste-option:hover { border-color: var(--ink); }
.taste-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px; margin: 14px 0; }

/* Menu dialog */
.menu-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: 14px; }
.menu-toolbar .search-field { grid-column: 1 / -1; }
.menu-toolbar select { font-size: var(--text-sm); min-height: 44px; }
.menu-list { display: grid; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.menu-item.is-unavailable { opacity: 0.6; }
.menu-item > div { min-width: 0; flex: 1; }
.menu-item h3 { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.menu-item .price { font-size: var(--text-sm); }
.unavailable { display: block; font-size: var(--text-xs); color: #934239; }
.no-results, .loading { font-size: var(--text-sm); padding-block: 20px; grid-column: 1 / -1; color: var(--muted); }

/* Photo dialog */
#photo-dialog > .muted { font-size: var(--text-sm); }
.photo-drop { display: grid; place-items: center; min-height: 200px; padding: 20px; border: 1px dashed #ad9e88; margin-block: 18px; cursor: pointer; text-align: center; font-size: 16px; }
.photo-drop span { display: grid; place-items: center; gap: 8px; }
.photo-drop small { color: var(--muted); font-size: var(--text-xs); }
.photo-drop img { max-height: 300px; object-fit: contain; }
.photo-drop:has(+ input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
.photo-actions { display: grid; gap: 6px; }
.photo-checks { display: grid; }
.photo-check { display: flex; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.photo-check input { min-height: 0; width: 22px; height: 22px; accent-color: var(--ink); flex: 0 0 22px; margin-top: 4px; }
.photo-check b { font-weight: 500; }
.photo-check small { display: block; font-size: var(--text-xs); color: var(--muted); line-height: 1.6; }

/* Chat */
.chat-dialog { padding-bottom: 12px; height: min(820px, calc(100dvh - 32px)); }
.chat-dialog[open] { display: flex; flex-direction: column; }
.chat-dialog .dialog-heading { flex-shrink: 0; margin-bottom: 0; padding-bottom: 12px; position: static; }
.chat-title { display: flex; align-items: center; gap: 12px; }
.chat-title h2 { font: italic 26px var(--serif); margin: 0; }
.chat-title .quiet { font-size: var(--text-xs); }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #a38d69; border-radius: 50%; font: italic 24px var(--serif); color: #826a44; }
.chat-messages { flex: 1; min-height: 0; overflow: auto; padding-block: 16px; overscroll-behavior: contain; }
.message { margin-bottom: 18px; font-size: 16px; line-height: 1.85; position: relative; }
.message > p { white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { background: #e9e1d5; border-radius: var(--radius-dialog); padding: 12px 16px; margin-left: 28px; }
.message.user.is-failed { border: 1px solid #d9b7b2; background: #fbf4f2; }
.message.assistant { padding-right: 8px; font-weight: 300; }
.message.is-collapsed > p { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.read-more { font-size: var(--text-xs); min-height: 36px; }
.turn-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--text-xs); margin-top: 6px; align-items: center; }
.turn-actions .text-button { min-height: 36px; padding-block: 6px; }
.chat-wine { display: flex; gap: 14px; margin-top: 14px; padding: 14px 0; border-block: 1px solid var(--line); font-weight: 400; }
.chat-wine img, .chat-wine .img-missing { width: 64px; height: 96px; object-fit: contain; background: #fff; flex: 0 0 64px; }
.chat-wine h4 { font-size: 16px; }
.chat-suggestions { display: flex; gap: 8px; overflow-x: auto; padding-block: 8px; flex-shrink: 0; }
.chat-suggestions button { border: 1px solid var(--line); white-space: nowrap; padding: 8px 12px; font-size: var(--text-sm); min-height: 44px; border-radius: 22px; background: #fff; }
.chat-status { flex-shrink: 0; }
.chat-status .status-panel { margin-top: 6px; padding: 10px 12px; }
#chat-form { display: flex; gap: 8px; flex-shrink: 0; border-top: 1px solid var(--line); padding-top: 12px; }
#chat-input { flex: 1; resize: none; }
#send-chat { width: 48px; min-width: 48px; padding: 0; }
.chat-footnote { text-align: center; margin-top: 8px; flex-shrink: 0; }
.message.error, .error-panel { color: var(--danger); }
.toast { position: fixed; z-index: 100; bottom: calc(var(--nav-height) + 20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 20px; background: var(--ink); border: 1px solid var(--brass); color: var(--paper); box-shadow: 0 8px 40px #0003; font-size: var(--text-sm); text-align: center; border-radius: var(--radius); }

/* QR / staff page */
.qr-page { max-width: 640px; margin: 40px auto; padding: 16px; }
.qr-page h1 { font-size: 40px; margin-block: 20px; }
.qr-page input { background: var(--paper); color: var(--ink); }
.qr-page .field { font-size: var(--text-sm); }
.qr-page .two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qr-preview { background: white; color: #211e1b; text-align: center; padding: 36px; margin-block: 24px; }
.qr-preview h2 { font-family: var(--serif); letter-spacing: 0.1em; }
.qr-preview p { font-size: var(--text-sm); margin-top: 10px; }
.qr-preview img { width: 260px; margin: 24px auto; }
.qr-warning { color: #ecd1a3; font-size: var(--text-sm); margin-top: 14px; }

/* Breakpoints */
@media (min-width: 600px) {
  .page-width { width: min(1240px, calc(100% - 48px)); }
  .filter-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wine-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 18px; }
  .learn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
  .rec-grid:has(> .rec-card:only-child) { grid-template-columns: minmax(0, 760px); }
  .detail-hero { grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 28px; }
  .detail-image { width: 180px; height: 240px; }
  .palate-traits { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .taste-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  dialog { padding: 28px; }
  .dialog-heading { top: -28px; }
  .dialog-bottom { bottom: -28px; }
}
@media (min-width: 900px) {
  :root { --nav-height: 0px; }
  .site-header { height: 76px; padding-inline: 32px; }
  .brand img { width: 46px; height: 46px; }
  .brand > span { font-size: 18px; }
  .desktop-nav { display: flex; }
  .hero { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 48px; padding-block: 64px 56px; }
  .hero-media img { max-height: 420px; aspect-ratio: 1 / 0.85; border-radius: 48% 48% 0 0; }
  .hero-actions .button { flex: 0 1 auto; }
  .context-strip { top: 76px; }
  .section { padding-block: 56px; }
  .table-workspace { grid-template-columns: minmax(0, 1fr) 380px; gap: 44px; align-items: start; }
  .pair-controls { border-top: 0; border-left: 1px solid var(--line); padding: 0 0 0 32px; }
  .cellar-toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
  .filter-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wine-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 36px 24px; }
  .wine-image { height: 250px; }
  .learn-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mobile-nav { display: none; }
  footer { grid-template-columns: auto 1fr auto; align-items: center; padding-bottom: 32px; }
  footer small { grid-column: 1 / -1; }
  .compare-bar { left: auto; right: 24px; bottom: 24px; width: min(420px, calc(100% - 48px)); }
  .toast { bottom: 28px; }
  .taste-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .menu-list { grid-template-columns: 1fr 1fr; gap: 0 28px; }
  .menu-toolbar { grid-template-columns: 2fr 1fr 1fr; }
  .menu-toolbar .search-field { grid-column: auto; }
}
@media (max-width: 359px) {
  .page-width { width: calc(100% - 24px); }
  .rec-top { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; }
  .rec-image img, .rec-image .img-missing { width: 64px; height: 96px; }
  .rec-head h3 { font-size: 19px; }
  .staff-table { font-size: 32px; }
  .wine-grid { grid-template-columns: 1fr; }
  .taste-options { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: 1fr; }
  .brand > span { font-size: 14px; }
  .table-badge { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .pulse { opacity: 1; }
}
@media print {
  :root, body { background: white; color: black; }
  .site-header, .mobile-nav, .compare-bar, .toast, .age-notice, .offline-bar { display: none !important; }
  .qr-page > *:not(.qr-preview) { display: none; }
  .qr-page { margin: 0 auto; }
  .qr-preview { border: 1px solid #ccc; page-break-inside: avoid; }
}
