/* base.css — reset, element defaults, and the shared component vocabulary.
   Reads against DESIGN.md. Tokens come from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

img, picture, svg, video { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--plum); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.18em; }

:focus-visible { outline: 2px solid color-mix(in oklch, var(--focus) 58%, transparent); outline-offset: 2px; border-radius: var(--r-sm); }

/* ----- typography ----- */
h1, h2, h3, h4 { line-height: var(--lh-tight); color: var(--ink-strong); font-weight: 600; text-wrap: balance; }
.display, .serif { font-family: var(--font-display); font-weight: 300; color: var(--display); }

.display {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--fs-display);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--display);
  text-wrap: balance;
}
.h1 { font-family: var(--font-display); font-weight: 300; font-size: var(--fs-h1); letter-spacing: -0.02em; color: var(--ink-strong); text-wrap: balance; line-height: 1.1; }
.h2 { font-size: var(--fs-h2); font-weight: 600; text-wrap: balance; }
.h3 { font-size: var(--fs-h3); font-weight: 600; text-wrap: balance; }
.prose { max-width: var(--maxw-prose); text-wrap: pretty; }
.muted { color: color-mix(in oklch, var(--ink) 58%, transparent); }
.muted:hover, .muted:focus-visible, .muted:active { color: var(--ink); }

/* The letter-spaced small-cap label ("WELCOME TO", "YOUR TABLE"). Brand device, used sparingly. */
.label {
  font-family: var(--font-grotesque);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: color-mix(in oklch, var(--ink) 58%, transparent);
}
.label:hover, .label:focus-visible, .label:active { color: var(--ink); }

/* ----- layout helpers ----- */
.container { width: 100%; max-width: var(--maxw-content); margin-inline: auto; padding-inline: var(--sp-4); }
.stack > * + * { margin-top: var(--flow, var(--sp-4)); }
.center { text-align: center; }
/* Center width-capped BLOCK children too — text-align only centers inline content,
   so capped form rows/fields/buttons would otherwise sit at the padded content-left. */
.center > * { margin-inline: auto; }
.row { display: flex; gap: var(--sp-3); align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.section { padding-block: clamp(var(--sp-12), 9vw, var(--sp-24)); }

/* ----- buttons -----
   Control sizing: default buttons are 44px high, large controls follow the
   48px token rhythm, small controls are 38px, and chips/status chips sit in
   the 32-36px range. Chip groups should use at least var(--sp-2) between items. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 var(--sp-6);
  border-radius: var(--r-pill);
  font-weight: 600; font-size: var(--fs-body);
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
  text-decoration: none; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn--primary {
  background: var(--primary);
  color: var(--white);
  color: contrast-color(var(--accent));
}
.btn--primary:hover { background: var(--primary-press); text-decoration: none; }
.btn--accent {
  background: var(--plum);
  color: var(--white);
  color: contrast-color(var(--accent));
}
.btn--accent:hover { background: var(--primary-press); text-decoration: none; }
.btn--ghost, .secondary-button { background: transparent; color: color-mix(in oklch, var(--ink) 58%, transparent); border-color: var(--line); }
.btn--ghost:hover, .btn--ghost:focus-visible, .btn--ghost:active,
.secondary-button:hover, .secondary-button:focus-visible, .secondary-button:active { background: var(--surface-warm); color: var(--ink); text-decoration: none; }
.btn--text { min-height: auto; padding: 0; background: none; color: var(--plum); border-radius: var(--r-sm); }
.btn--text:hover { text-decoration: underline; }
.btn--lg { min-height: var(--sp-12); padding: 0 var(--sp-8); font-size: 1.0625rem; }
.btn--sm { min-height: 38px; padding: 0 var(--sp-4); font-size: var(--fs-sm); }
.btn--block { display: flex; width: 100%; }

/* ----- form controls ----- */
.field { display: block; }
.field > .label { display: block; margin-bottom: var(--sp-2); }
.input, .textarea, .select {
  width: 100%; min-height: var(--sp-12); padding: var(--sp-3) var(--sp-4);
  background: var(--surface-warm);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease-out), outline-color var(--dur-fast) var(--ease-out);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--ink-muted); }
.input:focus, .textarea:focus, .select:focus { outline: 2px solid color-mix(in oklch, var(--focus) 58%, transparent); outline-offset: 2px; border-color: var(--plum); }
.input--search { min-height: 56px; font-size: 1.0625rem; padding-left: var(--sp-12);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23756D65' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: var(--sp-4) center; }

/* ----- surfaces ----- */
.panel { background: var(--surface); border: var(--border); border-radius: var(--r-card); padding: var(--sp-6); }
.divider { height: 1px; background: var(--line); border: none; }

/* ----- chips ----- */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4); min-height: var(--sp-8);
  background: var(--surface-warm); border: 1px solid var(--line);
  border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 500; line-height: 1; color: var(--ink);
}
.chip--accent { background: var(--plum-tint); border-color: transparent; color: var(--plum); }
.chip--green { background: var(--green-tint); border-color: transparent; color: var(--green-ink); }

/* ----- badges / status ----- */
.badge { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--sp-8); padding: var(--sp-2) var(--sp-4); border-radius: var(--r-pill); font-family: var(--font-grotesque); font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.08em; line-height: 1; text-transform: uppercase; }
.badge--pending { background: var(--surface-warm); color: var(--ink-muted); }
.badge--approved, .badge--ok { background: var(--green-tint); color: var(--green-ink); }
.badge--rejected, .badge--err { background: var(--danger-tint); color: var(--danger); }

/* ----- alerts ----- */
.alert { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-input); font-size: var(--fs-sm); }
.alert--err { background: var(--danger-tint); color: var(--danger); }
.alert--ok { background: var(--green-tint); color: var(--green-ink); }

/* ----- guest mobile bottom tab bar ----- */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: var(--z-nav);
  display: flex; justify-content: space-around; align-items: stretch;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--tabbar-h); padding: var(--sp-2);
  color: color-mix(in oklch, var(--ink) 58%, transparent); font-family: var(--font-grotesque); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
.tabbar__item:hover, .tabbar__item:focus-visible, .tabbar__item:active { color: var(--ink); }
.tabbar__item[aria-current="page"] { color: var(--plum); }
.tabbar__item svg { width: 22px; height: 22px; }
.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0) + var(--sp-4)); }

/* ----- boot / loading ----- */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot__mark { font-family: var(--font-display); font-weight: 300; font-size: 1.25rem; color: var(--display); }
.skeleton { background: linear-gradient(90deg, var(--surface-warm) 25%, var(--canvas) 50%, var(--surface-warm) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: var(--r-input); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ----- spinner ----- */
.spinner { width: var(--sp-5); height: var(--sp-5); border-radius: var(--r-pill); border: 2px solid color-mix(in oklch, currentColor 25%, transparent); border-top-color: currentColor; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.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; }

@media (prefers-reduced-motion: reduce) {
  .skeleton, .spinner { animation: none; }
  * { scroll-behavior: auto !important; }
}
