/* 3C Cafe · shared tokens + components
   Quiet espresso-bar look: the owner's 10 browns, one serif for voice, one sans for work. */
:root {
  --color-1: #835427;
  --color-2: #6C4520;
  --color-3: #573616;
  --color-4: #311B08;
  --color-5: #201204;
  --color-6: #0D0802;
  --color-7: #43290E;
  --color-8: #AD7036;
  --color-9: #773F0B;
  --color-10: #E1AC6C;

  /* roles */
  --bg: var(--color-6);
  --surface: var(--color-5);
  --surface-2: var(--color-4);
  --line: var(--color-7);
  --line-soft: rgba(225, 172, 108, .1);     /* color-10 @ 10% */
  --text: var(--color-10);
  --text-2: var(--color-8);                 /* secondary copy: ~5.6:1 on bg */
  --text-3: var(--color-1);                 /* captions only */
  --accent: var(--color-10);
  --accent-ink: var(--color-6);

  --font-serif: 'Instrument Serif', 'Times New Roman', serif;
  --font-sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --shadow: 0 1px 0 rgba(225, 172, 108, .06) inset, 0 20px 40px -24px rgba(0, 0, 0, .8);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 1;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.ic { flex: none; }
.serif { font-family: var(--font-serif); font-weight: 400; letter-spacing: -.01em; }
.eyebrow { font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--text-2); }
.muted { color: var(--text-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 500; font-size: 15px; letter-spacing: -.005em;
  cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), background-color .2s, border-color .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: #ebbb80; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: var(--line-soft); border-color: var(--color-3); }
.btn--quiet { background: var(--surface-2); color: var(--text); }
.btn--quiet:hover { background: var(--color-7); }
.btn--danger { background: transparent; color: var(--text-2); border-color: transparent; }
.btn--danger:hover { color: var(--text); background: var(--line-soft); }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn--icon { width: 36px; min-height: 36px; padding: 0; }
.btn--lg { min-height: 54px; font-size: 16px; }

/* quantity stepper pill */
.stepper {
  display: inline-flex; align-items: center; gap: 2px;
  height: 36px; padding: 3px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.stepper button {
  display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text); cursor: pointer;
}
.stepper button:hover { background: var(--color-7); }
.stepper output { min-width: 22px; text-align: center; font-weight: 600; font-size: 14px; }
.add {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer;
  transition: background-color .2s, transform .15s var(--ease);
}
.add:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.add:active { transform: scale(.92); }

/* ---------- Inputs ---------- */
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field__label small { font-weight: 400; color: var(--text-3); }
.input {
  width: 100%; min-height: 48px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); font-size: 16px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea.input { padding: 12px 14px; min-height: 80px; resize: vertical; }
.input::placeholder { color: var(--color-2); }
.input:hover { border-color: var(--color-3); }
.input:focus { border-color: var(--color-8); box-shadow: 0 0 0 4px rgba(173, 112, 54, .18); }
.input-group { display: flex; align-items: stretch; }
.input-group > span {
  display: grid; place-items: center; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm);
  color: var(--text-2); font-size: 15px;
}
.input-group > .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.form-error { min-height: 1.2em; margin: 0; color: var(--color-10); font-size: 13px; }
.form-error:not(:empty)::before { content: '• '; color: var(--color-8); }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.divider { height: 1px; border: 0; margin: 0; background: var(--line-soft); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--text-2);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.chip--solid { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip--warm { background: rgba(173, 112, 54, .16); color: var(--color-10); border-color: rgba(173, 112, 54, .4); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* logo sits on a cream tile so the brown "C" stays readable on dark */
.logo-tile { display: grid; place-items: center; background: var(--color-10); border-radius: var(--r-md); padding: 10px 14px; }
.logo-tile img { width: 100%; height: auto; }

/* ---------- Switch ---------- */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 13px; color: var(--text-2); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); transition: background-color .2s; }
.switch__track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--color-2); transition: transform .25s var(--ease), background-color .2s; }
.switch input:checked + .switch__track { background: var(--color-8); border-color: var(--color-8); }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: var(--color-10); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Segmented control ---------- */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 4px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 999px; }
.seg button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .2s, color .2s; }
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

/* ---------- Sheet (mobile bottom sheet / desktop centered dialog) ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; justify-items: center; }
.sheet__scrim { position: absolute; inset: 0; background: rgba(13, 8, 2, .72); backdrop-filter: blur(4px); animation: fade .2s var(--ease); }
.sheet__panel {
  position: relative; width: min(560px, 100%); max-height: 92dvh; overflow: auto;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface); border: 1px solid var(--line-soft); border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  animation: sheet-up .35s var(--ease);
}
.sheet__handle { width: 40px; height: 4px; margin: 0 auto 14px; border-radius: 4px; background: var(--line); }
.sheet__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.sheet__head h2 { margin: 0; font-size: 28px; }
@media (min-width: 720px) {
  .sheet { align-items: center; }
  .sheet__panel { border-radius: var(--r-lg); border-bottom: 1px solid var(--line-soft); }
  .sheet__handle { display: none; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Lines (cart / bill) ---------- */
.lines { list-style: none; margin: 0; padding: 0; }
.line { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.line:last-child { border-bottom: 0; }
.line__name { font-weight: 500; }
.line__sub { display: block; font-size: 13px; color: var(--text-2); }
.line__amt { min-width: 64px; text-align: right; font-weight: 500; }
.lines--plain .line { grid-template-columns: 1fr auto; padding: 10px 0; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 4px; }
.total-row span:first-child { color: var(--text-2); }
.total-row strong { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }

/* ---------- Photo ---------- */
.photo { position: relative; overflow: hidden; background: var(--surface-2); }
.photo::before { content: attr(data-initial); position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-serif); font-size: 40px; color: var(--color-3); }
.photo img { position: relative; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 90;
  transform: translateX(-50%); max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 999px;
  background: var(--color-10); color: var(--color-6); font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .7);
  animation: toast-in .3s var(--ease);
}
@keyframes toast-in { from { transform: translate(-50%, 10px); opacity: 0; } }

.demo-flag {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 100; pointer-events: none;
  padding: 2px 10px; border-radius: 0 0 10px 10px; border: 1px solid var(--line); border-top: 0;
  background: var(--surface); color: var(--text-2); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
