/* ==========================================================================
   RCQT — Research Center for Quantum Technology, Chiang Mai University
   Design system, sister to the CEQT site (ceqt.eng.cmu.ac.th): same structure,
   RCQT brand colours sampled from the RCQT logo —
   orange-red #E55525, navy #263D93, cyan #44C8F4.
   ========================================================================== */

:root {
  --orange:      #E55525;
  --orange-dk:   #B83E13;
  --orange-tint: #FDEEE8;
  --navy:        #263D93;
  --cyan:        #44C8F4;
  --ink:         #141C36;
  --ink-2:       #22305A;
  --body:        #232B36;
  --muted:       #5E6875;
  --line:        #E2E6EB;
  --paper:       #FFFFFF;
  --band:        #F6F7F9;

  --p1: #263D93;   /* Cooling & trapping */
  --p2: #6B4FA8;   /* Quantum simulation */
  --p3: #0F7A86;   /* Sensing & metrology */
  --p4: #8A5A28;   /* Applications / archive */

  --link:        #B23C12;   /* 4.8:1 or better on every ground the site uses */
  --link-hover:  #141C36;
  --card:        #FFFFFF;
  --note-bg:     #FDF1EC;
  --note-bd:     #F2C3AE;
  --info-bg:     #EEF3F9;
  --info-bd:     #C9D9EA;
  --info-fg:     #23527C;
  --q1-bg:#E7F3EB; --q1-bd:#BEDCC8; --q1-fg:#1E5B34;
  --q2-bg:#E9F0F8; --q2-bd:#C3D6EA; --q2-fg:#23527C;
  --q3-bg:#FDF3E6; --q3-bd:#F0DCBE; --q3-fg:#8A5A28;
  --q4-bg:#F3F0F6; --q4-bd:#DED4E6; --q4-fg:#5C4470;
  --head-fg:     #141C36;

  --maxw: 1160px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,28,54,.06), 0 8px 24px rgba(20,28,54,.06);
  --font: "Prompt", "IBM Plex Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #0E141C; --ink-2:#16202D;
    --body:#DCE2EA; --muted:#98A3B2; --line:#28323F;
    --paper:#121821; --band:#0E141C;
    --card:#161F2B;
    --link:#FF8F63; --link-hover:#FFFFFF;
    --note-bg:#241A11; --note-bd:#5A3E20;
    --info-bg:#121D29; --info-bd:#27405A; --info-fg:#9CC4E8;
    --q1-bg:#14291C; --q1-bd:#285034; --q1-fg:#9BD3AD;
    --q2-bg:#122132; --q2-bd:#27405A; --q2-fg:#9CC4E8;
    --q3-bg:#2A1E12; --q3-bd:#5A3E20; --q3-fg:#E0B27C;
    --q4-bg:#221B29; --q4-bd:#453454; --q4-fg:#C4AAD8;
    --head-fg:#F2F5F8;
    --orange-tint:#241A11;
  }
}
:root[data-theme="dark"] {
    --ink: #0E141C; --ink-2:#16202D;
    --body:#DCE2EA; --muted:#98A3B2; --line:#28323F;
    --paper:#121821; --band:#0E141C;
    --card:#161F2B;
    --link:#FF8F63; --link-hover:#FFFFFF;
    --note-bg:#241A11; --note-bd:#5A3E20;
    --info-bg:#121D29; --info-bd:#27405A; --info-fg:#9CC4E8;
    --q1-bg:#14291C; --q1-bd:#285034; --q1-fg:#9BD3AD;
    --q2-bg:#122132; --q2-bd:#27405A; --q2-fg:#9CC4E8;
    --q3-bg:#2A1E12; --q3-bd:#5A3E20; --q3-fg:#E0B27C;
    --q4-bg:#221B29; --q4-bd:#453454; --q4-fg:#C4AAD8;
    --head-fg:#F2F5F8;
    --orange-tint:#241A11;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--body);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

:lang(th), .th { line-height: 1.78; letter-spacing: normal; }

img { max-width: 100%; height: auto; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }

:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--head-fg); font-weight: 600;
  margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 2.5rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.35rem, 1.05rem + 1.1vw, 1.65rem); margin-top: 2.2em; }
h3 { font-size: 1.12rem; margin-top: 1.8em; }
p  { margin: 0 0 1.05em; max-width: 72ch; }
ul, ol { max-width: 72ch; padding-left: 1.15em; }
li { margin-bottom: .35em; }
code, kbd { font-family: var(--mono); font-size: .88em; background: var(--band);
  padding: .12em .38em; border-radius: 4px; border: 1px solid var(--line); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 820px; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--orange);
  color: var(--ink); padding: 10px 16px; z-index: 200; font-weight: 600; }
.skip:focus { left: 8px; top: 8px; }

/* ---------------------------------------------------------------- header */
.hdr { background: var(--ink); position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.08); }
.hdr-in { max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 20px; min-height: 66px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { height: 38px; width: auto; display: block; }
.brand span { font-size: .68rem; font-weight: 400; color: #9AA6B4; letter-spacing: .04em;
  line-height: 1.35; width: 176px; text-wrap: balance; border-left: 1px solid rgba(255,255,255,.16);
  padding-left: 14px; }
@media (max-width: 1180px) { .brand span { display: none; } }
@media (max-width: 420px) { .brand img { height: 32px; } }
.nav { margin-left: auto; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav a { color: #D8DEE6; text-decoration: none; font-size: .845rem; padding: 8px 10px;
  border-radius: 6px; white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a[aria-current="page"] { color: var(--orange); box-shadow: inset 0 -2px 0 var(--orange); }
.nav .lang { color: #8A95A3; font-size: .78rem; margin-left: 8px;
  border-left: 1px solid rgba(255,255,255,.15); padding-left: 14px; }
.navtoggle { display: none; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.25);
  color: #fff; border-radius: 6px; padding: 7px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
@media (max-width: 900px) {
  .navtoggle { display: block; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch;
    padding-bottom: 14px; margin-left: 0; }
  .nav.open { display: flex; }
  .hdr-in { flex-wrap: wrap; }
  .nav a { padding: 10px 8px; }
  .nav .lang { border-left: 0; padding-left: 8px; margin-left: 0; }
}

/* ---------------------------------------------------------------- hero */
.hero { background: linear-gradient(160deg, var(--ink) 0%, #1E2F6B 100%); color: #EDF1F5;
  padding: 78px 0 66px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(68,200,244,.30) 1px, transparent 0);
  background-size: 34px 34px; opacity: .5; pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; }
.hero .eyebrow { color: var(--orange); font-family: var(--mono); font-size: .74rem; letter-spacing: .14em;
  text-transform: uppercase; font-weight: 600; margin-bottom: 14px; }
.hero h1 { color: #fff; max-width: 19ch; font-size: clamp(2.1rem, 1.2rem + 3.2vw, 3.15rem);
  letter-spacing: -.02em; margin-bottom: .45em; }
.hero p { color: #C3CCD7; font-size: 1.06rem; max-width: 62ch; }
.hero .btns { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

.pagehead { background: var(--band); border-bottom: 1px solid var(--line); padding: 46px 0 38px; }
.pagehead .eyebrow { color: var(--link); font-family: var(--mono); font-size: .72rem; letter-spacing: .12em;
  text-transform: uppercase; font-weight: 600; margin-bottom: 10px; }
.pagehead h1 { margin-bottom: .3em; }
.pagehead .lede { font-size: 1.08rem; color: var(--muted); max-width: 68ch; margin: 0; }

.crumb { font-size: .8rem; color: var(--muted); margin-bottom: 14px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--orange-dk); text-decoration: underline; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-block; background: var(--orange); color: #141C36; font-weight: 600;
  padding: 11px 22px; border-radius: var(--radius); text-decoration: none; font-size: .95rem;
  border: 1px solid var(--orange); }
.btn:hover { background: #F2794F; color: #141C36; }
.btn.ghost { background: transparent; color: #EDF1F5; border-color: rgba(255,255,255,.34); }
.btn.ghost:hover { background: rgba(255,255,255,.10); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.dark:hover { background: var(--ink-2); color: #fff; }

/* ---------------------------------------------------------------- sections */
section.band { background: var(--band); border-block: 1px solid var(--line); }
.sec { padding: 58px 0; }
.sec-head { margin-bottom: 30px; }
.sec-head h2 { margin-top: 0; }
.sec-head p { color: var(--muted); margin: 0; }

.grid { display: grid; gap: 18px; align-items: stretch; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(252px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; height: 100%;
  text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--orange); box-shadow: var(--shadow); }
.card .eyebrow { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.card h3 { margin: 0 0 .45em; font-size: 1.05rem; }
.card p { font-size: .93rem; color: var(--muted); margin: 0; }
.card .more { display: inline-block; margin-top: auto; padding-top: 14px; font-size: .87rem;
  font-weight: 600; color: var(--link); }

.card.p1 { border-top: 4px solid var(--p1); }
.card.p2 { border-top: 4px solid var(--p2); }
.card.p3 { border-top: 4px solid var(--p3); }
.card.p4 { border-top: 4px solid var(--p4); }
.dot { display: inline-block; width: .6em; height: .6em; border-radius: 50%; margin-right: .5em;
  vertical-align: .02em; }
.dot.p1 { background: var(--p1); } .dot.p2 { background: var(--p2); }
.dot.p3 { background: var(--p3); } .dot.p4 { background: var(--p4); }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 16px; }
.stat { text-align: center; padding: 22px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card); }
.stat b { display: block; font-size: 2.15rem; font-weight: 700; color: var(--link);
  line-height: 1.1; font-family: var(--mono); font-variant-numeric: tabular-nums;
  letter-spacing: -.02em; }
.stat span { font-size: .85rem; color: var(--muted); }

/* ---------------------------------------------------------------- matrix */
.matrix-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.matrix { border-collapse: separate; border-spacing: 3px; min-width: 720px; width: 100%; }
table.matrix th { font-size: .76rem; font-weight: 600; color: var(--muted); text-align: center;
  padding: 6px 4px; vertical-align: bottom; line-height: 1.25; }
table.matrix th.rowh { text-align: left; width: 170px; color: var(--head-fg); font-size: .86rem; }
table.matrix td { padding: 0; }
.cell { display: flex; font-family: var(--mono); align-items: center; justify-content: center; min-height: 52px;
  border-radius: 7px; font-size: .74rem; font-weight: 600; text-decoration: none;
  border: 1px solid var(--line); color: var(--muted); background: var(--card);
  text-align: center; padding: 4px; line-height: 1.2; }
.cell.lv3 { background: var(--orange); border-color: var(--orange-dk); color: #1B2430; }
.cell.lv2 { background: #F9C795; border-color: #F0B071; color: #52340F; }
.cell.lv1 { background: var(--orange-tint); border-color: #F3D9C0; color: #8A5A28; }
a.cell:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--muted);
  margin-top: 14px; align-items: center; }
.legend i { display: inline-block; width: 15px; height: 15px; border-radius: 4px;
  border: 1px solid var(--line); margin-right: 6px; vertical-align: -3px; }

/* ---------------------------------------------------------------- tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); }
table.data { border-collapse: collapse; width: 100%; font-size: .88rem; min-width: 560px; }
table.data th { background: var(--ink); color: #fff; text-align: left; font-weight: 600;
  padding: 11px 13px; font-size: .8rem; position: sticky; top: 0; }
table.data td { padding: 10px 13px; border-top: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:nth-child(even) { background: var(--band); }
table.data td.num { text-align: right; white-space: nowrap; color: var(--muted);
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .92em; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input, .filters select { font: inherit; font-size: .9rem; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--body); }
.filters input { min-width: 240px; flex: 1 1 240px; }
.count { font-size: .86rem; color: var(--muted); margin-left: auto; }

.badge { display: inline-block; font-family: var(--mono); font-size: .68rem; font-weight: 600; padding: 2px 7px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.q1 { background: var(--q1-bg); border-color: var(--q1-bd); color: var(--q1-fg); }
.badge.q2 { background: var(--q2-bg); border-color: var(--q2-bd); color: var(--q2-fg); }
.badge.q3 { background: var(--q3-bg); border-color: var(--q3-bd); color: var(--q3-fg); }
.badge.q4 { background: var(--q4-bg); border-color: var(--q4-bd); color: var(--q4-fg); }

/* ---------------------------------------------------------------- misc */
.note { background: var(--note-bg); border: 1px solid var(--note-bd); border-left: 4px solid var(--orange);
  border-radius: var(--radius); padding: 16px 20px; margin: 26px 0; }
.note h3 { margin-top: 0; color: var(--link); font-size: .95rem; }
.note p:last-child { margin-bottom: 0; }
.note.info { background: var(--info-bg); border-color: var(--info-bd); border-left-color: var(--p2); }
.note.info h3 { color: var(--info-fg); }

.fieldlist { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  margin: 22px 0; }
.fieldlist > div { display: grid; grid-template-columns: 210px 1fr; gap: 0;
  border-top: 1px solid var(--line); }
.fieldlist > div:first-child { border-top: 0; }
.fieldlist dt, .fieldlist .k { background: var(--band); padding: 12px 16px; font-weight: 600;
  font-size: .88rem; color: var(--head-fg); }
.fieldlist .v { padding: 12px 16px; font-size: .93rem; }
.fieldlist .v p { margin: 0 0 .6em; } .fieldlist .v p:last-child { margin: 0; }
@media (max-width: 640px) { .fieldlist > div { grid-template-columns: 1fr; }
  .fieldlist .k { border-bottom: 1px solid var(--line); } }

figure.dia { margin: 28px 0; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; background: #FFFFFF; color: #232B36; }
figure.dia svg { display: block; width: 100%; height: auto; }
/* the plate stays white in both themes, so its own text is pinned to ink —
   inheriting --muted would put light grey on white in dark mode */
figure.dia figcaption { font-size: .84rem; color: #5E6875; margin-top: 14px;
  padding-top: 12px; border-top: 1px solid #E2E6EB; }

.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 14px; }
.person { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  background: var(--card); }
.person h3 { margin: 0 0 2px; font-size: .99rem; }
.person .role { font-size: .82rem; color: var(--muted); margin: 0 0 6px; }
.person .meta { font-size: .8rem; margin: 0; }
.person .meta a { word-break: break-all; }

.timeline { border-left: 2px solid var(--line); padding-left: 22px; margin-left: 6px; }
.timeline > li { list-style: none; margin-bottom: 22px; position: relative; }
.timeline > li::before { content: ""; position: absolute; left: -29px; top: .45em;
  width: 11px; height: 11px; border-radius: 50%; background: var(--orange);
  border: 2px solid var(--card); }
.timeline h3 { margin: 0 0 .2em; font-size: 1rem; }
.timeline .when { font-family: var(--mono); font-size: .73rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; }

.logos { display: flex; flex-wrap: wrap; gap: 10px; }
.logos a { border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px;
  font-size: .84rem; text-decoration: none; color: var(--body); background: var(--card); }
.logos a:hover { border-color: var(--orange); color: var(--orange-dk); }

.updated { font-size: .8rem; color: var(--muted); margin-top: 40px; padding-top: 16px;
  border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- footer */
.ftr { background: var(--ink); color: #B8C2CE; padding: 50px 0 26px; margin-top: 70px;
  font-size: .88rem; }
.ftr a { color: #D8DEE6; text-decoration: none; }
.ftr a:hover { color: var(--orange); text-decoration: underline; }
.ftr .ftr-h { color: var(--orange); font-family: var(--mono); font-size: .7rem;
  letter-spacing: .1em; text-transform: uppercase; font-weight: 600; margin: 0 0 12px; }
.ftr-logo { height: 108px; width: auto; display: block; margin: 0 0 30px; }
.ftr .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 30px; }
.ftr ul { list-style: none; padding: 0; margin: 0; }
.ftr li { margin-bottom: 6px; }
.ftr .base { margin-top: 34px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: .8rem; color: #8A95A3; }

@media print {
  .hdr, .ftr, .btns, .filters { display: none; }
  body { font-size: 11pt; } a { color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; }
}

/* =============================== CEQT-VIZ-BLOCK — figures, charts, motion */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  gap: 46px; align-items: center; }
.hero-copy h1 { max-width: 17ch; }
.hero-copy p { max-width: 54ch; }
.hero-viz { min-width: 0; }
.hero-cap { font-size: .82rem !important; color: #9AA6B4 !important; margin: 14px 0 0;
  max-width: 44ch; line-height: 1.55; }
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; gap: 26px; }
  .hero-copy h1, .hero-copy p { max-width: none; }
  .hero-fig { margin: 0 auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .has-js .matrix-scroll .cell { opacity: 0; transition: opacity .4s ease; }
  .has-js .matrix-scroll.in .cell { opacity: 1; }
  .has-js .vstats .vstat { opacity: 0; transform: translateY(10px);
    transition: opacity .5s ease, transform .5s cubic-bezier(.22,1,.36,1); }
  .has-js .vstats.in .vstat { opacity: 1; transform: none; }
  .has-js .vstats.in .vstat:nth-child(2) { transition-delay: .07s; }
  .has-js .vstats.in .vstat:nth-child(3) { transition-delay: .14s; }
  .has-js .vstats.in .vstat:nth-child(4) { transition-delay: .21s; }
}
a.cell { transition: transform .14s ease; }
a.cell:hover { transform: translateY(-1px); }

/* ==========================================================================
   Figures and charts
   Palette validated with the data-viz six checks against both surfaces:
     categorical (pillars)  light #D94F4F #2F7CC7 #2E9E6B #8358CE
                            dark  #E05F5F #4F97DE #2FA772 #9276DE
     ordinal (one hue)      light #F0A15C → #8A4410   dark #B25C15 → #FBD7B4
   ========================================================================== */
:root {
  --viz-surface: #FFFFFF;
  --viz-grid:    #EDF0F4;
  --viz-axis:    #C9D1DC;
  --viz-ink:     #1B2430;
  --viz-muted:   #5E6875;
  --viz-dim:     #98A3B2;
  --viz-track:   #EDF0F4;
  --viz-solo:    #DE7A2E;
  --viz-s1: #D94F4F;  --viz-s2: #2F7CC7;  --viz-s3: #2E9E6B;  --viz-s4: #8358CE;
  --viz-r1: #F0A15C;  --viz-r2: #DE7A2E;  --viz-r3: #B9601A;  --viz-r4: #8A4410;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --viz-surface: #161F2B; --viz-grid: #232E3D; --viz-axis: #35435A;
    --viz-ink: #F2F5F8;     --viz-muted: #98A3B2; --viz-dim: #566577;
    --viz-track: #232E3D;   --viz-solo: #F6A868;
    --viz-s1: #E05F5F; --viz-s2: #4F97DE; --viz-s3: #2FA772; --viz-s4: #9276DE;
    --viz-r1: #B25C15; --viz-r2: #E37E2E; --viz-r3: #F6A868; --viz-r4: #FBD7B4;
  }
}
:root[data-theme="dark"] {
  --viz-surface: #161F2B; --viz-grid: #232E3D; --viz-axis: #35435A;
  --viz-ink: #F2F5F8;     --viz-muted: #98A3B2; --viz-dim: #566577;
  --viz-track: #232E3D;   --viz-solo: #F6A868;
  --viz-s1: #E05F5F; --viz-s2: #4F97DE; --viz-s3: #2FA772; --viz-s4: #9276DE;
  --viz-r1: #B25C15; --viz-r2: #E37E2E; --viz-r3: #F6A868; --viz-r4: #FBD7B4;
}
/* on the ink hero band the ground is dark in both themes */
.viz-on-ink {
  --viz-surface: #1B2430; --viz-grid: #2A3647; --viz-axis: #3A4759;
  --viz-ink: #F2F5F8; --viz-muted: #9AA6B4; --viz-dim: #5C6B80;
  --viz-solo: #F9A661;
}

/* ------------------------------------------------------------- the frame */
.viz { margin: 26px 0 30px; }
.viz-cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
  margin: 0 0 14px; }
.viz-ttl { font-weight: 600; color: var(--head-fg); font-size: 1.02rem; }
.viz-note { font-family: var(--mono); font-size: .72rem; letter-spacing: .04em;
  color: var(--muted); }
.vsvg { display: block; width: 100%; height: auto; overflow: visible; }
.viz-wide { margin-inline: 0; }

.vg { stroke: var(--viz-grid); stroke-width: 1; shape-rendering: crispEdges; }
.va { stroke: var(--viz-axis); stroke-width: 1; shape-rendering: crispEdges; }
.vframe { stroke: var(--viz-axis); stroke-width: 1; }
.vt { font-family: var(--mono); font-size: 11px; fill: var(--viz-muted);
  font-variant-numeric: tabular-nums; }
.vt-c { text-anchor: middle; }
.vt-r { text-anchor: end; }
.vt-val { fill: var(--viz-ink); font-weight: 600; }
.vt-head { fill: var(--viz-ink); font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; font-size: 10px; }
.vt-mixed { text-transform: none; letter-spacing: .01em; font-size: 11px; }
.vt-ann { fill: var(--viz-muted); font-size: 10px; letter-spacing: .05em; }
.vhit { fill: transparent; }
.vdot { fill: var(--viz-solo); stroke: var(--viz-surface); stroke-width: 2; }
.vline { fill: none; stroke: var(--viz-solo); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.vline-ctx { stroke: var(--viz-dim); stroke-width: 1.5; }
.vfill { fill: var(--viz-solo); opacity: .1; }
.vb { cursor: default; }
.vb:focus-visible { outline: none; }
.vb:focus-visible path, .vb:focus-visible rect:not(.vhit),
.vb:focus-visible circle:not(.vhit) { stroke: var(--viz-ink); stroke-width: 2; }
.vb:hover path, .vb:hover rect:not(.vhit) { filter: brightness(1.08); }

.vlegend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 12px 0 0;
  font-size: .82rem; color: var(--body); }
.vl-item { display: inline-flex; align-items: center; gap: 8px; }
.vk { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.vk-line { width: 16px; height: 3px; border-radius: 2px; }

.viz-data { margin-top: 14px; }
.viz-data > summary { font-family: var(--mono); font-size: .72rem;
  letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  cursor: pointer; padding: 4px 0; }
.viz-data > summary:hover { color: var(--link); }
.viz-tbl { width: 100%; border-collapse: collapse; margin-top: 10px;
  font-size: .86rem; font-variant-numeric: tabular-nums; }
.viz-tbl caption { text-align: left; color: var(--muted); font-size: .8rem;
  padding-bottom: 8px; }
.viz-tbl th, .viz-tbl td { border-bottom: 1px solid var(--line); padding: 6px 10px;
  text-align: right; }
.viz-tbl th[scope=row] { text-align: left; font-weight: 500; }
.viz-tbl thead th { color: var(--muted); font-weight: 600; font-size: .78rem; }

/* --------------------------------------------------------------- KPI row */
.vstats { display: grid; gap: 2px; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin: 26px 0; }
.vstat { background: var(--card); padding: 20px 18px 18px; }
.vstat b { display: block; font-size: 2.1rem; line-height: 1; font-weight: 700;
  color: var(--head-fg); letter-spacing: -.02em; }
.vstat span { display: block; margin-top: 8px; font-size: .88rem; color: var(--body); }
.vstat i { display: block; margin-top: 5px; font-style: normal; font-family: var(--mono);
  font-size: .68rem; letter-spacing: .04em; color: var(--muted); }

/* ------------------------------------------------------------- heat cells */
.vheat .vcell rect { transition: opacity .18s ease; }
.vheat a.vcell { cursor: pointer; }
.vheat a.vcell:hover rect, .vheat a.vcell:focus-visible rect {
  stroke: var(--viz-ink); stroke-width: 2; }
.vmeter text { font-size: 10px; }

/* ----------------------------------------------------------------- tooltip */
.vtip { position: fixed; z-index: 60; pointer-events: none; opacity: 0;
  transform: translate(-50%, -100%); transition: opacity .12s ease;
  background: var(--ink); color: #F2F5F8; border-radius: 7px;
  padding: 7px 11px; font-size: .8rem; line-height: 1.35;
  box-shadow: 0 6px 20px rgba(0,0,0,.3); max-width: 240px; }
.vtip.on { opacity: 1; }
.vtip b { display: block; font-size: .96rem; font-weight: 700; }
.vtip span { color: #B8C2CE; font-size: .74rem; }

/* -------------------------------------------------------------- the hero */
.hero-fig { max-width: 560px; margin-left: auto; }
.hline { fill: none; stroke: var(--viz-solo); stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round; }
.hstem { stroke: var(--viz-axis); stroke-width: 1; }
.hmin { fill: var(--viz-solo); stroke: var(--viz-surface); stroke-width: 2; }
.hq { fill: #FFE7CE; stroke: var(--viz-surface); stroke-width: 2; }
.hc { fill: #A3AEBC; stroke: rgba(14,20,28,.6); stroke-width: 1.5; }
.htun { stroke: url(#hgt); stroke-width: 3; stroke-linecap: round; }
.vt-tun { fill: var(--viz-solo); font-size: 10px; letter-spacing: .05em; }
.hero-fig.paused * { animation-play-state: paused !important; }
.hglow { opacity: .9; }

/* ------------------------------------------------ motion, opt-in via JS */
@media (prefers-reduced-motion: no-preference) {
  .has-js .viz .vb > path,
  .has-js .viz .vb > rect:not(.vhit) {
    transform-box: fill-box; transform-origin: bottom;
    transform: scaleY(.001); transition: transform .75s cubic-bezier(.22,1,.36,1); }
  .has-js .viz.in .vb > path,
  .has-js .viz.in .vb > rect:not(.vhit) { transform: scaleY(1); }
  .has-js .viz .vb-h > path { transform-origin: left; transform: scaleX(.001);
    transition: transform .7s cubic-bezier(.22,1,.36,1); }
  .has-js .viz .vb-h > path { transform-box: fill-box; }
  .has-js .viz.in .vb-h > path { transform: scaleX(1); }
  .has-js .viz .vline { stroke-dasharray: 1; stroke-dashoffset: 1;
    transition: stroke-dashoffset 1.1s ease-out; }
  .has-js .viz.in .vline { stroke-dashoffset: 0; }
  .has-js .viz .vfill, .has-js .viz .vdot, .has-js .viz .vt-val {
    opacity: 0; transition: opacity .5s ease .5s; }
  .has-js .viz.in .vfill { opacity: .1; }
  .has-js .viz.in .vdot, .has-js .viz.in .vt-val { opacity: 1; }
  .has-js .vheat .vcell rect { opacity: 0; transition: opacity .45s ease; }
  .has-js .viz.in .vheat .vcell rect, .has-js .vheat.in .vcell rect { opacity: 1; }
}

/* ------------------------------------------------------------- diagrams */
:root { --dg-bg: #F7F9FB; --dg-line: #C6D0DC; --dg-accent: #C96612;
        --dg-accent-bg: #FFF2E4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --dg-bg: #1B2533; --dg-line: #35435A;
    --dg-accent: #F9A661; --dg-accent-bg: #2A1E12; }
}
:root[data-theme="dark"] { --dg-bg: #1B2533; --dg-line: #35435A;
  --dg-accent: #F9A661; --dg-accent-bg: #2A1E12; }

.dg text { font-family: var(--font); }
.dg-t { fill: var(--viz-ink); font-weight: 600; font-size: 13px; text-anchor: middle; }
.dg-s { fill: var(--viz-muted); font-size: 11px; text-anchor: middle; }
.dg-left { text-anchor: start; }
.dg-right { text-anchor: end; }
.dg-h { fill: var(--viz-muted); font-family: var(--mono); font-size: 10px;
  letter-spacing: .09em; text-transform: uppercase; }
.dg-l { fill: var(--viz-muted); font-size: 10.5px; text-anchor: middle;
  font-family: var(--mono); }
.dg-n { fill: #1B2430; font-size: 11px; font-weight: 700; text-anchor: middle;
  font-family: var(--mono); }
.dg-a { stroke: var(--dg-line); stroke-width: 1.5; fill: none; }
.dg-a2 { stroke: var(--dg-line); stroke-width: 1.5; fill: none; opacity: .65; }
.dg-rail { stroke: var(--dg-line); stroke-width: 1; }
.dg-brace { stroke: var(--dg-accent); stroke-width: 2; stroke-linecap: round; }
@media (prefers-reduced-motion: no-preference) {
  .has-js .viz .dg rect, .has-js .viz .dg circle, .has-js .viz .dg path,
  .has-js .viz .dg text { opacity: 0; transition: opacity .5s ease; }
  .has-js .viz.in .dg rect, .has-js .viz.in .dg circle, .has-js .viz.in .dg path,
  .has-js .viz.in .dg text { opacity: 1; }
}

/* the capability matrix: --orange-tint flips to near-black in dark mode, so the
   lightest cell needs its own text colour there rather than the light-mode brown */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cell.lv1 { color: #E8B682; border-color: #5A3E20; }
}
:root[data-theme="dark"] .cell.lv1 { color: #E8B682; border-color: #5A3E20; }

/* ------------------------------------------------------ interactive controls
   Every control here is hidden in the markup and revealed by script, so a
   visitor without JavaScript is never shown a dead knob.                    */
[hidden] { display: none !important; }

.viz-ctl { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap;
  margin: 0 0 18px; padding: 12px 16px; background: var(--band);
  border: 1px solid var(--line); border-radius: var(--radius); }
.viz-ctl label, .viz-ctl .ctl-lbl { font-family: var(--mono); font-size: .72rem;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; }
.viz-ctl input[type=range] { flex: 1 1 190px; min-width: 140px; accent-color: var(--link);
  height: 22px; }
.viz-ctl output { font-size: .9rem; color: var(--body); flex: 1 1 100%; }
.viz-ctl output b { color: var(--head-fg); font-variant-numeric: tabular-nums; }
@media (min-width: 720px) { .viz-ctl output { flex: 2 1 300px; } }

.chip { font: inherit; font-size: .82rem; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--body);
  cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.chip:hover { border-color: var(--orange); }
.chip.on { background: var(--head-fg); border-color: var(--head-fg); color: var(--paper); }
.chip:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.matrix tbody tr { transition: opacity .25s ease; }
.matrix tbody tr.dim { opacity: .22; }
.matrix tbody tr.dim a.cell { pointer-events: none; }

.vmark { stroke: var(--viz-ink); stroke-width: 1; opacity: .55; }

.sortbtn { font: inherit; font-weight: 600; color: inherit; background: none;
  border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center;
  gap: 5px; }
.sortbtn:hover { color: var(--link); }
.sortbtn:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.sortbtn::after { content: "\2195"; font-size: .8em; opacity: .35; }
.sortbtn.asc::after { content: "\2191"; opacity: 1; }
.sortbtn.desc::after { content: "\2193"; opacity: 1; }

.hero-replay { margin-top: 14px; font: inherit; font-size: .8rem; padding: 6px 14px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.22); background: transparent;
  color: #C3CCD7; cursor: pointer; }
.hero-replay:hover { border-color: var(--orange); color: #fff; }
.hero-replay:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.lc-row { transition: opacity .18s ease; }

/* recent developments */
ul.timeline { list-style: none; padding: 0; margin: 0; }
ul.timeline > li { position: relative; padding: 0 0 26px 26px;
  border-left: 2px solid var(--line); }
ul.timeline > li::before { content: ""; position: absolute; left: -7px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%; background: var(--orange);
  border: 2px solid var(--card); }
ul.timeline > li:last-child { border-left-color: transparent; padding-bottom: 0; }
ul.timeline .when { font-family: var(--mono); font-size: .72rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 5px; }
ul.timeline h3 { margin: 0 0 6px; font-size: 1.02rem; }
ul.timeline p { margin: 0 0 8px; font-size: .94rem; }
ul.timeline .src { font-size: .84rem; color: var(--muted); }
.tag-ext { display: inline-block; font-family: var(--mono); font-size: .64rem;
  letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px;
  background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-bd);
  vertical-align: 2px; margin-left: 8px; }
.tag-res { background: var(--note-bg); color: #8A4410; border-color: var(--note-bd); }
.tag-cen { background: #EEF6EF; color: #1B6130; border-color: #C5E0CB; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag-res { color: #E8B682; }
  :root:not([data-theme="light"]) .tag-cen {
    background: #11221A; color: #93D8AA; border-color: #2C4D38; }
}
:root[data-theme="dark"] .tag-res { color: #E8B682; }
:root[data-theme="dark"] .tag-cen {
  background: #11221A; color: #93D8AA; border-color: #2C4D38; }

/* the home page's three-item latest strip */
@media (min-width: 820px) {
  ul.timeline.home-latest { display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0 30px; }
  ul.timeline.home-latest > li { padding-bottom: 0; }
  ul.timeline.home-latest > li:last-child { border-left-color: var(--line); }
}
ul.timeline.home-latest h3 { font-size: .98rem; }
ul.timeline.home-latest p { font-size: .9rem; }

/* ==========================================================================
   RCQT additions — brand, story player, media, books
   ========================================================================== */
:root { --hdr: 66px; }

/* the logo is full-colour on transparent: it sits on a white plate in the
   dark header and footer so the navy Q never disappears into the ink */
.brand .plate { background: #fff; border-radius: 8px; padding: 6px 10px; display: flex;
  align-items: center; }
.brand .plate img { height: 24px; width: auto; display: block; }
@media (max-width: 420px) { .brand .plate img { height: 20px; } }
.ftr-plate { display: inline-block; background: #fff; border-radius: 12px; padding: 14px 18px;
  margin: 0 0 30px; }
.ftr-plate img { height: 54px; width: auto; display: block; }

.lede-strong { font-size: 1.12rem; color: var(--body); }
.kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--link); font-weight: 600; margin-bottom: 8px; }

/* ------------------------------------------------------------ hero media */
.hero-media { position: relative; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.14); box-shadow: 0 20px 50px rgba(0,0,0,.35);
  background: #0B1320; aspect-ratio: 16 / 9; }
.hero-media img, .hero-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-media .tag { position: absolute; left: 12px; bottom: 12px; background: rgba(9,15,30,.82);
  color: #E8EEF6; font-size: .78rem; padding: 6px 11px; border-radius: 999px;
  text-decoration: none; border: 1px solid rgba(255,255,255,.18); }
.hero-media .tag:hover { border-color: var(--cyan); color: #fff; }

/* ------------------------------------------------------- animation cards */
.acard { display: flex; flex-direction: column; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; background: var(--card);
  text-decoration: none; color: inherit; height: 100%; }
a.acard:hover { border-color: var(--orange); box-shadow: var(--shadow); }
.acard .thumb { aspect-ratio: 16 / 9; background: #0B1320; position: relative; overflow: hidden; }
.acard .thumb img { width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .4s ease; }
a.acard:hover .thumb img { transform: scale(1.03); }
.acard .thumb .len { position: absolute; right: 10px; bottom: 10px; font-family: var(--mono);
  font-size: .68rem; background: rgba(9,15,30,.85); color: #E8EEF6; padding: 3px 8px;
  border-radius: 999px; }
.acard .thumb .play { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; }
.acard .thumb .play span { width: 54px; height: 54px; border-radius: 50%;
  background: rgba(229,85,37,.92); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.acard .thumb .play span::before { content: ""; border-left: 16px solid #fff;
  border-top: 10px solid transparent; border-bottom: 10px solid transparent; margin-left: 4px; }
.acard .body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.acard .eyebrow { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em;
  text-transform: uppercase; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.acard h3 { margin: 0 0 .4em; font-size: 1.02rem; }
.acard p { font-size: .9rem; color: var(--muted); margin: 0; }
.acard .more { margin-top: auto; padding-top: 12px; font-size: .86rem; font-weight: 600; color: var(--link); }

/* ---------------------------------------------------------- story player */
.story { background: #0B1320; color: #E8EEF6; }
.story-head { padding: 50px 0 28px; }
.story-head .kicker { color: #7FD3F5; }
.story-head h2 { color: #fff; margin-top: 0; }
.story-head p { color: #B9C4D2; }
.story-head a { color: #FF9A73; }
.story-tools { display: flex; gap: 10px 18px; flex-wrap: wrap; align-items: center; margin-top: 18px;
  font-size: .88rem; }
.story-tools .hint { color: #8FA0B5; font-size: .84rem; }
.story-stage { display: none; position: relative; }
.has-js .story-stage { display: block; }
.has-js .story-fallback { display: none; }
.story-sticky { position: sticky; top: var(--hdr); height: calc(100vh - var(--hdr));
  height: calc(100svh - var(--hdr)); display: grid; grid-template-rows: minmax(0,1fr) auto;
  background: radial-gradient(ellipse at 40% 45%, #172A55 0%, #0B1320 68%); overflow: hidden; }
.story-view { display: grid; grid-template-columns: minmax(0,1fr) minmax(300px, 400px);
  min-height: 0; }
.story-screen { position: relative; min-width: 0; min-height: 0; display: flex;
  align-items: center; justify-content: center; padding: 14px; }
.story-canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.story-load { position: absolute; top: 14px; left: 18px; font-family: var(--mono); font-size: .7rem;
  color: #9FB0C4; background: rgba(0,0,0,.45); padding: 4px 10px; border-radius: 999px; }
.story-panel { border-left: 1px solid rgba(255,255,255,.08); padding: 26px 26px 20px;
  overflow-y: auto; display: flex; flex-direction: column; justify-content: center;
  background: rgba(6,11,24,.55); }
.story-panel .n { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em;
  text-transform: uppercase; color: #7FD3F5; margin: 0 0 8px; }
.story-panel h3 { color: #fff; font-size: 1.12rem; margin: 0 0 .55em; }
.story-panel .b { color: #D3DCE7; font-size: .95rem; line-height: 1.65; margin: 0; max-width: none; }
.story-panel .b:lang(th) { line-height: 1.85; }
.story-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: #070D1A; border-top: 1px solid rgba(255,255,255,.09); flex-wrap: wrap; }
.sbtn { font: inherit; font-size: .82rem; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22); background: transparent; color: #E8EEF6; cursor: pointer; }
.sbtn:hover { border-color: var(--cyan); color: #fff; }
.sbtn.primary { background: var(--orange); border-color: var(--orange); color: #141C36; }
.sbtn.primary:hover { background: #F2794F; }
.sbtn[aria-pressed="true"].lang { background: #E8EEF6; color: #0B1320; border-color: #E8EEF6; }
.sbtn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.story-ticks { flex: 1 1 260px; display: flex; gap: 3px; align-items: center; min-width: 180px; }
.story-ticks button { flex-basis: 0; flex-shrink: 1; height: 9px; border-radius: 5px; border: 0;
  background: rgba(255,255,255,.16); cursor: pointer; position: relative; overflow: hidden; padding: 0; }
.story-ticks button i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--cyan); }
.story-ticks button.on { background: rgba(68,200,244,.28); }
.story-ticks button:hover { background: rgba(255,255,255,.3); }
.story-ticks button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.story-count { font-family: var(--mono); font-size: .72rem; color: #9FB0C4; white-space: nowrap; }
.story-lang { display: flex; gap: 6px; }
@media (max-width: 860px) {
  .story-view { grid-template-columns: 1fr; grid-template-rows: auto minmax(0,1fr); }
  .story-screen { padding: 8px; aspect-ratio: 16 / 9; }
  .story-panel { border-left: 0; border-top: 1px solid rgba(255,255,255,.08); padding: 16px 18px;
    justify-content: flex-start; }
  .story-panel h3 { font-size: 1rem; }
  .story-panel .b { font-size: .9rem; }
  .story-bar { gap: 8px 10px; padding: 8px 10px; }
  .story-ticks { order: -1; flex-basis: 100%; }
}
.story-fallback { padding: 0 0 40px; }
.story-fallback img { border-radius: 10px; border: 1px solid rgba(255,255,255,.12); }
.story-after { padding: 26px 0 48px; border-top: 1px solid rgba(255,255,255,.08); }
.story-after details { margin: 0 0 12px; background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: 12px 16px; }
.story-after summary { cursor: pointer; font-weight: 600; color: #E8EEF6; }
.story-after ol { margin: 14px 0 4px; color: #C7D1DE; font-size: .92rem; max-width: 80ch; }
.story-after ol li { margin-bottom: .7em; }
.story-after ol b { color: #fff; }
.story-after .dl { display: flex; gap: 10px 20px; flex-wrap: wrap; font-size: .9rem; }
.story-after a { color: #FF9A73; }
.story-after .check { color: #9FB0C4; font-size: .84rem; margin: 14px 0 0; max-width: 90ch; }

/* -------------------------------------------------------------- videos */
figure.media { margin: 24px 0; }
figure.media video { width: 100%; height: auto; display: block; border-radius: 10px;
  background: #0B1320; border: 1px solid var(--line); }
figure.media figcaption { font-size: .86rem; color: var(--muted); margin-top: 10px; max-width: 80ch; }

/* --------------------------------------------------------------- books */
.book { display: grid; grid-template-columns: 110px 1fr; gap: 20px; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; background: var(--card); }
.book .spine { border-radius: 6px; min-height: 150px; display: flex; align-items: flex-end;
  padding: 12px; color: #fff; font-family: var(--mono); font-size: .66rem; letter-spacing: .08em;
  text-transform: uppercase; line-height: 1.35; font-weight: 600; }
.book .spine.v1 { background: linear-gradient(160deg, #263D93, #141C36); }
.book .spine.v2 { background: linear-gradient(160deg, #6B4FA8, #2B1D4B); }
.book .spine.v3 { background: linear-gradient(160deg, #0F7A86, #0B2F38); }
.book .spine.iq { background: linear-gradient(160deg, #E55525, #6E2208); }
.book .spine.hx { background: linear-gradient(160deg, #5E6875, #232B36); }
.book h3 { margin: 0 0 .3em; }
.book .facts { font-family: var(--mono); font-size: .74rem; color: var(--muted); margin: 0 0 .7em; }
.book p { font-size: .94rem; }
@media (max-width: 560px) { .book { grid-template-columns: 1fr; } .book .spine { min-height: 64px; } }
.chlist { columns: 2 300px; column-gap: 34px; font-size: .88rem; padding-left: 1.6em; max-width: none; }
.chlist li { break-inside: avoid; margin-bottom: .3em; }
details.toc { margin: 10px 0 0; }
details.toc summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--link); }

/* ------------------------------------------------------------ field maps */
.fmap { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: #FAFBFD; text-decoration: none; color: inherit; }
.fmap img { display: block; width: 100%; height: auto; }
.fmap .cap { padding: 12px 16px; font-size: .9rem; border-top: 1px solid var(--line);
  background: var(--card); }
a.fmap:hover { border-color: var(--orange); box-shadow: var(--shadow); }

/* ------------------------------------------------------------ misc bits */
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; max-width: none; }
.pill-list li { margin: 0; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
  font-size: .84rem; background: var(--card); }
.netlist { columns: 3 220px; column-gap: 28px; font-size: .88rem; padding-left: 0; list-style: none;
  max-width: none; }
.netlist li { break-inside: avoid; margin-bottom: .25em; }
.status { display: inline-block; font-family: var(--mono); font-size: .66rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--line); white-space: nowrap; }
.status.ok { background: var(--q1-bg); border-color: var(--q1-bd); color: var(--q1-fg); }
.status.wait { background: var(--q3-bg); border-color: var(--q3-bd); color: var(--q3-fg); }
.status.arch { background: var(--q4-bg); border-color: var(--q4-bd); color: var(--q4-fg); }
.steps4 { counter-reset: s; display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps4 > div { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  background: var(--card); position: relative; }
.steps4 > div::before { counter-increment: s; content: counter(s); font-family: var(--mono);
  font-weight: 700; color: #fff; background: var(--orange); width: 26px; height: 26px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; margin-bottom: 10px; }
.steps4 h3 { margin: 0 0 .35em; font-size: 1rem; }
.steps4 p { font-size: .9rem; color: var(--muted); margin: 0; }
.sister { background: linear-gradient(120deg, #FFF4EA, #EEF3FB); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px; display: grid; grid-template-columns: 1fr auto; gap: 18px;
  align-items: center; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sister {
  background: linear-gradient(120deg, #241A11, #121D29); } }
:root[data-theme="dark"] .sister { background: linear-gradient(120deg, #241A11, #121D29); }
@media (max-width: 700px) { .sister { grid-template-columns: 1fr; } }
.sister h2 { margin: 0 0 .3em; }
.sister p { margin: 0; color: var(--muted); }
.numgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.equation { font-family: var(--mono); font-size: .92rem; background: var(--band);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; display: inline-block; }

/* the CEQT rule `.brand span` (tagline) must not style the logo plate */
.brand .plate { width: auto; border-left: 0; font-size: inherit; line-height: 1; }
@media (max-width: 1180px) { .brand .plate { display: flex; } }

/* ---------------------------------------------------------- languages */
.nav .langsw { display: inline-flex; gap: 2px; margin-left: 8px; padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,.15); }
.nav .langsw a { font-size: .78rem; padding: 6px 7px; color: #AEB8C5; }
.nav .langsw a[aria-current="true"] { color: #fff; background: rgba(255,255,255,.10); box-shadow: none; }
@media (max-width: 900px) { .nav .langsw { border-left: 0; margin-left: 0; padding: 6px 0 0 2px; } }
:lang(zh) { font-family: "Prompt", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif; }
:lang(zh) h1, :lang(zh) h2, :lang(zh) h3 { letter-spacing: .01em; }
:lang(zh) body, :lang(zh) p, :lang(zh) li { line-height: 1.8; }
:lang(th) p, :lang(th) li { line-height: 1.75; }
.story-lang .sbtn { min-width: 3.1em; }

/* ------------------------------------------------- the CEQT half (box) */
.ceqtbox { margin: 34px 0 6px; padding: 20px 22px 18px; border: 1px solid var(--line);
  border-left: 4px solid var(--navy); border-radius: 0 12px 12px 0; background: var(--card);
  max-width: 980px; }
.ceqtbox .kicker { margin: 0 0 4px; color: var(--navy); }
:root[data-theme="dark"] .ceqtbox .kicker { color: var(--cyan); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ceqtbox .kicker { color: var(--cyan); } }
.ceqtbox h3 { margin: 0 0 6px; }
.ceqtbox p { margin: 0 0 10px; }
.ceqtbox ul { margin: 0 0 8px; padding-left: 1.1em; columns: 2 280px; column-gap: 28px; }
.ceqtbox li { break-inside: avoid; margin: 0 0 4px; font-size: .94rem; }
.ceqtbox .more { margin: 6px 0 0; font-size: .9rem; }
.band .ceqtbox { background: var(--paper); }

/* ------------------------------------------------------- YouTube band */
.ytband { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center;
  background: var(--ink); color: #E8EDF3; border-radius: 14px; padding: 24px 26px; }
.ytband h2 { color: #fff; margin: 0 0 .25em; }
.ytband p { margin: 0; color: #B9C3CF; }
.ytband .kicker { color: var(--cyan); margin: 0 0 4px; }
.ytmark { width: 64px; height: 46px; border-radius: 12px; background: #E62117; position: relative; }
.ytmark span { position: absolute; left: 26px; top: 14px; border-left: 16px solid #fff;
  border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
@media (max-width: 700px) { .ytband { grid-template-columns: 1fr; } }
.ftr a.yt::before { content: "\25B6"; color: #E62117; margin-right: 6px; font-size: .8em; }

/* --------------------------------------------------- synergy page bits */
.seam { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; }
.seam > div { padding: 22px 24px; }
.seam > div + div { border-left: 3px dashed var(--orange); }
.seam h3 { margin-top: 0; }
.seam .who { font-family: var(--mono); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 6px; }
.seam ul { margin: 0; padding-left: 1.1em; }
@media (max-width: 760px) { .seam { grid-template-columns: 1fr; }
  .seam > div + div { border-left: 0; border-top: 3px dashed var(--orange); } }
.rules { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.rules > div { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: var(--card); }
.rules b { display: block; color: var(--ink-2); margin-bottom: 4px; }
:root[data-theme="dark"] .rules b { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rules b { color: #fff; } }
.rules p { margin: 0; font-size: .93rem; color: var(--muted); }
.linkwall { display: grid; gap: 14px 24px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid.two { grid-template-columns: 1fr; } }
.linkwall h3 { font-size: .95rem; margin: 0 0 6px; }
.linkwall ul { list-style: none; margin: 0; padding: 0; }
.linkwall li { margin: 0 0 4px; font-size: .92rem; }
table.data td.k { white-space: nowrap; font-weight: 600; }

.brand em.nw { font-style: normal; white-space: nowrap; }

/* ------------------------------------------- pages from the old site */
.brand .tagl { display: none; }
.oc { max-width: 980px; }
.oc > p, .oc .oc-app > p { max-width: 92ch; }
.oc-note { font-size: .86rem; color: var(--muted); border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 0 0 22px; max-width: 90ch; }
.oc h2.oc-cat { margin: 40px 0 14px; padding-top: 18px; border-top: 2px solid var(--orange); color: var(--orange-dk); font-size: 1.3rem; }
:root[data-theme="dark"] .oc h2.oc-cat { color: var(--orange); }
.oc h4 { margin: 26px 0 8px; font-size: .86rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.oc-app { border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px 8px; margin: 0 0 20px; background: var(--card); }
.oc-app h3 { margin: 0 0 10px; color: var(--navy); }
:root[data-theme="dark"] .oc-app h3 { color: var(--cyan); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .oc-app h3 { color: var(--cyan); } }
.oc p.oc-f { margin: .45em 0; font-size: .95rem; }
.oc p.oc-f b { color: var(--ink-2); }
:root[data-theme="dark"] .oc p.oc-f b { color: #fff; }
.oc-fig { margin: 14px 0 18px; }
.oc-fig img { display: block; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: var(--band); }
.oc-fig figcaption { font-size: .82rem; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.oc-fig.noimg img { display: none; }
.oc-fig.noimg::before { content: attr(data-missing); display: block; font-size: .8rem; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 8px; padding: 14px; background: var(--band); }
.oc-cards .card h3 { font-size: 1.02rem; }
.oc-pn { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 30px;
  padding-top: 16px; border-top: 1px solid var(--line); font-size: .92rem; }
.oc.visit .oc-fig img { max-width: min(960px, 100%); }
.doctext { max-width: 100ch; font-size: .93rem; }
.doctext p { margin: .35em 0; }
.doctext h2 { margin-top: 34px; padding-top: 14px; border-top: 2px solid var(--orange); }
details.toc ol { columns: 2 320px; }

/* ==========================================================================
   Layout and typesetting pass (Nov 2026)
   ========================================================================== */

/* one row of navigation down to 901 px: tighter items between 901 and 1180 */
@media (min-width: 901px) and (max-width: 1180px) {
  .hdr-in { gap: 12px; padding: 0 18px; }
  .nav a { font-size: .8rem; padding: 8px 6px; }
  .nav .langsw { margin-left: 4px; padding-left: 6px; }
  .nav .langsw a { padding: 6px 5px; }
}

/* a jump to #section lands below the sticky header, not under it */
[id] { scroll-margin-top: calc(var(--hdr) + 18px); }
.story[id] { scroll-margin-top: var(--hdr); }

/* words and phrases that must not be split across lines */
span.nw { white-space: nowrap; }

/* hero headline: a measure per script (ch is a Latin unit) */
.hero-copy h1:lang(th) { max-width: 15em; line-height: 1.3; }
.hero-copy h1:lang(zh) { max-width: 13em; letter-spacing: .01em; line-height: 1.3; }
.hero .eyebrow { line-height: 1.6; }

/* blocks that should run the full width of their column */
ul.timeline.home-latest { max-width: none; }
.ceqtbox { max-width: none; }
.ceqt-sec .sec { padding-top: 0; }
.ceqt-sec .ceqtbox { margin-top: 0; }
section.band + .ceqt-sec .sec { padding-top: 46px; }
.ftr { margin-top: 0; }
.tablewrap + p { margin-top: 14px; }

/* KPI row: tiles share the last row instead of leaving empty cells */
.vstats { display: flex; flex-wrap: wrap; }
.vstat { flex: 1 1 158px; }
@media (max-width: 420px) { .vstat { flex-basis: 140px; } }

/* ---- reading pages: text column + a menu or contents list beside it */
.docgrid { display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 56px; align-items: start; }
.doc-main { min-width: 0; }
.docgrid .narrow, .docgrid .oc { max-width: 820px; }
.sidenav, .toc-side { position: sticky; top: calc(var(--hdr) + 24px); align-self: start;
  max-height: calc(100vh - var(--hdr) - 48px); overflow-y: auto; font-size: .86rem; line-height: 1.4;
  border-left: 1px solid var(--line); padding: 2px 0 6px 18px; }
.sn-h { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 600; color: var(--muted); margin: 0 0 10px; max-width: none; }
.sidenav ol, .toc-side ol { list-style: none; padding: 0; margin: 0; max-width: none; }
.sidenav li, .toc-side li { margin: 0; }
.sidenav a, .toc-side a { display: block; position: relative; padding: 5px 0; color: var(--muted);
  text-decoration: none; }
.sidenav a:hover, .toc-side a:hover { color: var(--link); }
.sidenav a[aria-current], .toc-side a.on { color: var(--head-fg); font-weight: 600; }
.sidenav a[aria-current]::before, .toc-side a.on::before { content: ""; position: absolute; left: -20px;
  top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--orange); }
.docgrid details.toc { display: none; }
@media (max-width: 1100px) {
  .docgrid { display: block; }
  .sidenav, .toc-side { display: none; }
  .docgrid details.toc { display: block; }
}

/* ---- pages from the old site: labels and values on two aligned columns */
.oc-fields { margin: 16px 0 6px; border-top: 1px solid var(--line); }
.oc-fields > div { display: grid; grid-template-columns: 11.5em minmax(0, 1fr); gap: 4px 20px;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.oc-fields dt { font-weight: 600; font-size: .84rem; color: var(--ink-2); line-height: 1.45; padding-top: 2px; }
:root[data-theme="dark"] .oc-fields dt { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .oc-fields dt { color: #fff; } }
.oc-fields dd { margin: 0; font-size: .95rem; line-height: 1.6; }
.oc-fields dd.nil { color: var(--muted); }
.oc > .oc-fields { margin-bottom: 26px; }
@media (max-width: 640px) {
  .oc-fields > div { grid-template-columns: 1fr; gap: 2px; }
}
.oc-list { padding-left: 1.2em; margin: 0 0 18px; }
.oc-list li { margin-bottom: .4em; }
.oc-app { padding: 22px 26px 12px; }
.oc-app > p:first-of-type { font-size: 1rem; }
.oc-fig { margin: 18px 0 22px; }
.oc-fig figcaption { line-height: 1.5; max-width: 90ch; }
.oc-fig figcaption b { color: var(--body); }
.oc h4 { margin-top: 30px; }
.oc > h4:first-child { margin-top: 0; }
.oc-note { margin-bottom: 26px; }
.oc-pn { max-width: 820px; }
.oc-pn a { text-decoration: none; font-weight: 600; }
.oc-pn a:hover { text-decoration: underline; }
@media (max-width: 640px) { .oc-app { padding: 16px 16px 8px; } }

/* curriculum documents: the text is long and Thai; give it air */
.doctext { line-height: 1.75; }
.doctext h2 { scroll-margin-top: calc(var(--hdr) + 18px); }
@media (min-width: 901px) and (max-width: 960px) {
  .hdr-in { gap: 8px; padding: 0 14px; }
  .nav a { font-size: .78rem; padding: 8px 4px; }
  .brand .plate { padding: 5px 8px; }
}
@media (min-width: 1101px) { details.doc-toc { display: none; } }

/* ==========================================================================
   Technology map (the old front-page orbit figure, redrawn)
   ========================================================================== */
.tmap { margin: 0; --tm-bg: #F5F6F8; --tm-lab: #3B4452; --tm-lab-on: #141C36; --tm-rim: #D3D8DF; }
:root[data-theme="dark"] .tmap { --tm-bg: #121A26; --tm-lab: #B9C3CF; --tm-lab-on: #FFFFFF; --tm-rim: #3A4759; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tmap {
  --tm-bg: #121A26; --tm-lab: #B9C3CF; --tm-lab-on: #FFFFFF; --tm-rim: #3A4759; } }
.tm-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.tm-tools .chip { display: inline-flex; align-items: center; gap: 7px; }
.tm-tools .sw { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.sw.g-light { background: #E9693C; } .sw.g-sci { background: #FCB400; } .sw.g-dev { background: #FA9B6E; }
.sw.g-app { background: #E9693C; box-shadow: inset 0 0 0 3px #FAA687; } .sw.g-flag { background: #fff; box-shadow: 0 0 0 2px var(--orange); }
.tm-scroll { border-radius: 16px; background: var(--tm-bg); border: 1px solid var(--line); overflow: hidden; }
.tm-stage { position: relative; }
.tm-svg { display: block; width: 100%; height: auto; font-family: var(--font); user-select: none; }
.tm-ring { fill: none; stroke-width: 9; stroke-linecap: butt; transition: opacity .35s ease; }
.c-orange { stroke: #E9693C; } .c-yellow { stroke: #FCB400; } .c-salmon { stroke: #FAA687; }
.c-grey { stroke: #BBBBBB; } .c-blue { stroke: #009BDC; } .c-amber { stroke: #FA822D; } .c-steel { stroke: #428BC4; }
.tm-core { fill: #2C323A; }
.tm-node { cursor: pointer; text-decoration: none; outline: none; }
.tm-node .tm-bg { fill: #fff; }
.tm-node .tm-rim { fill: none; stroke: var(--tm-rim); stroke-width: 3; }
.tm-node .tm-halo { fill: none; stroke: transparent; stroke-width: 3; }
.tm-node.flag .tm-rim { stroke: var(--orange); stroke-width: 3.5; }
.tm-node.flag .tm-halo { stroke: rgba(229,85,37,.35); }
.tm-lab { fill: var(--tm-lab); font-weight: 500; }
.tm-node.flag .tm-lab { fill: var(--tm-lab-on); font-weight: 700; }
.tm-node > * { transition: opacity .3s ease, transform .25s ease; }
.tm-node:hover .tm-rim, .tm-node:focus-visible .tm-rim, .tm-node.on .tm-rim { stroke: var(--orange); stroke-width: 4; }
.tm-node:hover .tm-lab, .tm-node:focus-visible .tm-lab, .tm-node.on .tm-lab { fill: var(--orange-dk); }
:root[data-theme="dark"] .tm-node:hover .tm-lab, :root[data-theme="dark"] .tm-node.on .tm-lab { fill: #FF9A73; }
.tm-node:focus-visible .tm-halo { stroke: var(--orange); stroke-dasharray: 4 3; }
.tmap.dim .tm-node:not(.hit) { opacity: .18; }
.tmap.dim .tm-ring:not(.hit) { opacity: .2; }
@media (prefers-reduced-motion: no-preference) {
  .tm-node.flag .tm-halo { animation: tmPulse 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  @keyframes tmPulse { 0%, 100% { opacity: .25; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.08); } }
}
.tm-parts circle { fill: url(#techmap-glow); }
.tm-card { position: absolute; z-index: 5; width: min(330px, 86%); background: var(--card); color: var(--body);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(20,28,54,.22);
  padding: 14px 16px 12px; font-size: .9rem; line-height: 1.5; pointer-events: auto; }
.tm-card .k { font-family: var(--mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 4px; }
.tm-card h3 { margin: 0 0 6px; font-size: 1.02rem; }
.tm-card p { margin: 0 0 8px; max-width: none; }
.tm-card .flagb { display: inline-block; font-size: .64rem; font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--orange); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.tm-card .go { display: flex; flex-direction: column; gap: 4px; font-size: .86rem; }
.tm-card .go a { font-weight: 600; }
.tm-card .x { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 1.2rem; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 4px; }
.tmap figcaption { font-size: .84rem; color: var(--muted); margin: 12px 0 0; max-width: 90ch; }
.tm-list { margin-top: 12px; }
.tm-list summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--link); }
.tm-cols { columns: 2 380px; column-gap: 36px; font-size: .9rem; }
.tm-cols h3 { font-size: .95rem; margin: 16px 0 6px; break-after: avoid; }
.tm-cols ul { margin: 0 0 8px; padding-left: 1.1em; max-width: none; }
.tm-cols li { break-inside: avoid; }
@media (max-width: 760px) {
  .tm-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tm-stage { width: 760px; }
  .tm-card { width: 300px; }
}

/* ==========================================================================
   Cool atoms with light (the laser-cooling toy)
   ========================================================================== */
.cool-sec { background: linear-gradient(160deg, #0B1320, #142451); color: #E8EEF6; }
.cool { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 40px; align-items: center; }
.cool-copy h2 { color: #fff; margin-top: 0; }
.cool-copy p { color: #C3CCD7; }
.cool-copy .kicker { color: #7FD3F5; }
.cool-copy a { color: #FF9A73; }
.cool-ctl { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 12px; }
.cool-ctl .sbtn[aria-pressed="true"] { background: #E8EEF6; color: #0B1320; border-color: #E8EEF6; }
.cool-ctl .sbtn.primary[aria-pressed="true"] { background: var(--orange); color: #141C36; border-color: var(--orange); }
.cool-msg { min-height: 3.2em; font-weight: 600; color: #fff !important; }
.cool-note { font-size: .8rem; color: #8FA0B5 !important; }
.cool-stage { position: relative; }
.cool-cv { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: 14px;
  background: radial-gradient(ellipse at center, #10203F 0%, #070C18 75%); border: 1px solid rgba(255,255,255,.12);
  touch-action: none; cursor: crosshair; }
.cool-cv:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.cool-temp { position: absolute; left: 14px; right: 14px; bottom: 12px; display: grid; grid-template-columns: auto 1fr;
  gap: 2px 12px; align-items: center; font-size: .78rem; color: #9FB0C4; pointer-events: none; }
.cool-temp .ct-v { font-family: var(--mono); color: #fff; font-size: 1rem; text-align: right; grid-column: 2; grid-row: 1; }
.ct-bar { grid-column: 1 / -1; position: relative; height: 6px; border-radius: 3px; margin: 4px 0 14px;
  background: linear-gradient(90deg, #E5552599, #FCB40099 40%, #44C8F499 80%, #FFFFFF99); }
.ct-bar i { position: absolute; top: -4px; width: 4px; height: 14px; margin-left: -2px; background: #fff; border-radius: 2px;
  box-shadow: 0 0 8px #fff; left: 0; transition: left .2s linear; }
.ct-bar span { position: absolute; top: 9px; transform: translateX(-50%); font-family: var(--mono); font-size: .62rem; white-space: nowrap; }
.ct-bar span:first-of-type { transform: none; } .ct-bar span:last-of-type { transform: translateX(-100%); }
@media (max-width: 860px) { .cool { grid-template-columns: 1fr; gap: 18px; } }

/* ==========================================================================
   Photographs and the lightbox
   ========================================================================== */
.phgrid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.phgrid .ph { margin: 0; display: flex; flex-direction: column; }
.phgrid .ph.wide { grid-column: span 2; grid-row: span 2; }
.phgrid .ph a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--band);
  flex: 1; min-height: 0; }
.phgrid .ph img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; transition: transform .5s ease; }
.phgrid .ph.wide img { aspect-ratio: auto; }
.phgrid .ph a:hover img { transform: scale(1.03); }
.phgrid figcaption { font-size: .8rem; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.phgrid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 22px 0 6px; }
.phgrid.five img { aspect-ratio: 1; object-fit: contain; background: #fff; }
@media (max-width: 900px) { .phgrid, .phgrid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phgrid .ph.wide { grid-column: 1 / -1; grid-row: auto; } }
.lbox { position: fixed; inset: 0; z-index: 300; background: rgba(6,10,20,.92); display: flex; align-items: center;
  justify-content: center; padding: 4vh 4vw; flex-direction: column; gap: 12px; }
.lbox img { max-width: 100%; max-height: 82vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lbox p { color: #D3DCE7; max-width: 80ch; text-align: center; font-size: .9rem; margin: 0; }
.lbox button { position: absolute; top: 14px; right: 18px; font-size: 1.8rem; background: none; border: 0; color: #fff; cursor: pointer; }

/* ==========================================================================
   Book downloads
   ========================================================================== */
.dls { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.dl { display: inline-grid; grid-template-columns: auto 1fr; column-gap: 9px; align-items: center; text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px 7px 10px; background: var(--card); color: var(--body);
  line-height: 1.25; transition: border-color .15s ease, box-shadow .15s ease; }
.dl:hover { border-color: var(--orange); box-shadow: var(--shadow); color: var(--body); }
.dl.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.dl.primary:hover { background: var(--ink-2); color: #fff; }
.dl-ico { grid-row: span 2; width: 18px; height: 22px; border-radius: 3px; position: relative;
  background: var(--orange); }
.dl-ico::after { content: ""; position: absolute; left: 5px; top: 5px; border-left: 4px solid transparent;
  border-right: 4px solid transparent; border-top: 6px solid #fff; }
.dl-ico::before { content: ""; position: absolute; left: 8px; top: 3px; width: 2px; height: 5px; background: #fff; }
.dl-t { font-weight: 600; font-size: .86rem; }
.dl-m { font-family: var(--mono); font-size: .66rem; color: var(--muted); }
.dl.primary .dl-m { color: #AEB8C5; }
.dl-note { font-size: .86rem; color: var(--muted); font-style: italic; margin: 10px 0 0; }
.chlist li { display: flex; gap: 10px; justify-content: space-between; }
.chlist .pg { font-family: var(--mono); font-size: .72rem; color: var(--muted); white-space: nowrap; }
.chlist li:target, .chlist li.hl { background: var(--orange-tint); border-radius: 4px; }
.dlall { margin-top: 40px; }
.dlall .tablewrap { margin-top: 14px; }

/* ==========================================================================
   Site search
   ========================================================================== */
.srch-btn { order: 3; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 8px; border: 1px solid rgba(255,255,255,.18); background: transparent; color: #D8DEE6; cursor: pointer;
  margin-left: 6px; flex: none; }
.srch-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
@media (max-width: 900px) { .srch-btn { order: 1; margin-left: auto; } .navtoggle { order: 2; margin-left: 8px; }
  .nav { order: 3; } }
.srch { position: fixed; inset: 0; z-index: 310; background: rgba(9,14,28,.55); display: flex; justify-content: center;
  align-items: flex-start; padding: 9vh 16px 16px; backdrop-filter: blur(3px); }
.srch-box { width: min(680px, 100%); background: var(--paper); border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.35);
  overflow: hidden; border: 1px solid var(--line); display: flex; flex-direction: column; max-height: 78vh; }
.srch-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.srch-in input { flex: 1; font: inherit; font-size: 1.05rem; border: 0; outline: none; background: transparent; color: var(--body); }
.srch-in kbd { font-size: .7rem; }
.srch-res { overflow-y: auto; margin: 0; padding: 6px; list-style: none; max-width: none; }
.srch-res li { margin: 0; }
.srch-res a { display: block; padding: 9px 12px; border-radius: 9px; text-decoration: none; color: var(--body); }
.srch-res a b { display: block; color: var(--head-fg); font-weight: 600; }
.srch-res a span { display: block; font-size: .84rem; color: var(--muted); line-height: 1.45; }
.srch-res a em { font-style: normal; background: var(--orange-tint); color: var(--orange-dk); border-radius: 3px; padding: 0 2px; }
:root[data-theme="dark"] .srch-res a em { color: #FFB394; }
.srch-res a.on, .srch-res a:hover { background: var(--band); }
.srch-foot { padding: 8px 16px; border-top: 1px solid var(--line); font-size: .74rem; color: var(--muted); }
.tm-swipe { display: none; font-size: .8rem; color: var(--muted); margin: 8px 0 0; }
@media (max-width: 760px) { .tm-swipe { display: block; } }
.dl.req { border-style: dashed; }
.dl.req .dl-ico { background: var(--muted); }
.dl.req .dl-ico::after { border-top-color: transparent; border-left: 0; border-right: 0; left: 4px; top: 6px; width: 10px; height: 7px;
  border: 1.5px solid #fff; border-radius: 1px; }
.dl.req .dl-ico::before { display: none; }
.dlall .cc { font-size: .86rem; color: var(--muted); }
.chlist li > span:first-child { flex: 1; }

/* ---- home hero: the moving network of atoms behind the title */
.hero.net { background: #050B1C; }
.hero.net::after { display: none; }
.hero-net, .hero-bgv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.hero-bgv { object-fit: cover; }
.hero-shade { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(4,8,23,.62) 0%, rgba(4,8,23,.3) 50%, rgba(4,8,23,.05) 100%); }
@media (max-width: 900px) { .hero-shade { background: rgba(4,8,23,.42); } }

/* ---- collaborations: world map, Thailand and network */
.cmap { margin-top: 22px; border-radius: 16px; overflow: hidden; background: #071026;
  border: 1px solid #1B2A52; color: #DCE6F2; box-shadow: 0 18px 50px -24px rgba(4,10,30,.6); }
.cm-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 14px 16px;
  border-bottom: 1px solid #16234A; background: linear-gradient(180deg, #0B1636, #08122C); }
.cm-tabs { display: inline-flex; background: #050C20; border: 1px solid #1F3060; border-radius: 10px; padding: 3px; }
.cm-tab { font: inherit; font-size: .86rem; color: #A9B8CF; background: none; border: 0; padding: 6px 14px;
  border-radius: 7px; cursor: pointer; }
.cm-tab[aria-selected="true"] { background: #F26B3A; color: #fff; }
.cm-tab:focus-visible, .cm-chip:focus-visible { outline: 2px solid #3CC8F4; outline-offset: 2px; }
.cm-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; order: 3; }
.cm-chip { font: inherit; font-size: .76rem; color: #C9D5E6; background: #0A1533; border: 1px solid #22346A;
  border-radius: 999px; padding: 4px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.cm-chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cm-chip[aria-pressed="true"] { border-color: #F26B3A; background: #1A1F3F; color: #fff; }
.cm-q { font: inherit; font-size: .84rem; flex: 0 1 300px; margin-left: auto; min-width: 180px; color: #fff; background: #050C20;
  border: 1px solid #22346A; border-radius: 9px; padding: 7px 11px; }
.cm-q::placeholder { color: #7486A3; }
.cm-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 560px; }
.cm-stage { position: relative; min-width: 0; display: flex; align-items: center; justify-content: center; background:
  radial-gradient(ellipse at 60% 40%, rgba(40,80,170,.22), transparent 60%), #060E24; }
.cm-svg { display: block; width: 100%; height: auto; max-height: 720px; touch-action: none; }
.cmap[data-view="thailand"] .cm-svg { width: auto; height: 700px; max-width: 100%; }
.cmap[data-view="network"] .cm-svg { touch-action: none; }
.cm-grat { fill: none; stroke: rgba(120,160,230,.09); stroke-width: .6; vector-effect: non-scaling-stroke; }
.cm-land { fill: #12204A; stroke: #22366F; stroke-width: .6; vector-effect: non-scaling-stroke; }
.cm-hi { fill: #1C3474; stroke: #3A5CB0; stroke-width: .7; vector-effect: non-scaling-stroke; }
.cm-hi.cm-th { fill: #2A2F5E; stroke: #F26B3A; }
.cm-arc { fill: none; stroke-opacity: .55; stroke-linecap: round; transition: stroke-opacity .2s; }
.cm-arc-p { stroke-dasharray: 2 3; stroke-opacity: .45; }
.cm-arc.dim, .cm-edge.dim { stroke-opacity: .06; }
.cm-arc.sel, .cm-edge.sel { stroke-opacity: 1; }
.cm-edge { stroke-opacity: .35; stroke-width: 1.1; }
.cm-pulse { pointer-events: none; }
.cm-n { cursor: pointer; transition: opacity .2s; outline: none; }
.cm-n.dim { opacity: .14; }
.cm-n:hover > circle:last-child, .cm-n:focus-visible > circle:last-child, .cm-n.sel > circle:last-child { stroke: #fff; }
.cm-n.sel > circle:first-child { stroke: #fff; }
.cm-hub .cm-ring { fill: none; stroke: #F26B3A; stroke-width: 1; transform-origin: 0 0; animation: cmRing 2.6s ease-out infinite; }
.cm-hub .cm-ring2 { animation-delay: 1.3s; }
@keyframes cmRing { from { transform: scale(.6); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }
.cm-lab { fill: #C9D6EA; font-size: 9px; font-family: var(--sans, sans-serif); pointer-events: none;
  paint-order: stroke; stroke: #060E24; stroke-width: 2.5px; }
.cm-cc { font-size: 7.5px; fill: #8FA4C6; letter-spacing: .04em; }
.cm-hubl { font-size: 8.5px; fill: #FFD2BF; font-weight: 600; }
.cm-city { font-size: 13px; fill: #9FB3D3; font-weight: 600; letter-spacing: .02em; }
.cm-leadl { font-size: 11px; fill: #fff; font-weight: 600; }
.cm-corel { font-size: 9px; fill: #fff; font-weight: 700; pointer-events: none; }
.cm-tip { position: absolute; z-index: 3; max-width: 250px; background: rgba(8,15,38,.96); border: 1px solid #2A3E7A;
  border-radius: 10px; padding: 8px 11px; font-size: .8rem; line-height: 1.4; pointer-events: none;
  box-shadow: 0 10px 28px rgba(0,0,0,.4); }
.cm-tip b { display: block; color: #fff; } .cm-tip span { display: block; color: #AEBCD3; }
.cm-tip .cm-tc { color: #F59A74; font-size: .74rem; margin-top: 2px; }
.cm-hint { position: absolute; left: 14px; bottom: 10px; margin: 0; font-size: .74rem; color: #7487A8; pointer-events: none; }
.cm-panel { border-left: 1px solid #16234A; padding: 18px 18px 20px; background: #08122C; overflow-y: auto; max-height: 720px; font-size: .88rem; position: relative; }
.cm-panel h3 { color: #fff; font-size: 1.08rem; margin: 2px 0 6px; line-height: 1.3; }
.cm-panel p { margin: 0 0 10px; color: #C3CFE1; line-height: 1.5; }
.cm-k { font-family: var(--mono, monospace); font-size: .68rem !important; letter-spacing: .12em; text-transform: uppercase;
  color: #F59A74 !important; margin: 14px 0 6px !important; }
.cm-x { position: absolute; right: 12px; top: 10px; font-size: 1.3rem; line-height: 1; background: none; border: 0; color: #9FB0CB; cursor: pointer; }
.cm-av { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem;
  color: #fff; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); box-shadow: 0 0 0 4px rgba(255,255,255,.06), 0 0 24px -4px var(--c); }
.cm-ll, .cm-bars { list-style: none; margin: 0; padding: 0; }
.cm-ll button, .cm-bars button { font: inherit; width: 100%; text-align: left; background: none; border: 0; color: #DCE6F2; cursor: pointer;
  padding: 5px 4px; border-radius: 7px; display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.cm-ll button:hover, .cm-bars button:hover { background: #0F1D44; }
.cm-ll i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.cm-ll small { color: #8193B2; margin-left: auto; font-size: .72rem; }
.cm-many { columns: 1; }
.cm-bars button { display: grid; grid-template-columns: 1fr auto; position: relative; padding: 6px 6px 9px; }
.cm-bars b { color: #fff; font-family: var(--mono, monospace); font-size: .8rem; }
.cm-bars i { position: absolute; left: 6px; bottom: 3px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, #F26B3A, #3CC8F4); max-width: calc(100% - 12px); }
.cmap.cm-none .cm-hint::after { content: " · ∅"; }
.cleads { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.cleads li { border: 1px solid var(--line, #E3E8EF); border-top: 3px solid var(--lc); border-radius: 10px; padding: 12px 14px; display: grid; gap: 3px; }
.cleads b { font-size: .92rem; } .cleads span { font-size: .84rem; color: var(--muted, #5B6B80); } .cleads i { font-style: normal; font-family: var(--mono, monospace); font-size: .72rem; color: var(--muted, #5B6B80); }
details.cdir { border-bottom: 1px solid var(--line, #E3E8EF); padding: 8px 0; }
details.cdir summary { cursor: pointer; font-weight: 600; }
.cd-n { font-family: var(--mono, monospace); font-size: .78rem; color: var(--muted, #5B6B80); margin-left: 6px; }
details.cdir ul { margin: 8px 0 6px; padding-left: 18px; columns: 2 380px; column-gap: 32px; }
details.cdir li { break-inside: avoid; margin: 0 0 8px; font-size: .9rem; line-height: 1.45; }
.cd-x { color: var(--muted, #5B6B80); font-size: .84rem; } .cd-l { color: var(--muted, #5B6B80); font-size: .8rem; }
@media (max-width: 900px) {
  .cm-body { grid-template-columns: 1fr; }
  .cm-panel { border-left: 0; border-top: 1px solid #16234A; max-height: none; }
  .cmap[data-view="thailand"] .cm-svg { height: 560px; }
  .cm-chips { flex-basis: 100%; }
  .cm-hint { display: none; }
}

/* ---- interactive labs (shared) */
.lab { margin: 0; border-radius: 16px; overflow: hidden; background: #060D22; color: #DCE6F2;
  border: 1px solid #1B2A52; box-shadow: 0 24px 60px -30px rgba(4,10,30,.7); font-size: .9rem; }
.lab:not(.lab-on) { min-height: 420px; display: grid; place-items: center; color: #8DA0C0; }
.lab-top { display: flex; align-items: center; gap: 14px; padding: 11px 16px; border-bottom: 1px solid #16234A;
  background: linear-gradient(180deg, #0B1636, #08122C); }
.lab-live { font-family: var(--mono, monospace); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #6FE3B2;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.lab-live i { width: 8px; height: 8px; border-radius: 50%; background: #34D399; box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: labPulse 1.8s infinite; }
@keyframes labPulse { 70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
.lab-title { font-weight: 600; color: #fff; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.lab-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.lab-stage { position: relative; min-width: 0; background: radial-gradient(ellipse at 50% 45%, #0E1C46 0%, #050B1D 70%); }
.lab-ctrl { border-left: 1px solid #16234A; background: #08122C; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.lab-grp { display: flex; flex-direction: column; gap: 10px; }
.lab-gt { margin: 2px 0 -2px; font-family: var(--mono, monospace); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: #F59A74; }
.lab-sl-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .82rem; }
.lab-sl-top label { color: #C3CFE1; }
.lab-sl-top output { font-family: var(--mono, monospace); color: #fff; font-size: .78rem; white-space: nowrap; }
.lab-sl input[type=range] { width: 100%; margin: 5px 0 0; accent-color: #F26B3A; height: 18px; }
.lab-btn, .lab-tg, .lab-seg button, .lab-sel select { font: inherit; font-size: .8rem; color: #DCE6F2; background: #0C1838; border: 1px solid #263A72;
  border-radius: 9px; padding: 6px 11px; cursor: pointer; }
.lab-btn:hover, .lab-tg:hover, .lab-seg button:hover { border-color: #3CC8F4; }
.lab-btn.pri { background: #F26B3A; border-color: #F26B3A; color: #fff; font-weight: 600; }
.lab-btn.pri:hover { background: #E4572A; }
.lab-btn:focus-visible, .lab-tg:focus-visible, .lab-seg button:focus-visible, .lab-sl input:focus-visible { outline: 2px solid #3CC8F4; outline-offset: 2px; }
.lab-tg { display: inline-flex; align-items: center; gap: 8px; }
.lab-tg i { width: 26px; height: 14px; border-radius: 8px; background: #23345F; position: relative; flex: none; transition: background .2s; }
.lab-tg i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: #8DA0C0; transition: transform .2s, background .2s; }
.lab-tg[aria-pressed="true"] i { background: #F26B3A; }
.lab-tg[aria-pressed="true"] i::after { transform: translateX(12px); background: #fff; }
.lab-row { display: flex; flex-wrap: wrap; gap: 8px; }
.lab-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.lab-seg button[aria-pressed="true"] { background: #F26B3A; border-color: #F26B3A; color: #fff; }
.lab-sel { display: grid; gap: 5px; font-size: .82rem; color: #C3CFE1; }
.lab-sel select { width: 100%; }
.lab-ro { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.lab-ro div { background: #0A1533; border: 1px solid #1C2B58; border-radius: 10px; padding: 7px 10px; min-width: 0; }
.lab-ro dt { font-size: .7rem; color: #8DA0C0; line-height: 1.3; }
.lab-ro dd { margin: 2px 0 0; font-family: var(--mono, monospace); font-size: .92rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-ro dd small { color: #8DA0C0; font-size: .72rem; }
.lab-ro .ok { color: #6FE3B2; } .lab-ro .bad { color: #FF8A80; } .lab-ro .warn { color: #F5B83D; }
.lab-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); border-top: 1px solid #16234A; }
.lab-panel { padding: 12px 14px 12px; border-right: 1px solid #16234A; min-width: 0; background: #070F27; }
.lab-panel:last-child { border-right: 0; }
.lab-ph { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.lab-ph b { font-size: .82rem; color: #fff; font-weight: 600; } .lab-ph span { font-size: .72rem; color: #8DA0C0; text-align: right; }
.lab-cv { position: relative; width: 100%; }
.lab-cv canvas { display: block; }
.lab-stage .lab-cv { height: 100%; }
.lab-note { font-size: .74rem; color: #8DA0C0; line-height: 1.45; margin: 0; }
.lab-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .74rem; color: #AEBCD3; margin-top: 4px; }
.lab-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.lab-ovl { position: absolute; pointer-events: none; font-family: var(--mono, monospace); font-size: .72rem; color: #AEBCD3; }
@media (max-width: 960px) {
  .lab-grid { grid-template-columns: 1fr; }
  .lab-ctrl { border-left: 0; border-top: 1px solid #16234A; }
  .lab-panel { border-right: 0; border-bottom: 1px solid #16234A; }
  .lab-title { display: none; }
}
.labwide { max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.lab-page .pagehead { padding-bottom: 26px; }
.labsec { padding: 26px 0 10px; background: linear-gradient(180deg, var(--ink, #141C36) 0, var(--ink, #141C36) 140px, transparent 140px); }
.labcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 20px; }
.labcard { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid var(--line, #E3E8EF);
  color: inherit; text-decoration: none; transition: transform .2s, box-shadow .2s; }
.labcard:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgba(20,28,54,.45); }
.lc-img { aspect-ratio: 16 / 10; background: #060D22; overflow: hidden; }
.lc-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.labcard:hover .lc-img img { transform: scale(1.03); }
.lc-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.lc-body b { font-size: 1.12rem; line-height: 1.3; color: var(--ink, #141C36); }
.lc-t { color: var(--muted, #5B6B80); font-size: .92rem; flex: 1; }
.labtext { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; }
.labsee { padding-left: 1.1em; } .labsee li { margin: 0 0 .7em; }
.labnums { width: 100%; border-collapse: collapse; font-size: .9rem; }
.labnums th, .labnums td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line, #E3E8EF); vertical-align: top; }
.labnums th { font-weight: 500; color: var(--muted, #5B6B80); width: 55%; }
.labnums td { font-family: var(--mono, monospace); font-size: .82rem; }
@media (max-width: 900px) { .labtext { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) {
  .labcard { background: #0E1530; border-color: #22305A; } .lc-body b { color: #fff; }
}
/* the header carries 12 sections: keep it on one row down to the phone menu */
@media (min-width: 1181px) { .nav a { font-size: .82rem; padding: 8px 5px; } .nav .langsw { margin-left: 6px; padding-left: 8px; } }
@media (min-width: 901px) and (max-width: 1180px) { .nav a { font-size: .76rem; padding: 8px 4.5px; } .nav .langsw a { padding: 6px 4px; } }
@media (min-width: 901px) and (max-width: 1050px) { .nav a { font-size: .72rem; padding: 8px 3px; } .nav .langsw { margin-left: 2px; padding-left: 4px; } }
@media (min-width: 901px) and (max-width: 985px) { .nav a { font-size: .675rem; padding: 8px 2.4px; } .nav .langsw a { padding: 6px 3px; } .hdr-in { gap: 12px; } }
/* drop-down lists under every main menu item */
.nav-dd { position: relative; display: inline-flex; }
.dd-row { display: inline-flex; align-items: center; }
/* no chevrons: with a list under every item the header has no room for them, and every item opens on hover */
.dd-tog { display: none; }
.nav-sub { display: none; position: absolute; top: calc(100% + 4px); left: -6px; z-index: 60; min-width: 220px; width: max-content; max-width: 340px; flex-direction: column;
  background: #141C36; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 6px; box-shadow: 0 18px 40px rgba(0,0,0,.35); }
.nav-sub.right { left: auto; right: -6px; }
.nav-sub::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.nav-dd:hover .nav-sub, .nav-dd:focus-within .nav-sub { display: flex; }
.nav-dd:hover .nav-sub.wide, .nav-dd:focus-within .nav-sub.wide { display: grid; grid-template-columns: repeat(2, minmax(220px, 290px)); column-gap: 4px; max-width: none; }
@media (min-width: 901px) and (max-width: 1100px) { .nav-dd:hover .nav-sub.wide, .nav-dd:focus-within .nav-sub.wide { grid-template-columns: repeat(2, minmax(200px, 245px)); } }
.nav .nav-sub a { padding: 8px 12px; border-radius: 8px; white-space: normal; line-height: 1.3; font-size: .84rem; box-shadow: none; max-width: 300px; }
.nav .nav-sub a:first-child { font-weight: 700; }
.nav .nav-sub a[aria-current="page"] { color: var(--orange); background: rgba(255,255,255,.06); }
@media (max-width: 900px) {
  .nav-dd { flex-direction: column; }
  .dd-row { display: flex; width: 100%; justify-content: space-between; }
  .dd-row > a { flex: 1; }
  .dd-tog { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 38px; height: 32px; margin-left: 6px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); border-radius: 8px; color: #fff; cursor: pointer; }
  .dd-tog::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg); transition: transform .2s ease; }
  .nav-dd.open .dd-tog::before { transform: translateY(2px) rotate(-135deg); }
  .nav-sub, .nav-dd:hover .nav-sub, .nav-dd:focus-within .nav-sub,
  .nav-dd:hover .nav-sub.wide, .nav-dd:focus-within .nav-sub.wide { display: none; }
  .nav-dd.open .nav-sub, .nav-dd.open .nav-sub.wide { display: flex; position: static; min-width: 0; border: 0; box-shadow: none; background: none; padding: 0 0 6px 14px; }
  .nav .nav-sub a { padding: 7px 8px; font-size: .84rem; color: #AEB8C5; max-width: none; }
  .nav .nav-sub a:first-child { font-weight: 600; }
}
.hero-bgv + .hero-shade { background: linear-gradient(90deg, rgba(4,8,23,.8) 0%, rgba(4,8,23,.5) 52%, rgba(4,8,23,.28) 100%); }
@media (max-width: 900px) { .hero-bgv + .hero-shade { background: rgba(4,8,23,.62); } }
.labband .labcards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.labband .lc-t { font-size: .86rem; }
.labband .lc-body b { font-size: 1rem; }
.lc-body .eyebrow { font-family: var(--mono, monospace); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--orange, #E8562A); line-height: 1.5; margin: 0; }
.lc-body .more { font-size: .88rem; font-weight: 600; color: var(--orange, #E8562A); margin-top: 6px; }
@media (min-width: 1100px) { .labband .labcards, .labcards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.labband .lc-body { padding: 14px 14px 16px; }
/* home hero: the gravimeter cut out of its black background, so the film shows around it */
.hero-media.cutout { border: 0; background: none; box-shadow: none; overflow: visible; border-radius: 0; }
.hero-media.cutout img { object-fit: contain; filter: drop-shadow(0 22px 34px rgba(0,0,0,.5)); }
.hero-media.cutout .tag { bottom: 6%; }

/* focus programme (programme.html) and the wavelength meter */
.status.qc { background: var(--q2-bg); border-color: var(--q2-bd); color: var(--q2-fg); }
.status.qs { background: var(--q4-bg); border-color: var(--q4-bd); color: var(--q4-fg); }
table.prog { min-width: 760px; }
table.prog td { vertical-align: top; }
table.prog td:nth-child(2) { min-width: 210px; }
table.prog .sub, p.sub { color: var(--muted); font-size: .86em; }
table.prog td.lk { font-size: .88em; line-height: 1.55; min-width: 190px; }
figure.media img { width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--line); }
/* lab pages: real footage beside the simulation */
.vidpair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
.vidpair figure.media { margin: 0; }
.vidpair video { background: #000; }
@media (max-width: 760px) { .vidpair { grid-template-columns: 1fr; } }
.lab-row label.lab-btn { cursor: pointer; display: inline-flex; align-items: center; }
.lab-ro div:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ==========================================================================
   Research explained (featured-research.html) and its home-page band
   ========================================================================== */
.rm-h { margin: 46px 0 16px; padding-top: 6px; scroll-margin-top: 90px; }
.rm-h:first-child { margin-top: 0; }
.rm-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (min-width: 1180px) { .rm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rm-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: var(--card); scroll-margin-top: 90px; }
.rm-card:target { box-shadow: 0 0 0 3px var(--orange); }
.rm-fig { margin: 0; background: #0B1530; position: relative; height: 0; padding-top: 56.25%; }
.rm-fig a { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.rm-fig img { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform .5s ease; }
.rm-fig a:hover img { transform: scale(1.03); }
.rm-fig figcaption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rm-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.rm-meta { margin: 0 0 8px; font-family: var(--mono); font-size: .7rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.rm-year { font-weight: 700; color: var(--orange); }
.rm-body h3 { font-size: 1.02rem; line-height: 1.35; margin: 0 0 8px; }
.rm-sum { font-size: .9rem; margin: 0 0 8px; color: var(--body); }
.rm-body details { margin: 0 0 10px; font-size: .88rem; }
.rm-body details summary { cursor: pointer; color: var(--navy, #1B2A5B); font-weight: 600; font-size: .84rem; }
.rm-body details p { margin: 8px 0 0; }
.rm-cite { font-size: .76rem; color: var(--muted); line-height: 1.45; margin: auto 0 10px; padding-top: 6px; }
.rm-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; font-size: .84rem; }
.rm-links a { font-weight: 600; }
.rm-yt span { color: #E8372C; }
.rm-n { font-family: var(--mono); font-size: .7rem; opacity: .7; margin-left: 2px; }
.rm-minis { display: grid; gap: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .rm-minis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .rm-minis { grid-template-columns: 1fr; } }
.rm-mini { display: flex; flex-direction: column; text-decoration: none; color: var(--body); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; background: var(--card); transition: transform .2s ease, box-shadow .2s ease; }
.rm-mini:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgba(20,28,54,.45); color: var(--body); }
.rm-mimg { position: relative; height: 0; padding-top: 56.25%; background: #0B1530; }
.rm-mimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.rm-mt { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.rm-mt b { font-size: .92rem; line-height: 1.35; }
.rm-mt .eyebrow { font-family: var(--mono); font-size: .68rem; color: var(--orange); letter-spacing: .03em; text-transform: none; margin: 0; }

/* ---- home, first screen: the RCQT logo, large and clear over the film, as on the first page
   of the original site; the film stays screen-high while the logo and then the title scroll over it */
.hero.net { overflow: hidden; overflow: clip; padding-top: 0; }
.hero-bgwrap { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero-bgwrap .hero-bgv, .hero-bgwrap .hero-net { position: sticky; inset: auto; top: 0; height: 100vh; height: 100svh; }
.hero-bgwrap .hero-shade { position: absolute; inset: 0; }
.hero-stage { position: relative; z-index: 1; min-height: max(440px, calc(100svh - 122px)); display: flex;
  flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 20px 104px; }
.hero-stage::before { content: ""; position: absolute; inset: 0 0 -90px; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(4,8,23,0) 0%, rgba(4,8,23,.32) 55%, rgba(4,8,23,.5) 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent); mask-image: linear-gradient(180deg, #000 72%, transparent); }
.hero-logo { position: relative; width: min(800px, 86vw); }
.hero-logo::before { content: ""; position: absolute; inset: -30% -10%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(225,238,255,.30), rgba(225,238,255,.12) 55%, rgba(225,238,255,0)); }
.hero-logo img { display: block; width: 100%; height: auto;
  filter: drop-shadow(0 0 1.5px rgba(255,255,255,.95)) drop-shadow(0 0 12px rgba(255,255,255,.6)) drop-shadow(0 0 34px rgba(150,205,255,.4));
  animation: rcqtLogoIn 1.4s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rcqtLogoIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.hero .hero-name { margin: 30px auto 0; max-width: none; color: #fff; font-size: clamp(1.1rem, .78rem + 1.1vw, 1.65rem);
  font-weight: 500; line-height: 1.35; letter-spacing: .01em; text-shadow: 0 2px 14px rgba(0,0,0,.7); }
.hero .hero-name .hn-sub { display: block; margin-top: 12px; color: var(--orange); font-family: var(--mono);
  font-size: clamp(.72rem, .62rem + .3vw, .92rem); letter-spacing: .22em; text-transform: uppercase; font-weight: 600; }
.hero .hero-name .hn-sub:lang(th), .hero .hero-name .hn-sub:lang(zh) { font-family: inherit; letter-spacing: .1em; font-size: clamp(.86rem, .74rem + .35vw, 1.05rem); }
.hero-down { position: absolute; left: 50%; bottom: 28px; width: 48px; height: 48px; margin-left: -24px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: rgba(4,8,23,.35); border: 1.5px solid rgba(255,255,255,.45);
  animation: rcqtDown 2.4s ease-in-out infinite; }
.hero-down:hover, .hero-down:focus-visible { color: var(--orange); border-color: var(--orange); }
@keyframes rcqtDown { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(7px); } }
.hero-stage + .hero-grid { padding-top: 34px; }
#intro { scroll-margin-top: 84px; }
@media (max-width: 900px) { .hero-stage::before { display: none; } .hero-stage { padding-bottom: 96px; } }
@media (prefers-reduced-motion: reduce) { .hero-logo img, .hero-down { animation: none; } }

/* ---- footer: RCQT and its university */
.ftr-marks { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; margin: 0 0 30px; }
.ftr-marks .ftr-plate { margin: 0; }
.ftr-cmu { display: inline-flex; align-items: center; gap: 12px; color: #AEB8C5; text-decoration: none; font-size: .84rem; line-height: 1.35; }
.ftr-cmu img { width: 60px; height: 60px; display: block; flex: none; }
.ftr-cmu b { display: block; color: #fff; font-weight: 600; font-size: 1rem; }
.ftr-cmu:hover b { color: var(--orange); }

/* ---- about: the lab RCQT grew from, the centre, the university */
.marks { display: grid; grid-template-columns: 1fr 1.55fr 1fr; gap: 14px; margin: 4px 0 26px; }
.mark { margin: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 18px 14px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.mark .mk-img { height: 112px; width: 100%; display: flex; align-items: center; justify-content: center; }
.mark img { max-height: 112px; max-width: 100%; width: auto; height: auto; display: block; }
.mark.wide img { max-height: 74px; }
.mark figcaption { font-size: .86rem; line-height: 1.45; color: #4A5563; }
.mark figcaption b { display: block; font-family: var(--mono); color: var(--orange); font-size: .76rem; letter-spacing: .12em; margin-bottom: 2px; }
@media (max-width: 640px) { .marks { grid-template-columns: 1fr; } .mark .mk-img { height: 96px; } .mark img { max-height: 96px; } }

/* ---- contact: the coordinator's namecard, drawn to the printed card's proportions */
.ncard { container-type: inline-size; position: relative; width: 100%; max-width: 460px; aspect-ratio: 993 / 563;
  margin: 4px 0 28px; background: #fff; border: 3px solid #FF6A10; box-shadow: 0 14px 34px rgba(9,15,30,.16); overflow: hidden; }
.ncard .nc-chev { position: absolute; inset: 0; background: #F00;
  clip-path: polygon(6.5% 0, .7% 21.3%, 14.1% 68%, 48% 68%, 50.4% 58.6%, 17.8% 58.1%, 7.3% 21.3%, 13.1% 0); }
.ncard .nc-logo { position: absolute; left: 25%; top: 1.5%; width: 71.5%; height: auto; }
.ncard .nc-url { position: absolute; right: 1%; top: 51.5%; font-size: 2.45cqw; line-height: 1; color: #111; letter-spacing: .01em; }
.ncard .nc-bar { position: absolute; left: 50.4%; right: 0; top: 58.6%; height: 9.6%;
  background: linear-gradient(180deg, rgba(0,0,0,.82), rgba(0,0,0,.28) 45%, rgba(0,0,0,0));
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%); mask-image: linear-gradient(90deg, transparent, #000 14%); }
.ncard .nc-who { position: absolute; left: 2.8%; bottom: 2.6%; font-size: 3.0cqw; line-height: 1.3; color: #111; }
.ncard .nc-who b { font-weight: 500; }
.ncard .nc-who a { color: #111; text-decoration: none; }
.ncard .nc-who a:hover { color: var(--orange); text-decoration: underline; }

/* ---- home stats: journal papers by journal quartile (one hue, strongest for Q1; checked for
   order and contrast on the light and dark card) */
:root { --qs1: #104281; --qs2: #256abf; --qs3: #3987e5; --qs4: #86b6ef; --qsn: #C9CED6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --qs1: #b7d3f6; --qs2: #86b6ef; --qs3: #3987e5; --qs4: #1c5cab; --qsn: #3B4554; } }
:root[data-theme="dark"] { --qs1: #b7d3f6; --qs2: #86b6ef; --qs3: #3987e5; --qs4: #1c5cab; --qsn: #3B4554; }
.vstat.vpub { flex: 1.7 1 250px; }
.vstat.vpub span a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.vstat.vpub span a:hover { color: var(--orange); border-color: var(--orange); }
.vstat span.qbar { display: flex; gap: 2px; height: 8px; margin: 12px 0 0; border-radius: 4px; overflow: hidden; font-size: 0; }
.vstat span.qkey { display: flex; flex-wrap: wrap; gap: 4px 11px; margin: 9px 0 0; font-family: var(--mono); font-size: .72rem;
  line-height: 1.4; color: var(--muted); }
.qbar s, .qkey s { text-decoration: none; display: block; }
.qbar s { height: 100%; min-width: 3px; }
.qkey em { font-style: normal; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.qkey s { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.qs-1 { background: var(--qs1); } .qs-2 { background: var(--qs2); } .qs-3 { background: var(--qs3); }
.qs-4 { background: var(--qs4); } .qs-n { background: var(--qsn); }
/* Thai no-break words inside the stat tiles stay inline (not caption blocks) */
.vstat .nw { display: inline; margin: 0; font-size: inherit; color: inherit; }

/* ------------------------------------------------ Glossary: terms in the running text (a.gl) and their pop-up */
a.gl { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--orange);
  text-decoration-thickness: 1.5px; text-underline-offset: .2em; cursor: help; }
a.gl:hover, a.gl:focus-visible, a.gl.on { color: var(--link); text-decoration-style: solid; }
.gl-tip { position: absolute; z-index: 250; width: max-content; max-width: min(400px, calc(100vw - 20px));
  background: var(--card); color: var(--body); border: 1px solid var(--line); border-top: 3px solid var(--orange);
  border-radius: 10px; box-shadow: 0 12px 36px rgba(20,28,54,.22); padding: 11px 15px 10px;
  font-size: .9rem; line-height: 1.55; text-align: left; font-weight: 400; }
.gl-tip p { margin: 0 0 6px; }
.gl-tip .gl-tip-h { font-weight: 700; color: var(--head-fg); margin-bottom: 3px; }
.gl-tip .gl-tip-m { margin: 6px 0 0; font-size: .82rem; }
.gl-tip .gl-tip-m a { font-weight: 600; }
.gl-tip sup, .gl-tip sub, .gl-d sup, .gl-d sub, .gl-tab sup, .gl-tab sub { line-height: 0; }
.ov { text-decoration: overline; }
@media print { a.gl { text-decoration: none; color: inherit; } .gl-tools, .gl-az { display: none; } }

/* ------------------------------------------------ Glossary pages */
.gl-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 0 0 14px; }
.gl-filter { flex: 1 1 300px; max-width: 520px; font: inherit; font-size: 1rem; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--body); }
.gl-filter:focus, .gl-find input:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.gl-deep { font-size: .86rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.gl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gl-chips button { font: inherit; font-size: .8rem; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--body); cursor: pointer; }
.gl-chips button:hover { border-color: var(--orange); }
.gl-chips button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.gl-count { margin: 0; font-size: .85rem; color: var(--muted); flex-basis: 100%; min-height: 1.2em; }
.gl-count:empty { display: none; }
.gl-az { position: sticky; top: calc(var(--hdr, 64px) + 4px); z-index: 6; display: flex; flex-wrap: wrap; gap: 2px;
  padding: 5px; margin: 0 0 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.gl-az a { min-width: 27px; text-align: center; padding: 3px 6px; border-radius: 6px; font-weight: 600; font-size: .84rem;
  text-decoration: none; color: var(--head-fg); }
.gl-az a:hover { background: var(--orange-tint); color: var(--link); }
.gl-az.gl-gr a { min-width: 0; font-weight: 500; padding: 4px 9px; }
.gl-legend { font-size: .84rem; color: var(--muted); max-width: 980px; margin: 0 0 16px; }
.gl-intro { max-width: 860px; }
.gl-letter { scroll-margin-top: calc(var(--hdr, 64px) + 100px); }
.gl-letter > h2 { font-size: 1.45rem; margin: 26px 0 6px; padding-bottom: 6px; border-bottom: 2px solid var(--orange);
  scroll-margin-top: calc(var(--hdr, 64px) + 64px); }
.gl-n { font-size: .8rem; font-weight: 500; color: var(--muted); margin-left: 4px; }
.gl-e { padding: 13px 0 12px; border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--hdr, 64px) + 64px); }
.gl-e:target { background: var(--orange-tint); box-shadow: -10px 0 0 var(--orange-tint), 10px 0 0 var(--orange-tint); }
.gl-e h3 { margin: 0 0 3px; font-size: 1.04rem; line-height: 1.35; }
.gl-sym { font-weight: 400; color: var(--muted); margin-left: 6px; }
.gl-tr { margin: 0 0 5px; color: var(--info-fg); font-weight: 600; }
.gl-en { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.gl-d { margin: 5px 0 0; }
.gl-d > p { margin: 0; max-width: 920px; }
.gl-d + .gl-d { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line); }
.gl-here { background: var(--orange-tint); border-radius: 8px; padding: 8px 12px; }
.gl-here + .gl-d { border-top: 0; }
.gl-d > p.gl-srcs { margin: 4px 0 0; font-size: .78rem; display: flex; flex-wrap: wrap; gap: 4px 5px; align-items: center; }
.gl-src { display: inline-block; padding: 0 7px; border-radius: 5px; background: var(--info-bg); border: 1px solid var(--info-bd);
  color: var(--info-fg); text-decoration: none; font-family: var(--mono); font-size: .7rem; line-height: 1.7; white-space: nowrap; }
.gl-src:hover { border-color: var(--info-fg); color: var(--info-fg); }
.gl-more { margin-left: 4px; font-size: .8rem; }
.gl-nl { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--orange-dk); font-weight: 700; margin-right: 4px; }
.gl-on { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.gl-site { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); column-gap: 34px; }
.gl-ne { padding: 10px 0; }
.gl-ne p { margin: 0; max-width: 980px; }
.gl-tab { width: 100%; border-collapse: collapse; font-size: .88rem; }
.gl-tab th, .gl-tab td { text-align: left; vertical-align: top; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.gl-tab th { background: var(--band); font-size: .78rem; font-weight: 600; }
.gl-tab td.gl-s { white-space: nowrap; font-size: 1.02rem; color: var(--head-fg); }
.gl-tab .r { text-align: right; font-variant-numeric: tabular-nums; }
.gl-tab tr.tot td { font-weight: 700; border-top: 2px solid var(--line); }
.gl-find { display: flex; flex-wrap: wrap; gap: 10px; max-width: 660px; margin: 18px 0 0; }
.gl-find input { flex: 1 1 260px; font: inherit; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--body); }
.gl-find .btn { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.gl-hide { display: none !important; }
@media (max-width: 640px) { .gl-az { position: static; } .gl-tab { font-size: .82rem; } .gl-tab th, .gl-tab td { padding: 5px 6px; } }

/* Glossary: the book's English wording folded under a Thai or Chinese translation */
details.gl-o { margin: 4px 0 0; }
details.gl-o > summary { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; list-style: none;
  font-size: .76rem; color: var(--muted); user-select: none; }
details.gl-o > summary::-webkit-details-marker { display: none; }
details.gl-o > summary::before { content: ""; width: 0; height: 0; border-left: 5px solid currentColor;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s; }
details.gl-o[open] > summary::before { transform: rotate(90deg); }
details.gl-o > summary:hover { color: var(--ink, inherit); }
details.gl-o > p { margin: 5px 0 2px; padding-left: 10px; border-left: 2px solid var(--line); font-size: .9em; color: var(--muted); max-width: 920px; }
.gl-ne details.gl-o { margin-top: 2px; }

/* people cards: only e-mail addresses may break anywhere; glossary terms (e.g. SERF) stay whole */
.person .meta a.gl, .person .role a.gl { word-break: normal; }
/* phones: long web addresses and dot leaders in the reproduced curriculum documents wrap
   instead of widening the page */
.doctext { overflow-wrap: anywhere; }

/* ==========================================================================
   Public Outreach · the Dancing Atomic Boy studio (assets/dab.js), hub, schools, poster
   ========================================================================== */
.dab-sec { background: linear-gradient(180deg, var(--ink, #141C36) 0, #070E24 260px, #070E24 100%); color: #DCE6F2;
  padding: 24px 0 34px; }
.dab { max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.dab-steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 16px; flex-wrap: wrap; }
.dab-steps li { font-size: .82rem; padding: 6px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px;
  color: #9FB0C4; margin: 0; }
.dab-steps li b { font-family: var(--mono); margin-right: 4px; }
.dab-steps li.on { border-color: var(--cyan); color: #fff; }
.dab-steps li.done { border-color: rgba(111,227,178,.6); color: #BFF3DD; }
.dab-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(340px, 1fr); gap: 22px; align-items: start; }
.dab-left { position: sticky; top: calc(var(--hdr) + 12px); min-width: 0; }
@media (max-width: 980px) { .dab-grid { grid-template-columns: 1fr; } .dab-left { position: static; } }
.dab-stage { position: relative; background: #000; border-radius: 14px; overflow: hidden; scroll-margin-top: calc(var(--hdr) + 10px);
  border: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; }
.dab-cv { display: block; width: 100%; height: auto; max-height: calc(100vh - 250px); object-fit: contain; }
.dab-stage.vert .dab-cv { width: auto; height: min(calc(100vh - 250px), 880px); max-width: 100%; }
@media (max-width: 980px) { .dab-cv { max-height: none; } .dab-stage.vert .dab-cv { height: min(80vh, 760px); } }
.dab-hello { position: absolute; inset: auto 0 18px; margin: 0; text-align: center; font-size: .92rem; color: #C3CFE1;
  pointer-events: none; padding: 0 16px; }
.dab-bar { display: flex; gap: 12px; align-items: center; margin: 10px 0 8px; flex-wrap: wrap; }
.dab-bar .sbtn[disabled] { opacity: .45; cursor: default; }
.dab-time, .dab-bpm { font-family: var(--mono); font-size: .8rem; color: #9FB0C4; }
.dab-wave { border-radius: 10px; background: #0B1530; border: 1px solid rgba(255,255,255,.1); cursor: grab;
  touch-action: none; }
.dab-wave:active { cursor: grabbing; }
.dab-wave:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.dab-wcv { display: block; width: 100%; height: 84px; }
.dab-whint { font-size: .8rem; color: #8FA0B5; margin: 6px 0 0; }
.dab-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dab-card { border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 12px 16px 16px; margin: 0;
  background: rgba(255,255,255,.03); min-width: 0; }
.dab-card[disabled] { opacity: .42; }
.dab-card legend { font-weight: 600; color: #fff; padding: 0 6px; font-size: .98rem; }
.dab-card legend b { font-family: var(--mono); color: var(--cyan); margin-right: 6px; }
.dab-card p { font-size: .88rem; color: #C9D3E0; }
.dab-card .btn { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.dab-card .btn[disabled] { opacity: .55; cursor: default; }
.dab-drop { position: relative; display: flex; flex-direction: column; gap: 4px; border: 1.5px dashed rgba(127,211,245,.55);
  border-radius: 10px; padding: 16px; text-align: center; cursor: pointer; }
.dab-drop:hover, .dab-drop.over { background: rgba(68,200,244,.08); border-color: var(--cyan); }
.dab-drop:focus-within { outline: 2px solid var(--cyan); outline-offset: 2px; }
.dab-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dab-drop-t { font-weight: 600; color: #fff; }
.dab-drop-s { font-size: .8rem; color: #9FB0C4; }
.dab-or { font-size: .84rem; margin: 12px 0 8px; }
.dab-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dab-chip { font: inherit; font-size: .8rem; padding: 6px 11px; border-radius: 999px; border: 1px solid rgba(255,255,255,.22);
  background: transparent; color: #DCE6F2; cursor: pointer; }
.dab-chip:hover { border-color: var(--cyan); color: #fff; }
.dab-chip[aria-pressed="true"] { background: #E8EEF6; color: #0B1320; border-color: #E8EEF6; }
.dab-chip:focus-visible, .dab-card .sbtn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.dab-msg, .dab-pmsg, .dab-fmsg, .dab-tmsg { min-height: 1.2em; font-size: .88rem; margin: 10px 0 0; color: #E8EEF6; }
.dab-msg.good, .dab-fmsg.good { color: #8FF0C4; }
.dab-msg.warn, .dab-fmsg.warn, .dab-pmsg.warn { color: #F5B83D; }
.dab-small { font-size: .78rem !important; color: #8FA0B5 !important; margin: 10px 0 0; line-height: 1.55; }
.dab-card a, .dab-tmsg a { color: #FF9A73; }
.dab-row { display: grid; grid-template-columns: 5.4em minmax(0, 1fr); gap: 8px; align-items: start; margin: 0 0 10px; }
.dab-lab { font-size: .72rem; color: #8FA0B5; padding-top: 7px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.dab-opts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dab-opt { position: relative; display: inline-flex; margin: 0; }
.dab-opt input[type="radio"] { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.dab-opt span { font-size: .8rem; padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2); color: #DCE6F2; }
.dab-opt input:checked + span { background: var(--cyan); color: #06122A; border-color: var(--cyan); font-weight: 600; }
.dab-opt input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.dab-tick { align-items: flex-start; }
.dab-tick input { position: static; opacity: 1; margin: 3px 8px 0 0; accent-color: var(--cyan); flex: none; }
.dab-tick span, .dab-tick input:checked + span { border: 0; padding: 0; font-size: .82rem; line-height: 1.5; color: #C9D3E0;
  background: none; font-weight: 400; }
.dab-prog { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dab-prog li { font-size: .76rem; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.06); color: #8FA0B5; margin: 0; }
.dab-prog li.run { background: rgba(68,200,244,.22); color: #fff; }
.dab-prog li.ok { background: rgba(111,227,178,.18); color: #BFF3DD; }
.dab-prog li.ok::before { content: "\2713\00a0"; }
.dab-result { margin-top: 12px; }
.dab-vid { width: 100%; max-height: 440px; background: #000; border-radius: 10px; display: block; }
.dab-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.dab-more { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.dab-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; font-size: .82rem; color: #B9C4D2; }
.dab-field input, .dab-tform input { font: inherit; font-size: .92rem; padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.25); background: #0B1530; color: #fff; }
.dab-field input:focus, .dab-tform input:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.dab-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.dab-form .dab-tick { margin: 0 0 9px; }
.dab-q { font-size: .86rem !important; color: #E8EEF6 !important; background: rgba(255,255,255,.05); border-radius: 8px; padding: 8px 10px; }
.dab-check { margin-top: 12px; font-size: .86rem; }
.dab-check summary { cursor: pointer; color: #B9C4D2; }
.dab-tform { display: flex; gap: 6px; margin-top: 8px; }
.dab-tform input { flex: 1; min-width: 0; font-family: var(--mono); }
.dab-nojs { padding: 20px; color: #fff; }
/* the light sections of the studio page */
.dab-real { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dab-realcol { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: var(--card); }
.dab-realcol .kicker { margin: 0 0 6px; }
.dab-realcol p:last-child { margin-bottom: 0; }
@media (max-width: 760px) { .dab-real { grid-template-columns: 1fr; } }
.dab-tl { list-style: none; padding: 0; margin: 30px 0 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 3px solid var(--line); }
.dab-tl li { padding: 14px 14px 0 0; position: relative; margin: 0; }
.dab-tl li::before { content: ""; position: absolute; top: -9px; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--navy); }
.dab-tl li.now::before { background: var(--orange); }
.dab-tl li.next::before { background: var(--paper); border: 3px solid var(--orange); width: 9px; height: 9px; }
.dab-tl b { display: block; font-family: var(--mono); font-size: .84rem; color: var(--head-fg); }
.dab-tl span { font-size: .9rem; color: var(--muted); }
@media (max-width: 760px) { .dab-tl { grid-template-columns: 1fr 1fr; row-gap: 20px; } }
.dab-how { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.dab-times { max-width: 760px; }
.dab-qa { border-bottom: 1px solid var(--line); padding: 11px 0; }
.dab-qa summary { cursor: pointer; font-weight: 600; }
.dab-qa p { margin: 8px 0 4px; color: var(--muted); }
/* hub */
.dab-hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 34px; align-items: center; }
.dab-hero-v { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 1 / 1; max-width: 520px; width: 100%; }
.dab-hero-v video { width: 100%; height: 100%; object-fit: cover; display: block; }
.dab-hero-tag { position: absolute; left: 10px; bottom: 10px; font-size: .74rem; background: rgba(9,15,30,.82); color: #E8EEF6;
  padding: 5px 10px; border-radius: 999px; }
.dab-hero-t h2 { margin: 0 0 .4em; }
.dab-hero-steps { padding-left: 1.3em; }
.dab-hero-steps li { margin-bottom: .45em; }
@media (max-width: 860px) { .dab-hero { grid-template-columns: 1fr; } }
/* schools */
.dab-acts3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.dab-act { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; background: var(--card); }
.dab-act .kicker { margin: 0 0 6px; }
.dab-act h3 { margin: 0 0 .4em; }
.dab-actq { font-weight: 600; margin: 14px 0 4px; font-size: .9rem; }
.dab-act ol { padding-left: 1.2em; font-size: .93rem; margin: 0; }
.dab-act li { margin-bottom: .45em; }
.dab-two { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
@media (max-width: 760px) { .dab-two { grid-template-columns: 1fr; } }
/* poster: white and print-ready in both themes */
.poster-tools { padding-top: 18px; }
.poster-tools p { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.poster-tools .btn { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.poster { max-width: 794px; margin: 14px auto 44px; background: #fff; color: #141C36; border: 1px solid #E2E6EB;
  box-shadow: var(--shadow); padding: 46px 50px 40px; display: flex; flex-direction: column; gap: 24px;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.poster-k { font-family: var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #E55525; font-weight: 700; margin: 0; }
.poster h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); line-height: 1.04; margin: .12em 0 .18em; color: #141C36; }
.poster-s { font-size: 1.16rem; color: #22305A; margin: 0; }
.poster-m { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; }
.poster-art { width: 100%; height: auto; display: block; }
.poster-steps { list-style: none; counter-reset: p; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.poster-steps li { counter-increment: p; display: grid; grid-template-columns: 44px 1fr; gap: 2px 12px; margin: 0; }
.poster-steps li::before { content: counter(p); grid-row: span 2; width: 40px; height: 40px; border-radius: 50%; background: #141C36;
  color: #F5B83D; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; }
.poster-steps b { font-size: 1.2rem; color: #141C36; }
.poster-steps span { color: #22305A; font-size: .98rem; line-height: 1.5; }
.poster-f { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; border-top: 3px solid #F5B83D; padding-top: 18px; }
.poster-qr svg { width: 150px; height: 150px; display: block; }
.poster-u p { margin: 0 0 4px; color: #141C36; }
.poster-url { font-family: var(--mono); font-size: .84rem; word-break: break-all; color: #22305A !important; }
.poster-c { font-size: .8rem; color: #5E6875 !important; }
.poster-logos { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.poster-logos img { height: 44px; width: auto; }
@media (max-width: 640px) { .poster { padding: 26px 20px; } .poster-m, .poster-f { grid-template-columns: 1fr; } .poster-logos { flex-direction: row; } }
@media print {
  @page { size: A4 portrait; margin: 0; }
  body:has(.poster) .hdr, body:has(.poster) .ftr, body:has(.poster) .skip, .poster-tools, body:has(.poster) .ceqt-sec { display: none !important; }
  body:has(.poster) { background: #fff !important; }
  .poster { box-shadow: none; border: 0; margin: 0 auto; width: 210mm; height: 296mm; max-width: none; padding: 18mm 17mm 13mm;
    justify-content: space-between; gap: 8mm; }
  .poster h1 { font-size: 50pt; }
  .poster-s { font-size: 15pt; }
  .poster-m { grid-template-columns: 1.15fr 1fr; gap: 10mm; }
  .poster-steps { gap: 9mm; }
  .poster-steps b { font-size: 16pt; }
  .poster-steps span { font-size: 12pt; }
  .poster-qr svg { width: 44mm; height: 44mm; }
  .poster-url { font-size: 10pt; }
}
.dab-home .dab-hero-v { max-width: 420px; }
