:root {
  --paper: #fbfaf7;
  --ink: #243b30;
  --muted: #59675e;
  --green: #345943;
  --sage: #e8efe1;
  --line: #dfe2d8;
  --white: #fff;
  --radius: 12px;
  --max: 1320px;
  --gutter: clamp(14px, 2.5vw, 32px);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
html {
  scrollbar-gutter: stable;
}
body {
  margin: 0;
}
[hidden] {
  display: none !important;
}
button,
input,
select {
  font: inherit;
}
a {
  color: inherit;
}
button,
a,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
a {
  text-decoration: none;
}
p {
  line-height: 1.65;
}
button {
  border: 0;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #a35526;
  outline-offset: 5px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-weight: 550;
}
h2 {
  letter-spacing: -0.025em;
  font-weight: 550;
}
h3 {
  font-size: 1rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.skip {
  position: fixed;
  top: -70px;
  left: 20px;
  padding: 14px;
  background: white;
  z-index: 10;
}
.skip:focus {
  top: 12px;
}
.header {
  min-height: 56px;
  max-width: var(--max);
  width: 100%;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 23px;
  letter-spacing: -1px;
  font-weight: 650;
}
.logo-dot {
  color: #ad6236;
}
.home-brand {
  visibility: hidden;
}
.header nav {
  display: flex;
  gap: 24px;
  align-items: center;
}
.header nav a {
  padding: 12px 0;
  font-size: 14px;
  font-weight: 550;
}
.header nav a:hover,
.header nav a[aria-current] {
  color: #a35526;
}
.hero {
  min-height: 280px;
  height: clamp(280px, 40svh, 340px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px var(--gutter);
  text-align: center;
}
.hero .brand {
  font-size: clamp(2.5rem, 5vw, 3.25rem);
  letter-spacing: -2px;
  gap: 12px;
}
.hero .brand img {
  height: 54px;
  width: 54px;
}
.hero h1 {
  font-family: Georgia, serif;
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  margin: 12px 0 20px;
}
.search-bar {
  width: 100%;
  max-width: 660px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 5px 6px 5px 18px;
  box-shadow: 0 3px 14px #243b3007;
}
.search-bar:focus-within {
  border-color: #7c9372;
  box-shadow: 0 5px 22px #243b3010;
}
.search-bar input {
  border: 0;
  background: transparent;
  min-width: 0;
  flex: 1;
  padding: 12px 0;
  color: var(--ink);
  font-size: 16px;
  outline: none;
}
.search-bar input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.search-bar input:focus-visible {
  outline: none;
}
.search-bar input::placeholder {
  color: #697368;
}
.icon-button {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
}
.icon-button:hover {
  background: var(--sage);
}
.search-clear {
  color: var(--green);
}
.submit {
  flex-shrink: 0;
  background: var(--green);
  color: white;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.search-hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.search-hint a {
  text-decoration: underline;
  text-decoration-color: #a8b49f;
  text-underline-offset: 4px;
}
.about {
  border-top: 1px solid var(--line);
  padding: 24px
    max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
  scroll-margin-top: 16px;
  background: #f1f3ec;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 650;
  color: #566c51;
  margin-bottom: 8px;
}
.about h2,

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 16px;
}
.about-grid h3 {
  font-size: 15px;
  margin-bottom: 6px;
}
.about p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 0;
  line-height: 1.5;
}
.theory {
  max-width: 980px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.theory a,
.dish-topic a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.page {
  max-width: var(--max);
  margin: auto;
  padding: 16px var(--gutter) 24px;
}
.page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
}
.page-top h1 {
  margin-bottom: 6px;
}
.page-top p {
  color: var(--muted);
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.45;
}
.count {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.results-search {
  max-width: 660px;
  margin: 0 0 20px;
}
.results-title {
  font-size: 1.75rem;
  font-family: Georgia, serif;
  letter-spacing: -0.03em;
}
.food-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.food-card {
  display: block;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 2px 0 #dfe2d85c;
  overflow: hidden;
  transition: transform 0.15s;
}
.food-card:hover {
  transform: translateY(-3px);
}
.card-image {
  position: relative;
  height: 150px;
  overflow: hidden;
  background: var(--sage);
}
.card-image img,
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-photo img {
  object-fit: contain;
  background: var(--sage);
}
.card-culture {
  position: absolute;
  bottom: 8px;
  left: 8px;
  max-width: calc(100% - 16px);
  font-size: 11px;
  background: #fffe;
  padding: 4px 8px;
  border-radius: 12px;
  color: #273d2d;
}
.card-copy {
  padding: 12px;
}
.card-copy h2 {
  font-size: 17px;
  line-height: 1.25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
.card-copy h2 svg {
  width: 19px;
}
.card-copy p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}
.photo-pending {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(130deg, #e5eadb, #f1e9d9);
  color: #526348;
}
.food-card:nth-child(3n + 2) .photo-pending {
  background: linear-gradient(130deg, #ede4d8, #f5eee4);
}
.photo-pending svg {
  width: 44px;
  height: 44px;
  stroke-width: 0.9;
  opacity: 0.65;
}
.photo-pending span {
  font-size: 11px;
}
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.filter {
  padding: 11px 19px;
  border: 1px solid var(--line);
  border-radius: 30px;
  color: var(--muted);
  background: transparent;
  min-height: 44px;
}
.filter[aria-pressed="true"] {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.notice {
  background: var(--sage);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  margin: 12px 0;
}
.notice p:last-child {
  margin-bottom: 0;
}
.note,
.small-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.small-note {
  max-width: 360px;
}
.empty {
  border-top: 1px solid var(--line);
  padding: 16px 0 0;
  margin-top: 20px;
}
.empty h2 {
  font-size: 18px;
  margin-bottom: 6px;
}
.empty p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.primary,
.secondary,
.text-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 14px;
}
.primary {
  background: var(--green);
  color: white;
}
.secondary {
  background: transparent;
  border: 1px solid #abb7a6;
  color: var(--ink);
}
.text-link {
  padding-left: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.more {
  margin: 16px auto 0;
  display: flex;
}
.dish-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.dish-back {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  min-height: 44px;
  padding: 8px;
  margin-left: -8px;
  border-radius: 8px;
  background: transparent;
  color: var(--green);
  font-size: 14px;
}
.dish-back:hover {
  background: var(--sage);
}
.dish-back svg {
  width: 18px;
  height: 18px;
}
.meta-divider {
  width: 1px;
  height: 18px;
  flex-shrink: 0;
  background: var(--line);
}
.cultural-associations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.cultural-associations li {
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--sage);
  color: var(--green);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.dish-hero {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(28px, 4vw, 56px);
}
.hero-photo {
  width: 100%;
  height: clamp(300px, 40svh, 380px);
  border-radius: 18px;
  overflow: hidden;
}
.dish-intro h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.12;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.dish-visual {
  margin: 0;
  min-width: 0;
}
.photo-credit { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }


.photo-credit a {
  text-decoration: underline;
  text-underline-offset: 3px;
}






.reference-links li + li {
  margin-top: 8px;
}
#generation-status > .note {
  margin: 10px 0 0;
}
.dish-description {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.gloss {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 12px;
}
.gloss span {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.gloss p {
  font-size: 15px;
  margin: 5px 0 10px;
}
.dish-details {
  min-width: 0;
  margin: 28px 0;
}
#explanation-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.dish-topic {
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius);
}
.dish-topic h2 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  font-family: inherit;
}
.topic-body { color: var(--muted); font-size: 14px; line-height: 1.55; }
.topic-body > :last-child { margin-bottom: 0; }
.topic-body strong { display: inline; margin-right: 5px; color: var(--ink); }
.topic-body ul { display: flex; flex-wrap: wrap; padding: 0; list-style: none; gap: 6px; margin: 0 0 12px; }
.topic-body li { margin: 0; background: var(--sage); color: var(--green); border-radius: 6px; padding: 5px 8px; font-size: 12px; overflow-wrap: anywhere; }
#explanation-sections > .notice { grid-column: 1 / -1; margin: 0; padding: 14px 18px; }
#explanation-sections > .notice h3 { margin-bottom: 5px; }
#explanation-sections > .notice p { margin-bottom: 0; }
@media (max-width: 735px) { #explanation-sections { grid-template-columns: 1fr; } }
.attribution {
  font-size: 12px;
}
.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  font-size: 14px;
}
.spinner {
  height: 18px;
  width: 18px;
  border: 2px solid #bac7b0;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  width: calc(100% - 24px);
  max-width: 540px;
  max-height: 90svh;
  overflow: auto;
  color: var(--ink);
  background: var(--paper);
}
dialog::backdrop {
  background: #1e3529a3;
}
dialog h2 {
  font-size: 28px;
  margin: 12px 0;
}
dialog p {
  font-size: 14px;
  color: var(--muted);
}
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.upload-box {
  padding: 14px;
  border: 1px dashed #8b9c80;
  border-radius: 12px;
  text-align: center;
  margin: 14px 0;
}
.upload-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.upload-actions .secondary {
  padding: 10px 16px;
}
.upload-actions .secondary:hover {
  background: var(--sage);
}
.upload-box .photo-filename {
  margin: 12px 0 4px;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.upload-box .upload-hint {
  margin: 0;
  font-size: 12px;
}
.camera-preview {
  display: block;
  width: 100%;
  max-height: 240px;
  border-radius: 12px;
  background: var(--ink);
  object-fit: contain;
}
#camera-panel {
  margin-top: 14px;
}
.camera-status {
  margin: 8px 0 12px;
}
.photo-preview {
  max-height: 180px;
  max-width: 100%;
  border-radius: 12px;
  display: block;
  margin: 0 auto 14px;
}
.field {
  width: 100%;
  border: 1px solid #aebba5;
  background: white;
  border-radius: 12px;
  padding: 13px;
  color: var(--ink);
  font-size: 16px;
  margin: 9px 0 16px;
}
.photo-candidate {
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px;
  margin: 12px 0;
}
.photo-candidate h3 {
  margin-bottom: 6px;
}
.photo-candidate p {
  margin: 0;
}
.error {
  color: #8c351c;
}
.not-found {
  text-align: center;
  min-height: 65svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.not-found h1 {
  font-family: Georgia, serif;
  margin-bottom: 20px;
}
/* Compact layout inspired by the Monopoly Deal hub's shallow covers and
   horizontal mobile cards. Content remains in normal document flow. */
#app {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
#main {
  flex: 1;
}
.header .brand img {
  width: 30px;
  height: 30px;
}
.header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.about h2 {
  margin-bottom: 0;
}
.theory summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
}
.theory p {
  padding-bottom: 12px;
  font-size: 13px;
}
#results .food-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
#gallery + .note {
  margin: 16px 0 0;
}
.dish-page {
  display: block;
}
.empty .actions .secondary {
  min-height: 48px;
}
.secondary:hover {
  background: var(--sage);
  border-color: var(--green);
}
.dish-intro {
  width: 100%;
}


@media (max-width: 1099px) {
  .food-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 859px) {
  .food-grid,
  #results .food-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .food-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
  }
  .card-image {
    height: 100%;
    min-height: 112px;
  }
  .card-copy {
    padding: 10px;
    align-self: center;
  }
  .card-copy h2 {
    font-size: 16px;
  }
  .card-copy h2 svg {
    width: 16px;
  }
  .card-culture {
    left: 4px;
    bottom: 5px;
    max-width: calc(100% - 8px);
    padding: 3px 5px;
    font-size: 10px;
  }
  .photo-pending {
    gap: 6px;
    padding: 8px 4px 28px;
    text-align: center;
  }
  .photo-pending svg {
    width: 28px;
    height: 28px;
  }
  .photo-pending span {
    font-size: 10px;
  }
  .about-grid {
    gap: 16px;
  }

  .hero-photo {
    height: 280px;
  }
}
@media (max-width: 599px) {
  .header .brand {
    font-size: 21px;
    gap: 7px;
  }
  .header nav {
    gap: 20px;
  }
  .header nav a {
    font-size: 13px;
  }
  .hero {
    height: auto;
    min-height: 260px;
    padding: 24px var(--gutter);
  }
  .hero .brand img {
    width: 46px;
    height: 46px;
  }
  .hero h1 {
    margin: 12px 0 18px;
  }
  .search-bar {
    gap: 6px;
    padding: 4px 5px 4px 12px;
  }
  .search-bar > svg {
    width: 18px;
  }
  .search-bar input {
    width: 0;
  }
  .search-hint {
    font-size: 12px;
  }
  .about {
    padding: 20px var(--gutter);
  }
  .about-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
  }
  .about-grid h3 {
    margin-bottom: 4px;
  }
  .page {
    padding-top: 12px;
  }
  .page-top {
    gap: 10px;
    margin-bottom: 12px;
  }
  .page-top .count {
    max-width: 100px;
    text-align: right;
    font-size: 12px;
  }
  .page-top h1 {
    font-size: 1.75rem;
  }
  .page-top p {
    font-size: 13px;
  }
  .count {
    white-space: normal;
  }
  .results-search {
    margin-bottom: 16px;
  }
  .food-grid,
  #results .food-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .filters {
    margin-bottom: 12px;
  }
  .dish-hero {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .hero-photo {
    height: 150px;
  }
  .dish-meta {
    margin-bottom: 8px;
  }
  .dish-intro h1 {
    font-size: 1.9rem;
  }
  .dish-description {
    font-size: 15px;
  }
  .dish-details {
    margin-top: 16px;
  }

  .empty {
    margin-top: 16px;
  }
  .actions {
    gap: 8px;
  }
  .actions .secondary {
    font-size: 13px;
    padding: 10px 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Compact, explicit source links and per-photo controls. */
.citation {font-size:.78em;vertical-align:super;font-weight:650;white-space:nowrap;scroll-margin-top:1rem}
.dish-references {border-top:1px solid var(--line,#c9d2c3);margin-top:2rem;padding-top:1rem;font-size:.9rem}
.dish-references li {margin:.6rem 0;overflow-wrap:anywhere;scroll-margin-top:2rem}
.dish-references li:target {background:#e8efe1;outline:2px solid #537b57;outline-offset:4px}
.photo-controls {display:flex;gap:1rem;align-items:center;justify-content:center;margin-top:.65rem}
.photo-controls button {padding:.5rem;min-width:44px;min-height:44px}
.photo-controls svg {width:20px;height:20px}
.attribution-text {display:block;font-size:.78rem;margin-top:.35rem}
.photo-caption {margin:.4rem 0;font-size:.88rem}

/* Bracketed bibliography labels match inline citation numbers. */
.dish-references li::marker { content: "[" counter(list-item) "] "; }

.photo-credit .photo-variant, .photo-credit .note { display: block; margin-top: .3rem; }
