/* ==========================================================================
   The Cajun Pasta Theory: Today's Special (#109).

   The page is a laminated Louisiana diner menu: gingham on the wall, a cream
   card with double red rules down the sides, Arvo headings, Lora body text,
   and one chalkboard (Caveat) carrying the verdict. The dark version is a
   night diner: neon red title, dark laminate, the same chalkboard.
   ========================================================================== */

/* 1. TOKENS
   ------------------------------------------------------------------------ */
:root {
  color-scheme: light;

  --wall: #FBF3E1;
  --check: #B8321E22;
  --card: #FFFBF1;
  --edge: #B8321E;
  --ink: #2A1D14;
  --muted: #7A6450;      /* 5.3:1 on the card */
  --red: #B8321E;        /* 5.6:1 on the card */
  --green: #2F5D3A;
  --leader: #B8321E88;
  --chalk: #1F2320;
  --chalk-ink: #F2EFE6;
  --chalk-hd: #F6D36B;
  --chalk-note: #FF8C73;
  --frame: #7A5230;
  --chip: #F4E7CF;
  --chip-ink: #5B3A22;
  --neon: none;

  /* The story-so-far lines. The chalkboard is dark in both themes, so one
     pair serves both; validated with the dataviz palette checks against
     #1F2320 and #0E1211 (lightness, chroma, CVD, contrast all pass). */
  --story-emily: #B88E0C;
  --story-overall: #4A94E0;

  /* The same two lines, small, on an "Around town" card (#138). The card is
     cream in light mode, where the chalk pair's gold is under 3:1, so light
     mode takes a darker step of each; validated against #FFFBF1 (light) and
     #1C2322 (dark) with the dataviz palette checks, all pass. */
  --spark-emily: #9A7609;
  --spark-overall: #3A82CF;

  --arvo: "Arvo", "Rockwell", Georgia, serif;
  --caveat: "Caveat", "Bradley Hand", "Segoe Print", cursive;
  --lora: "Lora", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --wall: #141A1A;
    --check: #ffffff08;
    --card: #1C2322;
    --edge: #FF4F6D;
    --ink: #EDE6D8;
    --muted: #9FA89F;
    --red: #FF6B5A;
    --green: #7FD6A0;
    --leader: #FF6B5A66;
    --chalk: #0E1211;
    --chalk-ink: #EDEAE0;
    --chalk-hd: #FFD86B;
    --chalk-note: #FF8C73;
    --frame: #3B2A1C;
    --chip: #263130;
    --chip-ink: #E8DCC4;
    --neon: 0 0 6px #FF4F6D, 0 0 18px #FF4F6D99;
    --spark-emily: #B88E0C;
    --spark-overall: #4A94E0;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --wall: #141A1A;
  --check: #ffffff08;
  --card: #1C2322;
  --edge: #FF4F6D;
  --ink: #EDE6D8;
  --muted: #9FA89F;
  --red: #FF6B5A;
  --green: #7FD6A0;
  --leader: #FF6B5A66;
  --chalk: #0E1211;
  --chalk-ink: #EDEAE0;
  --chalk-hd: #FFD86B;
  --chalk-note: #FF8C73;
  --frame: #3B2A1C;
  --chip: #263130;
  --chip-ink: #E8DCC4;
  --neon: 0 0 6px #FF4F6D, 0 0 18px #FF4F6D99;
  --spark-emily: #B88E0C;
  --spark-overall: #4A94E0;
}

/* 2. BASE
   ------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font: 400 16px/1.5 var(--lora);
  background:
    repeating-linear-gradient(0deg, var(--check) 0 14px, transparent 14px 28px),
    repeating-linear-gradient(90deg, var(--check) 0 14px, transparent 14px 28px),
    var(--wall);
  min-height: 100vh;
}

h1, h2, h3, p, ul, ol { margin: 0; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Red on the chalkboard is too dim to see a ring by; chalk yellow is not. */
.chalk :focus-visible { outline-color: var(--chalk-hd); }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 3. THE CARD
   ------------------------------------------------------------------------ */
.menu {
  max-width: 36rem;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--card);
  padding: 26px 20px 36px;
  border-left: 6px double var(--edge);
  border-right: 6px double var(--edge);
  display: grid;
  gap: 22px;
  align-content: start;
}

/* Wide enough that the card stops filling the screen and starts floating on
   the wall: margin-block lifts it off both the top and the foot. With only
   side rules the card was open at both ends -- two rules beginning in mid-air
   above the masthead and stopping in mid-air below the footer. Closing all
   four sides is what makes it read as a menu rather than as a column of page.

   Capped here rather than on .menu itself, because below this width the card
   fills the viewport with no margin: there is nothing to close against, and
   rules across the very top and bottom of the screen are not the same thing
   as the edges of a card. */
@media (min-width: 40rem) {
  .menu {
    padding: 36px 40px 44px;
    min-height: auto;
    margin-block: 32px;
    border-top: 6px double var(--edge);
    border-bottom: 6px double var(--edge);
  }
}

.mast { text-align: center; display: grid; gap: 4px; }
.mast .est {
  font: 700 11px/1 var(--arvo);
  letter-spacing: 0.2em;
  color: var(--green);
  text-transform: uppercase;
}
.mast h1 {
  font: 700 32px/1.05 var(--arvo);
  color: var(--red);
  text-shadow: var(--neon);
}
.mast p { font-style: italic; color: var(--muted); font-size: 14px; }

.rule {
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  height: 5px;
  opacity: 0.8;
}

/* 4. THE CHALKBOARD: Emily's number against her bar
   ------------------------------------------------------------------------ */
.chalk {
  background: var(--chalk);
  color: var(--chalk-ink);
  border: 10px solid var(--frame);
  border-radius: 6px;
  padding: 18px 16px;
  text-align: center;
  display: grid;
  gap: 4px;
  box-shadow: 0 6px 16px #0004;
}
.chalk .narrowed { display: grid; gap: 4px; }
.chalk .hd {
  font: 700 30px/1 var(--caveat);
  color: var(--chalk-hd);
  letter-spacing: 0;
  text-transform: none;
}
.chalk .claim { font: 600 20px/1.2 var(--caveat); }
.chalk .num {
  font: 700 84px/0.95 var(--caveat);
  color: #fff;
  font-variant-numeric: lining-nums;
}
.chalk .num small { font-size: 40px; }
.chalk .num .of-word { font-size: 40px; padding-inline: 0.1em; }
.chalk .num.is-pending { font-size: 44px; line-height: 1.1; padding-block: 6px; }
.chalk .of { font: 600 20px/1.2 var(--caveat); opacity: 0.9; }
.chalk .note {
  font: 700 22px/1.1 var(--caveat);
  color: var(--chalk-note);
  margin-top: 6px;
}

/* 5. THE OVERALL LINE, under the board
   ------------------------------------------------------------------------ */
.side {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 1px dotted var(--muted);
  padding-bottom: 6px;
}
.side b { font: 700 18px var(--arvo); color: var(--ink); white-space: nowrap; }
.side b small { font: 400 12px var(--lora); color: var(--muted); }
.side b.is-pending { font-size: 14px; }

.verdict-note { font-size: 14px; color: var(--muted); font-style: italic; }

/* 5a. AROUND TOWN: a card per metro, local restaurants only (#119)
   ------------------------------------------------------------------------ */

/* The finding, read across the cards below and the board above (#265). Set
   like a lede rather than a headline: it is one observation with its own
   hedge attached, and a pull quote would strip the hedge off it. */
.finding {
  font: 400 15px/1.55 var(--lora);
  color: var(--ink);
  border-left: 3px solid var(--red);
  padding-left: 12px;
  max-width: 62ch;
}

.metro-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.metro-card {
  background: var(--card);
  border: 2px solid var(--edge);
  border-radius: 6px;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  min-width: 0;
}
.metro-name { font: 700 18px/1.15 var(--arvo); color: var(--ink); }
.metro-tagline { font: 600 19px/1 var(--caveat); color: var(--red); margin-top: -4px; }
.metro-card .metro-figure:last-of-type .side { border-bottom: 0; padding-bottom: 0; }

/* A metro's trend under each figure (#138): one line per sparkline, named by
   the row above it, so no legend. Solid for Emily's number and dashed for
   every one, as on the story chart, so the lines never rest on colour alone. */
.metro-figure { display: grid; gap: 4px; }
.metro-spark { display: block; width: 100%; height: auto; overflow: visible; }
.metro-spark-base { stroke: var(--muted); stroke-width: 1; opacity: 0.6; }
.metro-spark-bar { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.metro-spark-line { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.metro-spark-emily { stroke: var(--spark-emily); stroke-width: 2.5; }
.metro-spark-overall { stroke: var(--spark-overall); stroke-width: 2; stroke-dasharray: 4 3; }
.metro-spark-dot { stroke: var(--card); stroke-width: 2; }
.metro-spark-dot-emily { fill: var(--spark-emily); }
.metro-spark-dot-overall { fill: var(--spark-overall); }
.metro-spark line, .metro-spark-line, .metro-spark-dot { vector-effect: non-scaling-stroke; }
.metro-spark-times { display: flex; justify-content: space-between; font: 400 11px var(--lora); color: var(--muted); }

/* 5b. THE STORY SO FAR: the snapshots, drawn in chalk (#100)
   ------------------------------------------------------------------------ */
.story { gap: 10px; }
.story .story-empty { color: var(--chalk-ink); font: 600 20px/1.2 var(--caveat); font-style: normal; }

.story-key {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  font: 400 13px/1.3 var(--lora);
  color: var(--chalk-ink);
}
.story-key li { display: flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--story-emily); }
.swatch-emily { box-shadow: 0 0 0 4px color-mix(in srgb, var(--story-emily) 30%, transparent); }
.swatch-overall { border-top: 2px dashed var(--story-overall); }
.swatch-bar { border-top: 2px dotted var(--chalk-ink); }

.story-chart { display: block; width: 100%; height: auto; overflow: visible; }
.story-chart text { font: 400 11px var(--lora); fill: var(--chalk-ink); }
.story-axis line { stroke: var(--chalk-ink); stroke-width: 1; opacity: 0.5; }
.story-axis text { opacity: 0.8; }
.story-bar { stroke: var(--chalk-ink); stroke-width: 1.5; stroke-dasharray: 2 4; stroke-linecap: round; }
.story-filter line { stroke: var(--chalk-ink); stroke-width: 1; stroke-dasharray: 1 3; opacity: 0.6; }
.story-filter text { font-style: italic; opacity: 0.8; }
.story-band { fill: var(--story-emily); opacity: 0.28; }
.story-overall, .story-emily { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.story-overall { stroke: var(--story-overall); stroke-width: 2; stroke-dasharray: 5 4; }
.story-emily { stroke: var(--story-emily); stroke-width: 3; }
.story-dot { stroke: var(--chalk); stroke-width: 2; }
.story-dot-emily { fill: var(--story-emily); }
.story-dot-overall { fill: var(--story-overall); }
.story-overall, .story-emily, .story-bar, .story-axis line, .story-filter line { vector-effect: non-scaling-stroke; }

.story-summary { font: 400 13px/1.45 var(--lora); color: var(--chalk-ink); opacity: 0.9; text-align: left; }

/* 6. SECTIONS AND MENU LISTS
   ------------------------------------------------------------------------ */
.section { display: grid; gap: 12px; scroll-margin-top: 16px; }

h2 {
  text-align: center;
  font: 700 19px/1.1 var(--arvo);
  color: var(--green);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
h2 small {
  display: block;
  font: italic 400 13px/1.6 var(--lora);
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  margin-top: 2px;
}

.menu-list { list-style: none; padding: 0; display: grid; gap: 9px; }
.menu-list .item { display: flex; align-items: baseline; gap: 6px; }
.menu-list .dish { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.menu-list .dots {
  flex: 1;
  border-bottom: 2px dotted var(--leader);
  transform: translateY(-4px);
  min-width: 12px;
}
.menu-list .ct { font: 700 17px var(--arvo); color: var(--red); white-space: nowrap; }
.menu-list .ct small { font: 400 12px var(--lora); color: var(--muted); }
/* A dish name that leads somewhere, marked the way a menu would: the leader
   dots already run to a number, so the link is the name, not a blue rule. */
.menu-list .dish a {
  text-decoration: underline;
  text-decoration-color: var(--leader);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.menu-list .dish a:hover, .menu-list .dish a:focus-visible {
  color: var(--red);
  text-decoration-color: var(--red);
}

.variants-more, .empty { font-size: 14px; color: var(--muted); font-style: italic; text-align: center; }
/* The count of the names the list caps off is the way into them (#193), so it
   has to read as a link and not as the muted aside around it. */
.variants-more a { font-weight: 600; text-underline-offset: 2px; text-decoration-color: var(--red); }

.near { gap: 16px; }
.near h3 { margin: 0 0 6px; font: 700 22px/1 var(--caveat); color: var(--red); }
.near .item { font-size: 15px; }
.near .dish { font-weight: 400; }
.near .ct { font-size: 15px; color: var(--ink); }

/* 7. A DISH'S PAGE
   ------------------------------------------------------------------------ */
.place-list { list-style: none; padding: 0; display: grid; gap: 14px; }
.place {
  border: 1px solid var(--leader);
  border-radius: 4px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}
.place-name { font: 700 18px/1.15 var(--arvo); color: var(--ink); overflow-wrap: anywhere; }
.place-where { font: 400 13px/1.3 var(--lora); color: var(--muted); }
.place-listings { gap: 12px; margin-top: 2px; }
.place-listing { display: grid; gap: 4px; }
/* The dish and its price read as a menu line; everything else stacks under it. */
.listing-line { display: flex; align-items: baseline; gap: 6px; }
.listing-price small { font: italic 400 12px var(--lora); color: var(--muted); }
.listing-description { font: italic 400 14px/1.45 var(--lora); color: var(--muted); }

/* Why the row counts: the published words it hit, in the rule's own chips. */
.listing-why { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.why-words { display: flex; flex-wrap: wrap; gap: 6px; }
.why-word {
  background: var(--chip);
  color: var(--chip-ink);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
}
.why-cajun { box-shadow: inset 0 0 0 1px var(--red); }
.why-note { font: italic 400 12px var(--lora); color: var(--muted); }

/* A dish that did not make it (#194). The half it never hit is written out
   rather than shown as a gap where a chip would be: the missing word is the
   claim the page is making, and an empty space makes no claim. */
.why-missing { font: italic 400 12px var(--lora); color: var(--muted); }

/* The verdict, read before any restaurant is named. Set larger than the page
   under it, because a reader who takes nothing else off this page must still
   not take it for a dish that counted. */
.dish-verdict { gap: 10px; }
.verdict-near-miss { font: 400 16px/1.5 var(--lora); }
.verdict-near-miss b { color: var(--red); }
.verdict-veto { font: italic 400 14px/1.45 var(--lora); color: var(--muted); }

.spelling-list .dish { font-weight: 400; }
.spelling-list .ct { font-size: 15px; color: var(--ink); }

.foot .back a { font-weight: 600; text-underline-offset: 2px; }

/* 8. HOUSE RULES
   ------------------------------------------------------------------------ */
.rules {
  border: 2px dashed var(--muted);
  border-radius: 4px;
  padding: 16px 14px;
}
.rules .lbl {
  font: 700 11px/1 var(--arvo);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  background: var(--chip);
  color: var(--chip-ink);
  font-size: 13px;
  padding: 3px 9px;
  border-radius: 999px;
}
.rule-list { padding-left: 1.2em; display: grid; gap: 6px; font-size: 14px; }
.rule-list b { font-weight: 600; }
.coverage, .price-line { font-size: 14px; color: var(--muted); }
.coverage b, .price-line b { color: var(--ink); font-weight: 600; }


/* 9. FOOT
   ------------------------------------------------------------------------ */
.foot { text-align: center; font-size: 13px; color: var(--muted); display: grid; gap: 10px; }
.foot .sep { padding-inline: 0.2em; }
.foot a { text-underline-offset: 2px; }

/* 10. MOTION / PRINT
   ------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body { background: none; }
  .menu { border: 0; max-width: none; }
  .chalk { background: none; color: #000; border: 2px solid #000; box-shadow: none; }
  .chalk .num, .chalk .hd, .chalk .note { color: #000; }
  .mast h1 { text-shadow: none; }
  .story-key, .story-summary { color: #000; }
  .story-chart text { fill: #000; }
  .story-axis line, .story-bar, .story-filter line { stroke: #000; }
  .story-dot { stroke: #fff; }
  .metro-spark-base, .metro-spark-bar { stroke: #000; }
}
