/* Article pages: a single reading column of about 66 characters. Tokens live in tokens.css. */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17.5px/1.7 var(--f-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--sea); outline-offset: 3px; }
.es { font-family: var(--f-es); }
.wrap { max-width: 1120px; margin: 0 auto; }

/* Header (same markup as the home page) */
.mast { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.seal-sm { display: none; }
.brand-name { font-family: var(--f-display); font-size: 22px; }
.nav { display: flex; gap: 6px 20px; flex-wrap: wrap; font-size: 14.5px; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover, .nav a[aria-current] { color: var(--ink); }

/* Pinyin */
ruby { ruby-position: over; }
rt { font-family: var(--f-mono); font-weight: 400; font-style: normal; letter-spacing: 0; color: var(--muted); text-transform: none; }
p rt, li rt, td rt, figcaption rt, blockquote rt, h2 rt, h3 rt { display: inline; font-size: .74em; margin-left: .3em; }
.hero-es rt { font-size: .26em; }

/* Article */
.article { max-width: 720px; margin: 0 auto; padding-block: 48px 64px; }
.kicker { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--sea); display: flex; gap: 10px; flex-wrap: wrap; }
.kicker a { text-decoration: none; }
.article h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(36px, 6vw, 58px); line-height: 1.08; margin: 16px 0 0; text-wrap: balance; letter-spacing: -.01em; }
.dek { font-size: 20px; color: var(--muted); margin: 18px 0 0; max-width: 60ch; text-wrap: pretty; }
.byline { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 24px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.hero-es { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 32px 0 8px; padding: 28px 32px; border-radius: 6px; background: var(--season-soft); }
.hero-es .big { font-family: var(--f-es); font-size: clamp(64px, 12vw, 112px); line-height: 1.1; color: var(--season); }
.hero-es p { font-size: 15px; color: var(--muted); max-width: 30ch; margin: 0; }

.body { margin-top: 32px; }
.body > * + * { margin-top: 1.1em; }
/* Paragraphs keep the 1.1em gap from `.body > * + *`; only the bottom margin is reset */
.body p { margin-bottom: 0; text-wrap: pretty; }
.body > p:first-child { margin-top: 0; }
.body h2 { font-family: var(--f-display); font-weight: 400; font-size: 30px; line-height: 1.2; margin: 2em 0 0; text-wrap: balance; }
.body h3 { font-family: var(--f-body); font-weight: 600; font-size: 18px; line-height: 1.4; margin: 1.6em 0 0; }
.body ul, .body ol { padding-left: 1.2em; margin-bottom: 0; }
.body li + li { margin-top: .5em; }
.body blockquote { margin: 1.8em 0; padding: 4px 0 4px 24px; border-left: 2px solid var(--flamboyan); }
.body blockquote .zh { font-family: var(--f-es); font-size: 26px; line-height: 1.5; display: block; }
.body blockquote .py { font-family: var(--f-mono); font-size: 13px; color: var(--sea); display: block; margin-top: 6px; }
.body blockquote .en { font-family: var(--f-display); font-style: italic; font-size: 21px; display: block; margin-top: 8px; }

.terms { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.table-wrap { overflow-x: auto; }
.terms th, .terms td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.terms th { font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.terms td:first-child { font-family: var(--f-es); font-size: 20px; white-space: nowrap; }
.terms td .py { display: block; font-family: var(--f-mono); font-size: 12px; color: var(--sea); }

.taboo { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; padding-block: 20px; border-bottom: 1px solid var(--line); }
.body .taboo { margin-top: 0; }
.taboo .glyph { font-family: var(--f-es); font-size: 40px; line-height: 1.1; color: var(--flamboyan); text-align: center; }
.taboo .glyph small { display: block; font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-top: 4px; }
.taboo h3 { margin: 0; }
.taboo p { margin: 6px 0 0; color: var(--muted); font-size: 16px; }

.ask { margin-top: 2.4em; padding: 24px 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }
.ask h2 { margin: 0; font-size: 24px; }
.ask p { color: var(--muted); font-size: 15.5px; margin-top: 6px; }
.ask ol { margin-top: 12px; }

.related { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.related h2 { font-family: var(--f-mono); font-weight: 400; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.related a { font-family: var(--f-display); font-size: 21px; text-decoration: none; }
.related a:hover { text-decoration: underline; text-underline-offset: 4px; }
.sources { margin-top: 32px; font-size: 14px; color: var(--muted); }
.sources p { margin: 4px 0 0; }

/* Article index */
.list { max-width: 820px; margin: 0 auto; padding-block: 48px 64px; }
.list h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(36px, 5.6vw, 54px); margin: 12px 0 0; }
.list > p { color: var(--muted); margin: 12px 0 0; max-width: 56ch; }
.cards { list-style: none; padding: 0; margin: 32px 0 0; }
.cards li { padding-block: 24px; border-top: 1px solid var(--line); }
.cards a { text-decoration: none; display: grid; gap: 6px; }
.cards h2 { font-family: var(--f-display); font-weight: 400; font-size: 28px; line-height: 1.2; margin: 0; }
.cards a:hover h2 { text-decoration: underline; text-underline-offset: 4px; }
.cards p { margin: 0; color: var(--muted); font-size: 16px; }

footer { max-width: 1120px; margin: 0 auto; border-top: 1px solid var(--line); padding-block: 32px 48px; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
footer p { max-width: 60ch; margin: 0; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  /* Three-column tables stack on phones: term on the left, the other two cells stacked on the right */
  .terms.stack thead { display: none; }
  .terms.stack, .terms.stack tbody { display: block; }
  .terms.stack tr { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 2px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .terms.stack td { border: 0; padding: 0; }
  .terms.stack td:first-child { grid-row: span 2; white-space: normal; }
  .terms.stack td:nth-child(2) { font-weight: 600; color: var(--ink); }
  .hero-es { flex-direction: column; align-items: flex-start; padding: 22px; }
  .taboo { grid-template-columns: 48px minmax(0, 1fr); }
  .taboo .glyph { font-size: 32px; }
}
.terms td:first-child { font-style: italic; }
.es-note { max-width: 1120px; margin: 16px auto 0; padding: 10px 16px; border: 2px solid var(--line); border-radius: 8px; background: var(--t2); color: var(--t2-ink); font-weight: 700; font-size: 14.5px; }

/* Mami Bruny layout: full-bleed header and footer; the reading column keeps its own gutter */
body { padding-left: 0; padding-right: 0; }
.article, .list, .kitchen, .recipe-page { padding-left: 16px; padding-right: 16px; }
.es-note { margin-left: 16px; margin-right: 16px; }
@media (min-width: 1152px) { .es-note { margin-left: auto; margin-right: auto; } }
