/* Master Lee · Polish layer, shared by every tool page and every atlas page.
 * Loads after ml-tools.css. Adds ornament, air between blocks, a legible label system, and the quote band.
 * Type stays on brand: Playfair Display, Inter, Cinzel (kickers only), Newsreader (letters), ML Brush / ML Serif SC.
 */
:root {
  --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='26' viewBox='0 0 260 26'%3E%3Cg fill='none' stroke='%23b8975a' stroke-width='1'%3E%3Cpath d='M0 13H98'/%3E%3Cpath d='M162 13H260'/%3E%3Ccircle cx='106' cy='13' r='3.2'/%3E%3Ccircle cx='154' cy='13' r='3.2'/%3E%3Cpath d='M112 13c0-4.5 5.5-7 9.5-3.5'/%3E%3Cpath d='M148 13c0-4.5-5.5-7-9.5-3.5'/%3E%3Cpath d='M130 4.5l8.5 8.5-8.5 8.5-8.5-8.5z'/%3E%3Cpath d='M130 9l4 4-4 4-4-4z' fill='%23b8975a' fill-opacity='.35'/%3E%3C/g%3E%3C/svg%3E");
  --cloud: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60' viewBox='0 0 120 60'%3E%3Cg fill='none' stroke='%23c6a764' stroke-opacity='.22' stroke-width='1'%3E%3Cpath d='M10 44c0-10 12-14 18-6 2-12 20-14 24-2 6-8 20-4 18 8'/%3E%3Cpath d='M22 44c0-5 6-7 9-3'/%3E%3Cpath d='M70 44h40'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Ornamental divider (reusable) ---------- */
.orn-div, .prose .sec + .sec::before, .faq::before, .more::before, .at-end-col::before, #sources::before {
  content: ''; display: block; width: 260px; height: 26px; margin: 0 auto clamp(56px, 7vw, 84px); background: var(--orn) center / contain no-repeat; opacity: .9;
}
.more::before { margin-bottom: clamp(44px, 5vw, 64px); }
#sources::before { margin-bottom: 40px; }

/* ---------- Tool hero: more air, quieter crumbs, obsidian-gold cartouche ---------- */
.h-in { padding-top: clamp(48px, 7vw, 96px); }
.h h1 { margin-bottom: 34px; text-wrap: balance; }
.h-lede { line-height: 1.75; }
.h-crumbs { font-size: 11.5px; margin-bottom: clamp(40px, 5.5vw, 72px); }
.h-frame img { object-position: center 46%; }
.h-seal {
  padding: 16px 12px;
  background: rgba(16, 13, 10, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold-bright);
  border: 1px solid rgba(198, 167, 100, .52);
  box-shadow:
    inset 0 0 0 4px rgba(16, 13, 10, .92),
    inset 0 0 0 5px rgba(198, 167, 100, .24),
    0 22px 44px -18px rgba(0, 0, 0, .78);
}
.h::before { display: none; }
@media (max-width: 860px) {
  .h-in { padding-top: clamp(28px, 5vw, 48px); padding-bottom: 136px; gap: clamp(32px, 5vw, 44px); }
  .h-fig { order: -1; justify-self: center; width: 100%; max-width: 540px; margin: 0 auto; }
  .h-frame { aspect-ratio: 4 / 3; box-shadow: 0 36px 70px -34px rgba(0, 0, 0, .82); }
  .h-frame::before { inset: 12px; }
  .h-frame::after { background: linear-gradient(180deg, rgba(19, 17, 13, 0) 58%, rgba(19, 17, 13, .48)); }
  .h-seal { left: auto; right: 18px; bottom: -20px; font-size: 28px; padding: 12px 10px; }
}
@media (max-width: 520px) {
  .h-fig { max-width: none; }
  .h-frame { aspect-ratio: 5 / 4; }
  .h-seal { right: 14px; bottom: -16px; font-size: 25px; padding: 10px 8px; }
}

/* ---------- Tool card ---------- */
.tool { padding: clamp(40px, 5.4vw, 72px) clamp(26px, 6vw, 84px) clamp(42px, 5.4vw, 70px); }
.tool-orn { max-width: 300px; height: 26px; margin: -14px auto 34px; background: var(--orn) center / contain no-repeat; }
.tool-orn span, .tool-orn i { visibility: hidden; }
.tool-form { gap: 32px; }
.f-field > span { font-size: 11px; letter-spacing: .12em; }
.f-field select, .f-field input {
  box-sizing: border-box;
  height: 52px;
  font: 400 16.5px/20px var(--sans);
  vertical-align: middle;
}
.f-field select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  padding: 15px 40px 15px 16px;
  align-items: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.2 1.4L6 6.2l4.8-4.8' fill='none' stroke='%2393743a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 14px center;
  background-size: 12px 8px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.f-field select::picker-icon {
  display: none !important;
  content: none !important;
}
.f-field select::-ms-expand { display: none; }
.result { margin-top: 40px; padding-top: 40px; }
.r-block + .r-block { margin-top: 30px; }
.r-quote { line-height: 1.7; }

/* ---------- Long read on tool pages ---------- */
.prose { max-width: 700px; margin-top: clamp(104px, 12vw, 160px); }
.prose.is-cont { margin-top: clamp(96px, 11vw, 144px); }
.sec { margin-bottom: clamp(64px, 7.5vw, 96px); text-align: left; }
.sec:last-child { margin-bottom: 0; }
.prose .sec-num { display: none !important; }
.prose h2 { text-align: left; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.14; letter-spacing: -.015em; margin-bottom: 28px; text-wrap: balance; }
.prose p, .prose li { font-size: 18px; line-height: 1.85; color: #2a251f; text-wrap: pretty; }
.prose p { margin: 0 0 1.45em; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1.5em; }
.prose li + li { margin-top: .5em; }
.tbl-wrap { margin: 34px 0 22px; }
.sec.is-wide .tbl-wrap { margin-inline: calc(-1 * max(0px, min(140px, (100vw - 700px) / 2 - var(--gutter)))); }
.tbl th { font-family: var(--sans); font-size: 11px; letter-spacing: .1em; }
@media (max-width: 640px) {
  .prose p, .prose li { font-size: 17.5px; }
}

/* ---------- Master Lee's Note: a letter, centered, with room ---------- */
.note { max-width: 780px; margin-top: clamp(96px, 11vw, 140px); margin-bottom: clamp(96px, 11vw, 140px); padding: clamp(48px, 6vw, 76px) clamp(28px, 7vw, 88px); text-align: center; }
.note::before, .note::after { width: 34px; height: 34px; }
.note-label { font: 500 12px/1.4 var(--cinzel); letter-spacing: .26em; margin-bottom: 26px; }
.note blockquote p { font-size: clamp(20px, 1.9vw, 23px); line-height: 1.8; text-align: left; }
.note-sig { justify-content: center; margin-top: 32px; }

/* ---------- FAQ: numbered index with air ---------- */
.faq { max-width: 1000px; }
.faq h2 { font: 400 clamp(32px, 3.4vw, 46px)/1.1 var(--display); letter-spacing: -.015em; text-align: center; margin-bottom: 40px; }
.faq dl { counter-reset: q; border-top: 1px solid rgba(84, 62, 30, .22); }
.faq-i { counter-increment: q; padding: 34px 0; gap: 12px clamp(28px, 6vw, 80px); }
.faq dt::before { content: counter(q, decimal-leading-zero); display: block; margin-bottom: 12px; font: 600 11px/1 var(--sans); letter-spacing: .16em; color: var(--gold-deep); }
.faq dt { font-size: 22px; line-height: 1.38; }
.faq dd { font-size: 17px; line-height: 1.8; color: #3a332a; }

/* ---------- More tools: archival gallery wall with generous caption room ---------- */
.more { margin-top: clamp(104px, 12vw, 150px); }
.more-head h2 { font-size: clamp(28px, 3vw, 38px); }
.more-head a { font: 600 11.5px/1 var(--sans); letter-spacing: .14em; }
.more-row {
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 20px;
  overflow: visible;
  padding-bottom: 0;
}
.more-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  aspect-ratio: auto;
  background: var(--paper-card);
  color: var(--ink);
  border: 1px solid rgba(84, 62, 30, .12);
  box-shadow: 0 20px 42px -30px rgba(36, 24, 8, .42);
  overflow: hidden;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .35s, color .25s;
}
.more-card::after { display: none; }
.more-card:hover {
  transform: translateY(-4px);
  color: var(--gold-deep);
  border-color: rgba(198, 167, 100, .52);
  box-shadow: 0 30px 56px -30px rgba(36, 24, 8, .55);
}
.more-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--night);
}
.more-media img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  opacity: 1;
  box-shadow: none;
  transition: transform 1s var(--ease);
}
.more-card:hover .more-media img { transform: scale(1.045); opacity: 1; }
.more-name {
  position: static;
  padding: 15px 16px 18px;
  font: 500 16.5px/1.36 var(--display);
  color: inherit;
  min-height: 0;
  flex: 1;
  display: flex;
  align-items: flex-start;
}
.more-zh, .hub-zh {
  background: rgba(15, 13, 10, .68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--gold-bright);
  border: 1px solid rgba(232, 213, 162, .34);
  box-shadow: inset 0 0 0 2.5px rgba(15, 13, 10, .38), 0 10px 22px -10px rgba(0, 0, 0, .65);
}
.more-zh { top: 12px; left: 12px; width: 34px; height: 34px; font-size: 20px; }
.hub-zh { top: 16px; left: 16px; width: 42px; height: 42px; font-size: 24px; }
@media (max-width: 1120px) {
  .more-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
}
@media (max-width: 640px) {
  .more-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .more-name { padding: 13px 13px 16px; font-size: 16px; }
}

/* ---------- Closing band ---------- */
.band { min-height: clamp(460px, 44vw, 600px); margin-top: 0; }
.band-in { padding-block: clamp(80px, 10vw, 120px); }
.band p { line-height: 1.55; margin-bottom: 38px; }

/* ---------- Tools hub ---------- */
.hub-group + .hub-group { margin-top: clamp(80px, 9vw, 120px); }
.hub-row { gap: 26px; }
.hub-card { box-shadow: 0 34px 70px -46px rgba(24, 16, 6, .55); }
.hub-body { padding: 26px 26px 30px; }
.hub-body p { line-height: 1.7; }

/* ---------- Full-bleed quote band (tools and atlas) ---------- */
.at-breather { position: relative; isolation: isolate; min-height: clamp(460px, 52vw, 700px); display: flex; align-items: flex-end; color: var(--ivory);
  background: #0c0a08 var(--bimg) center / cover no-repeat; overflow: hidden; }
.at-breather::before { content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(10, 8, 6, .9) 0%, rgba(10, 8, 6, .64) 40%, rgba(10, 8, 6, .12) 74%), linear-gradient(0deg, rgba(10, 8, 6, .55), rgba(10, 8, 6, 0) 45%); }
.at-breather-in { width: 100%; max-width: 1240px; margin: 0 auto; padding: clamp(56px, 7vw, 96px) var(--gutter); }
.at-breather-k { margin: 0 0 22px; font: 500 12px/1 var(--cinzel); letter-spacing: .26em; text-transform: uppercase; color: var(--gold-soft); }
.at-breather blockquote { margin: 0; max-width: min(100%, 780px); }
.at-breather blockquote p { margin: 0; font: italic 400 clamp(28px, 3.6vw, 50px)/1.22 var(--display); letter-spacing: -.01em; color: #f7f1e5; text-wrap: balance; }
.at-breather-sig { display: inline-flex; align-items: center; gap: 12px; margin: 30px 0 0; font: 500 12px/1 var(--cinzel); letter-spacing: .22em; text-transform: uppercase; color: rgba(244, 237, 224, .78); }
.at-breather-sig .brush { display: grid; place-items: center; width: 32px; height: 32px; background: var(--seal); color: #faf7f1; font: 400 21px/1 var(--brush); letter-spacing: 0; }
.at-breather.is-tool { margin-top: clamp(96px, 11vw, 144px); }
@media (max-width: 720px) {
  .at-breather { background-image: var(--bimg-m); background-position: 62% center; min-height: 560px; }
  .at-breather::before { background: linear-gradient(0deg, rgba(10, 8, 6, .92) 10%, rgba(10, 8, 6, .5) 55%, rgba(10, 8, 6, .15)); }
}

/* ---------- Atlas pages: extra air on dense lists ---------- */
.at-reading p + p { margin-top: 1.7em; }
.at-term { padding-block: clamp(48px, 6vw, 72px); }
.br-entry { padding-block: clamp(52px, 6.5vw, 84px); }
.bg-row { padding-block: clamp(52px, 6.5vw, 92px); }
.wx-monograph { margin-top: clamp(40px, 5vw, 60px); }
.wx-stems-grid { gap: 24px; }
.at-term-notes { gap: 24px 44px; }
.y-q-grid { gap: clamp(18px, 2.4vw, 30px); }
.y-q { padding: 30px 26px 32px; }
.at-season { padding-block: clamp(96px, 11vw, 150px); }

/* ---------- Motion respect ---------- */
@media (prefers-reduced-motion: reduce) { .h-frame img, .h-copy > * { animation: none !important; } }
.at-end-col .faq::before { display: none; }

.prose .note-small { font-size: 16.5px; line-height: 1.75; font-style: italic; color: #6a5f50; }
@media (max-width: 860px) { .h::before { display: none; } }

/* ---------- Result copy action & 2027 map legend clarity ---------- */
.r-copy-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  font: 500 14.5px/1.5 var(--sans);
  color: var(--gold-deep);
  text-decoration: underline;
  text-decoration-color: rgba(147, 116, 58, .45);
  text-underline-offset: .22em;
  cursor: pointer;
}
.r-copy-btn:hover { color: var(--ink); text-decoration-color: var(--ink); }
.fs-k-plain { background: #fffdf9; box-shadow: inset 0 0 0 1.5px rgba(84, 62, 30, .42); }
.fs-empty { font-style: normal; font-size: 16.5px; color: var(--ink-soft); }

/* ---------- Conversion actions, inline email capture & footer newsletter ---------- */
.r-cta-acts, .band-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.r-sec-link {
  font: 500 14.5px/1.5 var(--sans);
  color: var(--gold-deep);
  text-decoration: underline;
  text-decoration-color: rgba(147, 116, 58, .45);
  text-underline-offset: .24em;
}
.r-sec-link:hover { color: var(--ink); text-decoration-color: var(--ink); }
.band-sub-link {
  font: 500 14px/1.5 var(--sans);
  color: rgba(244, 237, 224, .82);
  text-decoration: underline;
  text-decoration-color: rgba(198, 167, 100, .5);
  text-underline-offset: .24em;
}
.band-sub-link:hover { color: #fff; text-decoration-color: var(--gold-bright); }

.r-mail {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(84, 62, 30, .14);
  text-align: left;
}
.r-mail-k {
  margin: 0 0 6px !important;
  font: 600 11px/1.2 var(--sans) !important;
  letter-spacing: .18em !important;
  text-transform: uppercase;
  color: var(--gold-deep) !important;
}
.r-mail-p {
  margin: 0 0 14px !important;
  font: 400 14.5px/1.6 var(--sans) !important;
  color: #544b3e !important;
}
.ml-news-form {
  display: grid;
  grid-template-columns: 1fr 1.35fr auto;
  gap: 8px;
  align-items: stretch;
}
.ml-news-form input {
  min-width: 0;
  height: 44px;
  padding: 0 13px;
  border: 1px solid rgba(84, 62, 30, .24);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: 400 14.5px/1 var(--sans);
}
.ml-news-form input:focus { outline: 2px solid rgba(147, 116, 58, .35); outline-offset: -1px; }
.ml-news-btn {
  appearance: none;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--ivory);
  font: 500 11.5px/1 var(--sans);
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, border-color .2s;
}
.ml-news-btn:hover { background: var(--gold-deep); border-color: var(--gold-deep); }
.ml-news-status {
  margin: 12px 0 0 !important;
  font: 500 14px/1.55 var(--sans) !important;
  color: var(--gold-deep) !important;
}
@media (max-width: 640px) {
  .ml-news-form { grid-template-columns: 1fr; }
}

/* Mid-page editorial conversion bridge on Atlas pages */
.ml-bridge {
  max-width: 1120px;
  margin: clamp(48px, 6vw, 76px) auto;
  padding: 0 var(--gutter);
}
.ml-bridge-in {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  padding: clamp(28px, 4vw, 44px);
  background: var(--paper-card);
  border: 1px solid rgba(84, 62, 30, .14);
  border-top: 2px solid var(--gold-soft);
  box-shadow: 0 24px 50px -38px rgba(36, 24, 8, .35);
  align-items: center;
}
.ml-bridge-k, .ml-bridge-mk {
  margin: 0 0 10px;
  font: 600 11px/1.2 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.ml-bridge-main h2 {
  margin: 0 0 12px;
  font: 400 clamp(24px, 2.4vw, 32px)/1.18 var(--display);
  letter-spacing: -.012em;
  color: var(--ink);
}
.ml-bridge-p {
  margin: 0 0 22px;
  font: 400 16px/1.68 var(--sans);
  color: #3f382f;
}
.ml-bridge-acts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
}
.ml-bridge-sec {
  font: 500 14px/1.4 var(--sans);
  color: var(--gold-deep);
  text-decoration: underline;
  text-decoration-color: rgba(147, 116, 58, .45);
  text-underline-offset: .24em;
}
.ml-bridge-sec:hover { color: var(--ink); text-decoration-color: var(--ink); }
.ml-bridge-mail {
  padding-left: clamp(20px, 3vw, 40px);
  border-left: 1px solid rgba(84, 62, 30, .14);
}
.ml-bridge-mp {
  margin: 0 0 16px;
  font: 400 14.5px/1.6 var(--sans);
  color: #544b3e;
}
.ml-bridge-mail .ml-news-form {
  grid-template-columns: 1fr 1fr;
}
.ml-bridge-mail .ml-news-btn {
  grid-column: 1 / -1;
}
@media (max-width: 900px) {
  .ml-bridge-in { grid-template-columns: 1fr; }
  .ml-bridge-mail { padding-left: 0; padding-top: 24px; border-left: 0; border-top: 1px solid rgba(84, 62, 30, .14); }
}
@media (max-width: 520px) {
  .ml-bridge-mail .ml-news-form { grid-template-columns: 1fr; }
}

/* Footer newsletter is provided natively by SiteLayout Footer.astro */

/* ---------- Fewer layers on tool pages: no decorative Chinese echoes beside English labels ---------- */
.h-eyebrow .zh, .r-eyebrow .zh { display: none !important; }
.h-rule { display: none !important; }

/* ---------- Red reserved for the Master Lee seal only: Chinese glyphs in ink or gold, filled chips in obsidian + gold ---------- */
.r-glyph .brush, .pair-side .brush, .grid12 th .brush, .dm-tstem, .st-czh, .st-rzh { color: var(--ink) !important; }
.r-sub .zh, .d-name .zh, .tbl .zh, .fs-edge .zh, .fs-dir .zh, .st-opens .zh, .st-mbadge .zh,
.fs-cell.is-center .fs-num, .fs-empty .brush, .dm-col.is-day .dm-ch:first-of-type .brush,
.st-row.is-next .st-rzh, .st-row.is-focus .st-rzh, .bg-ls-c, .at-term.is-current .at-term-zh, .y-cell em { color: var(--gold-deep) !important; }
.r-notice strong { color: var(--ink) !important; }
.c-zh.is-good, .st-node.is-next .st-dot { fill: var(--gold-deep) !important; }
.pair-join b, .hub-gh .brush, .dm-tag, .st-nseal, .st-pill, .st-tmark, .at-term-badge-now, .r-notice::before {
  background: #1c1813 !important;
  color: var(--gold-bright) !important;
}
.r-notice { border-left-color: var(--gold-soft) !important; }
.fs-cell.is-on { box-shadow: inset 0 0 0 2px var(--gold-deep), 0 18px 32px -18px rgba(52, 34, 8, .55) !important; }
.y-node.is-cny i { background: var(--gold-bright) !important; }

/* Wide reference tables on phones: keep readable column widths and swipe sideways instead of squeezing every row tall */
@media (max-width: 640px) {
  .sec.is-wide .tbl-wrap .tbl { min-width: 680px; }
  .sec.is-wide .tbl-wrap { -webkit-overflow-scrolling: touch; }
}
