/* Fallback "modernist" design-system stylesheet.
 * Colors, font (Archivo) and typography match spec.md exactly.
 * Fonts are self-hosted (fonts.css + fonts/*.woff2) — no external requests.
 * NOT sourced from the original _ds export, but token/class values are per spec.
 * The --space-* scale and --shadow-lg are not defined in spec.md; they use a
 * consistent 4-8-12-16-24-32 ramp as a sensible approximation. Replace with the
 * real _ds/ export for a pixel-exact result. */

@import "fonts.css";

:root {
  /* Palette — per spec.md token reference */
  --color-bg:          #f3f2f2;
  --color-surface:     #eae9e9;
  --color-text:        #201e1d;
  --color-accent:      #ec3013;
  --color-accent-100:  #fff2ef;
  --color-accent-800:  #7c1405;
  --color-divider:     rgba(32, 30, 29, 0.4);   /* #201e1d @ 40% */
  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-500: #9b9797;
  --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d;

  /* Spacing scale — NOT defined in spec.md; consistent 4-based ramp (approx). */
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Typography — Archivo throughout (weights 400 / 600 / 800) */
  --font-body: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Elevation — NOT defined in spec.md; approximate. */
  --shadow-lg: 0 12px 32px rgba(32, 30, 29, 0.16);
}

html, body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--color-text);
}

/* Modernist: sharp corners everywhere */
.seg, .seg-opt span, .tag, .btn { border-radius: 0; }

/* Segmented control (Tổng quan / Thực đơn tuần tabs) */
.seg {
  display: inline-flex;
  border: 2px solid var(--color-divider);
  background: var(--color-surface);
}
.seg-opt {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}
.seg-opt:not(:last-child) {
  border-right: 2px solid var(--color-divider);
}
.seg-opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.seg-opt span {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text);
  white-space: nowrap;
}
.seg-opt input:checked + span {
  background: var(--color-accent);
  color: var(--color-bg);
}
.seg-opt input:focus-visible + span {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* Tag / pill — spec §7: 11px / 400, no uppercase */
.tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 400;
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  color: var(--color-neutral-600);
}
.tag-accent {
  border-color: var(--color-accent);
  background: var(--color-accent-100);
  color: var(--color-accent-800);
}

/* Muted text — spec: --color-text @ 55% */
.text-muted {
  color: rgba(32, 30, 29, 0.55);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  border: 2px solid var(--color-accent);
  background: var(--color-accent);
  color: var(--color-bg);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover { opacity: 0.9; }

/* "Đặt lại" — spec: text --color-text, 1px divider border, weight 800 */
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-divider);
}
.btn-secondary:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-bg);
}
.btn:focus-visible,
.btn-secondary:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Responsive — the fixed macro rail + 230px reserved gutter break on phones.
   Below 720px: drop the rail, reclaim the gutter, collapse the grids. */
@media (max-width: 720px) {
  .page { padding-right: var(--space-4) !important; }
  .rail { display: none !important; }
  .meal-grid { grid-template-columns: 1fr !important; }
  .summary-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .totalbar-inner {
    padding-left: var(--space-4) !important;
    padding-right: var(--space-4) !important;
    flex-wrap: wrap;
    gap: var(--space-3) !important;
  }
  .app-header h1 { font-size: 30px !important; }
}
