/*
 * Theme: Minhwa (default since run 10, docs/DESIGN_SYSTEM.md v3). The lantern layout and type (DM Serif Display, DM
 * Sans) on the warm hanji paper of themes/hanji.css (same color and grain), ink (먹) text, dancheong vermilion (주홍) for
 * the main button, and the five-element colors (오행 색): each product's art band is its element's color, and on the free
 * result and the reading the reader's own Day Master element replaces the vermilion as the one accent
 * (html[data-dm], set by app.ts). Same variable names as themes/lantern.css and themes/hanji.css (kept to switch back).
 * A theme file only sets these variables; app.css never uses a literal color, font or background.
 * Fonts (all OFL, served from fonts/; nothing is downloaded from anywhere else, THIRD_PARTY_NOTICES.md):
 *   titles and the brand   DM Serif Display (one weight, 400: --display-weight keeps it from a faked bold)
 *   body                   DM Sans (variable, 100–1000)
 *   hanja                  Noto Serif KR subset
 * Contrast (test/site/a11y.test.ts): against the paper's darkest pixel, rgb(227, 215, 195), as hanji.css.
 */
@font-face { font-family: 'FT Display'; src: url('../fonts/DMSerifDisplay-Regular-Latin.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'FT Display'; src: url('../fonts/DMSerifDisplay-Italic-Latin.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'FT Sans'; src: url('../fonts/DMSans-Variable-Latin.woff2') format('woff2'); font-weight: 100 1000; font-style: normal; font-display: swap; }
@font-face { font-family: 'FT Sans'; src: url('../fonts/DMSans-Italic-Variable-Latin.woff2') format('woff2'); font-weight: 100 1000; font-style: italic; font-display: swap; }
@font-face { font-family: 'FT Serif'; src: local('Noto Serif KR'), local('NotoSerifKR'), url('../fonts/NotoSerifKR-Subset.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }

:root {
  /* Type */
  --font-display: 'FT Display', 'Noto Serif KR', Georgia, serif;
  --font-body: 'FT Sans', 'Noto Sans KR', 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-hanja: 'FT Serif', 'Noto Serif KR', 'Noto Serif CJK KR', 'Batang', serif;
  --display-weight: 400;   /* DM Serif Display has 400 only: 700 would be a fake bold */

  /* Page: hanji paper (the color and grain of themes/hanji.css, drawn here, no image file). The SVG namespace is
     written http%3A//… so this file holds no address (test/site/brand.test.ts). */
  --bg: #F4ECDD;
  --bg-texture:
    url("data:image/svg+xml;utf8,<svg xmlns='http%3A//www.w3.org/2000/svg' width='260' height='260'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='0.012 0.22' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.45 0 0 0 0 0.3 0 0 0 0.10 0'/></filter><rect width='100%25' height='100%25' filter='url(%23f)'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http%3A//www.w3.org/2000/svg' width='180' height='180'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' seed='9' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.35 0 0 0 0 0.24 0 0 0 0.07 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>"),
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, .5) 0, transparent 40%),
    radial-gradient(circle at 88% 72%, rgba(201, 180, 143, .22) 0, transparent 46%);
  --surface: #FFFCF5;      /* cards: warm white */
  --surface-strong: #FFFCF5;
  --ink: #2B2620;          /* 먹: 10.6:1 on the darkest paper pixel, 14.6:1 on a card */
  --ink-soft: #463D33;     /* 7.5:1 */
  --ink-faint: #5C5244;    /* 5.4:1 on paper, 6.0:1 on the paper bands */
  --line: #D9CBAF;
  --line-soft: #E8DDC8;
  --control-line: #857560; /* borders of fields and choices: 3.1:1 on paper, 4.4:1 on a field (WCAG 1.4.11) */

  /* Accents: ONE per screen (design v2 rule kept). Dancheong vermilion for the main button; html[data-dm] below swaps it
     for the reader's Day Master element on the free result and the reading. */
  --accent: #AA2E1D;        /* 주홍: main buttons only; white on it 6.7:1, 4.7:1 on paper */
  --accent-strong: #7F1D10; /* the main button's 2px under-shadow, pressed; error lines */
  --accent-ink: #FFFFFF;
  --accent-soft: #EDE2CC;   /* quiet paper panel (notes, the draft banner, the placeholder's conclusion bars) */
  --conclusion: #2B2620;    /* the bold conclusion line of each chunk: ink, bold */
  --focus: #2B2620;         /* focus ring and chosen states: ink */
  --focus-halo: rgba(43, 38, 32, .14);
  --link: #2B2620;
  --dm: #2B2620;            /* the Day Master line (the current chapter in the contents); ink until html[data-dm] */
  --dm-tint: #D9CBAF;       /* the thin rule around a chapter band */

  /* Flat parts */
  --chip-bg: #FFFCF5;
  --chip-line: #CDBE9F;
  --chip-text: #2B2620;
  --band-bg: #EDE2CC;       /* flat paper panels: today's score, the paywall, "go deeper" */
  --choice-bg: #EDE2CC;
  --step-bg: #EDE2CC;
  --bar-fill: #2B2620;
  --bar-track: #DCCFB6;
  --luck-now: #F6E1B2;      /* the current ten-year luck period (information) */
  --art-bg: #2B2620;        /* behind a painting while it loads */
  --art-ink: #FFFFFF;
  --art-pattern: none;
  --hero-veil: rgba(255, 252, 245, .93); /* the panel over the first screen's painting (text on it: ink 14:1) */
  --hero-scrim: rgba(14, 20, 38, .72);   /* desktop: the veil over the painting; over its lightest pixel (the moon) it is
                                            still rgb(≤ 81): the light text on it ≥ 6:1 */
  --hero-ink: #FFFCF5;

  /* Five elements (오행 색), deep shades: the product art bands (each product's element) and the Day Master accent.
     White on each ≥ 6.4:1; each ≥ 4.5:1 on the darkest paper pixel. 목 green, 화 red, 토 ochre, 금 grey, 수 navy-black. */
  --el-wood-deep: #2A6342;  --el-wood-deeper: #1F4D31;
  --el-fire-deep: #A82C1B;  --el-fire-deeper: #8A1F18;
  --el-earth-deep: #7C5016; --el-earth-deeper: #5E3C10;
  --el-metal-deep: #555A62; --el-metal-deeper: #3E4249;
  --el-water-deep: #1F2E4F; --el-water-deeper: #121C33;
  /* each product's element (docs/DESIGN_SYSTEM.md 10-3): Life Overview 토, Personality 목, Love 화, Compatibility 화,
     Year Ahead 목, Career 수, Wealth 금 */
  --band-lo: #7C5016; --band-pe: #2A6342; --band-lv: #A82C1B; --band-co: #A82C1B; --band-ya: #2A6342; --band-ca: #1F2E4F; --band-we: #555A62; --band-mo: #1F2E4F; --band-full: #2B2620;

  /* Five elements in the tables (big: 3:1; the -text shades for small text: 4.5:1 on a card) */
  --el-wood: #2E7D4F;
  --el-fire: #C0352B;
  --el-earth: #8A5E10;
  --el-metal: #63676F;
  --el-water: #1E2A44;
  --el-wood-text: #24663F;
  --el-fire-text: #A32B22;
  --el-earth-text: #7C5410;
  --el-metal-text: #555960;
  --el-water-text: #1E2A44;
  /* five-element pastels: chart tiles, Day Master circles, luck chips, with ink characters. Yin one shade deeper. */
  --chip-wood: #CFE6D2; --chip-wood-ink: #2B2620;
  --chip-fire: #F6D0C7; --chip-fire-ink: #2B2620;
  --chip-earth: #EED9AE; --chip-earth-ink: #2B2620;
  --chip-metal: #E6E4DE; --chip-metal-ink: #2B2620;
  --chip-water: #CFDCEC; --chip-water-ink: #2B2620;
  --chip-wood-yin: #B4D8BA; --chip-fire-yin: #F0B7AA; --chip-earth-yin: #E4C98F; --chip-metal-yin: #D3D0C8; --chip-water-yin: #B6CAE2;

  /* Run 11 (§1): letter tiles of the chart, the element bar, the luck chips and the Day Master emblem: the deep element
     colors (yang) and one shade deeper (yin), the character and count in white on them (white on each ≥ 6.4:1,
     test/site/a11y.test.ts). The emblem's pattern lines are white at a third. */
  --tile-text: #FFFFFF;
  --tile-wood: #2A6342;  --tile-wood-yin: #1F4D31;
  --tile-fire: #A82C1B;  --tile-fire-yin: #8A1F18;
  --tile-earth: #7C5016; --tile-earth-yin: #5E3C10;
  --tile-metal: #555A62; --tile-metal-yin: #3E4249;
  --tile-water: #1F2E4F; --tile-water-yin: #121C33;
  --emb-line: rgba(255, 255, 255, .34);
  /* the free balance tip's swatch: the free card's lucky colors (reading/card/content.ts), decorative */
  --lucky-wood: #2F6B45; --lucky-fire: #A8322B; --lucky-earth: #C9971C; --lucky-metal: #F7F3EA; --lucky-water: #1F2E4D;
  /* Run 11 (§2): the emphasis box behind each bold conclusion line: a paper a shade darker than the page (ink on it 11:1) */
  --concl-bg: #E9DABF;
  /* Run 11 (§1): an ink-brush stroke, a mask shape for the small rules between text blocks (painted --ink-faint) */
  --ink-rule: url("data:image/svg+xml;utf8,<svg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 120 12'><path d='M2 7.2 C18 3.4 40 2.6 64 3.6 C84 4.4 104 4.2 118 5.4 C104 7.6 86 8.6 64 8.4 C40 8.2 20 9.4 2 7.2 Z'/><circle cx='112' cy='9.6' r='1.4'/></svg>");

  /* Shape */
  --radius: 4px;
  --radius-small: 6px;
  --radius-chip: 2px;
  --shadow: none;
  --shadow-pop: 0 6px 18px rgba(60, 45, 20, .12);
  --blur: 6px;
  --backdrop: rgba(30, 24, 18, .55);
}

/* The reader's Day Master element as the one accent (free result, reading): set on <html> by app.ts. Literal values (not
   var()) so test/site/a11y.test.ts can check each: white on the accent ≥ 4.5:1, the accent ≥ 4.5:1 on paper. */
html[data-dm="wood"] { --accent: #2A6342; --accent-strong: #1F4D31; --dm: #2A6342; --dm-tint: #B4D8BA; }
html[data-dm="fire"] { --accent: #A82C1B; --accent-strong: #8A1F18; --dm: #A82C1B; --dm-tint: #F0B7AA; }
html[data-dm="earth"] { --accent: #7C5016; --accent-strong: #5E3C10; --dm: #7C5016; --dm-tint: #E4C98F; }
html[data-dm="metal"] { --accent: #555A62; --accent-strong: #3E4249; --dm: #555A62; --dm-tint: #D3D0C8; }
html[data-dm="water"] { --accent: #1F2E4F; --accent-strong: #121C33; --dm: #1F2E4F; --dm-tint: #B6CAE2; }
