/*
  brunch.org — minimal responsive shell.
  Palette matches the legacy site; layout is fluid (no fixed 602px / floats).
*/

:root {
  --bg-page: #6a655f;
  --bg-panel: #ccccbb;
  --bg-header: #330000;
  /* Slightly darker than the tan panel so the scorecard reads as inset, not muddy. */
  --bg-scorecard: #c3c3b0;
  --border-scorecard: #bdbda9;
  --border-soft: #999999;
  --text: #333333;
  --text-muted: #666666;
  --title: #003333;
  --score: #990000;
  --link: #333399;
  --font-serif: Georgia, "Times New Roman", Times, serif;
  --font-sans: Verdana, Geneva, sans-serif;
  /* ~768px: wider than legacy 602px, still a readable column. */
  --content-max: 48rem;
  --pad-x: clamp(1rem, 4vw, 3rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--link);
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
.nav a:focus-visible,
.skip-link:focus {
  outline: 2px solid var(--title);
  outline-offset: 3px;
}

/* Skip link: visible only on keyboard focus. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  background: var(--bg-panel);
  color: var(--title);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid var(--title);
}

.skip-link:focus {
  left: var(--pad-x);
}

img {
  max-width: 100%;
  height: auto;
  border: 0;
  vertical-align: middle;
}

.wrap {
  width: min(100%, var(--content-max));
  margin: 0 auto;
  background: var(--bg-panel);
  /* Height follows content — do not stretch to the viewport. */
}

.header-bar,
.footer-bar {
  background: var(--bg-header);
}

.footer-bar {
  height: 1.25rem; /* ~20px legacy footer band */
}

.header-bar {
  height: 1.25rem; /* ~20px legacy header band; grows on mobile for the logo */
}

/* Mobile wordmark in the red band — hidden until the narrow breakpoint. */
.header-logo {
  display: none;
}

/* —— Nav ——
   Side icons with HTML labels underneath.
   Center brunch.svg is a wide wordmark — size by width, not icon height. */
.nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  column-gap: 1rem;
  padding: 0.5rem var(--pad-x) 0.65rem;
  background: var(--bg-panel);
}

.nav-cluster {
  display: flex;
  align-items: flex-start;
  gap: 1.35rem;
  min-width: 0;
}

.nav-cluster-start,
.nav-cluster-end {
  /* Center each group in its column so left/right of the logo feel even. */
  justify-content: center;
}

.nav-cluster-end {
  /* Three icons on the right — slightly tighter than the left pair. */
  gap: 0.85rem;
}

.nav-cluster-center {
  /* Match icon image height so the logo sits on the GIF baseline, above labels. */
  justify-content: center;
  align-items: flex-end;
  min-height: 60px;
}

.nav-logo {
  display: inline-block;
  line-height: 0;
  flex-shrink: 1;
  min-width: 0;
}

.nav-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  max-width: 4.6rem;
  text-decoration: none;
  color: var(--text-muted);
  line-height: 1.15;
}

.nav-icon:hover,
.nav-icon:focus-visible {
  color: var(--text-muted);
}

.nav-icon.is-active {
  color: var(--text-muted);
}

.nav-icon img {
  width: auto;
  height: 60px;
  max-width: none;
  max-height: 60px;
}

.nav-label {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-sans);
  font-size: 0.5625rem;
  font-weight: normal;
  text-align: center;
  text-wrap: balance;
  hyphens: auto;
}

.nav-logo img {
  width: 296px;
  max-width: 100%;
  height: auto;
}

@media (max-width: 520px) {
  /* Tall red band with the wordmark centered inside. */
  .header-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
    min-height: 3.75rem;
    padding: 0.65rem var(--pad-x);
  }

  .header-logo {
    display: block;
    line-height: 0;
    flex-shrink: 0;
    /* Nudge wordmark down slightly in the red band. */
    margin-top: 2px;
  }

  .header-logo img {
    /* Avoid min(280px, 100%) — % width can collapse when the parent is shrink-wrapped. */
    display: block;
    width: 280px;
    max-width: 100%;
    height: auto;
  }

  /* Nav icons only — desktop/center logo is hidden on mobile.
     Cap each icon so long labels wrap; keep gaps usable at ~320px. */
  .nav {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    column-gap: 0;
    row-gap: 0;
    /* Slightly tighter inset than --pad-x frees room between the five icons. */
    padding: 0.65rem 0.65rem 0.65rem;
  }

  .nav-cluster-center {
    display: none;
  }

  .nav-cluster-start,
  .nav-cluster-end {
    display: contents;
  }

  .nav-icon {
    flex: 0 0 auto;
    width: auto;
    /* Restore a cap (desktop uses 4.6rem) so “Steak au Poivre” wraps under the GIF. */
    max-width: 4.25rem;
  }

  .nav-icon img {
    height: 48px;
    max-height: 48px;
  }

  .nav-label {
    font-size: 0.65rem;
  }
}

.body {
  padding: 0.75rem var(--pad-x) 1.5rem;
}

/* Home: 13pt ohashi on the dark page bg, below the © line, panel-centered. */
.home-ohashi {
  width: min(100%, var(--content-max));
  margin: 20px auto 1.5rem;
  /* Match .wrap/.body horizontal inset so “80%” is of the visible panel. */
  padding: 0 var(--pad-x);
  box-sizing: border-box;
}

/* Anchor is the sized box (~84% of panel); img fills it. */
.home-ohashi a {
  display: block;
  width: 84%;
  margin-left: auto;
  margin-right: auto;
  line-height: 0;
}

.home-ohashi img {
  display: block;
  width: 100%;
  height: auto;
}

/* Credit sits on the page background below the red band, centered on the panel. */
.site-credit {
  width: min(100%, var(--content-max));
  margin: 0.35rem auto 1.5rem;
  padding: 0 var(--pad-x);
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: #444;
}

.site-credit a {
  color: #444;
}

/* —— Type & chrome —— */
.breadcrumbs {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  /* Long crumb text should not force horizontal page scroll on narrow phones. */
  overflow-wrap: break-word;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  row-gap: 0.2rem;
  column-gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Flex items avoid HTML whitespace adding uneven space around the separator. */
.breadcrumbs li {
  display: flex;
  align-items: baseline;
}

/* ">" between crumbs; optional final ">" when ol.has-trailing (leaf subpage). */
.breadcrumbs li:not(:last-child)::after,
.breadcrumbs ol.has-trailing li:last-child::after {
  content: ">";
  /* Equal padding so ">" sits evenly between crumbs. */
  padding: 0 0.3em;
  color: var(--text-muted);
}

.breadcrumbs a {
  color: var(--text-muted);
}

h1,
h2,
h3,
.section-heading {
  color: var(--title);
  font-weight: normal;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-soft);
}

/* Ranked list pages: title + review count (legacy all.html layout). */
.list-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-soft);
}

.list-heading h1 {
  margin: 0;
  /* Rule lives on the flex row (under title + count), not the h1 alone. */
  padding-bottom: 0;
  border-bottom: none;
}

.list-count {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  line-height: 1.2;
  white-space: nowrap;
}

/* Sort toggle under /eb/ and /sap/ headings — muted, non-competing with H1. */
.list-sort {
  margin: 0 0 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.list-sort a {
  color: inherit;
}

.list-sort a:hover {
  color: var(--link);
}

.list-sort-sep {
  margin: 0 0.25rem;
}

.list-sort-current {
  font-weight: 700;
}

.review-title h1,
.review-title h2 {
  margin: 0;
  /* Rule lives on .review-title (under title + score), not the heading alone. */
  padding-bottom: 0;
  border-bottom: none;
}

h2,
.section-heading {
  font-size: 1.35rem;
  margin: 1.5rem 0 0.75rem;
}

h2:first-child,
.section-heading:first-child {
  margin-top: 0;
}

/* Site lede / epigraph: gray italic block, centered (home intro + quotes). */
.site-lede,
.home-lede {
  display: block;
  max-width: 36rem;
  margin: 0 auto 2rem;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: normal;
  line-height: 1.45;
}

/* Home “Since 1999” summary — full lede size. */
.home-lede {
  font-size: clamp(1.15rem, 2.6vw, 1.45rem);
}

/* Section-page quotes — same gray/italic as home lede, a step smaller. */
.site-lede:not(.home-lede) {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
}

.site-lede p,
.home-lede p {
  margin: 0;
  color: inherit;
  font: inherit;
  font-style: italic;
  text-align: center;
  /* Even out wrapped lines so the quote doesn’t leave a short last line. */
  text-wrap: balance;
}

/* Attribution — roman (not italic), smaller than the quote body. */
.site-lede .quote-attribution {
  margin-top: 0.5rem;
  font-style: normal;
  font-size: 0.85em;
}

/* Home: Eggs Benedict and Steak au Poivre side by side (stack on narrow screens). */
.home-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem 2.5rem;
  margin-top: 0.25rem;
}

/* Same soft rule under home H2s as under H1s / .list-heading elsewhere. */
.home-column .section-heading {
  margin: 0 0 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-soft);
}

.home-column .section-heading a {
  color: inherit;
  text-decoration: none;
}

.home-column .section-heading a:hover {
  text-decoration: underline;
}

.home-column .list-table {
  margin-bottom: 0.5rem;
}

/* Home previews: no Score/Restaurant head, no dividers between rows. */
.home-column .list-table td {
  border-bottom: none;
}

.home-column .place-link {
  margin-top: 0.5rem;
}

@media (max-width: 40rem) {
  .home-columns {
    grid-template-columns: 1fr;
  }
}

h3 {
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
}

.place-link {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* Scoring page: PDF icon + download link after the intro. */
.scorecard-download a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: bold;
}

.scorecard-download-icon {
  flex-shrink: 0;
  color: var(--score);
}

.review-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-soft);
}

/* Pathological restaurant names: wrap instead of overflowing the panel. */
.review-title h1 {
  overflow-wrap: break-word;
  min-width: 0;
}

.score {
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  color: var(--text-muted);
  white-space: nowrap;
}

.score strong {
  color: var(--score);
  font-weight: normal;
}

/* Older stacked visits: whole score stays muted (not the listed/current total). */
.score-prior {
  font-weight: normal;
}

.address {
  margin: 0 0 1.25rem;
  line-height: 1.45;
}

.tagline {
  font-style: italic;
  color: #555;
  font-size: 0.95em;
  margin-top: 0.15rem;
}

/* Permanent closure — keep historical list rows, mark clearly. */
.closed-label {
  font-style: normal;
  font-variant: small-caps;
  letter-spacing: 0.03em;
  color: #666;
}

.closed-notice {
  margin: 0.35rem 0 1rem;
  font-style: italic;
  color: #555;
}

/* List rows: keep the italic blurb tight under the restaurant / article name. */
.list-table .tagline,
.article-item .tagline {
  margin-top: 0.1rem;
  line-height: 1.25;
  font-size: 0.9em;
}

/* —— Review visits —— */
/* No border-top between visits — .review-title already has a rule under the H1. */
.visit {
  margin-top: 2rem;
}

.visit:first-of-type {
  margin-top: 0;
}

.visit-meta {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
  clear: both;
}

/* Scorecard floats right; prose wraps beside it. */
.visit-main {
  display: flow-root; /* contain the float without an extra clearfix element */
}

.visit-main > .prose + .prose,
.visit-main > .prose + .img-block,
.visit-main > .img-block + .prose {
  margin-top: 0.85rem;
}

.prose p {
  margin: 0 0 0.85rem;
}

.prose p:last-child {
  margin-bottom: 0;
}

.scorecard {
  float: right;
  width: max-content;
  max-width: calc(100% - 1rem);
  margin: 0 0 0.85rem 1rem;
  background: var(--bg-scorecard);
  border: 1px solid var(--border-scorecard);
  border-radius: 0.8rem;
  padding: 0.45rem 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  border-collapse: separate;
  border-spacing: 0.12rem 0.08rem;
  line-height: 1.15;
}

/* Mobile: scorecard stacks full-width above the prose (no side float). */
@media (max-width: 520px) {
  .scorecard {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 0 0 0.85rem;
  }
}

.scorecard td {
  padding: 0 0.15rem;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.15;
}

/* Label column may wrap (long custom labels); keep bullet/scale cells on one line. */
.scorecard td:first-child {
  white-space: normal;
}

.score-scale {
  padding-left: 0 !important;
}

/* Shared column grid: number labels and bullets occupy the same slots. */
.score-scale-marks,
.score-bullets {
  display: inline-grid;
  /* Column width under the glyph size packs bullets tighter. */
  grid-template-columns: repeat(7, 1.05rem);
  justify-items: center;
  align-items: center;
  letter-spacing: 0;
  line-height: 1;
  column-gap: 0;
}

.score-scale-marks {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.score-scale-marks-bonus,
.score-bullets-bonus {
  grid-template-columns: repeat(3, 1.25rem);
}

.scorecard-bonus-head td {
  padding-top: 0.4rem;
}

.score-bullet {
  /* Rating dots — sized to read clearly as a score row. */
  font-size: 1.35rem;
}

.score-bullet-on {
  color: #663333;
}

.score-bullet-off {
  color: #999;
}

/* —— Images: block flow only (no floats). Partial = .img-block; Full = + .img-hero. —— */
.img-block {
  display: block;
  margin: 1rem 0;
  max-width: min(100%, 28rem);
}

.img-block img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #333;
}

/* Filename contains "_noborder" → no frame (body embeds, heroes, home list). */
.img-block.img-noborder img,
.list-hero.img-noborder img {
  border: none;
}

/* Full width of the content column (same as .wrap / --content-max). */
.img-hero {
  max-width: 100%;
  margin: 0 0 1.25rem;
}

.img-caption {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* —— Lists —— */
.list-table {
  width: 100%;
  border-collapse: collapse;
}

.list-table th,
.list-table td {
  vertical-align: top;
  padding: 0.45rem 0.5rem 0.45rem 0;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.list-table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.list-table tbody tr:last-child td {
  border-bottom: none;
}

/* Restaurant / location name links in list tables. */
.list-table tbody a {
  font-weight: 700;
}

/* Home list heroes: own row above score + name so those stay aligned. */
.list-hero {
  display: block;
  font-weight: normal; /* override bold list-link rule */
}

.list-hero img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #333;
}

.list-hero-row td {
  padding-top: 0.65rem;
  padding-bottom: 0.25rem;
  border-bottom: none; /* divider stays under the score/name row */
}

.list-table-heroes tbody tr:not(.list-hero-row) td {
  padding-top: 0.15rem;
}

.list-head th {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: normal;
  color: var(--text-muted);
  padding-bottom: 0.35rem;
  /* Match the lighter row dividers below (not the darker --border-soft). */
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  /* UA styles center <th>; keep labels flush with column content. */
  text-align: left;
}

.list-head .list-score {
  color: #993333;
  text-align: right;
  padding-right: 0.65rem;
}

.list-score {
  width: 2.75rem;
  color: var(--score);
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding-right: 0.65rem;
}

.list-footnote {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 1rem 0 0;
}

.reviewer-bio-body {
  margin-top: 0.25rem;
  /* Space below bio so it does not sit against the EB/SAP review columns. */
  margin-bottom: 1.5rem;
  /* Verdana on the wrapper so plain-text bios (no <p> in the snippet) still match. */
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: #444;
  font-weight: normal;
  line-height: 1.45;
}

/* Contact / bio links stay regular weight (list tables bold all tbody anchors). */
.reviewer-bio-body a {
  font-weight: normal;
}

.reviewer-bio-body p {
  margin: 0 0 0.45rem;
}

.reviewer-bio-body p:last-child {
  margin-bottom: 0;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border-soft);
  margin: 1.75rem 0 1rem;
}

.article-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem 2.5rem;
  margin-top: 0.25rem;
}

@media (max-width: 40rem) {
  .article-list {
    grid-template-columns: 1fr;
  }
}

.article-item {
  margin: 0;
  min-width: 0; /* allow grid children to shrink with long titles */
}

.article-item a {
  font-weight: 700;
}

/* News list heroes fill their column (column is already ~home half-width). */
.article-list-hero {
  width: 100%;
  margin: 0 0 0.35rem;
  font-weight: normal; /* title links stay bold; image link should not */
}

.article-byline {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

/* /scoring/ — section blocks with floated example scorecards. */
.scoring-intro {
  margin-bottom: 1.25rem;
}

.scoring-section {
  margin: 1.75rem 0 0;
}

.scoring-section-main {
  display: flow-root; /* contain floated scorecard */
}

.scoring-section-tasting {
  clear: both;
  margin-top: 2rem;
  padding-top: 0.25rem;
}

/* Recipe ingredient lists (direct children of main; not breadcrumbs). */
.body > ul,
.body > ol {
  margin: 0.75rem 0 1rem;
  padding-left: 1.35rem;
}

.body > ul li,
.body > ol li {
  margin-bottom: 0.25rem;
}

.geo-list {
  padding-left: 1.25rem;
}

.geo-list li {
  margin-bottom: 0.35rem;
}
