/* Taqueria Hidalgo — demo preview by Ni Biashara
   Style dossier: Control Room/ui-ux-library/engine/styles/craft-paper.md
   Layout archetypes: Kraft Fold (hero) + Packing Slip (menu/cart) */

:root {
  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Spectral', Georgia, serif;
  --font-stamp: 'Special Elite', 'Courier New', monospace;
  --font-mono: 'Courier Prime', 'SFMono-Regular', Consolas, monospace;

  --text-2xs: 0.875rem;
  --text-xs: 1rem;
  --text-sm: 1.125rem;
  --text-base: 1.375rem;
  --text-lg: 1.75rem;
  --text-xl: 2.25rem;
  --text-2xl: 3rem;
  --text-3xl: 4rem;

  /* Color — light (default) */
  --ground: #F3ECDD;
  --kraft-surface: #D9C7A8;
  --ink: #2B2420;
  --ink-muted: #6B5E4D;
  --stamp-red: #B23A2E;
  --twine-green: #4B5842;
  --success: #4B6B3E;
  --warning: #A6752C;
  --error: #B23A2E;
  --focus-ring: #1F6FEB;

  /* Space */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --space-7: 48px; --space-8: 64px; --space-9: 96px;

  /* Shape */
  --radius-card: 2px;
  --radius-button: 4px;
  --rule: 1px solid var(--ink-muted);
  --rule-dashed: 1px dashed var(--ink-muted);
  --shadow-card: 0 2px 8px rgba(43, 36, 32, 0.12);

  --grid-margin: 64px;
  --measure-max: 66ch;

  --texture-kraft: url('../img/texture-kraft.webp');
  --texture-wood: url('../img/texture-wood.webp');
}

:root[data-theme="dark"],
:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --ground: #221D16;
    --kraft-surface: #332B1F;
    --ink: #EDE3D0;
    --ink-muted: #B9AC93;
    --stamp-red: #D8574A;
    --twine-green: #7C9468;
  }
}
:root[data-theme="dark"] {
  --ground: #221D16;
  --kraft-surface: #332B1F;
  --ink: #EDE3D0;
  --ink-muted: #B9AC93;
  --stamp-red: #D8574A;
  --twine-green: #7C9468;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 60, "WONK" 1;
  font-weight: 600;
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}
p { margin: 0 0 var(--space-4); max-width: var(--measure-max); }
.stamp-label {
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--text-2xs);
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Focus visibility */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
a:focus:not(:focus-visible), button:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--ink);
  color: var(--ground);
  padding: var(--space-3) var(--space-4);
  z-index: 999;
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding-inline: var(--space-5);
}
@media (min-width: 900px) {
  .wrap { padding-inline: var(--space-8); }
}

section { padding-block: var(--space-8); }
@media (min-width: 900px) { section { padding-block: var(--space-9); } }

.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  max-width: 640px;
}
.eyebrow {
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--stamp-red);
  font-size: var(--text-2xs);
}
.section-head h2 { font-size: var(--text-xl); }
@media (min-width: 700px) { .section-head h2 { font-size: var(--text-2xl); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--text-2xs);
  padding: 14px 24px;
  border-radius: var(--radius-button);
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  min-height: 48px;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.btn:hover { background: rgba(43,36,32,0.06); }
.btn-primary {
  background: var(--stamp-red);
  border-color: var(--stamp-red);
  color: #F8F1E4;
}
.btn-primary:hover { background: #973025; border-color: #973025; }
.btn-ghost {
  border-color: var(--ground);
  color: var(--ground);
}
.btn-ghost:hover { background: rgba(248,241,228,0.12); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--ground);
  border-bottom: 2px solid var(--ink);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
}
.wordmark {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.wordmark small {
  font-family: var(--font-stamp);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stamp-red);
}
.main-nav {
  display: none;
  gap: var(--space-5);
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--text-2xs);
}
@media (min-width: 900px) {
  .main-nav { display: flex; }
}
.main-nav a { text-decoration: none; border-bottom: 2px solid transparent; padding-bottom: 2px; }
.main-nav a:hover { border-color: var(--stamp-red); }

.header-actions { display: flex; align-items: center; gap: var(--space-3); }
.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: 2px solid var(--ink);
  border-radius: var(--radius-button);
  padding: 10px 14px;
  min-height: 44px;
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--text-2xs);
  cursor: pointer;
  color: var(--ink);
}
.cart-count {
  background: var(--stamp-red);
  color: #fff;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding-inline: 4px;
}

/* ---------- Hero (Kraft Fold) ---------- */
.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: flex-end;
  color: #F8F1E4;
  background-color: var(--ink);
}
.hero-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
}
.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20,16,10,0.15) 0%, rgba(20,16,10,0.55) 60%, rgba(20,16,10,0.88) 100%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  padding-block: var(--space-8) var(--space-7);
  width: 100%;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(243,236,221,0.94);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--radius-button);
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--text-2xs);
  margin-bottom: var(--space-4);
}
.hero h1 {
  font-size: 2.6rem;
  line-height: 1.05;
  max-width: 14ch;
  margin-bottom: var(--space-3);
}
@media (min-width: 700px) { .hero h1 { font-size: var(--text-3xl); } }
.hero .lede {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-base);
  max-width: 46ch;
  color: #F1E7D3;
  margin-bottom: var(--space-5);
}
.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
}
.hero-proof strong { font-family: var(--font-display); font-size: var(--text-sm); display: block; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: var(--space-3); }

.deckle {
  position: relative;
  height: 28px;
  background-image: var(--texture-kraft);
  background-size: cover;
  background-position: center;
}
.deckle::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 20px;
  background-image: url('../img/torn-paper-edge.webp');
  background-size: 220px 100%;
  background-repeat: repeat-x;
  background-position: top;
  filter: sepia(0.25) saturate(0.6);
  opacity: 0.9;
}

/* ---------- Ledger / Packing slip ---------- */
.ledger-panel {
  background-image: var(--texture-kraft);
  background-size: cover;
  background-position: center;
  border: var(--rule);
  box-shadow: var(--shadow-card);
}
.ledger-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 2px solid var(--ink);
  padding: var(--space-4) var(--space-5);
  gap: var(--space-3);
  flex-wrap: wrap;
}
.ledger-head h3 { margin: 0; font-size: var(--text-lg); }
.ledger-head .stamp-label { color: var(--ink-muted); }

.category-tabs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-4) var(--space-5) 0;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: none;
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--text-2xs);
  padding: 10px 16px;
  border: 1px solid var(--ink-muted);
  border-radius: var(--radius-button);
  background: var(--ground);
  color: var(--ink);
  cursor: pointer;
  min-height: 44px;
}
.tab-btn[aria-selected="true"] {
  background: var(--ink);
  color: var(--ground);
  border-color: var(--ink);
}

.menu-list { padding: var(--space-4) var(--space-5) var(--space-6); }
.menu-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-2) var(--space-4);
  align-items: center;
  padding: var(--space-4) 0;
  border-bottom: var(--rule-dashed);
}
.menu-row:last-child { border-bottom: none; }
.menu-row .item-name {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
}
.menu-row .item-es {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink-muted);
  font-size: var(--text-2xs);
}
.menu-row .item-desc {
  grid-column: 1 / -1;
  color: var(--ink-muted);
  font-size: var(--text-2xs);
  margin: 0;
}
.menu-row .item-price {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-sm);
  white-space: nowrap;
}
.qty-add {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--ink);
  border-radius: var(--radius-button);
  overflow: hidden;
}
.stepper button {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  cursor: pointer;
}
.stepper button:hover { background: var(--kraft-surface); }
.stepper output {
  min-width: 28px;
  text-align: center;
  font-family: var(--font-mono);
}
.add-btn {
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--text-2xs);
  border: 2px solid var(--ink);
  background: var(--ground);
  color: var(--ink);
  padding: 10px 14px;
  min-height: 44px;
  min-width: 44px;
  border-radius: var(--radius-button);
  cursor: pointer;
}
.add-btn:hover { background: var(--ink); color: var(--ground); }
.add-btn.added { background: var(--twine-green); border-color: var(--twine-green); color: #fff; }

.menu-note {
  padding: var(--space-4) var(--space-5);
  border-top: 2px solid var(--ink);
  font-size: var(--text-2xs);
  color: var(--ink-muted);
  background: var(--ground);
}

/* ---------- Specials ---------- */
.specials-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 1fr;
}
@media (min-width: 760px) {
  .specials-grid { grid-template-columns: 1.2fr 1fr; }
}
.special-card {
  background: var(--kraft-surface);
  border: var(--rule);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
}
.special-card h3 { font-size: var(--text-lg); }
.special-card .price-line {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--stamp-red);
  margin-bottom: var(--space-3);
}
.special-photo { overflow: hidden; border: var(--rule); }
.special-photo img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/3; }

/* ---------- Story ---------- */
.story-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 860px) {
  .story-grid { grid-template-columns: 1fr 1.1fr; }
}
.story-photos {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-3);
}
.story-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: var(--rule);
}
.story-photos .tall { aspect-ratio: 3/4; }
.story-photos .short { aspect-ratio: 3/4; margin-top: var(--space-6); }

/* ---------- Hours / Location ---------- */
.hl-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}
@media (min-width: 860px) {
  .hl-grid { grid-template-columns: 1fr 1fr; }
}
.hours-table { width: 100%; border-collapse: collapse; }
.hours-table td {
  padding: var(--space-2) 0;
  border-bottom: var(--rule-dashed);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
}
.hours-table td:first-child { font-family: var(--font-body); font-style: italic; }
.map-embed {
  border: var(--rule);
  overflow: hidden;
  aspect-ratio: 4/3;
}
.map-embed iframe { width: 100%; height: 100%; border: 0; }

.contact-card {
  background: var(--kraft-surface);
  border: var(--rule);
  padding: var(--space-6);
}
.contact-line {
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
}
.contact-line .stamp-label { min-width: 90px; color: var(--ink-muted); }
.contact-line a { text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: var(--ground);
  padding-block: var(--space-7);
}
.footer-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
@media (min-width: 700px) {
  .footer-grid { flex-direction: row; justify-content: space-between; align-items: flex-end; }
}
.footer-wordmark { font-family: var(--font-display); font-size: var(--text-lg); }
.footer-demo-note {
  font-family: var(--font-stamp);
  font-size: var(--text-2xs);
  color: #D8CBB2;
  border-top: 1px solid rgba(243,236,221,0.25);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
}
.footer-demo-note a { color: var(--ground); text-decoration: underline; }

/* ---------- Demo ribbon ---------- */
.demo-ribbon {
  background: var(--stamp-red);
  color: #F8F1E4;
  text-align: center;
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  padding: 8px var(--space-4);
}

/* ---------- Sticky mobile cart bar ---------- */
.mobile-cart-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 70;
  background: var(--ink);
  color: var(--ground);
  padding: var(--space-3) var(--space-4);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.25);
}
.mobile-cart-bar.visible { display: flex; }
.mobile-cart-bar button {
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--stamp-red);
  color: #fff;
  border: none;
  padding: 12px 18px;
  min-height: 44px;
  border-radius: var(--radius-button);
  font-size: var(--text-2xs);
}
.mobile-cart-bar .bar-info { font-family: var(--font-mono); font-size: var(--text-2xs); }
@media (min-width: 900px) { .mobile-cart-bar { display: none !important; } }

/* ---------- Cart drawer / dialog ---------- */
.drawer-scrim {
  position: fixed; inset: 0;
  background: rgba(20,16,10,0.5);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 100vw);
  background: var(--ground);
  z-index: 90;
  border-left: 2px solid var(--ink);
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(.34,1.2,.64,1);
  display: flex;
  flex-direction: column;
}
.cart-drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 2px solid var(--ink);
}
.drawer-head h2 { margin: 0; font-size: var(--text-lg); }
.icon-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  min-width: 44px; min-height: 44px;
}
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-4) var(--space-5); }
.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  border-bottom: var(--rule-dashed);
}
.cart-line .name { font-family: var(--font-display); font-size: var(--text-2xs); font-weight: 600; }
.cart-line .line-total { font-family: var(--font-mono); font-weight: 700; text-align: right; }
.cart-line .line-controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.remove-link {
  background: none; border: none; color: var(--stamp-red);
  font-family: var(--font-stamp); text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 0.65rem; cursor: pointer; text-decoration: underline;
  min-height: 44px;
}
.empty-cart {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--ink-muted);
}
.drawer-foot {
  border-top: 2px solid var(--ink);
  padding: var(--space-4) var(--space-5);
  background: var(--kraft-surface);
}
.totals-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  margin-bottom: var(--space-2);
}
.totals-row.grand {
  font-size: var(--text-base);
  font-weight: 700;
  border-top: var(--rule-dashed);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
}

/* ---------- Checkout modal ---------- */
.modal-scrim {
  position: fixed; inset: 0;
  background: rgba(20,16,10,0.55);
  z-index: 95;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal-scrim.open { display: flex; }
@media (min-width: 700px) {
  .modal-scrim { align-items: center; padding: var(--space-5); }
}
.checkout-modal {
  background: var(--ground);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  border: 2px solid var(--ink);
  border-bottom: none;
}
@media (min-width: 700px) {
  .checkout-modal { border-bottom: 2px solid var(--ink); }
}
.checkout-head {
  padding: var(--space-5);
  border-bottom: 2px solid var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.checkout-body { padding: var(--space-5); }
.demo-flag {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  background: var(--kraft-surface);
  border: 1px solid var(--ink);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}
.demo-flag .stamp-label { color: var(--stamp-red); }
.field-group { margin-bottom: var(--space-5); }
.field-group legend, .field-group .fg-label {
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--text-2xs);
  color: var(--ink-muted);
  margin-bottom: var(--space-3);
  display: block;
}
.radio-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.radio-pill {
  border: 1px solid var(--ink);
  border-radius: var(--radius-button);
  padding: 10px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
}
.radio-pill input { margin-right: 8px; }
.radio-pill:has(input:checked) { background: var(--ink); color: var(--ground); }
.review-line {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: var(--rule-dashed);
  font-size: var(--text-2xs);
}
.confirm-stamp {
  text-align: center;
  padding: var(--space-6) var(--space-4);
}
.confirm-stamp .order-no {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  letter-spacing: 0.05em;
  margin: var(--space-3) 0;
}
.badge-box {
  display: inline-block;
  border: 1px solid var(--ink);
  padding: 6px 12px;
  font-family: var(--font-stamp);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--text-2xs);
  color: var(--stamp-red);
}

[hidden] { display: none !important; }

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

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
