/* NGCC Dragon & Thunder study pages — shared stylesheet (file-center style) */

:root {
  --ink: #1c2733; --mut: #5c6b7a; --line: #d9dee4; --bg: #ffffff; --soft: #f6f7f5;
}
body.dragon  { --acc: #b3452c; --acc-soft: #f7e9e4; }
body.thunder { --acc: #4653b0; --acc-soft: #e9ebf7; }
body.landing { --acc: #356b52; --acc-soft: #e9f2ec; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", sans-serif;
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font: 0.95em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: #f1f2f0; padding: .08em .35em; border-radius: 3px; }
pre { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: .9em 1.1em; overflow-x: auto; }
pre code { background: none; padding: 0; }

header.site { border-bottom: 1px solid var(--line); }
header.site .in {
  max-width: 64rem; margin: 0 auto; padding: .9rem 1.2rem;
  display: flex; flex-wrap: wrap; gap: .4em 1.2rem; align-items: center;
}
.brand { font-weight: 700; font-size: 1.12rem; color: var(--ink); display: inline-flex; align-items: center; gap: .5rem; }
.brand .name { line-height: 1.1; }
.brand .mark {
  width: 2rem; height: 2rem; display: block; flex: 0 0 auto;
  transition: transform .3s cubic-bezier(.2,.8,.3,1);
}
.brand:hover { text-decoration: none; }
.brand:hover .mark { transform: rotate(-9deg) scale(1.08); }
/* each mark keeps its own identity colour, independent of page accent */
/* ring emblems: single flat colour each, flattened from generated artwork */
.brand .mark--dragon  { background: url(assets/dragon-mark.png?v=2) center / contain no-repeat; }
.brand .mark--thunder { background: url(assets/thunder-mark.png?v=2) center / contain no-repeat; }
:root[data-theme="dark"] .brand .mark--dragon  { background-image: url(assets/dragon-mark-dark.png?v=2); }
:root[data-theme="dark"] .brand .mark--thunder { background-image: url(assets/thunder-mark-dark.png?v=2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .mark--dragon  { background-image: url(assets/dragon-mark-dark.png?v=2); }
  :root:not([data-theme="light"]) .brand .mark--thunder { background-image: url(assets/thunder-mark-dark.png?v=2); }
}
.brand .id {
  color: var(--mut); font-weight: 400; font-size: .72rem; margin-left: 0;
  display: inline-block; padding: .12rem .55rem; border: 1px solid var(--line);
  border-radius: 99px; background: var(--soft); letter-spacing: .02em; white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .brand .mark { transition: none; }
  .brand:hover .mark { transform: none; }
}
nav.cand { display: flex; flex-wrap: wrap; gap: .15em .95rem; font-size: .95rem; align-items: center; }
nav.cand a { color: var(--mut); }
nav.cand a:hover, nav.cand a[aria-current] { color: var(--acc); }
nav.cand a.lang { margin-left: .4rem; padding-left: .9rem; border-left: 1px solid var(--line); font-weight: 600; }

main { max-width: 64rem; margin: 0 auto; padding: 1.6rem 1.2rem 3rem; }
/* comfortable reading measure for prose; tables & charts keep the full column */
main > p, main > ul, main > ol, main > .note, main > .zh { max-width: 46rem; }
h1 { font-size: 1.9rem; line-height: 1.25; margin: .4rem 0 .3rem; }
h1 .sub, .sub { color: var(--mut); margin: 0 0 1.2rem; font-size: 1.02rem; font-weight: 400; }
h1 .sub { display: block; margin: .3rem 0 0; font-size: 1rem; }
h2 { font-size: 1.42rem; margin: 2.1rem 0 .7rem; padding-bottom: .25rem; border-bottom: 2px solid var(--acc); display: inline-block; }
h3 { font-size: 1.16rem; margin: 1.5rem 0 .5rem; }

table { border-collapse: collapse; width: 100%; margin: .8rem 0 1.2rem; font-size: .98rem; }
th, td { border: 1px solid var(--line); padding: .4rem .6rem; text-align: left; vertical-align: top; }
th { background: var(--soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
figure.fig { margin: 1.2rem auto; text-align: center; }
figure.fig img { display: block; margin: 0 auto; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
figure.fig figcaption { font-size: .88rem; color: var(--mut); margin-top: .4rem; }
.fig-grid { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.1rem 0; }
.fig-grid figure.fig { flex: 1 1 18rem; margin: 0; }
.chart-flex { margin: .6rem 0 1.2rem; }
.chart-flex svg, main > svg { display: block; width: 100%; height: auto; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { margin-top: .2rem; }
table.table-wide { font-size: .88rem; }
table.table-wide th, table.table-wide td { padding: .3rem .35rem; }

.zh {
  background: var(--soft); border-left: 4px solid var(--acc);
  padding: .85rem 1.1rem; margin: 1.1rem 0 1.4rem; border-radius: 0 6px 6px 0;
}
.zh .tag { font-size: .78rem; letter-spacing: .12em; color: var(--acc); font-weight: 700; }

.badges { display: flex; flex-wrap: wrap; gap: .45rem; margin: .8rem 0 1.2rem; }
.badge { border: 1px solid var(--line); border-radius: 99px; padding: .16rem .75rem; font-size: .86rem; color: var(--mut); background: var(--soft); }
.badge.ok { border-color: #9db8a0; color: #3c6b42; background: #eef5ef; }

figure.hero { margin: 1.1rem 0 1.5rem; }
figure.hero img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
figure.hero figcaption { font-size: .85rem; color: var(--mut); margin-top: .45rem; text-align: center; }

.note { background: var(--acc-soft); border-radius: 6px; padding: .8rem 1rem; margin: 1rem 0; }
.news li { margin: .3rem 0; }
ul.links { padding-left: 1.2rem; }
ul.links li { margin: .35rem 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: 1.2rem 0; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.2rem; }
.card h3 { margin: 0 0 .3rem; }
.card.dragon h3 a { color: #b3452c; }
.card.thunder h3 a { color: #4653b0; }
.card p { margin: .3rem 0 .6rem; color: var(--mut); font-size: .92rem; }

footer.site { border-top: 1px solid var(--line); color: var(--mut); font-size: .9rem; }
footer.site .in { max-width: 64rem; margin: 0 auto; padding: 1rem 1.2rem 2rem; }
th.num, td.num { white-space: nowrap; }

@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  table { font-size: .92rem; }
  .brand .name { white-space: nowrap; }
  .brand .id { display: none; }   /* the h1 subtitle already carries the candidate id */
}

/* ---- dark theme: manual choice via [data-theme="dark"] on <html>,
        or system preference when the visitor has not chosen ---- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #dfe5ea; --mut: #93a1ae; --line: #333d47; --bg: #13171c; --soft: #1c2229;
}
:root[data-theme="dark"] body.dragon  { --acc: #d97b5f; --acc-soft: #2a1d18; }
:root[data-theme="dark"] body.thunder { --acc: #93a0e0; --acc-soft: #1e2130; }
:root[data-theme="dark"] body.landing { --acc: #74b193; --acc-soft: #18251f; }
:root[data-theme="dark"] code { background: #232b33; }
:root[data-theme="dark"] .badge.ok { border-color: #3d5a44; color: #8fc49a; background: #16241a; }
:root[data-theme="dark"] figure.fig img,
:root[data-theme="dark"] figure.hero img { background: #fff; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #dfe5ea; --mut: #93a1ae; --line: #333d47; --bg: #13171c; --soft: #1c2229;
  }
  :root:not([data-theme="light"]) body.dragon  { --acc: #d97b5f; --acc-soft: #2a1d18; }
  :root:not([data-theme="light"]) body.thunder { --acc: #93a0e0; --acc-soft: #1e2130; }
  :root:not([data-theme="light"]) body.landing { --acc: #74b193; --acc-soft: #18251f; }
  :root:not([data-theme="light"]) code { background: #232b33; }
  :root:not([data-theme="light"]) .badge.ok { border-color: #3d5a44; color: #8fc49a; background: #16241a; }
  :root:not([data-theme="light"]) figure.fig img,
  :root:not([data-theme="light"]) figure.hero img { background: #fff; }
}

button.theme-toggle {
  cursor: pointer; border: 1px solid var(--line); background: var(--soft); color: var(--ink);
  border-radius: 99px; font: inherit; font-size: .85rem; line-height: 1.4;
  padding: .05rem .55rem; margin-left: .4rem;
}
button.theme-toggle:hover { border-color: var(--acc); }

/* ---- hero banner: full-bleed band under the header.
        The artwork lives on its own layer (::before) and the band's background
        colour is sampled from that artwork, so the picture melts into the band
        instead of ending on a visible seam. Every colour is theme-swappable
        through the --hb-* variables. ---- */
.hero-banner {
  position: relative; isolation: isolate; overflow: hidden;

  /* light defaults (dragon) */
  --hb-ink: #17212b; --hb-lead: #4b5866;
  --hb-acc: #b3452c; --hb-glow: rgba(179,69,44,.20);
  --hb-base: #f1ebe3; --hb-rgb: 241,235,227; --hb-py: 65%;
  --hb-art: url(assets/hero-banner-dragon-light.webp?v=2);
  --hb-size: auto 120%; --hb-pos: 78% 62%;

  background-color: var(--hb-base);
  max-width: calc(64rem - 2.4rem); margin: 1.5rem auto 0; /* align with main's padded column */
  border-radius: 12px;
  border: 1px solid rgba(20,26,33,.06);
  box-shadow: 0 1px 2px rgba(20,26,33,.04), 0 10px 28px rgba(20,26,33,.07);
  color: var(--hb-ink);
}
.hero-banner--thunder {
  --hb-acc: #4653b0; --hb-glow: rgba(70,83,176,.20);
  --hb-base: #dbcebd; --hb-rgb: 219,206,189; --hb-px: left; --hb-py: 38%; --hb-size: auto 127%;
  --hb-art: url(assets/hero-banner-thunder-classic.webp?v=2);
}

/* the artwork layer, feathered along its left edge */
.hero-banner::before {
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 62%; z-index: -2;
  background-image: var(--hb-art);
  background-repeat: no-repeat;
  background-size: var(--hb-size, auto 120%);
  background-position: var(--hb-px, right) var(--hb-py, 68%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 72px);
  mask-image: linear-gradient(90deg, transparent 0, #000 72px);
}
/* the veil that keeps the copy column clean, plus a soft bottom edge */
.hero-banner::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(var(--hb-rgb),0) 82%, rgba(var(--hb-rgb),.30) 100%),
    linear-gradient(90deg,
      rgba(var(--hb-rgb),.98) 0%, rgba(var(--hb-rgb),.95) 52%,
      rgba(var(--hb-rgb),.32) 60%, rgba(var(--hb-rgb),.02) 100%);
}

.hb-in {
  min-height: 20rem; padding: 2rem 2rem;
  display: flex; flex-direction: column; justify-content: center;
}
.hb-kicker {
  margin: 0 0 .55rem; font-size: .76rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--hb-acc);
}
.hb-kicker code { background: rgba(127,127,127,.13); color: inherit; padding: .05em .4em; }
.hero-banner h1 {
  margin: 0 0 .75rem; font-size: 2.85rem; line-height: 1.15; letter-spacing: -.015em;
  font-weight: 700; color: var(--hb-ink);
  text-shadow: 0 1px 0 rgba(255,255,255,.55), 0 0 26px var(--hb-glow);
}
.hb-lead { margin: 0 0 1.3rem; max-width: 30rem; font-size: 1.02rem; line-height: 1.65; color: var(--hb-lead); }
.hero-banner h1 a { color: inherit; text-decoration: none; }
.hero-banner h1 a:hover { text-decoration: underline; text-underline-offset: .12em; }

/* ---- inner pages: same artwork, holder content ---- */
.hero-banner--slim .hb-in { min-height: 15rem; }
.hero-banner--slim .hb-kicker { margin-bottom: .35rem; }
.hero-banner--slim h1 { font-size: 1.5rem; margin: 0; letter-spacing: 0; }

/* the wide letter-spacing that suits an all-caps latin kicker looks loose on
   Chinese glyphs — tighten it for the zh pages */
html[lang="zh-CN"] .hb-kicker { letter-spacing: .06em; }

/* ---- narrow screens: fill by height, crop sideways, veil the whole plate ---- */
@media (max-width: 720px) {
  .hero-banner { margin: 0 .75rem; }
  .hero-banner::before {
    width: auto; inset: 0;
    -webkit-mask-image: none; mask-image: none;
    background-size: var(--hb-size, cover);
    background-position: var(--hb-pos, 78% 62%);
  }
  .hero-banner::after {
    background:
      linear-gradient(180deg, rgba(var(--hb-rgb),.99) 0%, rgba(var(--hb-rgb),.92) 42%, rgba(var(--hb-rgb),.45) 100%);
  }
  .hb-in { padding: 2.3rem 1.2rem 2rem; }
  .hero-banner h1 { font-size: 1.85rem; }
  .hb-lead { font-size: .96rem; }
  .hero-banner--slim .hb-in { padding: 2.4rem 1.2rem 2.1rem; min-height: 10.5rem; }
  .hero-banner--slim h1 { font-size: 1.3rem; }
}

/* ---- dark themes: dark artwork, light copy, colours sampled from the art ---- */
:root[data-theme="dark"] .hero-banner {
  border-color: rgba(255,255,255,.07);
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.35);
  --hb-ink: #eef3f8; --hb-lead: #c3cedb;
  --hb-base: #0b0f12; --hb-rgb: 11,15,18; --hb-py: 60%;
  --hb-art: url(assets/hero-banner-dragon.webp?v=2);
  --hb-acc: #ff8a5c; --hb-glow: rgba(255,116,64,.5);
}
:root[data-theme="dark"] .hero-banner--thunder {
  --hb-base: #050e1a; --hb-rgb: 5,14,26; --hb-px: left; --hb-py: 0%; --hb-size: auto 127%;
  --hb-art: url(assets/hero-banner-thunder-classic-dark.webp?v=2);
  --hb-acc: #93a8ff; --hb-glow: rgba(110,150,255,.5);
}
:root[data-theme="dark"] .hero-banner h1 { text-shadow: 0 0 22px var(--hb-glow), 0 0 60px rgba(0,0,0,.35); }
:root[data-theme="dark"] .hb-kicker code { background: rgba(255,255,255,.08); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-banner {
    border-color: rgba(255,255,255,.07);
    box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.35);
    --hb-ink: #eef3f8; --hb-lead: #c3cedb;
    --hb-base: #0b0f12; --hb-rgb: 11,15,18; --hb-py: 60%;
    --hb-art: url(assets/hero-banner-dragon.webp?v=2);
    --hb-acc: #ff8a5c; --hb-glow: rgba(255,116,64,.5);
  }
  :root:not([data-theme="light"]) .hero-banner--thunder {
    --hb-base: #050e1a; --hb-rgb: 5,14,26; --hb-px: left; --hb-py: 0%; --hb-size: auto 127%;
    --hb-art: url(assets/hero-banner-thunder-classic-dark.webp?v=2);
    --hb-acc: #93a8ff; --hb-glow: rgba(110,150,255,.5);
  }
  :root:not([data-theme="light"]) .hero-banner h1 { text-shadow: 0 0 22px var(--hb-glow), 0 0 60px rgba(0,0,0,.35); }
  :root:not([data-theme="light"]) .hb-kicker code { background: rgba(255,255,255,.08); }
}

/* narrow screens override the dark-theme artwork sizing, so repeat the block */
@media (max-width: 720px) {
  .hero-banner,
  :root[data-theme="dark"] .hero-banner,
  :root:not([data-theme="light"]) .hero-banner { --hb-size: cover; --hb-pos: 78% 62%; }
  .hero-banner::before,
  :root[data-theme="dark"] .hero-banner::before,
  :root:not([data-theme="light"]) .hero-banner::before { -webkit-mask-image: none; mask-image: none; }
  .hero-banner::after,
  :root[data-theme="dark"] .hero-banner::after,
  :root:not([data-theme="light"]) .hero-banner::after {
    background: linear-gradient(180deg, rgba(var(--hb-rgb),.99) 0%, rgba(var(--hb-rgb),.92) 42%, rgba(var(--hb-rgb),.45) 100%);
  }
}

/* ---- narrow screens: per-variant artwork anchor (mobile crops sideways) ---- */
@media (max-width: 720px) {
  .hero-banner--dragon { --hb-pos: 72% 62%; }
  .hero-banner--thunder { --hb-pos: 58% 57%; }
  :root[data-theme="dark"] .hero-banner--dragon,
  :root:not([data-theme="light"]) .hero-banner--dragon { --hb-pos: 72% 60%; }
  :root[data-theme="dark"] .hero-banner--thunder,
  :root:not([data-theme="light"]) .hero-banner--thunder { --hb-pos: 47% 44%; }
}

/* ---- responsive containment: wide tables and long inline code must not overflow ---- */
:not(pre) > code { overflow-wrap: anywhere; }
img { max-width: 100% !important; height: auto; }
@media (max-width: 720px) {
  table { display: block; overflow-x: auto; }
}
