:root {
  --paper: #f6efe3;
  --paper-2: #efe5d4;
  --card: #fbf7f0;
  --ink: #2a1d17;
  --muted: #7a6a5c;
  --tuna: #b8452e;
  --tuna-dark: #963624;
  --olive: #6b7046;
  --rule: #d8c8b0;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  background-image: radial-gradient(rgba(120, 90, 60, .06) 1px, transparent 1px);
  background-size: 4px 4px;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 48px 24px calc(64px + env(safe-area-inset-bottom)); }

/* ---------- masthead ---------- */
.mast { text-align: center; border-bottom: 1px solid var(--rule); padding-bottom: 32px; }
.kicker, .label { font-size: .7rem; letter-spacing: .32em; text-transform: uppercase; color: var(--muted); }
.mast h1 {
  font-family: var(--serif); font-weight: 400; font-style: italic;
  font-size: clamp(2.8rem, 10vw, 6.5rem); line-height: .95; letter-spacing: -.02em;
  margin: 14px 0 12px;
}
.mast h1 b { font-style: normal; font-weight: 700; color: var(--tuna); }
.mast p { font-family: var(--serif); font-size: 1.15rem; color: var(--muted); max-width: 520px; margin: 0 auto; }
.ornament { color: var(--tuna); letter-spacing: .6em; margin-top: 18px; font-size: .9rem; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: center; padding: 48px 0; border-bottom: 1px solid var(--rule); }
.hero img { width: 100%; height: auto; aspect-ratio: 3/4; object-fit: cover; border-radius: 2px; box-shadow: 0 30px 60px -30px rgba(60, 30, 10, .5); }
.hero figcaption { font-family: var(--serif); font-style: italic; font-size: .9rem; color: var(--muted); margin-top: 10px; }
.hero h2 { font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 2.2rem); font-weight: 500; line-height: 1.15; margin-bottom: 18px; }
.hero-copy p { font-family: var(--serif); font-size: 1.12rem; margin-bottom: 14px; }
.hero .sig { font-style: italic; color: var(--tuna); font-size: 1.3rem; }

/* ---------- amuse-bouche ---------- */
.amuse { text-align: center; padding: 44px 0; border-bottom: 1px solid var(--rule); }
.amuse h2 { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: 1.9rem; margin: 6px 0 10px; }
.amuse p { font-family: var(--serif); font-size: 1.15rem; max-width: 560px; margin: 0 auto 18px; min-height: 3.4em; transition: opacity .2s; }

/* ---------- section titles ---------- */
.section-title { text-align: center; padding: 56px 0 8px; }
.section-title h2 { font-family: var(--serif); font-weight: 400; font-size: 2.6rem; font-style: italic; }
.section-title span { display: block; font-size: .7rem; letter-spacing: .32em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.loading { text-align: center; font-family: var(--serif); font-style: italic; color: var(--muted); padding: 40px 0; }

/* ---------- courses ---------- */
.course { display: grid; grid-template-columns: 110px 1fr 300px; gap: 32px; padding: 40px 0; border-bottom: 1px dashed var(--rule); align-items: start; }
.course .yr { font-family: var(--serif); font-size: 3rem; font-weight: 300; color: var(--tuna); line-height: 1; }
.course .yr small { display: block; font-family: var(--sans); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.course h3 { font-family: var(--serif); font-size: 1.75rem; font-weight: 500; line-height: 1.2; display: flex; align-items: baseline; gap: 12px; }
.course h3::after { content: ""; flex: 1; border-bottom: 2px dotted var(--rule); transform: translateY(-6px); min-width: 20px; }
.course .place { color: var(--muted); font-size: .9rem; margin: 4px 0 12px; }
.course .note { font-family: var(--serif); font-size: 1.08rem; }

.plate { display: flex; flex-direction: column; gap: 8px; }
.plate .main { padding: 0; border: 0; background: none; cursor: zoom-in; overflow: hidden; border-radius: 2px; }
.plate .main img { width: 100%; aspect-ratio: 4/3; object-fit: cover; object-position: center 25%; transition: transform .4s ease; }
.plate .main:hover img { transform: scale(1.03); }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb { position: relative; width: 54px; height: 54px; padding: 0; border: 0; border-radius: 2px; overflow: hidden; cursor: pointer; background: var(--paper-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(42, 29, 23, .8); color: #fff; font-size: .7rem; line-height: 18px; cursor: pointer; display: none; }
.editing .thumb .x { display: block; }
.empty-plate {
  aspect-ratio: 4/3; border: 2px dashed var(--rule); display: grid; place-items: center; text-align: center;
  font-family: var(--serif); font-style: italic; color: var(--muted); padding: 16px; border-radius: 2px;
}

/* scores */
.scores { width: 100%; margin-top: 18px; border-collapse: collapse; font-size: .85rem; }
.scores th { font-weight: 500; text-align: left; color: var(--muted); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; padding-bottom: 4px; }
.scores th:not(:first-child), .scores td:not(:first-child) { text-align: right; width: 90px; }
.scores td { padding: 5px 0; border-bottom: 1px solid var(--paper-2); }
.fork {
  display: inline-block; width: 1em; height: 1em; vertical-align: -.15em; background: var(--tuna);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 2v7a3 3 0 0 0 2 2.83V22h2V11.83A3 3 0 0 0 15 9V2h-1.5v6h-1V2h-1v6h-1V2z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 2v7a3 3 0 0 0 2 2.83V22h2V11.83A3 3 0 0 0 15 9V2h-1.5v6h-1V2h-1v6h-1V2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.fork.off { background: var(--rule); }
.forks-read { white-space: nowrap; font-size: 1.05rem; }
.verdict { margin-top: 16px; display: flex; align-items: baseline; gap: 10px; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--olive); }
.verdict strong { font-family: var(--serif); font-size: 2rem; letter-spacing: 0; color: var(--ink); font-weight: 600; }
.verdict em { font-family: var(--serif); text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--muted); }
.unscored { margin-top: 16px; font-family: var(--serif); font-style: italic; color: var(--muted); }

/* staff controls */
.staff-only { display: none !important; }
.editing .staff-only { display: flex !important; }
.course-tools { gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.add-course { justify-content: center; padding: 32px 0 0; }

/* ---------- digestif ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-top: 20px; }
.stats div { padding: 22px 12px; text-align: center; }
.stats div + div { border-left: 1px solid var(--rule); }
.stats dd { font-family: var(--serif); font-size: 2.4rem; color: var(--tuna); line-height: 1; }
.stats dt { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }

/* ---------- next table ---------- */
.next-table { margin-top: 56px; background: var(--ink); color: var(--paper); padding: 40px; text-align: center; border-radius: 2px; }
.next-table h2 { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: 2rem; }
.next-table p { color: #cbb9a4; margin: 6px 0 20px; }
.next-table .btn-line { color: var(--paper); border-color: #6a5a50; }

footer { text-align: center; padding-top: 48px; font-family: var(--serif); font-style: italic; color: var(--muted); }
.kitchen { margin-top: 18px; background: none; border: 0; color: var(--rule); font: .7rem var(--sans); letter-spacing: .25em; text-transform: uppercase; cursor: pointer; padding: 8px; }
.kitchen:hover { color: var(--muted); }

/* ---------- buttons ---------- */
.btn, .btn-line, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: 2px; cursor: pointer; text-decoration: none;
  font: 600 .74rem var(--sans); letter-spacing: .18em; text-transform: uppercase;
}
.btn { background: var(--tuna); color: #fff; border: 0; }
.btn:hover { background: var(--tuna-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-line { background: none; border: 1px solid var(--rule); color: var(--ink); }
.btn-line:hover { border-color: var(--tuna); color: var(--tuna); }
.btn-ghost { background: none; border: 0; color: var(--muted); }
.btn-danger { background: none; border: 1px solid #e0b8ae; color: var(--tuna); }
.btn-sm { padding: 7px 12px; font-size: .66rem; }

/* ---------- dialogs ---------- */
.dlg { margin: auto; border: 0; border-radius: 4px; background: var(--card); color: var(--ink); width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 28px; box-shadow: 0 30px 80px rgba(42, 29, 23, .4); }
.dlg::backdrop { background: rgba(42, 29, 23, .55); }
.dlg h3 { font-family: var(--serif); font-weight: 500; font-size: 1.6rem; margin-bottom: 14px; }
.dlg .muted { color: var(--muted); font-size: .92rem; margin: -6px 0 14px; }
.dlg label { display: block; font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.dlg input:not([type=radio]), .dlg textarea {
  display: block; width: 100%; margin-top: 4px; background: transparent; border: 0; border-bottom: 1px solid var(--rule);
  font: 1.08rem var(--serif); color: var(--ink); padding: 6px 0; outline: none; border-radius: 0; resize: vertical;
  letter-spacing: 0; text-transform: none;
}
.dlg input:focus, .dlg textarea:focus { border-color: var(--tuna); }
.dlg .row { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; }
.dlg-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 18px; }
.spacer { flex: 1; }
.err { color: var(--tuna); font-size: .88rem; min-height: 1.2em; }

.who { display: flex; gap: 8px; margin-bottom: 14px; }
.who label { margin: 0; }
.who input { position: absolute; opacity: 0; }
.who span { display: inline-block; padding: 7px 16px; border: 1px solid var(--rule); border-radius: 99px; font: 600 .8rem var(--sans); letter-spacing: .05em; text-transform: none; color: var(--ink); cursor: pointer; }
.who input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.who input:focus-visible + span { outline: 2px solid var(--tuna); outline-offset: 2px; }

.fork-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--paper-2); }
.fork-row span { font-family: var(--serif); font-size: 1.05rem; }
.fork-row .forks { display: flex; }
.fork-row .forks button { background: none; border: 0; font-size: 1.5rem; padding: 4px 3px; cursor: pointer; line-height: 1; transition: transform .12s; }
.fork-row .forks button .fork { background: var(--rule); transition: background .12s; }
.fork-row .forks button.on .fork { background: var(--tuna); }
.fork-row .forks button:active { transform: scale(.88); }

/* ---------- lightbox ---------- */
.lightbox { margin: auto; border: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; padding: 0; display: none; }
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgba(20, 12, 8, .92); }
.lightbox img { max-width: 94vw; max-height: 88dvh; object-fit: contain; }
.lb-close, .lb-nav { position: fixed; background: rgba(246, 239, 227, .9); border: 0; border-radius: 99px; cursor: pointer; color: var(--ink); }
.lb-close { top: calc(14px + env(safe-area-inset-top)); right: 14px; width: 40px; height: 40px; font-size: 1rem; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 1.6rem; line-height: 1; }
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
.lb-nav[hidden] { display: none; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 99px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .course { grid-template-columns: 1fr; gap: 14px; }
  .course .yr { display: flex; align-items: baseline; gap: 12px; font-size: 2.4rem; }
  .course .yr small { margin: 0; }
  .plate { order: -1; }
}
@media (max-width: 760px) {
  .wrap { padding-top: 32px; }
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(3) { border-left: 0; }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .next-table { padding: 32px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
