/* assets/css/styles.css
   ChinatownMenu.com
   Mobile-first public site CSS
*/

/* ------------------------------------------------------------
   Design tokens
   ------------------------------------------------------------ */

:root {
  color-scheme: light;

  --ink: #181411;
  --ink-soft: #352b25;
  --muted: #6d6259;
  --muted-2: #8f8378;

  --paper: #fffaf2;
  --paper-2: #f7efe4;
  --surface: #ffffff;
  --surface-warm: #fff7ec;
  --surface-tint: #f3e7d7;

  --border: #decfbd;
  --border-strong: #c7b19b;

  --accent: #8b1e1e;
  --accent-dark: #5e1212;
  --accent-soft: rgba(139, 30, 30, 0.09);
  --gold: #a77b38;
  --green: #365b44;

  --shadow-sm: 0 1px 2px rgba(24, 20, 17, 0.06);
  --shadow-md: 0 12px 32px rgba(24, 20, 17, 0.10);
  --shadow-lg: 0 26px 70px rgba(24, 20, 17, 0.14);

  --font-body: Georgia, "Times New Roman", serif;
  --font-ui: Arial, Helvetica, sans-serif;
  --font-mono: Consolas, Monaco, "Courier New", monospace;

  --container: 1180px;
  --article: 780px;
  --sidebar: 320px;

  --step--2: clamp(0.72rem, 0.68rem + 0.18vw, 0.82rem);
  --step--1: clamp(0.84rem, 0.80rem + 0.22vw, 0.96rem);
  --step-0: clamp(1rem, 0.96rem + 0.25vw, 1.125rem);
  --step-1: clamp(1.16rem, 1.06rem + 0.55vw, 1.45rem);
  --step-2: clamp(1.38rem, 1.18rem + 1.00vw, 1.95rem);
  --step-3: clamp(1.74rem, 1.36rem + 1.90vw, 2.80rem);
  --step-4: clamp(2.18rem, 1.58rem + 3.00vw, 4.10rem);
  --step-5: clamp(2.55rem, 1.72rem + 4.15vw, 5.25rem);

  --space-1: clamp(0.25rem, 0.20rem + 0.25vw, 0.38rem);
  --space-2: clamp(0.50rem, 0.43rem + 0.35vw, 0.72rem);
  --space-3: clamp(0.75rem, 0.62rem + 0.65vw, 1.10rem);
  --space-4: clamp(1.00rem, 0.82rem + 0.90vw, 1.50rem);
  --space-5: clamp(1.40rem, 1.10rem + 1.50vw, 2.25rem);
  --space-6: clamp(2.00rem, 1.46rem + 2.70vw, 3.50rem);
  --space-7: clamp(3.00rem, 2.10rem + 4.50vw, 5.50rem);

  --radius-sm: 0.55rem;
  --radius: 0.95rem;
  --radius-lg: 1.35rem;
  --radius-pill: 999px;

  --measure: 66ch;
  --line: 1.68;
}

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

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

html {
  min-height: 100%;
  font-size: 100%;
  line-height: var(--line);
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(167, 123, 56, 0.16), transparent 34rem),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 56%, var(--paper) 100%);
  font-family: var(--font-body);
  font-size: var(--step-0);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(139, 30, 30, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 30, 30, 0.020) 1px, transparent 1px);
  background-size: 2.1rem 2.1rem;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-dark);
}

p,
li,
dd,
figcaption {
  color: var(--ink-soft);
}

p {
  margin: 0 0 var(--space-3);
}

p:last-child,
ul:last-child,
ol:last-child,
table:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--ink);
}

::selection {
  color: #fff;
  background: var(--accent);
}

code {
  padding: 0.08em 0.28em;
  color: var(--accent-dark);
  background: #f1e6d9;
  border: 1px solid var(--border);
  border-radius: 0.32rem;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

hr {
  margin: var(--space-6) 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* ------------------------------------------------------------
   Accessibility
   ------------------------------------------------------------ */

:focus-visible {
  outline: 3px solid rgba(139, 30, 30, 0.38);
  outline-offset: 3px;
  border-radius: 0.35rem;
}

.skip-link {
  position: absolute;
  left: -999rem;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  left: var(--space-3);
  top: var(--space-3);
  width: auto;
  height: auto;
  z-index: 1000;
  padding: 0.55rem 0.8rem;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */

.site-header {
  position: relative;
  z-index: 10;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 250, 242, 0.97));
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  width: min(100%, var(--container));
  margin-inline: auto;
  padding: var(--space-3) var(--space-3);
  display: grid;
  gap: var(--space-3);
}

.brand {
  min-width: 0;
  display: inline-flex;
  flex-direction: column;
  justify-self: start;
  color: var(--ink);
  text-decoration: none;
}

.brand__name {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: clamp(1.35rem, 5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.brand__name::before {
  content: "";
  flex: 0 0 auto;
  width: 0.72em;
  height: 0.72em;
  background: linear-gradient(135deg, var(--accent), #ba4b2e);
  border-radius: 0.16rem;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
  transform: rotate(45deg);
}

.brand__tagline {
  margin-top: 0.38rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--step--2);
  line-height: 1.25;
}

/* Mobile-first nav: no hamburger needed. It becomes a touch-friendly
   horizontal scroller on small screens and a standard nav on wider screens. */
.site-nav {
  width: 100%;
  margin-inline: calc(var(--space-3) * -1);
  padding: 0 var(--space-3) 0.18rem;
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  white-space: nowrap;
}

.site-nav a {
  flex: 0 0 auto;
  padding: 0.55rem 0.78rem;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(139, 30, 30, 0.12);
  border-radius: var(--radius-pill);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent-dark);
  background: rgba(139, 30, 30, 0.075);
  border-color: rgba(139, 30, 30, 0.22);
}

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

.page {
  width: min(100%, var(--container));
  margin-inline: auto;
  padding: var(--space-5) var(--space-3) var(--space-6);
}

.page--article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.article {
  width: min(100%, var(--article));
  min-width: 0;
}

.article > * + * {
  margin-top: var(--space-4);
}

.article h1,
.article h2,
.article h3 {
  color: var(--ink);
  text-wrap: balance;
}

.article h1 {
  margin: 0 0 var(--space-3);
  font-size: var(--step-5);
  line-height: 0.92;
  letter-spacing: -0.066em;
}

.article h2 {
  margin: var(--space-6) 0 var(--space-3);
  font-size: var(--step-3);
  line-height: 1.07;
  letter-spacing: -0.043em;
}

.article h3 {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--step-1);
  line-height: 1.2;
  letter-spacing: -0.014em;
}

.article .lede {
  max-width: var(--measure);
  color: #2f2823;
  font-size: var(--step-1);
  line-height: 1.58;
}

.article-meta {
  max-width: var(--measure);
  margin-top: calc(-1 * var(--space-2));
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.45;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 var(--space-2);
  padding: 0.42rem 0.62rem;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid rgba(139, 30, 30, 0.16);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 800;
  letter-spacing: 0.10em;
  line-height: 1;
  text-transform: uppercase;
}

.article-section {
  margin-top: var(--space-5);
}

.article-section[id] {
  scroll-margin-top: 1.25rem;
}

.article-section > h2:first-child {
  margin-top: 0;
}

.article ul,
.article ol {
  padding-left: 1.25rem;
}

.article li + li {
  margin-top: 0.45rem;
}

/* ------------------------------------------------------------
   Cards and content blocks
   ------------------------------------------------------------ */

.callout,
.menu-example,
.related-card,
.sidebar-section {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 236, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.callout,
.menu-example,
.related-card {
  padding: var(--space-4);
}

.callout {
  border-left: 0.38rem solid var(--accent);
}

.callout h2,
.callout h3,
.menu-example h2,
.menu-example h3 {
  margin-top: 0;
}

.menu-example {
  margin: var(--space-5) 0;
  overflow: hidden;
}

.menu-example::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.45rem;
  background: linear-gradient(180deg, var(--accent), var(--gold));
}

.menu-example__label {
  width: fit-content;
  margin: 0 0 var(--space-2);
  padding: 0.36rem 0.56rem;
  color: var(--green);
  background: rgba(54, 91, 68, 0.09);
  border: 1px solid rgba(54, 91, 68, 0.16);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.menu-excerpt {
  position: relative;
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.95), rgba(248, 239, 227, 0.95));
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.annotation-list li + li {
  margin-top: 0.62rem;
}

.related-card ul {
  margin: 0;
  padding-left: 1.2rem;
}

/* Future support classes for landing pages and regional index pages. They do
   not require HTML changes, but they are available when the site grows. */
.card-grid,
.topic-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.topic-card,
.term-card {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.topic-card h2,
.topic-card h3,
.term-card h2,
.term-card h3 {
  margin-top: 0;
}

.breadcrumb {
  margin-bottom: var(--space-3);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--step--1);
}

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

/* ------------------------------------------------------------
   Tables
   ------------------------------------------------------------ */

.table-wrap {
  position: relative;
  width: 100%;
  margin: var(--space-4) 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* Mobile scroll hint. This is intentionally CSS-only. */
.table-wrap::before {
  content: "Scroll table horizontally";
  position: sticky;
  left: 0;
  display: block;
  padding: 0.45rem 0.7rem;
  color: var(--muted);
  background: #f7ecdd;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

table {
  width: 100%;
  min-width: 42rem;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
}

th,
td {
  padding: 0.72rem 0.78rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--ink);
  background: #f5eadb;
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 800;
  letter-spacing: 0.065em;
  line-height: 1.3;
  text-transform: uppercase;
}

td {
  color: var(--ink-soft);
  font-size: 0.95em;
  line-height: 1.48;
}

tbody tr:nth-child(even) td {
  background: #fffaf4;
}

tbody tr:hover td {
  background: #fff2e1;
}

/* First-column stickiness helps on large glossary tables. */
@media (max-width: 740px) {
  th:first-child,
  td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 5.8rem;
    background: #fff8ee;
    box-shadow: 1px 0 0 var(--border);
  }

  th:first-child {
    z-index: 3;
    background: #f1e3d1;
  }
}

/* ------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------ */

.sidebar {
  min-width: 0;
}

.sidebar > * + * {
  margin-top: var(--space-3);
}

.sidebar-section {
  padding: var(--space-4);
}

.sidebar-section h2 {
  margin: 0 0 var(--space-3);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 800;
  letter-spacing: 0.075em;
  line-height: 1.2;
  text-transform: uppercase;
}

.sidebar-section p,
.sidebar-section li {
  color: var(--muted);
  font-size: var(--step--1);
  line-height: 1.55;
}

.sidebar-section ul {
  margin: 0;
  padding-left: 1rem;
}

.sidebar-section li + li {
  margin-top: 0.5rem;
}

/* On mobile, turn the first sidebar list into a compact navigation panel. */
@media (max-width: 980px) {
  .sidebar {
    order: -1;
  }

  .sidebar-section {
    padding: var(--space-3);
  }

  .sidebar-section ul {
    display: flex;
    gap: 0.45rem;
    padding-left: 0;
    overflow-x: auto;
    list-style: none;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-section li {
    flex: 0 0 auto;
    margin: 0;
  }

  .sidebar-section li + li {
    margin-top: 0;
  }

  .sidebar-section a {
    display: block;
    padding: 0.48rem 0.68rem;
    background: #fffaf4;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-family: var(--font-ui);
    text-decoration: none;
    white-space: nowrap;
  }
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */

.site-footer {
  position: relative;
  margin-top: var(--space-6);
  color: #f8f3ea;
  background:
    radial-gradient(circle at top left, rgba(167, 123, 56, 0.22), transparent 30rem),
    linear-gradient(180deg, #241b18 0%, #15100e 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer a {
  color: #fff4df;
}

.site-footer__inner {
  width: min(100%, var(--container));
  margin-inline: auto;
  padding: var(--space-5) var(--space-3);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

.site-footer__section h2 {
  margin: 0 0 var(--space-2);
  color: #fff8ef;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 800;
  letter-spacing: 0.075em;
  line-height: 1.2;
  text-transform: uppercase;
}

.site-footer__section p,
.site-footer__section li {
  color: #d9cfc3;
  font-size: var(--step--1);
}

.site-footer__section ul {
  margin: 0;
  padding-left: 1rem;
}

.site-footer__section li + li {
  margin-top: 0.45rem;
}

.site-footer__bottom {
  width: min(100%, var(--container));
  margin-inline: auto;
  padding: var(--space-3);
  display: grid;
  gap: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #cfc4b8;
  font-family: var(--font-ui);
  font-size: var(--step--2);
}

/* ------------------------------------------------------------
   Forms and utility elements
   ------------------------------------------------------------ */

button,
.button,
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover,
input[type="submit"]:hover {
  color: #fff;
  background: var(--accent-dark);
}

input,
textarea,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.75rem 0.85rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 800;
}

/* ------------------------------------------------------------
   Larger screens
   ------------------------------------------------------------ */

@media (min-width: 740px) {
  .site-header__inner {
    padding: var(--space-4);
  }

  .site-footer__bottom {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .related-card ul {
    columns: 2;
    column-gap: var(--space-5);
  }

  .related-card li {
    break-inside: avoid;
  }

  .card-grid,
  .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 981px) {
  .site-header__inner {
    grid-template-columns: minmax(14rem, auto) 1fr;
    align-items: end;
    gap: var(--space-5);
  }

  .site-nav {
    width: auto;
    margin-inline: 0;
    padding: 0;
    justify-content: end;
    overflow: visible;
    flex-wrap: wrap;
  }

  .site-nav a {
    box-shadow: none;
  }

  .page {
    padding-inline: var(--space-4);
    padding-top: var(--space-6);
  }

  .page--article {
    grid-template-columns: minmax(0, 1fr) var(--sidebar);
    gap: var(--space-6);
  }

  .sidebar {
    position: sticky;
    top: var(--space-3);
    order: initial;
  }

  .sidebar-section ul {
    display: block;
    overflow: visible;
    padding-left: 1rem;
    list-style: disc;
  }

  .sidebar-section li + li {
    margin-top: 0.5rem;
  }

  .sidebar-section a {
    display: inline;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    text-decoration: underline;
    white-space: normal;
  }

  .site-footer__inner {
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: var(--space-5);
    padding-block: var(--space-6);
  }

  .topic-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .table-wrap::before {
    display: none;
  }
}

@media (min-width: 1180px) {
  .page--article {
    gap: var(--space-7);
  }
}

/* ------------------------------------------------------------
   Small-screen refinements
   ------------------------------------------------------------ */

@media (max-width: 520px) {
  .page {
    padding-inline: var(--space-2);
  }

  .site-header__inner {
    padding-inline: var(--space-2);
  }

  .site-nav {
    margin-inline: calc(var(--space-2) * -1);
    padding-inline: var(--space-2);
  }

  .article h1 {
    letter-spacing: -0.052em;
  }

  .callout,
  .menu-example,
  .related-card,
  .sidebar-section {
    border-radius: var(--radius);
  }

  th,
  td {
    padding: 0.64rem 0.66rem;
  }

  table {
    min-width: 39rem;
  }
}

/* ------------------------------------------------------------
   Reduced motion and print
   ------------------------------------------------------------ */

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

@media print {
  :root {
    --ink: #000;
    --ink-soft: #111;
    --muted: #444;
    --paper: #fff;
    --surface: #fff;
  }

  body {
    background: #fff !important;
    font-size: 11pt;
  }

  body::before,
  .site-nav,
  .sidebar,
  .site-footer,
  .skip-link,
  script {
    display: none !important;
  }

  .site-header {
    border-bottom: 1px solid #999;
    box-shadow: none;
  }

  .site-header__inner,
  .page {
    max-width: none;
    padding: 0;
  }

  .brand__name::before {
    display: none;
  }

  .page--article {
    display: block;
  }

  .article {
    max-width: none;
  }

  .article h1 {
    font-size: 28pt;
    line-height: 1.05;
  }

  .article h2 {
    page-break-after: avoid;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .callout,
  .menu-example,
  .related-card,
  table {
    box-shadow: none;
    break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
    box-shadow: none;
    border: 0;
  }

  .table-wrap::before {
    display: none;
  }

  table {
    min-width: 0;
    border: 1px solid #999;
  }

  th,
  td {
    border-color: #bbb;
  }
}

/* Cooking and recipe section */
.recipe-meta,
.article-meta {
  font-family: var(--font-ui);
}

.topic-card p,
.term-card p {
  margin-bottom: 0;
}

.topic-card h3 a,
.term-card h3 a {
  text-decoration: none;
}

.topic-card h3 a:hover,
.term-card h3 a:hover {
  text-decoration: underline;
}

/* Larger recipe index support */
@media (min-width: 1180px) {
  .article .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.topic-card strong {
  color: var(--accent-dark);
  font-family: var(--font-ui);
  font-size: 0.92em;
}

/* Dietary section */
.topic-card h3 {
  margin-bottom: 0.45rem;
}

.callout strong,
.topic-card strong {
  color: var(--accent-dark);
}

/* Expanded recipe library */
.topic-grid {
  align-items: stretch;
}

.topic-card {
  height: 100%;
}

.topic-card h3 {
  line-height: 1.15;
}

/* Chinese text-to-speech feature */
.zh-tts-control {
  margin: var(--space-4) 0 var(--space-5);
  padding: var(--space-4);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 236, 0.98));
  border: 1px solid var(--border);
  border-left: 0.38rem solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.zh-tts-control__body {
  display: grid;
  gap: var(--space-3);
}

.zh-tts-control h2 {
  margin: 0 0 var(--space-1);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.zh-tts-control p {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.5;
}

.zh-tts-control__tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  align-items: end;
}

.zh-tts-control label {
  margin: 0;
  color: var(--muted);
  font-size: var(--step--2);
}

.zh-tts-control select {
  margin-top: 0.28rem;
  min-height: 2.5rem;
  font-family: var(--font-ui);
  font-size: var(--step--1);
}

.zh-tts-control button,
.zh-tts-toggle {
  width: 100%;
  min-height: 2.5rem;
  font-size: var(--step--2);
}

.zh-tts-control__note {
  margin-top: var(--space-2) !important;
}

.zh-tts-term {
  padding: 0.05em 0.08em;
  color: var(--accent-dark);
  background: rgba(139, 30, 30, 0.055);
  border-radius: 0.22rem;
  white-space: nowrap;
}

.zh-tts-button {
  display: inline-flex;
  vertical-align: 0.08em;
  align-items: center;
  justify-content: center;
  width: 1.55em;
  height: 1.55em;
  min-height: 0;
  margin: 0 0.12em 0 0.16em;
  padding: 0;
  color: var(--accent-dark);
  background: rgba(139, 30, 30, 0.08);
  border: 1px solid rgba(139, 30, 30, 0.18);
  border-radius: 999px;
  box-shadow: none;
  font-size: 0.74em;
  line-height: 1;
  cursor: pointer;
}

.zh-tts-button:hover,
.zh-tts-button:focus-visible {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-dark);
}

.zh-tts-disabled .zh-tts-button {
  display: none;
}

.zh-tts-sample-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.zh-tts-sample {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.zh-tts-sample strong {
  color: var(--ink);
  font-size: var(--step-1);
}

@media (min-width: 740px) {
  .zh-tts-control__body {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.9fr);
    align-items: end;
  }

  .zh-tts-control__tools {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr) auto;
  }

  .zh-tts-control button,
  .zh-tts-toggle {
    width: auto;
  }

  .zh-tts-sample-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  .zh-tts-control,
  .zh-tts-button {
    display: none !important;
  }

  .zh-tts-term {
    padding: 0;
    color: #000;
    background: transparent;
  }
}

/* Search, filters, structured utilities */
.site-search-panel,
.recipe-filter-panel {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.site-search-panel__row,
.recipe-filter-grid,
.recipe-filter-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.search-status,
#recipe-filter-count {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--step--1);
}

.search-results,
.recipe-filter-results {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.search-result,
.recipe-filter-card {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.search-result h2,
.recipe-filter-card h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--step-1);
  line-height: 1.2;
}

.search-result__category {
  width: fit-content;
  margin: 0 0 var(--space-2);
  padding: 0.32rem 0.52rem;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.search-result__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  margin-top: var(--space-2);
}

.search-result__tags span {
  padding: 0.26rem 0.45rem;
  color: var(--muted);
  background: #f7ecdd;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: var(--step--2);
}

.search-empty {
  padding: var(--space-4);
  color: var(--muted);
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.print-recipe-button {
  margin: 0 0 var(--space-4);
}

.sidebar-section--dynamic-toc .toc-h3 {
  margin-left: 0.8rem;
  font-size: 0.95em;
}

.glossary-term {
  display: inline-flex;
  gap: 0.24em;
  align-items: baseline;
  padding: 0.04em 0.15em;
  background: rgba(167, 123, 56, 0.12);
  border-bottom: 1px dotted var(--gold);
  border-radius: 0.22rem;
  cursor: help;
}

.glossary-term__han {
  color: var(--accent-dark);
  font-weight: 700;
}

.glossary-term__pinyin {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.72em;
}

.glossary-tooltip {
  position: absolute;
  z-index: 1000;
  padding: var(--space-3);
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.45;
}

.glossary-tooltip strong {
  display: block;
  color: var(--accent-dark);
  font-size: var(--step-0);
}

.glossary-tooltip span {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
}

.glossary-tooltip p {
  margin: var(--space-2) 0 0;
  color: var(--ink-soft);
}

.glossary-tooltip a {
  display: inline-block;
  margin-top: var(--space-2);
}

@media (min-width: 740px) {
  .site-search-panel__row {
    grid-template-columns: auto minmax(12rem, 1fr) auto;
    align-items: end;
  }

  .recipe-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipe-filter-actions {
    grid-template-columns: auto 1fr;
    align-items: center;
  }
}

@media (min-width: 981px) {
  .recipe-filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .recipe-filter-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  .site-search-panel,
  .recipe-filter-panel,
  .search-results,
  .recipe-filter-results,
  .print-recipe-button,
  .glossary-tooltip {
    display: none !important;
  }

  .glossary-term {
    display: inline;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .glossary-term__pinyin {
    display: none;
  }
}

/* Chinese cuisine geography map */
.china-cuisine-map {
  margin: var(--space-4) 0;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.china-cuisine-map img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.china-cuisine-map figcaption {
  margin-top: var(--space-2);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--step--1);
}

.map-marker circle {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 3;
  cursor: pointer;
}

.map-marker text {
  fill: var(--ink);
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 13px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(255, 248, 237, 0.82);
  stroke-width: 4px;
  stroke-linejoin: round;
  cursor: pointer;
}

.map-marker:hover circle,
.map-marker:focus circle,
.map-marker.is-active circle {
  fill: var(--gold);
  stroke: var(--accent-dark);
}

.geography-region-detail {
  margin: var(--space-4) 0;
}

.geography-detail-card {
  padding: var(--space-4);
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-left: 0.38rem solid var(--accent);
  border-radius: var(--radius-lg);
}

.geography-detail-card h2 {
  margin-top: 0;
}

.geography-detail-card h2 span {
  color: var(--accent-dark);
}

.pinyin-line {
  margin-top: -0.55rem;
  color: var(--muted);
  font-family: var(--font-ui);
}

.geography-mini-list {
  display: grid;
  gap: var(--space-1);
  margin: var(--space-3) 0;
}

.geography-mini-list dt {
  color: var(--accent-dark);
  font-family: var(--font-ui);
  font-weight: 800;
}

.geography-mini-list dd {
  margin: 0;
}

.geography-detail-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--space-3);
}

.geography-detail-card__links a,
.geography-region-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.55rem 0.8rem;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 800;
  text-decoration: none;
}

.geography-detail-card__links a:hover,
.geography-region-card button:hover {
  background: var(--accent-dark);
}

.geography-region-card button {
  margin-top: var(--space-2);
  cursor: pointer;
}

@media print {
  .geography-region-card button,
  .geography-detail-card__links {
    display: none !important;
  }
}

/* SimpleMaps-based Chinese cuisine geography map */
.china-cuisine-map--simplemaps {
  margin: var(--space-4) 0;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.china-cuisine-map__frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  background: #f8f2e8;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.china-cuisine-map__frame img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 18rem;
  object-fit: contain;
  background: #f8f2e8;
}

.china-cuisine-marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-marker-pin {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 1.7rem;
  padding: 0.16rem 0.48rem 0.16rem 0.22rem;
  color: var(--ink);
  background: rgba(255, 248, 237, 0.94);
  border: 1px solid rgba(139, 30, 30, 0.28);
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px rgba(47, 35, 24, 0.18);
  font-family: var(--font-ui);
  font-size: clamp(0.58rem, 1.15vw, 0.78rem);
  font-weight: 800;
  line-height: 1;
  transform: translate(-0.65rem, -50%);
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
}

.map-marker-pin__dot {
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  flex: 0 0 auto;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--accent-dark);
}

.map-marker-pin:hover,
.map-marker-pin:focus-visible,
.map-marker-pin.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-dark);
  outline: 0;
}

.map-marker-pin:hover .map-marker-pin__dot,
.map-marker-pin:focus-visible .map-marker-pin__dot,
.map-marker-pin.is-active .map-marker-pin__dot {
  background: var(--gold);
  box-shadow: 0 0 0 2px #fff;
}

.map-marker-pin.is-active {
  z-index: 4;
}

@media (max-width: 640px) {
  .map-marker-pin {
    padding-right: 0.24rem;
    font-size: 0.58rem;
  }

  .map-marker-pin__label {
    max-width: 4.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map-marker-pin__dot {
    width: 0.62rem;
    height: 0.62rem;
  }
}

@media print {
  .china-cuisine-marker-layer {
    display: none !important;
  }
}

/* Sidebar placement for Chinese pronunciation controls */
.sidebar .zh-tts-control {
  margin: var(--space-3) 0 0;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: var(--radius);
  box-shadow: none;
}

.sidebar .zh-tts-control__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.sidebar .zh-tts-control h2 {
  margin: 0 0 0.2rem;
  font-size: var(--step--1);
}

.sidebar .zh-tts-control p,
.sidebar .zh-tts-control__note {
  font-size: var(--step--2);
  line-height: 1.4;
}

.sidebar .zh-tts-control__tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.sidebar .zh-tts-control select,
.sidebar .zh-tts-control button {
  width: 100%;
  min-height: 2.25rem;
  font-size: var(--step--2);
}

@media (max-width: 980px) {
  .sidebar .zh-tts-control {
    margin-top: var(--space-5);
    order: 99;
  }
}

/* Manual AdSense display units */
.cm-ad {
  margin: var(--space-5) 0;
  padding: 0;
  background: transparent;
  border: 0;
  clear: both;
}

.cm-ad__label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.cm-ad__ins {
  display: block;
  width: 100%;
  min-height: 7.5rem;
  background: rgba(0, 0, 0, 0.025);
  border-radius: var(--radius);
}

.cm-ad--horizontal {
  max-width: 100%;
}

.cm-ad--horizontal .cm-ad__ins {
  min-height: 7rem;
}

.sidebar .cm-ad {
  margin: var(--space-4) 0;
}

.cm-ad--square .cm-ad__ins {
  min-height: 18rem;
}

.cm-ad--vertical .cm-ad__ins {
  min-height: 34rem;
}

@media (max-width: 980px) {
  .cm-ad--desktop-sidebar {
    display: none;
  }

  .cm-ad {
    margin: var(--space-4) 0;
  }
}

@media (min-width: 981px) {
  .cm-ad--horizontal .cm-ad__ins {
    min-height: 6rem;
  }

  .cm-ad--vertical-only {
    display: block;
  }
}

@media print {
  .cm-ad {
    display: none !important;
  }
}
