/* ================================================================
   Today's Lunch — Refined modernist tasting-menu
   Display: Fraunces (variable serif with soft + opsz axes)
   Body:    Bricolage Grotesque (variable)
   Mono:    JetBrains Mono
   ================================================================ */

:root {
  /* Whisper-light: near white with the faintest warm tint */
  --bg:           #fefdfa;
  --bg-elev:      #ffffff;
  --bg-sunken:    #f7f5ef;
  --ink:          #3d3d3a;
  --ink-2:        #76756e;
  --ink-mute:     #b3b1a6;
  --rule:         #e8e4d8;
  --rule-soft:    rgba(61, 61, 58, 0.05);
  --rule-faint:   rgba(61, 61, 58, 0.03);

  --accent:       #8aa590;     /* pale sage */
  --accent-soft:  rgba(138, 165, 144, 0.08);
  --accent-ink:   #6b8a73;
  --accent-2:     #e89478;     /* light coral — errors only */

  --sage:         #9bb8a4;
  --gold:         #e0c878;

  --shadow:       0 1px 0 rgba(61, 61, 58, 0.02),
                  0 4px 14px -10px rgba(61, 61, 58, 0.08);
  --shadow-lift:  0 2px 4px -2px rgba(61, 61, 58, 0.04),
                  0 16px 40px -24px rgba(61, 61, 58, 0.12);

  --serif:  "Fraunces", "Instrument Serif", "Times New Roman", Georgia, serif;
  --sans:   "Bricolage Grotesque", "Helvetica Neue", Helvetica, system-ui, sans-serif;
  --mono:   "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --col-gap: 24px;
  --col-radius: 6px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:           #121211;
    --bg-elev:      #1a1a18;
    --bg-sunken:    #0c0c0b;
    --ink:          #f0eee6;
    --ink-2:        #d1cfc4;
    --ink-mute:     #8a877c;
    --rule:         #f0eee6;
    --rule-soft:    rgba(240, 238, 230, 0.14);
    --rule-faint:   rgba(240, 238, 230, 0.08);

    --accent:       #7fa893;
    --accent-soft:  rgba(127, 168, 147, 0.14);
    --accent-ink:   #aecabb;
    --accent-2:     #e07a52;

    --sage:         #97b790;
    --gold:         #d8b94a;

    --shadow:       0 1px 0 rgba(0, 0, 0, 0.4);
    --shadow-lift:  0 24px 60px -28px rgba(0, 0, 0, 0.7);

    color-scheme: dark;
  }
}

[data-theme="dark"] {
  --bg:           #121211;
  --bg-elev:      #1a1a18;
  --bg-sunken:    #0c0c0b;
  --ink:          #f0eee6;
  --ink-2:        #d1cfc4;
  --ink-mute:     #8a877c;
  --rule:         #2c2a26;
  --rule-soft:    rgba(240, 238, 230, 0.10);
  --rule-faint:   rgba(240, 238, 230, 0.05);

  --accent:       #7fa893;
  --accent-soft:  rgba(127, 168, 147, 0.14);
  --accent-ink:   #aecabb;
  --accent-2:     #e07a52;

  --sage:         #97b790;
  --gold:         #d8b94a;

  --shadow:       0 1px 0 rgba(0, 0, 0, 0.3);
  --shadow-lift:  0 2px 6px -2px rgba(0, 0, 0, 0.4),
                  0 24px 60px -28px rgba(0, 0, 0, 0.7);

  color-scheme: dark;
}

/* -------------------- Base -------------------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: var(--sans);
  font-variation-settings: "wght" 420, "opsz" 14;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  max-width: 100vw;
}
::selection { background: var(--accent); color: var(--bg-elev); }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }
a:hover { color: var(--accent-ink); }

/* -------------------- Masthead -------------------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.masthead-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.1rem clamp(1.2rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-mark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--accent);
  width: 36px; height: 36px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-line-1 {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
}
.brand-line-2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.45rem;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 2px;
  font-variation-settings: "opsz" 48, "SOFT" 80, "wght" 500;
}

.dateline {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  gap: 4px;
}
.dateline-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
}
.dateline-date {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variation-settings: "opsz" 60, "SOFT" 70, "wght" 450;
}
.dateline-edition {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: end;
}

.lang-toggle, .view-toggle {
  display: inline-flex;
  background: var(--bg-sunken);
  border-radius: 999px;
  padding: 3px;
}
.lang-toggle button, .view-toggle button {
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.view-toggle button.active {
  background: var(--ink);
  color: var(--bg);
}
.lang-toggle button.active {
  background: var(--accent);
  color: var(--bg-elev);
}
.lang-toggle button:hover:not(.active),
.view-toggle button:hover:not(.active) { color: var(--ink); }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1px solid var(--rule-soft);
  background: var(--bg-sunken);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.5s ease;
}
.icon-btn:hover { background: var(--ink); color: var(--bg); }
.icon-btn:active { transform: rotate(180deg); }

/* Variant: pill button with text label alongside icon */
.icon-btn--labelled {
  width: auto;
  gap: 0.45rem;
  padding: 0 0.85rem 0 0.7rem;
}
.icon-btn--labelled:active { transform: none; }
.icon-btn-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#theme-toggle { position: relative; }
#theme-toggle:active { transform: none; }
#theme-toggle .theme-icon-sun,
#theme-toggle .theme-icon-moon {
  position: absolute;
  transition: opacity 0.25s ease, transform 0.4s cubic-bezier(.4, 0, .2, 1);
}
[data-theme="light"] #theme-toggle .theme-icon-sun { opacity: 1; transform: rotate(0); }
[data-theme="light"] #theme-toggle .theme-icon-moon { opacity: 0; transform: rotate(-90deg); }
[data-theme="dark"] #theme-toggle .theme-icon-sun { opacity: 0; transform: rotate(90deg); }
[data-theme="dark"] #theme-toggle .theme-icon-moon { opacity: 1; transform: rotate(0); }

/* Smooth color transition on theme change */
body, .card, .masthead, footer, dialog, .pill, .chip,
.lang-toggle, .view-toggle, .icon-btn, .menu-image, .day-row.today {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* -------------------- Layout -------------------- */

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(1.6rem, 4vw, 2.8rem) clamp(1.2rem, 4vw, 3rem) 4rem;
}

.section { margin-top: 3rem; }

.section-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.4rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--rule);
}
.section-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.7rem, 2.6vw, 2.1rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variation-settings: "opsz" 96, "SOFT" 70, "wght" 500;
}
.section-meta {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
}

/* -------------------- Grid -------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: var(--col-gap);
}

@media (min-width: 1100px) {
  .grid:not(.week-grid) { grid-template-columns: repeat(3, 1fr); }
  /* When the 4th card (Bakern) is alone on its row, span the full row */
  .grid:not(.week-grid) > .card:nth-child(4):last-child {
    grid-column: 1 / -1;
  }
}

/* -------------------- Card -------------------- */

.card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--rule-soft);
  border-radius: var(--col-radius);
  padding: 1.5rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-height: 280px;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
}
.card:hover {
  /* Keep border and box-shadow constant on hover; no transform or shadow lift */
}

.card-ordinal {
  display: none;
}
.card:hover .card-ordinal {
  display: none;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-right: 3rem;
  position: relative;
}

.card-desc {
  margin: -0.2rem 0 0;
  font-family: var(--sans);
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink-2);
}

.card-share {
  position: absolute;
  top: 0;
  right: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--ink-mute);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.card-share:hover {
  color: var(--ink);
  border-color: var(--ink-2);
  background: var(--bg-sunken);
}

.card-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.85rem;
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variation-settings: "opsz" 72, "SOFT" 70, "wght" 500;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-2);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-sunken);
  border: 1px solid var(--rule-soft);
  color: var(--ink);
  white-space: nowrap;
}
.pill.open {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.pill.open::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* -------------------- Menu list -------------------- */

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.menu li {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: 0.6rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule-faint);
  align-items: baseline;
}
.menu li:first-child { border-top-color: var(--rule-soft); }

.menu .icon {
  font-size: 1.05rem;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  /* Use system emoji rendering; avoid serif so emojis align cleanly */
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
}
.menu .icon.veg {
  color: var(--sage);
  font-size: 1rem;
}

.dish {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dish .name {
  font-family: var(--sans);
  font-variation-settings: "wght" 460, "opsz" 16;
  font-size: 0.98rem;
  line-height: 1.4;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.empty {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-mute);
  padding: 1.5rem 0;
  text-align: center;
}

/* -------------------- Allergens -------------------- */

.allergen-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 2px;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--ink-2);
  line-height: 1.6;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  white-space: nowrap;
  font-family: var(--mono);
}
button.chip {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--ink-2);
  margin: 0;
}
.chip:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-elev);
}
.chip.is-avoided {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.chip.is-avoided:hover {
  background: #a82d22;
  border-color: #a82d22;
}
[data-theme="dark"] .chip.is-avoided {
  background: #e57368;
  border-color: #e57368;
  color: #1a1a1a;
}

/* Allergen reference dialog list */
#allergen-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0.6rem;
  align-items: baseline;
  font-size: 0.92rem;
}
.allergen-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-mute);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.allergen-name {
  font-family: var(--sans);
  color: var(--ink);
}

/* -------------------- Image card (bakery) -------------------- */

.card--image .image-note {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0.2rem 0;
}
.card--image .image-note p {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--ink-2);
}
.card--image .image-link {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-bottom-color: var(--accent);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
.card--image .image-link:hover {
  background: var(--accent);
  color: var(--bg-elev);
}

/* Full-row image card: keep it spanning, but content is just text */
@media (min-width: 1100px) {
  .grid:not(.week-grid) > .card--image:nth-child(4):last-child {
    grid-column: 1 / -1;
  }
}

/* -------------------- Skeletons -------------------- */

.card.skeleton .skel-line {
  height: 0.9rem;
  background: linear-gradient(
    90deg,
    var(--bg-sunken) 0%,
    var(--rule-soft) 50%,
    var(--bg-sunken) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  margin: 0.45rem 0;
  border-radius: 3px;
}
.card.skeleton .skel-line.short { width: 60%; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* -------------------- Error -------------------- */

.card.error { background: var(--bg); }
.card.error .card-header h2 { color: var(--accent-2); }
.card.error .empty { color: var(--accent-2); }

/* -------------------- Week view -------------------- */

.week-grid {
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}

.week-card .week-days {
  display: flex;
  flex-direction: column;
}

.day-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule-faint);
  align-items: flex-start;
}
.day-row:first-child { border-top: 1px solid var(--rule-soft); }

.day-row.today {
  background:
    linear-gradient(90deg, var(--accent-soft), transparent 80%);
  margin: 0 -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  border-radius: 4px;
  border-top-color: transparent;
}
.day-row.today + .day-row { border-top-color: transparent; }

.day-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.day-name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.day-row.today .day-name { color: var(--accent); }

.today-pill {
  display: inline-block;
  width: fit-content;
  background: var(--accent);
  color: var(--bg-elev);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
}

.week-dishes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.week-dishes li {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.96rem;
}
.week-dishes .icon {
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
}
.week-dishes .icon.veg {
  color: var(--sage);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.dish-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.empty-day {
  padding: 0;
  border: 0;
  color: var(--ink-mute);
  font-style: italic;
  font-size: 0.95rem;
  text-align: left;
}

@media (max-width: 560px) {
  .day-row { grid-template-columns: 1fr; gap: 0.5rem; padding: 0.9rem 0; }
  .day-label { flex-direction: row; align-items: center; gap: 0.6rem; }
  .day-name { font-size: 1.2rem; }
}

/* -------------------- Status / footer -------------------- */

.status {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  text-align: center;
  margin: 3rem 0 0;
}

footer {
  border-top: 1px solid var(--rule-soft);
  margin-top: 2rem;
}
.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.3rem clamp(1.2rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.copy {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
}
footer a {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom-style: dotted;
}

/* -------------------- Dialog -------------------- */

dialog {
  border: 0;
  background: var(--bg-elev);
  color: var(--ink);
  padding: 0;
  border-radius: 10px;
  max-width: 520px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}
dialog::backdrop {
  background: rgba(28, 28, 28, 0.5);
  backdrop-filter: blur(6px);
}

dialog h3 {
  margin: 0;
  padding: 1.4rem 1.6rem 1rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.5rem;
  border-bottom: 1px solid var(--rule-soft);
}
dialog ol {
  list-style: none;
  margin: 0;
  padding: 1rem 1.6rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 1.2rem;
}
dialog li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.92rem;
}
dialog form {
  padding: 0.8rem 1.6rem 1.3rem;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--rule-soft);
  background: var(--bg-sunken);
}
dialog button {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.55rem 1.2rem;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  cursor: pointer;
}
dialog button:hover { background: var(--accent); }

/* -------------------- Filter dialog -------------------- */

#filter-dialog h4 {
  margin: 0;
  padding: 0.9rem 1.6rem 0.5rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem 1.6rem;
  font-family: var(--sans);
  font-size: 0.98rem;
  cursor: pointer;
  border-bottom: 1px solid var(--rule-soft);
}
.filter-toggle input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.filter-allergen-grid {
  padding: 0.5rem 1.4rem 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 1rem;
}
.filter-allergen {
  display: grid;
  grid-template-columns: 18px 24px 1fr;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.92rem;
  padding: 0.35rem 0.2rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.filter-allergen:hover { background: var(--bg-sunken); }
.filter-allergen input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.filter-num {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}
.filter-name { color: var(--ink); }

.filter-actions {
  justify-content: space-between !important;
}
.link-btn {
  background: transparent !important;
  color: var(--ink-2) !important;
  border: 1px solid var(--rule) !important;
}
.link-btn:hover { color: var(--ink) !important; background: var(--bg-sunken) !important; }

/* -------------------- Suggestion dialog -------------------- */
.suggest-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--ink-2);
  line-height: 1.5;
}
.suggest-form { display: flex; flex-direction: column; gap: 0.8rem; }
.suggest-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
@media (max-width: 480px) {
  .suggest-row { grid-template-columns: 1fr; }
}
.suggest-field { display: flex; flex-direction: column; gap: 0.3rem; }
.suggest-field span {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.suggest-field input,
.suggest-field textarea {
  font: inherit;
  font-size: 0.92rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
  resize: vertical;
}
.suggest-field input:focus,
.suggest-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.suggest-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.suggest-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.82rem;
  color: var(--ink-2);
}

/* Filter button badge */
#filter-btn { position: relative; }
.filter-count {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg-elev);
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 600;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
#filter-btn.has-active .filter-count { display: inline-flex; }
#filter-btn.has-active { color: var(--accent); border-color: var(--accent); }

/* -------------------- Card states -------------------- */

.card--open {
  border-color: var(--accent);
  box-shadow: var(--shadow-lift), inset 0 0 0 1px var(--accent);
}
.card--open .card-ordinal {
  background: var(--accent);
  color: var(--bg-elev);
}

.card--closed {
  border-color: #c0392b;
  box-shadow: inset 0 0 0 1px #c0392b;
}
[data-theme="dark"] .card--closed {
  border-color: #e57368;
  box-shadow: inset 0 0 0 1px #e57368;
}

/* Dish hidden by avoid filter — kept visible, but dimmed and struck through */
.dish--avoided .name {
  text-decoration: line-through;
  text-decoration-color: var(--ink-mute);
  color: var(--ink-2);
  opacity: 0.7;
}
.avoid-warn {
  display: inline-block;
  margin-left: 0.4rem;
  color: var(--accent-2, #c97a4e);
  font-size: 0.85em;
  vertical-align: middle;
}

/* Notice banner inside a card (e.g. strike, closure) */
.card-notice {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 2.4rem;
  background: var(--bg-sunken);
  border-left: 3px solid var(--accent-2, #c97a4e);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
}
.card-notice::before {
  content: "!";
  position: absolute;
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-2, #c97a4e);
  color: var(--bg-elev);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card--noticed {
  border-color: var(--accent-2, #c97a4e);
}
.card--noticed .menu,
.card--noticed .week-days {
  opacity: 0.55;
}

/* -------------------- Reveal animations -------------------- */

@media (prefers-reduced-motion: no-preference) {
  .brand, .dateline, .controls {
    animation: fade 0.7s ease both;
  }
  .dateline { animation-delay: 0.05s; }
  .controls { animation-delay: 0.1s; }

  .card {
    animation: rise 0.5s cubic-bezier(.2,.7,.2,1) both;
  }
  .grid > .card:nth-child(1) { animation-delay: 0.06s; }
  .grid > .card:nth-child(2) { animation-delay: 0.12s; }
  .grid > .card:nth-child(3) { animation-delay: 0.18s; }
  .grid > .card:nth-child(4) { animation-delay: 0.24s; }
  .grid > .card:nth-child(5) { animation-delay: 0.30s; }
  .grid > .card:nth-child(6) { animation-delay: 0.36s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------------------- Responsive -------------------- */

@media (max-width: 900px) {
  .masthead-inner {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.9rem clamp(1rem, 4vw, 1.5rem);
  }
  .brand { grid-row: 1; }
  .dateline {
    grid-row: 2;
    align-items: flex-start;
    flex-direction: row;
    gap: 0.8rem;
  }
  .dateline-label { font-size: 0.6rem; }
  .dateline-date { font-size: 1.15rem; }
  .controls {
    grid-row: 3;
    justify-self: stretch;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
}

@media (max-width: 560px) {
  :root { --col-gap: 0.9rem; }
  html { -webkit-tap-highlight-color: transparent; }
  body { padding-bottom: env(safe-area-inset-bottom); }
  .masthead { position: static; }
  .masthead-inner {
    padding-left: max(0.85rem, env(safe-area-inset-left));
    padding-right: max(0.85rem, env(safe-area-inset-right));
    gap: 0.6rem;
  }
  main {
    padding: 1.25rem max(0.85rem, env(safe-area-inset-left)) 2.5rem;
  }
  .brand-line-1 { font-size: 0.58rem; }
  .brand-line-2 { font-size: 1.1rem; }
  .brand-mark { width: 32px; height: 32px; font-size: 1.5rem; }

  /* Make controls wrap and fit even narrow viewports */
  .controls {
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
  }
  /* Hide text labels on icon buttons to save space */
  .icon-btn--labelled { padding: 0 0.5rem; gap: 0.3rem; }
  .icon-btn--labelled .icon-btn-label { display: none; }
  .icon-btn { width: 34px; height: 34px; }
  .lang-toggle, .view-toggle { padding: 2px; }
  .lang-toggle button, .view-toggle button {
    padding: 0.4rem 0.6rem;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
  }

  /* Grid: allow shrinking below 290px so it never overflows */
  .grid { grid-template-columns: 1fr; }

  /* Cards: tighter padding, smaller min-height, smaller heading */
  .card { padding: 1.1rem 1rem; min-height: 0; gap: 0.85rem; border-radius: 10px; min-width: 0; }
  .card-header { gap: 0.5rem; padding-right: 2.5rem; min-width: 0; }
  .card-header h2 { font-size: 1.4rem; word-break: break-word; }
  .card-meta { gap: 0.25rem 0.35rem; font-size: 0.6rem; }
  .pill { padding: 0.2rem 0.5rem; }

  /* Bigger touch target for share button */
  .card-share { width: 32px; height: 32px; }

  /* Menu items tighter, allow wrapping */
  .menu { min-width: 0; }
  .menu li { padding: 0.7rem 0; grid-template-columns: 1.2rem 1fr; gap: 0.5rem; min-width: 0; }
  .dish, .dish-text { min-width: 0; }
  .dish .name { font-size: 0.95rem; word-break: break-word; }
  .chip { padding: 0.18rem 0.55rem; font-size: 0.62rem; }
  .allergen-chips { max-width: 100%; }

  /* Section heads slimmer */
  .section { margin-top: 2rem; }
  .section-head { gap: 0.6rem; margin-bottom: 1rem; padding-bottom: 0.6rem; }
  .section-meta { display: none; }
  .section-head h2 { font-size: 1.4rem; }

  /* Dialogs: full-width with comfortable margin */
  dialog { width: calc(100% - 1.5rem); max-height: 88vh; }
  dialog form { padding: 0.9rem 1rem 1rem; }
  dialog h3 { padding: 1rem 1rem 0.6rem; font-size: 1.4rem; }
  dialog ol { grid-template-columns: 1fr; padding: 0.9rem 1rem; }

  /* Prevent iOS zoom-on-focus by ensuring inputs >= 16px */
  .suggest-field input,
  .suggest-field textarea { font-size: 16px; }

  /* Toast lifted above safe-area */
  .toast { bottom: calc(20px + env(safe-area-inset-bottom)); }

  /* Footer compact */
  .footer-inner { padding: 1rem; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

@media (max-width: 380px) {
  /* Very small phones: drop the location line and shrink toggles more */
  .brand-line-1 { display: none; }
  .lang-toggle button, .view-toggle button { padding: 0.35rem 0.5rem; font-size: 0.6rem; }
  .card-header h2 { font-size: 1.25rem; }
  .icon-btn { width: 32px; height: 32px; }
}

/* Remove sticky hover effects on touch devices to avoid lingering state */
@media (hover: none) {
  .icon-btn:hover { background: var(--bg-sunken); color: var(--ink); }
  .chip:hover { background: transparent; color: var(--ink-2); border-color: var(--rule); }
  .chip.is-avoided:hover { background: #c0392b; color: #fff; border-color: #c0392b; }
  .card-share:hover { background: transparent; color: var(--ink-mute); border-color: var(--rule); }
}

/* -------------------- Toast -------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg-elev);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* -------------------- Install button -------------------- */
#install-btn[hidden] { display: none; }

/* -------------------- Lunch rooms -------------------- */
.rooms-dialog { max-width: 460px; }
.rooms-body {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}
.rooms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.4rem 0.9rem;
  border-bottom: 1px solid var(--rule-soft);
}
.rooms-head h3 {
  margin: 0;
  padding: 0;
  border: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.4rem;
}
.rooms-x {
  background: transparent;
  border: 0;
  color: var(--ink-mute);
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}
.rooms-x:hover { color: var(--ink); }
.rooms-intro {
  margin: 0;
  padding: 1rem 1.4rem 0;
  font-size: 0.85rem;
  color: var(--ink-2);
  line-height: 1.5;
}
.rooms-note {
  margin: 0.6rem 0 0;
  padding: 0 1.4rem;
  font-size: 0.72rem;
  color: var(--ink-mute);
  line-height: 1.4;
}
.rooms-error {
  margin: 0.7rem 1.4rem 0;
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  color: var(--bg);
  background: var(--accent-2);
  border-radius: 6px;
}
.room-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.8rem 1.4rem 0;
}
.room-field > span:first-child,
.room-legend {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.room-field input[type="text"],
.room-field input[type="time"] {
  font: inherit;
  font-size: 0.92rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.room-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.room-checks { display: flex; flex-direction: column; gap: 0.4rem; }
.room-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; cursor: pointer; }
.room-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.room-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.room-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.82rem;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.room-chip input { accent-color: var(--accent); cursor: pointer; }
.room-addtime { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }

.room-decision {
  margin: 0;
  padding: 0.85rem 1.4rem;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--rule-soft);
}
.room-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.4rem 0;
}
.room-count {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.room-members { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.6rem 1.4rem 0; }
.room-member {
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-sunken);
  border-radius: 999px;
  color: var(--ink-2);
}
.room-member.is-org { color: var(--accent-ink); font-weight: 600; }
.room-section { padding: 0.9rem 1.4rem 0; display: flex; flex-direction: column; gap: 0.45rem; }
.room-options { display: flex; flex-direction: column; gap: 0.4rem; }
.room-option {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-family: var(--sans) !important;
  font-size: 0.95rem !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  padding: 0.6rem 0.8rem !important;
  background: var(--bg) !important;
  color: var(--ink) !important;
  border: 1px solid var(--rule) !important;
  border-radius: 8px !important;
}
.room-option:hover { border-color: var(--accent) !important; }
.room-option.is-mine { border-color: var(--accent) !important; background: var(--accent-soft) !important; }
.room-option-count {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--ink-2);
}
.room-option.is-lead .room-option-count { color: var(--accent-ink); font-weight: 600; }
.room-times { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.room-time {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono) !important;
  font-size: 0.85rem !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  padding: 0.4rem 0.7rem !important;
  background: var(--bg) !important;
  color: var(--ink) !important;
  border: 1px solid var(--rule) !important;
  border-radius: 999px !important;
  font-variant-numeric: tabular-nums;
}
.room-time:hover { border-color: var(--accent) !important; }
.room-time.is-mine { border-color: var(--accent) !important; background: var(--accent-soft) !important; }
.room-time-count { color: var(--ink-2); font-size: 0.78rem; }
.room-time.is-lead .room-time-count { color: var(--accent-ink); font-weight: 600; }
.room-option[disabled], .room-time[disabled] { opacity: 0.6; cursor: default; }
.rooms-body .filter-actions {
  padding: 1rem 1.4rem 1.3rem;
  margin-top: 0.9rem;
  border-top: 1px solid var(--rule-soft);
  background: var(--bg-sunken);
}
.room-leave { color: var(--accent-2) !important; border-color: var(--rule) !important; }


