/* BoBAR · Coley — the phone frontend's one stylesheet.
   The visual system is the approved mockup's: dark ground, gold accent, Bodoni Moda for
   headings and drink names, Inter for text, JetBrains Mono for specs. Everything is a class
   (the CSP allows no inline style); the fonts are self-hosted under /fonts. */

@font-face {
  font-family: 'Bodoni Moda';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/bodoni-moda-latin-wght-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Bodoni Moda';
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/bodoni-moda-latin-wght-italic.woff2) format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/fonts/inter-latin-wght-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin-wght-normal.woff2) format('woff2');
}

:root {
  --bg: #12110F;
  --surface: #1D1B18;
  --surface-2: #26231F;
  --border: #3A352E;
  --text: #F4EFE7;
  --text-2: #D9D2C6;
  --muted: #B3AA9C;
  --dim: #8C8476;
  --accent: #E2B04A;
  --accent-hover: #F0C766;
  --ok: #8FB8A0;
  --warn: #E0654F;
  --warn-text: #F0A090;
  --serif: 'Bodoni Moda', 'Didot', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --page-width: 430px;
}

/* --- ground ------------------------------------------------------------------------------- */

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

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.page {
  width: 100%;
  max-width: var(--page-width);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 20px 24px 28px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

p { margin: 0; }
h1, h2, h3 { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; display: block; }

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

/* --- header ------------------------------------------------------------------------------- */

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 36px;
  gap: 12px;
}

.wordmark {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--accent);
  text-decoration: none;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--accent);
}
.avatar.big {
  width: 64px;
  height: 64px;
  font-size: 30px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}
.back:hover { color: var(--text); }
.back svg { width: 18px; height: 18px; }

.context { font-size: 13px; color: var(--muted); }

/* --- type --------------------------------------------------------------------------------- */

.hero { display: flex; flex-direction: column; gap: 8px; }

h1, .h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.08;
  overflow-wrap: anywhere;
}
.hero.wide h1 { font-size: 36px; }

.lead {
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--dim);
}
.eyebrow.gold { color: var(--accent); }

.quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 21px;
  line-height: 1.4;
}

.fine {
  font-size: 13px;
  line-height: 1.5;
  color: var(--dim);
}

.error {
  color: var(--warn-text);
  font-size: 14px;
  line-height: 1.5;
}

.found { font-size: 14px; color: var(--muted); }
.found b { color: var(--text); font-weight: 600; }

.spec { font-family: var(--mono); font-size: 14px; }

/* --- controls ----------------------------------------------------------------------------- */

.btn {
  height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  text-align: center;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--bg); }
.btn.small { height: 44px; font-size: 14px; padding: 0 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.danger { color: var(--warn-text); }

.icon-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.icon-btn svg { width: 14px; height: 14px; }

.field {
  height: 52px;
  width: 100%;
  min-width: 0;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}
.field::placeholder { color: var(--dim); }
.field:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field.small { height: 44px; border-radius: 12px; font-size: 15px; }

.form { display: flex; flex-direction: column; gap: 14px; }

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  cursor: pointer;
}
.check input {
  width: 22px;
  height: 22px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.add { display: flex; gap: 8px; }
.add .field { flex: 1; }

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 6px;
}

.options { display: flex; flex-wrap: wrap; gap: 12px; }
.options .btn { flex: 1 1 calc(50% - 6px); min-width: 0; }

.linkline {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.linkline a { color: var(--muted); }
.linkline a:hover { color: var(--text); }

.spin {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- the photo frame (screen 1) ----------------------------------------------------------- */

.frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 342 / 410;
  min-height: 220px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
}
.frame.has-photo { aspect-ratio: 342 / 250; }
.frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.frame-hint {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--dim);
}
.frame-hint svg { width: 36px; height: 36px; color: var(--accent); }
.frame-hint b { color: var(--text); font-weight: 600; font-size: 15px; }
.frame-veil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(18, 17, 15, .72);
  font-size: 14px;
  color: var(--text);
}
.frame-retake {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(18, 17, 15, .8);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
}

/* --- chips (screen 1) --------------------------------------------------------------------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  text-align: left;
}
.chip:hover { border-color: var(--muted); }
.chip.ask { border-color: var(--accent); }
.chip.editing { outline: 2px solid var(--accent); outline-offset: -1px; }
.chip svg { width: 16px; height: 16px; flex-shrink: 0; }
.chip .ok { color: var(--ok); }
.chip .maybe { color: var(--accent); }
.chip .typed { color: var(--muted); }
.chip-text { display: flex; flex-direction: column; min-width: 0; }
.chip-label { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.chip-sub { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.chip.ask .chip-sub { color: var(--accent); }

.editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.editor-row { display: flex; gap: 8px; }
.editor-row .field { flex: 1; }

/* --- the shelf (screen 2) ----------------------------------------------------------------- */

.groups { display: flex; flex-direction: column; gap: 14px; }
.group { display: flex; flex-direction: column; gap: 6px; }

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
}
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.row-sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.row-sub.unknown { color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
}
.tag.gold {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

/* --- one bottle away (screen 5) ----------------------------------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.card.gold { border-color: var(--accent); }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.card-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.card-note { font-size: 13px; color: var(--muted); flex-shrink: 0; }
.card p { font-size: 14px; line-height: 1.5; color: var(--text-2); }

.list { display: flex; flex-direction: column; gap: 8px; }
.list .row { padding: 14px; border-radius: 14px; }
.drink {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
  max-width: 50%;
  overflow-wrap: anywhere;
}
.drink small {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

/* --- the closing panel, and failures ------------------------------------------------------ */

.closing {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 32px 0;
  text-align: center;
}
.closing .quote { max-width: 300px; }

/* --- the conversation (screens 3 and 4) --------------------------------------------------- */

.linkbtn {
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  color: var(--muted);
}
.linkbtn:hover { color: var(--text); }

.welcome { display: flex; flex-direction: column; gap: 18px; }

.transcript { display: flex; flex-direction: column; gap: 28px; }
.transcript:empty { display: none; }
.turn { display: flex; flex-direction: column; gap: 14px; }
.you {
  align-self: flex-end;
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  background: var(--surface-2);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.answer { display: flex; flex-direction: column; gap: 14px; }
.slot { display: contents; }

.steps { display: flex; flex-direction: column; gap: 4px; }
.steps:empty { display: none; }
.step { font-size: 12px; color: var(--dim); overflow-wrap: anywhere; }
.step::before { content: "· "; }

.wait {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.prose {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.prose.quoted > p:first-child {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  line-height: 1.4;
  color: var(--text);
}
.prose strong { font-weight: 600; color: var(--text); }
.prose ul, .prose ol { margin: 0; padding-left: 22px; }
.prose li { margin: 2px 0; }

.cards { display: flex; flex-direction: column; gap: 14px; }
.cards:empty { display: none; }
.recipe {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 20px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.recipe-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 36px;
  line-height: 1;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--mono);
  font-size: 14px;
}
.line { display: flex; gap: 14px; align-items: baseline; }
.amount { flex: 0 0 56px; color: var(--accent); }
.line-text { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.yours { font-family: var(--sans); font-size: 11px; color: var(--muted); }
.method { font-size: 14px; line-height: 1.55; color: var(--text-2); white-space: pre-line; }
.meta { font-size: 13px; line-height: 1.5; color: var(--muted); }
.source {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
}
.source svg { width: 14px; height: 14px; flex-shrink: 0; }
.locator {
  margin-top: -6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  overflow-wrap: anywhere;
}
.more summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.more summary:hover { color: var(--text); }
.recipe-other {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sources { display: flex; flex-direction: column; gap: 8px; }
.source-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
}
.licence { max-width: 55%; text-align: right; font-size: 11px; color: var(--ok); }

.replies { display: flex; flex-wrap: wrap; gap: 10px; }
.replies .btn {
  flex: 1 1 calc(50% - 5px);
  min-width: 0;
  height: 50px;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.transcript.busy .replies .btn { opacity: .5; pointer-events: none; }

.composer {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0 max(0px, env(safe-area-inset-bottom));
  background: var(--bg);
  box-shadow: 0 -14px 14px -4px var(--bg);
}
.composer-row { display: flex; gap: 8px; }
.composer-row .field { flex: 1; }
.send { width: 52px; flex-shrink: 0; padding: 0; }
.send svg { width: 20px; height: 20px; }
