/* Our Menu app styles. Every value comes from tokens.css. */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-900.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
/* Follow the iOS text-size setting (Dynamic Type). */
@supports (font: -apple-system-body) {
  html { font: -apple-system-body; }
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: var(--body-leading);
  caret-color: var(--accent);
  overscroll-behavior: none;
}
::selection { background: var(--selection); color: var(--text); }
:focus { outline: none; }
:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
[hidden] { display: none !important; }

.app {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + var(--space-4)) var(--gutter) var(--space-5);
}
.app.has-tabs .screen {
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + var(--space-5));
}

/* ---- type ---- */
.label {
  margin: 0;
  font-size: var(--label-size);
  font-weight: 700;
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  color: var(--accent);
}
.dish {
  margin: var(--space-3) 0 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--display-size);
  line-height: var(--display-leading);
  letter-spacing: var(--display-tracking);
  text-transform: uppercase;
  overflow-wrap: normal;
  hyphens: none;
}
.dish.clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--display-max-lines);
  overflow: hidden;
  overflow-wrap: anywhere;
}
.pitch { margin: var(--space-3) 0 0; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.heading { margin: var(--space-3) 0 0; font-size: calc(24 * var(--px)); font-weight: 700; line-height: 1.2; }
.error-text { color: var(--danger); margin: var(--space-3) 0 0; }

/* ---- buttons & chips ---- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: calc(54 * var(--px));
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-button);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: var(--body-size);
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--line); }
.btn-link {
  background: none;
  color: var(--accent);
  min-height: var(--tap-min);
  border: 0;
}
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn .spinner {
  width: 1em; height: 1em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  border-radius: var(--radius-chip);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: calc(15 * var(--px));
  font-weight: 600;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---- Tonight ---- */
.tonight {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.status-line { margin: 0 0 var(--space-3); color: var(--text-muted); font-size: calc(15 * var(--px)); }
.rule { height: 1px; border: 0; background: var(--line); margin: var(--space-5) 0 var(--space-3); }
.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  font-size: calc(14 * var(--px));
  font-weight: 600;
}
.meta .ok { color: var(--accent); }
.order { margin: var(--space-3) 0 0; padding: 0; list-style: none; color: var(--text-muted); }
.energy { margin-top: var(--space-5); }
.energy p { margin: 0 0 var(--space-2); font-size: calc(15 * var(--px)); color: var(--text-muted); }
.actions { margin-top: var(--space-6); display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
.actions .btn-link { margin-top: var(--space-1); }
.rate {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}
.rate p { margin: 0 0 var(--space-2); }
.rate .skip { margin-top: var(--space-1); min-height: var(--tap-min); }

/* The one authored moment: the card changes → fade and rise 8px over 180ms. */
.enter { animation: rise var(--motion-duration) var(--motion-ease); }
@keyframes rise {
  from { opacity: 0; transform: translateY(var(--motion-rise)); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .enter { animation: none; }
  .btn .spinner { animation: none; border-right-color: currentColor; opacity: 0.6; }
}

/* Loading: shaded outlines, no shimmer (nothing else animates). */
.skeleton { display: block; background: var(--surface); border-radius: 0; }
.skeleton.label-s { width: 30%; height: var(--label-size); }
.skeleton.dish-s { width: 85%; height: calc(var(--display-size) * 2); margin-top: var(--space-3); }
.skeleton.line-s { width: 70%; height: var(--body-size); margin-top: var(--space-3); }
.skeleton.btn-s { width: 100%; height: calc(54 * var(--px)); margin-top: var(--space-3); border-radius: var(--radius-button); }

/* ---- Enter code ---- */
.code-boxes {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-6);
}
.code-boxes input {
  min-width: 0;
  min-height: calc(56 * var(--px));
  padding: 0;
  text-align: center;
  font: inherit;
  font-size: calc(24 * var(--px));
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
}
.code-boxes input:focus-visible,
.code-boxes input:focus { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.enter-code .btn { margin-top: var(--space-5); }

/* ---- Chat ---- */
.chat { flex: 1; display: flex; flex-direction: column; }
.thread { flex: 1; display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-5); }
.msg-assistant { margin: 0; max-width: 90%; }
.msg-user {
  margin: 0;
  align-self: flex-end;
  max-width: 85%;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-button);
}
.msg-assistant p { margin: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.chat-head .clear { width: auto; color: var(--text-muted); font-size: calc(15 * var(--px)); }
.chat-chips { margin-top: var(--space-4); }
.crisis { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.crisis .btn { min-height: var(--tap-min); }
/* Loading: three dim dots, static (the only motion is the Tonight card). */
.typing { display: flex; gap: 6px; margin: 0; padding: var(--space-2) 0; }
.typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.composer { display: flex; gap: var(--space-2); margin-top: var(--space-4); }
.composer input {
  flex: 1;
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
}
.composer .btn { width: auto; min-height: var(--tap-min); }

/* ---- empty states (Menu / Kitchen / Places) ---- */
.empty { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: var(--space-4); }
.empty p { margin: 0; color: var(--text-muted); }

/* ---- tab bar: 56px, five tabs ---- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  justify-content: center;
  background: #080c0b;
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1;
  max-width: calc(var(--max-width) / 5);
  min-width: var(--tap-min);
  height: var(--tabbar-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px; /* fixed: the bar is a fixed 56px */
  font-weight: 600;
}
.tabbar a[aria-selected="true"] { color: var(--accent); }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
