/* The look: rice paper, ink, cinnabar and gold (redesign of 4 Nov 2026).
 *
 * Tabler stays the component library; this file only re-points its tokens and
 * adds the few pieces it has no equivalent for (the seal, the character cards,
 * the ink bands). Loaded after Tabler and mingpan.css, so its :root wins on
 * order at equal specificity.
 *
 * Fonts are self-hosted (public/fonts, SIL OFL) so no page asks Google for
 * anything. Chinese has no web font: a CJK serif is several megabytes, and every
 * phone and desktop already has one (Songti, Noto Serif CJK, SimSun), named below.
 *
 * Contrast, computed on the paper ground #F4EDE1: ink #1B1712 15:1, muted
 * #5A5045 6.8:1, cinnabar #B3312A 4.7:1. Gold #A8823A is for rules and frames
 * only; as text it is used on the ink ground, where #D9B66A reaches 9.6:1.
 */

@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 500; font-display: swap;
  src: url("/fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); }

:root, [data-bs-theme=light] {
  --mp-paper: #F4EDE1;
  --mp-paper-2: #EAE0CF;
  --mp-card: #FBF7F0;
  --mp-ink: #1B1712;
  --mp-ink-band: #16120E;
  --mp-ink-2: #4A4238;
  --mp-muted: #5A5045;
  --mp-line: #D9CCB5;
  --mp-cinnabar: #B3312A;
  --mp-cinnabar-dark: #8E241E;
  --mp-gold: #A8823A;
  --mp-gold-text: #D9B66A;
  --mp-serif: "Cormorant Garamond", "Noto Serif SC", "Noto Serif TC", "Source Han Serif SC", "Songti SC", "Songti TC", STSong, SimSun, PMingLiU, Georgia, serif;
  --mp-cjk-serif: "Noto Serif SC", "Noto Serif TC", "Source Han Serif SC", "Songti SC", "Songti TC", STSong, SimSun, PMingLiU, serif;

  --tblr-font-sans-serif: Inter, system-ui, -apple-system, "Segoe UI", "PingFang SC", "PingFang TC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans TC", sans-serif;
  --tblr-body-font-family: var(--tblr-font-sans-serif);
  --tblr-body-bg: var(--mp-paper);
  --tblr-body-color: var(--mp-ink);
  --tblr-bg-surface: var(--mp-card);
  --tblr-bg-surface-primary: var(--mp-card);
  --tblr-bg-surface-secondary: var(--mp-paper-2);
  --tblr-bg-surface-tertiary: var(--mp-paper-2);
  --tblr-bg-forms: #FFFFFF;
  --tblr-border-color: var(--mp-line);
  --tblr-border-color-translucent: rgba(90, 80, 69, 0.22);
  --tblr-card-border-color: var(--mp-line);
  --tblr-primary: #B3312A;
  --tblr-primary-rgb: 179, 49, 42;
  --tblr-primary-fg: #FFFFFF;
  --tblr-primary-darken: #8E241E;
  --tblr-primary-lt: #F3DCD6;
  --tblr-link-color: #B3312A;
  --tblr-link-color-rgb: 179, 49, 42;
  --tblr-link-hover-color: #8E241E;
  --tblr-link-hover-color-rgb: 142, 36, 30;
  --tblr-secondary: #5A5045;
  --tblr-secondary-rgb: 90, 80, 69;
  --tblr-secondary-color: #5A5045;
  --tblr-muted: #5A5045;
  --tblr-muted-rgb: 90, 80, 69;
}

body { background: var(--mp-paper); color: var(--mp-ink); }

/* Headings: the display serif for Latin, a CJK serif for Chinese. */
h1, h2, h3, .h1, .h2, .h3, .page-title { font-family: var(--mp-serif); font-weight: 600; color: var(--mp-ink); letter-spacing: 0; }
h1, .h1, .page-title { font-size: clamp(2rem, 1.4rem + 2.2vw, 2.9rem); line-height: 1.1; }
h2, .h2 { font-size: clamp(1.55rem, 1.2rem + 1.2vw, 2.1rem); line-height: 1.15; }
h3, .h3 { font-size: 1.4rem; line-height: 1.2; }
.fs-2 { font-size: 1.6rem !important; }
:lang(zh-Hans) h1, :lang(zh-Hans) h2, :lang(zh-Hans) h3, :lang(zh-Hant) h1, :lang(zh-Hant) h2, :lang(zh-Hant) h3,
:lang(zh-Hans) .page-title, :lang(zh-Hant) .page-title { font-family: var(--mp-cjk-serif); font-weight: 700; }

.card { background: var(--mp-card); border-color: var(--mp-line); box-shadow: none; }
.bg-surface { background: var(--mp-card) !important; }
.btn-primary { --tblr-btn-bg: #B3312A; --tblr-btn-border-color: #B3312A; --tblr-btn-hover-bg: #8E241E; --tblr-btn-hover-border-color: #8E241E; --tblr-btn-color: #fff; --tblr-btn-hover-color: #fff; }
.form-control, .form-select { background-color: #FFFFFF; border-color: #C9B99E; }

/* Header: paper, a hairline, the seal. */
.navbar { --tblr-navbar-bg: var(--mp-paper); --tblr-navbar-border-color: var(--mp-line); --tblr-navbar-active-border-color: var(--mp-cinnabar); }
.mp-brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--mp-ink) !important; text-decoration: none; }
.mp-seal { width: 2.25rem; height: 2.25rem; border-radius: 4px; background: var(--mp-cinnabar); color: var(--mp-paper);
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--mp-cjk-serif); font-size: 1.25rem; font-weight: 700; line-height: 1; }
.mp-wordmark { font-family: var(--mp-serif); font-size: 1.5rem; font-weight: 600; line-height: 1; }
.mp-wordmark small { font-family: var(--mp-cjk-serif); font-size: .75rem; color: var(--mp-muted); letter-spacing: .2em; margin-left: .35rem; }

/* The 1982 strip above the header. */
.mp-notice { background: var(--mp-ink-band); color: #E9DFCC; font-size: .85rem; padding: .55rem 1rem; text-align: center; }
.mp-notice a { color: var(--mp-gold-text); }
.mp-notice .mp-seal { width: 1.3rem; height: 1.3rem; font-size: .75rem; margin-right: .4rem; vertical-align: -.2rem; }

/* Footer: ink. */
.footer { background: var(--mp-ink-band); color: #CFC4B1; border-top: 3px solid var(--mp-gold); margin-top: 3rem; }
.footer a, .footer .link-secondary { color: #E9DFCC !important; }
.footer .text-secondary, .footer .small { color: #A89F92 !important; }

/* Shared pieces for the new pages. */
.mp-eyebrow { font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; color: var(--mp-cinnabar-dark); font-weight: 600; }
.mp-lead { font-size: 1.15rem; color: var(--mp-ink-2); }
.mp-stem { font-family: var(--mp-cjk-serif); font-weight: 700; color: var(--mp-cinnabar); }
.mp-band { background: var(--mp-ink-band); color: #E9DFCC; border-radius: 10px; }
.mp-band h2, .mp-band h3 { color: #F4EDE1; }
.mp-band .mp-eyebrow, .mp-band a { color: var(--mp-gold-text); }
.mp-band .text-secondary { color: #CFC4B1 !important; }
.mp-frame { border: 1px solid var(--mp-gold); padding: .5rem; background: var(--mp-card); border-radius: 6px; }
.mp-frame img { display: block; width: 100%; height: auto; border-radius: 3px; }

/* Home: the hero. */
.mp-hero { display: flex; flex-wrap: wrap; gap: 2.5rem; align-items: center; padding: 1rem 0 2rem; }
.mp-hero > div { flex: 1 1 26rem; min-width: 0; }
.mp-hero > figure { flex: 1 1 28rem; min-width: 0; margin: 0; }
.mp-hero h1 { font-size: clamp(2.6rem, 1.6rem + 3.4vw, 4rem); line-height: 1.02; margin: 0; }
.mp-hero figcaption { font-size: .85rem; color: var(--mp-muted); margin-top: .5rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.mp-dateform { background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 8px; padding: 1.1rem; display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.mp-dateform label { flex: 1 1 13rem; display: flex; flex-direction: column; gap: .35rem; font-weight: 500; font-size: .9rem; }
.mp-dateform input { height: 3rem; font-size: 1rem; }
.mp-dateform .btn { height: 3rem; padding: 0 1.4rem; font-weight: 600; font-size: 1rem; }
.mp-faces { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.mp-faces span.mp-stack { display: inline-flex; padding-left: .5rem; }
.mp-faces img { width: 2.25rem; height: 2.25rem; border-radius: 50%; object-fit: cover; border: 2px solid var(--mp-paper); margin-left: -.5rem; }

/* The ten characters. */
.mp-chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 1rem; }
.mp-char { display: flex; flex-direction: column; background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 8px; overflow: hidden; color: var(--mp-ink); text-decoration: none; }
.mp-char:hover { border-color: var(--mp-gold); color: var(--mp-ink); text-decoration: none; }
.mp-char img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: 50% 18%; }
.mp-char .mp-char-body { padding: .8rem .9rem 1rem; border-top: 2px solid var(--mp-gold); display: flex; flex-direction: column; gap: .2rem; }
.mp-char .mp-stem { font-size: 1.7rem; line-height: 1; }
.mp-char .mp-name { font-family: var(--mp-serif); font-size: 1.35rem; font-weight: 600; line-height: 1.1; }
.mp-char .mp-kind { font-size: .75rem; color: var(--mp-muted); }
.mp-char .mp-gloss { font-size: .85rem; color: var(--mp-ink-2); line-height: 1.45; }
@media (max-width: 575px) {
  .mp-chars { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 10.5rem; overflow-x: auto; padding-bottom: .25rem; }
  .mp-char .mp-gloss { display: none; }
  .mp-char .mp-name { font-size: 1.15rem; }
  .mp-char .mp-stem { font-size: 1.4rem; }
  .mp-faces img { width: 1.9rem; height: 1.9rem; }
  .mp-hero > figure { display: none; }
}

/* Famous people, with their character's portrait (never a photograph of them). */
.mp-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: .75rem; }
.mp-person { display: flex; gap: .9rem; align-items: center; padding: .8rem; background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 8px; color: var(--mp-ink); text-decoration: none; }
.mp-person:hover { border-color: var(--mp-gold); color: var(--mp-ink); text-decoration: none; }
.mp-person img { width: 3.6rem; height: 3.6rem; border-radius: 50%; object-fit: cover; border: 2px solid var(--mp-gold); flex: none; }

/* The day-master page: portrait beside the title. */
.mp-dm-hero { display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; }
.mp-dm-hero .mp-frame { flex: 0 1 18rem; min-width: 0; }
.mp-dm-hero > div { flex: 1 1 22rem; min-width: 0; display: flex; flex-direction: column; gap: .8rem; }
.mp-dm-glyph { font-family: var(--mp-cjk-serif); font-weight: 700; color: var(--mp-cinnabar); font-size: 5rem; line-height: .9; }

@media print {
  .mp-notice, .mp-hero > figure { display: none !important; }
  body { background: #fff; }
}

/* Ornaments: a seal or glyph drawn by CSS, so it is decoration and not page
 * text. An English page never shows Chinese without its English beside it
 * (test/render-sweep.py); these sit beside the English already and say nothing new. */
[data-glyph]::before { content: attr(data-glyph); }

/* Topic pages (love, career, wealth, family): picture beside the question, a glance card, tiles. */
.mp-topic-hero { display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; }
.mp-topic-hero > div { flex: 1 1 24rem; min-width: 0; }
.mp-topic-hero > figure { flex: 1 1 22rem; min-width: 0; margin: 0; }
.mp-topic-hero h1 { font-size: clamp(2rem, 1.4rem + 2.2vw, 3rem); line-height: 1.08; }
.mp-glance { border-top: 3px solid var(--mp-gold); }
.mp-glance ul { padding-left: 1.1rem; display: flex; flex-direction: column; gap: .45rem; }
.mp-you { max-width: 34rem; }
.mp-topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; }
.mp-topic { display: flex; flex-direction: column; background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 8px; overflow: hidden; color: var(--mp-ink); text-decoration: none; }
.mp-topic:hover { border-color: var(--mp-gold); color: var(--mp-ink); text-decoration: none; }
.mp-topic img { display: block; width: 100%; aspect-ratio: 960 / 657; object-fit: cover; }
.mp-topic .mp-topic-body { padding: .8rem .9rem 1rem; border-top: 2px solid var(--mp-gold); display: flex; flex-direction: column; gap: .25rem; }
.mp-topic .mp-name { font-family: var(--mp-serif); font-size: 1.35rem; font-weight: 600; line-height: 1.1; }
@media (max-width: 575px) {
  .mp-topics { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .mp-topic .mp-topic-body .small { display: none; }
  .mp-topic .mp-name { font-size: 1.05rem; }
}

/* Share my character (src/partials/characters.php dm_share_row). */
.mp-share { display: flex; gap: 1.25rem; align-items: center; padding: 1rem; border: 1px solid var(--mp-line); border-top: 3px solid var(--mp-gold); border-radius: 8px; background: var(--mp-card); }
.mp-share img { width: 7.5rem; height: auto; border-radius: 4px; border: 1px solid var(--mp-line); flex: none; }
@media (max-width: 575px) { .mp-share img { width: 5.5rem; } }

/* Chart result: the day master as a character, the four pillars as cards, the one-screen summary (src/partials/result-hero.php). */
.mp-result-hero { display: flex; flex-wrap: wrap; max-width: 52rem; background: var(--mp-ink-band); color: #E9DFCC; border-radius: 10px; overflow: hidden; }
.mp-result-hero > img { flex: 0 1 17rem; min-width: 0; width: 100%; max-height: 22rem; object-fit: cover; object-position: 50% 15%; }
.mp-result-hero-body { flex: 1 1 18rem; min-width: 0; padding: 1.4rem 1.5rem; display: flex; flex-direction: column; gap: .5rem; justify-content: center; border-left: 2px solid var(--mp-gold); }
.mp-result-hero .mp-eyebrow { color: var(--mp-gold-text); }
.mp-result-stem { font-family: var(--mp-cjk-serif); font-weight: 700; font-size: 3rem; line-height: 1; color: #E0574B; }
.mp-result-name { font-family: var(--mp-serif); font-weight: 600; font-size: 2.3rem; line-height: 1.05; color: #F4EDE1; }
.mp-result-kind { color: #A89F92; }
.mp-btn-gold { background: transparent; border: 1px solid var(--mp-gold); color: var(--mp-gold-text); font-weight: 500; }
.mp-btn-gold:hover { background: var(--mp-gold); color: var(--mp-ink); border-color: var(--mp-gold); }
.mp-btn-gold-ghost { background: transparent; border: 1px solid transparent; color: #CFC4B1; }
.mp-btn-gold-ghost:hover { color: var(--mp-gold-text); text-decoration: underline; }
@media (max-width: 575px) {
  .mp-result-hero > img { flex-basis: 100%; max-height: 18rem; }
  .mp-result-hero-body { border-left: 0; border-top: 2px solid var(--mp-gold); }
}
.mp-pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; max-width: 34rem; }
.mp-pillar { background: var(--mp-card); border: 1px solid var(--mp-line); border-radius: 8px; padding: .7rem .25rem; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .1rem; }
.mp-pillar.is-you { background: #F6E4DA; border-color: var(--mp-cinnabar); }
.mp-pillar > div > span, .mp-pillar > div > span > span { display: block; }
.mp-pillar-label { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mp-muted); }
.mp-pillar-stem, .mp-pillar-branch { font-family: var(--mp-cjk-serif); font-size: 1.9rem; line-height: 1.15; }
.mp-pillar-stem { font-weight: 700; }
.mp-pillar.is-you .mp-pillar-stem { color: var(--mp-cinnabar); }
.mp-pillar-en { font-size: .75rem; color: var(--mp-ink-2); line-height: 1.3; }
.chart-summary { border-top: 3px solid var(--mp-gold); }
.chart-summary li { padding-bottom: .75rem; border-bottom: 1px solid var(--mp-line); }
.chart-summary li:last-child { border-bottom: 0; padding-bottom: 0; }
.chart-summary li > .fw-medium:first-child { display: block; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mp-cinnabar-dark); font-weight: 600 !important; }
@media print { .mp-result-hero, .mp-pillars { display: none !important; } }
