:root {
  --ink: #1c1c1e;
  --muted: #6b6b6b;
  --accent: #a8432c;
  --bg: #fafaf8;
  --border: #e7e4dc;
  --surface: #ffffff;
}

* {
  box-sizing: border-box;
}

/* The [hidden] attribute and an authored `display` value (grid/flex) have
   equal CSS specificity, and author styles beat the UA default at a tie -
   so category-nav.js's `el.hidden = true` would silently do nothing on any
   element (like .t2-grid/.t4-grid) that also sets its own display. This
   forces [hidden] to always win, everywhere. */
[hidden] {
  display: none !important;
}

/* Shared "no photo" glyph for category/product tiles across every template -
   a deliberate icon, not a browser broken-image icon and not an empty gap. */
.ph-icon {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

h1, h2 {
  font-weight: 700;
}

/* Home placeholder */
.placeholder {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
}

/* Branded placeholder - shown when a domain has no live menu yet */
.brand-placeholder {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 1.5rem;
  background: var(--ink);
}

.brand-placeholder-logo {
  width: 4.5rem;
  height: auto;
}

.brand-placeholder-tagline {
  margin: 0;
  color: #fff;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
}

/* Shared: keyboard accessibility floor for all menu templates */
.t1 a:focus-visible, .t1 button:focus-visible,
.t2 a:focus-visible, .t2 button:focus-visible,
.t3 a:focus-visible, .t3 button:focus-visible,
.t4 a:focus-visible, .t4 button:focus-visible,
.t5 a:focus-visible, .t5 button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .t1 *, .t2 *, .t3 *, .t4 *, .t5 * {
    transition: none !important;
    animation: none !important;
  }
}

/* ==========================================================================
   Template 1 - "Tasting Room": quiet, refined, a slow multi-course dinner.
   Serif display + numbered courses. Deep pine-green on warm parchment.
   ========================================================================== */
.t1 {
  --t1-bg: #f2f0e8;
  --t1-surface: #fffefb;
  --t1-ink: #21261f;
  --t1-muted: #767b70;
  --t1-accent: #3c5d52;
  --t1-border: #ddd8c8;
  background: var(--t1-bg);
  color: var(--t1-ink);
  min-height: 100vh;
  counter-reset: t1-course;
}

.t1 .menu-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--t1-surface);
  border-bottom: 1px solid var(--t1-border);
  padding: 1.5rem 1.25rem 1.15rem;
  text-align: center;
}

.t1 .menu-header h1 {
  margin: 0 0 0.55rem;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.t1 .menu-header::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2px;
  margin: 0 auto;
  background: var(--t1-accent);
}

.t1 .menu {
  max-width: 34rem;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 3rem;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}

.t1 .category {
  margin-top: 2.1rem;
}

.t1 .category h2 {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--t1-ink);
}

.t1 .category h2::before {
  counter-increment: t1-course;
  content: counter(t1-course, decimal-leading-zero);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--t1-accent);
}

.t1 .products {
  list-style: none;
  margin: 0;
  padding: 0;
}

.t1 .product {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--t1-border);
}

.t1 .product:last-child {
  border-bottom: none;
}

.t1 .product-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.t1 .product-name {
  font-weight: 600;
  font-size: 1rem;
}

.t1 .product-price {
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--t1-accent);
}

.t1 .product-description {
  margin: 0.3rem 0 0;
  color: var(--t1-muted);
  font-size: 0.875rem;
}

/* ==========================================================================
   Template 2 - "Night Market Stall": a hand-stamped street-food-stall board.
   Kraft cardboard, marker-bold headlines, torn tape-sticker category tags,
   and a rotated ink-stamp badge around every price - the signature element.
   ========================================================================== */
.t2 {
  --t2-bg: #e9dcc0;
  --t2-surface: #fbf6ea;
  --t2-ink: #2b2118;
  --t2-stamp: #8a4a12;
  --t2-tape: #c9b48a;
  --t2-muted: #6b5d47;
  background: var(--t2-bg);
  color: var(--t2-ink);
  min-height: 100vh;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}

.t2-header {
  padding: 1.75rem 1.25rem 1.1rem;
  text-align: center;
}

.t2-header h1 {
  margin: 0;
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.t2-board {
  max-width: 32rem;
  margin: 0 auto;
  padding: 0 1.1rem 3rem;
}

/* The landing view: a full-bleed photo tile per category, its name and a
   "View Menu" cta overlaid on a gradient at the bottom (or a graceful icon
   placeholder when the category has no image - never a broken <img> or an
   empty gap). Tapping one hides this grid and reveals that category's
   product list (category-nav.js). */
.t2-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 480px) {
  .t2-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.t2-grid-card {
  display: block;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.t2-grid-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 0.85rem;
  background: var(--t2-surface);
  box-shadow: 0 4px 12px rgba(43, 33, 24, 0.22);
}

.t2-grid-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.t2-grid-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(160deg, var(--t2-tape), var(--t2-surface));
}

.t2-grid-fallback .ph-icon {
  width: 2.1rem;
  height: 2.1rem;
  color: var(--t2-stamp);
  opacity: 0.65;
}

.t2-grid-overlay {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 1.6rem 0.75rem 0.6rem;
  background: linear-gradient(180deg, rgba(43, 33, 24, 0) 0%, rgba(20, 14, 9, 0.78) 85%);
}

.t2-grid-label {
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-weight: 900;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #fdf8ee;
  overflow-wrap: break-word;
}

.t2-grid-cta {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f0c775;
}

/* The drill-down view: one category's products, text-only per the brief -
   the photo already did its job on the grid tile. */
.t2-category {
  margin-top: 0.5rem;
}

.t2-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 1.1rem;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--t2-stamp);
  cursor: pointer;
}

.t2-tag {
  position: relative;
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.35rem 0.9rem 0.3rem;
  background: var(--t2-surface);
  border: 1px dashed var(--t2-tape);
  transform: rotate(-1.5deg);
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-weight: 900;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--t2-ink);
}

.t2-category:nth-of-type(even) .t2-tag {
  transform: rotate(1.5deg);
}

.t2-products {
  list-style: none;
  margin: 0;
  padding: 0;
}

.t2-product {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--t2-tape);
}

.t2-product:last-child {
  border-bottom: none;
}

.t2-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.t2-name {
  font-weight: 700;
  overflow-wrap: break-word;
  min-width: 0;
}

.t2-stamp {
  flex-shrink: 0;
  display: inline-block;
  border: 2px solid var(--t2-stamp);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  transform: rotate(-4deg);
  font-family: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--t2-stamp);
  white-space: nowrap;
}

.t2-desc {
  margin: 0.4rem 0 0;
  color: var(--t2-muted);
  font-size: 0.85rem;
  overflow-wrap: break-word;
}

@media (min-width: 640px) {
  .t2-board {
    max-width: 46rem;
  }
}

/* ==========================================================================
   Template 3 - "Quiet Ledger": omakase-minimalist. Whisper-quiet whitespace,
   near-monochrome ink type, and exactly one spot of color - a small oxblood
   dot marking each category, nothing else competes for attention.
   ========================================================================== */
.t3 {
  --t3-bg: #f5f5f3;
  --t3-ink: #22252a;
  --t3-seal: #8c342a;
  --t3-line: #d7d4cb;
  --t3-muted: #625f57;
  background: var(--t3-bg);
  color: var(--t3-ink);
  min-height: 100vh;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}

.t3-header {
  padding: 2.75rem 1.25rem 1.5rem;
  text-align: center;
}

.t3-header h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.t3-category {
  max-width: 30rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}

.t3-category:last-child {
  padding-bottom: 3.5rem;
}

.t3-label {
  position: relative;
  margin: 0 0 1.4rem;
  padding-left: 1.1rem;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--t3-ink);
}

.t3-label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--t3-seal);
}

.t3-products {
  list-style: none;
  margin: 0;
  padding: 0;
}

.t3-product {
  padding: 0.95rem 0;
}

.t3-product + .t3-product {
  border-top: 1px solid var(--t3-line);
}

.t3-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.25rem;
}

.t3-name {
  font-weight: 500;
  overflow-wrap: break-word;
  min-width: 0;
}

.t3-price {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--t3-muted);
  font-size: 0.9rem;
}

.t3-desc {
  margin: 0.35rem 0 0;
  color: var(--t3-muted);
  font-size: 0.85rem;
  max-width: 34ch;
  overflow-wrap: break-word;
}

/* ==========================================================================
   Template 4 - "The Ticket": dense, efficient deli/diner order slip.
   Monospace ledger type, dotted price leaders, perforated receipt edge.
   ========================================================================== */
.t4 {
  --t4-bg: #fbf7ef;
  --t4-surface: #ffffff;
  --t4-ink: #241d15;
  --t4-muted: #7a7264;
  --t4-border: #e6ddc9;
  --t4-gold: #b8862f;
  --t4-gold-ink: #4a3410;
  background: var(--t4-bg);
  color: var(--t4-ink);
  min-height: 100vh;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}

.t4-header {
  padding: 1.75rem 1.25rem 1.1rem;
  text-align: center;
}

.t4-header h1 {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
}

/* The landing view: a full-bleed photo tile per category, mirroring template
   2's grid - name and a "View Menu" cta overlaid on a gradient (or a
   graceful icon placeholder when the category has no image). */
.t4-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  max-width: 40rem;
  margin: 0.3rem auto 0;
  padding: 0 1.1rem 2rem;
}

@media (min-width: 480px) {
  .t4-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.t4-grid-card {
  display: block;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.t4-grid-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 0.75rem;
  background: var(--t4-surface);
  box-shadow: 0 4px 12px rgba(36, 29, 21, 0.16);
}

.t4-grid-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.t4-grid-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(160deg, #ece2c9, var(--t4-surface));
}

.t4-grid-fallback .ph-icon {
  width: 2.1rem;
  height: 2.1rem;
  color: var(--t4-gold);
  opacity: 0.7;
}

.t4-grid-overlay {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1.6rem 0.7rem 0.55rem;
  background: linear-gradient(180deg, rgba(36, 29, 21, 0) 0%, rgba(20, 15, 8, 0.78) 85%);
}

.t4-grid-label {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fdf8ee;
  overflow-wrap: break-word;
}

.t4-grid-cta {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f0c775;
}

.t4-category {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.1rem;
}

.t4-category:last-child {
  padding-bottom: 2rem;
}

.t4-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 1.3rem 0 0.6rem;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--t4-gold-ink);
  cursor: pointer;
}

.t4-category-label {
  margin: 0 0 0.85rem;
  padding: 0;
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--t4-ink);
}

/* Mobile-first single column; two columns once there's room for a card to
   breathe without its image getting cramped. */
.t4-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding-bottom: 0.5rem;
}

@media (min-width: 480px) {
  .t4-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.t4-card {
  display: flex;
  flex-direction: column;
  background: var(--t4-surface);
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(36, 29, 21, 0.12);
}

.t4-card-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
}

.t4-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.t4-card-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(160deg, #ece2c9, var(--t4-surface));
}

.t4-card-fallback .ph-icon {
  width: 1.9rem;
  height: 1.9rem;
  color: var(--t4-gold);
  opacity: 0.7;
}

/* A rounded price badge sitting in the photo's bottom-right corner. Bottom
   is a positive offset (not overlapping past the image edge) because
   .t4-card clips overflow to round its own corners - a negative offset here
   would get silently clipped away. */
.t4-price-badge {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  background: var(--t4-gold);
  box-shadow: 0 2px 6px rgba(36, 29, 21, 0.25);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.8rem;
  color: #2a1d08;
  white-space: nowrap;
}

.t4-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.15rem 0.85rem 0.85rem;
}

.t4-name {
  font-weight: 700;
  overflow-wrap: break-word;
}

.t4-desc {
  margin: 0.35rem 0 0;
  color: var(--t4-muted);
  font-size: 0.82rem;
  overflow-wrap: break-word;
}

/* ==========================================================================
   Template 5 - "Corner Garden": warm, tactile neighborhood bakery/cafe.
   Rounded display + serif body, sage & blush palette, washi-tape cards.
   ========================================================================== */
.t5 {
  --t5-bg: #f1f4ec;
  --t5-surface: #ffffff;
  --t5-ink: #33392f;
  --t5-sage: #6f8f6a;
  --t5-blush: #e8a0a0;
  --t5-muted: #7d8478;
  background: var(--t5-bg);
  color: var(--t5-ink);
  min-height: 100vh;
}

.t5-header {
  padding: 1.9rem 1.25rem 1rem;
  text-align: center;
}

.t5-header h1 {
  margin: 0;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--t5-sage);
}

.t5-cards {
  max-width: 34rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.t5-card {
  position: relative;
  background: var(--t5-surface);
  border-radius: 0.9rem;
  padding: 1.2rem 1.15rem 1.1rem;
  box-shadow: 0 2px 10px rgba(51, 57, 47, 0.08);
}

.t5-card::before {
  content: "";
  position: absolute;
  top: -0.5rem;
  left: 1.25rem;
  width: 2.4rem;
  height: 1.1rem;
  background: var(--t5-blush);
  opacity: 0.85;
  transform: rotate(-3deg);
  border-radius: 1px;
}

.t5-card:nth-of-type(even)::before {
  left: auto;
  right: 1.25rem;
  transform: rotate(3deg);
}

.t5-card h2 {
  margin: 0 0 0.8rem;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--t5-sage);
}

.t5-products {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: Georgia, "Iowan Old Style", serif;
}

.t5-product {
  padding: 0.6rem 0;
}

.t5-product + .t5-product {
  border-top: 1px solid #eceee5;
}

.t5-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.t5-name {
  font-weight: 700;
}

.t5-price {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #b84a4a;
  white-space: nowrap;
}

.t5-desc {
  margin: 0.3rem 0 0;
  color: var(--t5-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* Language switcher - shared across every template, kept template-agnostic
   so it doesn't need to be restyled per template. It renders directly on the
   page body (above the template partial, not inside any .t1-.t5 container),
   so its own warm/gold palette is self-contained rather than borrowed from
   whichever template happens to be active below it - that also keeps it
   looking reasonable on the plainer templates (1/3/5), not just 2/4. */
.lang-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.9rem 1rem 0;
}

.lang-btn {
  border: 1px solid #e6d9bd;
  background: #fffdf7;
  color: #4a3410;
  border-radius: 999px;
  padding: 0.35rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.lang-btn:hover {
  border-color: #d4b877;
  background: #fbf3df;
}

.lang-btn.active {
  background: #b8862f;
  color: #2a1d08;
  border-color: #b8862f;
  box-shadow: 0 2px 6px rgba(184, 134, 47, 0.35);
}
