/* ==========================================================
   BH3OY personal index — shared stylesheet
   Two themes (light / dark) + three page personalities
   Offline-friendly: no external assets, no CDN
   ========================================================== */

/* ---------- Base tokens: DARK ---------- */
:root {
  color-scheme: dark;
  --bg:          #080d14;
  --panel:       #121c28;
  --panel-2:     #1a2737;
  --line:        #26374d;
  --line-soft:   #1c2a3b;
  --text:        #eaf1f9;
  --text-dim:    #b7c6d8;
  --muted:       #8a9cb1;
  --faint:       #5f7288;

  --topbar-bg:     rgba(8, 13, 20, .82);
  --footer-bg:     rgba(8, 13, 20, .74);
  --section-bg-a:  rgba(23, 36, 51, .66);
  --section-bg-b:  rgba(16, 25, 36, .76);
  --table-bg:      rgba(10, 16, 24, .5);
  --card-bg-a:     rgba(23, 36, 51, .9);
  --card-bg-b:     rgba(14, 21, 31, .9);
  --toc-bg:        rgba(18, 28, 40, .55);
  --row-hover:     rgba(255, 255, 255, .035);
  --grid-line:     rgba(255, 255, 255, .022);
  --hr-fade:       rgba(255, 255, 255, .07);
  --sel-fg:        #06121a;
  --shadow:        0 18px 44px rgba(0, 0, 0, .38);
  --deco-strength: 1;
  --note-warn:     rgba(242, 178, 92, .10);
  --note-danger:   rgba(255, 138, 128, .10);

  --radius:    16px;
  --radius-sm: 10px;
  --maxw:      1060px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
          "Noto Sans SC", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", "Cascadia Mono",
          Consolas, "Liberation Mono", monospace;
}

/* ---------- Base tokens: LIGHT ---------- */
html[data-theme="light"] {
  color-scheme: light;
  --bg:          #f2f6fc;
  --panel:       #ffffff;
  --panel-2:     #eaf1f9;
  --line:        #d3dfec;
  --line-soft:   #e5edf6;
  --text:        #14202e;
  --text-dim:    #3b4c61;
  --muted:       #63768c;
  --faint:       #8798ab;

  --topbar-bg:     rgba(255, 255, 255, .84);
  --footer-bg:     rgba(255, 255, 255, .68);
  --section-bg-a:  #ffffff;
  --section-bg-b:  #f8fbfe;
  --table-bg:      #ffffff;
  --card-bg-a:     #ffffff;
  --card-bg-b:     #f4f8fd;
  --toc-bg:        rgba(255, 255, 255, .78);
  --row-hover:     rgba(20, 40, 70, .035);
  --grid-line:     rgba(30, 60, 100, .045);
  --hr-fade:       rgba(30, 60, 100, .10);
  --sel-fg:        #ffffff;
  --shadow:        0 16px 38px rgba(28, 52, 84, .14);
  --deco-strength: .62;
  --note-warn:     rgba(214, 140, 20, .10);
  --note-danger:   rgba(214, 58, 54, .09);
}

/* ---------- Page personality: INDEX (minimal / cool) ---------- */
body[data-page="index"] {
  --accent:      #8b93ff;
  --accent-2:    #45e0c8;
  --accent-soft: rgba(139, 147, 255, .14);
  --danger:      #ff8a95;
  --glow-1:      rgba(139, 147, 255, .17);
  --glow-2:      rgba(69, 224, 200, .10);
  --grad-1:      #b7bcff;
  --grad-2:      #63e9d4;
}
html[data-theme="light"] body[data-page="index"] {
  --accent:      #4653c4;
  --accent-2:    #0a8b7c;
  --accent-soft: rgba(70, 83, 196, .10);
  --danger:      #c0392b;
  --glow-1:      rgba(70, 83, 196, .13);
  --glow-2:      rgba(10, 139, 124, .10);
  --grad-1:      #3743ac;
  --grad-2:      #0a7c70;
}

/* ---------- Page personality: HAM (radio / instrument) ---------- */
body[data-page="ham"] {
  --accent:      #43e2c4;
  --accent-2:    #f3b55c;
  --accent-soft: rgba(67, 226, 196, .12);
  --danger:      #ff9a7a;
  --glow-1:      rgba(67, 226, 196, .13);
  --glow-2:      rgba(243, 181, 92, .07);
}
html[data-theme="light"] body[data-page="ham"] {
  --accent:      #0b7f6c;
  --accent-2:    #a96a12;
  --accent-soft: rgba(11, 127, 108, .10);
  --danger:      #b4471f;
  --glow-1:      rgba(11, 127, 108, .13);
  --glow-2:      rgba(169, 106, 18, .08);
}

/* ---------- Page personality: AID (emergency / red cross) ---------- */
body[data-page="aid"] {
  --accent:      #ff6f6a;
  --accent-2:    #f5c24e;
  --accent-soft: rgba(255, 111, 106, .13);
  --danger:      #ff8078;
  --glow-1:      rgba(255, 111, 106, .15);
  --glow-2:      rgba(245, 194, 78, .07);
}
html[data-theme="light"] body[data-page="aid"] {
  --accent:      #cf3b34;
  --accent-2:    #b07a10;
  --accent-soft: rgba(207, 59, 52, .09);
  --danger:      #b8322b;
  --glow-1:      rgba(207, 59, 52, .12);
  --glow-2:      rgba(176, 122, 16, .07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 10% -8%, var(--glow-1), transparent 62%),
    radial-gradient(760px 460px at 96% 2%, var(--glow-2), transparent 60%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

::selection { background: var(--accent); color: var(--sel-fg); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Decorative hero layers ---------- */
.page-deco {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 620px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: var(--deco-strength);
}
.page-deco span, .page-deco svg { position: absolute; display: block; }

/* INDEX: concentric orbit rings + glow orbs */
.deco-index .ring {
  border: 1px solid var(--accent);
  border-radius: 50%;
  right: -150px; top: -190px;
  opacity: .16;
}
.deco-index .ring-a { width: 420px; height: 420px; }
.deco-index .ring-b { width: 620px; height: 620px; right: -250px; top: -290px; opacity: .10; border-style: dashed; animation: spin 70s linear infinite; }
.deco-index .ring-c { width: 820px; height: 820px; right: -350px; top: -390px; opacity: .06; }
.deco-index .orb {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 16px 4px var(--accent-2);
  opacity: .65;
}
.deco-index .orb-a { right: 190px; top: 122px; }
.deco-index .orb-b { right: 58px; top: 268px; width: 5px; height: 5px; opacity: .45; }
@keyframes spin { to { transform: rotate(360deg); } }

/* HAM: radiating wavefronts + band ruler */
.deco-ham .wave {
  right: -140px; top: -160px;
  width: 380px; height: 380px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: radiate 6s ease-out infinite;
}
.deco-ham .wave-b { animation-delay: 1.5s; }
.deco-ham .wave-c { animation-delay: 3s; }
.deco-ham .wave-d { animation-delay: 4.5s; }
@keyframes radiate {
  0%   { transform: scale(.55); opacity: .34; }
  100% { transform: scale(1.75); opacity: 0; }
}
.deco-ham .ham-ruler {
  left: 0; right: 0; bottom: 8px;
  height: 26px;
  border-top: 1px solid var(--line);
  background-image: repeating-linear-gradient(90deg, var(--accent) 0 1px, transparent 1px 28px);
  background-size: 100% 7px;
  background-repeat: no-repeat;
  background-position: 0 0;
  opacity: .28;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.deco-ham .ham-morse {
  right: 5%; bottom: 46px;
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: .34em;
  color: var(--accent);
  opacity: .22;
  white-space: nowrap;
}
.deco-ham .ham-label {
  left: 4%; bottom: 46px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .28em;
  color: var(--accent-2);
  opacity: .4;
}

/* AID: ECG trace + soft cross */
.deco-aid .ecg {
  left: 0; right: 0; bottom: 26px;
  width: 100%; height: 130px;
  color: var(--accent);
  opacity: .26;
}
.deco-aid .ecg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  animation: ecg-pulse 3.2s ease-in-out infinite;
}
@keyframes ecg-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.deco-aid .cross-deco { right: 6%; top: 76px; width: 170px; height: 170px; }
.deco-aid .cross-deco::before,
.deco-aid .cross-deco::after {
  content: ""; position: absolute;
  background: var(--accent);
  border-radius: 8px;
  opacity: .10;
}
.deco-aid .cross-deco::before { left: 0; top: 57px; width: 170px; height: 56px; }
.deco-aid .cross-deco::after  { left: 57px; top: 0; width: 56px; height: 170px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.topbar-tools { display: flex; align-items: center; gap: 10px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 17px;
  box-shadow: 0 0 18px var(--accent-soft) inset;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .12em;
}
.brand-text small {
  margin-top: 4px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .22em;
  color: var(--muted);
}

.icon-btn {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--accent);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.icon-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transform: translateY(-1px);
}
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 17px; height: 17px; }
html[data-theme="dark"]  .icon-sun  { display: block; }
html[data-theme="dark"]  .icon-moon { display: none; }
html[data-theme="light"] .icon-sun  { display: none; }
html[data-theme="light"] .icon-moon { display: block; }

.lang-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  transition: border-color .2s, box-shadow .2s;
}
.lang-box:hover, .lang-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.lang-box svg { flex: 0 0 auto; color: var(--accent); }
.lang-box .chev { color: var(--muted); }

#lang-select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  padding-right: 4px;
  max-width: 150px;
}
#lang-select option { background: var(--panel); color: var(--text); }

/* ---------- Hero ---------- */
.hero {
  padding: 74px 0 44px;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--hr-fade) 45%, transparent);
  opacity: .8;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 30px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 13px;
}
.back-link:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  margin: 18px 0 16px;
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1.15;
  letter-spacing: -.02em;
  font-weight: 800;
}
.hero h1 .mono {
  font-family: var(--mono);
  color: var(--accent);
  letter-spacing: .02em;
}

/* INDEX: cool gradient headline */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  body[data-page="index"] .hero h1 {
    background: linear-gradient(100deg, var(--grad-1), var(--grad-2) 58%, var(--text) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  body[data-page="index"] .hero h1 .mono {
    -webkit-text-fill-color: var(--accent);
    color: var(--accent);
  }
}

/* HAM: instrument-style headline */
body[data-page="ham"] .hero h1 {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: -.03em;
  text-shadow: 0 0 28px var(--accent-soft);
}
body[data-page="ham"] .hero h1 .mono { text-transform: uppercase; }
body[data-page="ham"] .eyebrow::after {
  content: " // TX · RX";
  color: var(--accent-2);
  opacity: .75;
}

/* AID: warm, urgent headline */
body[data-page="aid"] .hero h1 { letter-spacing: -.025em; }
body[data-page="aid"] .eyebrow { color: var(--danger); }
body[data-page="aid"] .eyebrow::before { background: var(--danger); }

.hero-sub {
  margin: 0 0 18px;
  max-width: 720px;
  font-size: clamp(17px, 2.2vw, 21px);
  color: var(--text-dim);
  font-weight: 500;
}
.hero-intro {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 15.5px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 13px;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.badge.alt::before { background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }

/* ---------- Red Cross motto bar (FirstAid page) ---------- */
.motto-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 30px;
  padding: 16px 22px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: linear-gradient(90deg, var(--accent-soft), transparent 76%);
}
.motto-cross {
  position: relative;
  flex: 0 0 38px;
  width: 38px; height: 38px;
}
.motto-cross::before,
.motto-cross::after {
  content: "";
  position: absolute;
  background: var(--accent);
  border-radius: 3px;
  box-shadow: 0 0 14px var(--accent-soft);
}
.motto-cross::before { left: 0; top: 14px; width: 38px; height: 10px; }
.motto-cross::after  { left: 14px; top: 0; width: 10px; height: 38px; }
.motto-lines strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .24em;
  color: var(--text);
  line-height: 1.5;
}
.motto-lines > span {
  display: block;
  margin-top: 4px;
  font-size: 13.5px;
  letter-spacing: .14em;
  color: var(--accent);
}
.motto-note {
  margin-left: auto;
  font-size: 11px;
  font-style: normal;
  letter-spacing: .06em;
  color: var(--faint);
  text-align: right;
}

/* ---------- Table of contents ---------- */
.toc { margin: 26px 0 4px; }
.toc-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--toc-bg);
}
.toc-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--muted);
  text-transform: uppercase;
  margin-right: 6px;
}
.toc-pill {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12.5px;
  white-space: nowrap;
}
.toc-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

/* ---------- Sections ---------- */
.section {
  margin: 34px 0;
  padding: 30px 32px 34px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--section-bg-a), var(--section-bg-b));
  box-shadow: 0 8px 26px rgba(0, 0, 0, .08);
  scroll-margin-top: 84px;
}
html[data-theme="light"] .section { box-shadow: 0 8px 26px rgba(28, 52, 84, .05); }

.section-head {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}
.section-num {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  padding-top: 6px;
  letter-spacing: .08em;
}
body[data-page="index"] .section-num::before { content: "// "; opacity: .5; }
body[data-page="ham"]   .section-num::before { content: "CH."; opacity: .55; margin-right: 1px; }
body[data-page="aid"]   .section-num::after  { content: "+"; color: var(--danger); margin-left: 5px; }

.section-head h2 {
  margin: 0;
  font-size: clamp(21px, 2.6vw, 27px);
  line-height: 1.35;
  letter-spacing: -.01em;
}
body[data-page="ham"] .section-head h2 { font-family: var(--mono); font-size: clamp(19px, 2.3vw, 25px); }
.section-head .lead {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 15px;
}

.section-body > *:first-child { margin-top: 0; }
.section-body > *:last-child { margin-bottom: 0; }

.section-body p {
  margin: 0 0 16px;
  color: var(--text-dim);
}
.section-body h3 {
  margin: 28px 0 12px;
  font-size: 17px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-body h3::before {
  content: "";
  width: 4px; height: 16px;
  border-radius: 2px;
  background: var(--accent);
}
.section-body ul,
.section-body ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--text-dim);
}
.section-body li { margin: 7px 0; padding-left: 3px; }
.section-body li::marker { color: var(--accent); font-family: var(--mono); }

.section-body strong { color: var(--text); font-weight: 700; }
.section-body em { color: var(--accent-2); font-style: normal; }
.section-body code,
.section-body .mono {
  font-family: var(--mono);
  font-size: .92em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 5px;
}

/* ---------- Notes / callouts ---------- */
.note {
  margin: 20px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  color: var(--text-dim);
  font-size: 14.5px;
}
.note.warn {
  border-left-color: var(--accent-2);
  background: var(--note-warn);
}
.note.danger {
  border-left-color: var(--danger);
  background: var(--note-danger);
}
.note-label {
  display: block;
  margin-bottom: 5px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.note.warn .note-label { color: var(--accent-2); }
.note.danger .note-label { color: var(--danger); }
.note p { margin: 0; color: inherit; }

/* ---------- Tables ---------- */
.table-wrap {
  margin: 18px 0 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--table-bg);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 480px;
}
caption {
  caption-side: top;
  text-align: left;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 12.5px;
  border-bottom: 1px solid var(--line-soft);
}
th {
  text-align: left;
  padding: 12px 16px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
body[data-page="ham"] th { font-family: var(--mono); text-transform: uppercase; font-size: 11.5px; letter-spacing: .1em; }
td {
  padding: 12px 16px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--row-hover); }
td:first-child { color: var(--text); font-weight: 600; white-space: nowrap; }
td .mono { white-space: nowrap; }

/* ---------- Navigation cards (index) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 34px 0 10px;
}
.nav-card {
  position: relative;
  display: block;
  padding: 30px 30px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--card-bg-a), var(--card-bg-b));
  color: var(--text);
  overflow: hidden;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.nav-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: .75;
}
.nav-card:nth-child(2)::before { background: var(--accent-2); }
.nav-card::after {
  content: "";
  position: absolute;
  width: 220px; height: 220px;
  right: -90px; top: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
/* INDEX: extra "cool" corner glow */
body[data-page="index"] .nav-card {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.nav-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-soft);
  text-decoration: none;
}
.nav-card:nth-child(2):hover { border-color: var(--accent-2); }
.nav-card-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--accent);
}
.nav-card:nth-child(2) .nav-card-tag { color: var(--accent-2); }
.nav-card h3 {
  margin: 14px 0 10px;
  font-size: 27px;
  letter-spacing: -.01em;
}
.nav-card p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 14.5px;
  min-height: 3.2em;
}
.nav-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.nav-card:nth-child(2) .nav-card-cta { color: var(--accent-2); }
.nav-card-cta span { transition: transform .2s; }
.nav-card:hover .nav-card-cta span { transform: translateX(5px); }

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  margin-top: 56px;
  border-top: 1px solid var(--line-soft);
  background: var(--footer-bg);
  padding: 34px 0 46px;
}
.refs h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-family: var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.refs ul {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 26px;
}
.refs li {
  color: var(--muted);
  font-size: 13px;
  padding-left: 16px;
  position: relative;
  word-break: break-word;
}
.refs li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.refs a { color: var(--text-dim); }
.refs a:hover { color: var(--accent); }

.disclaimer {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  max-width: 860px;
}
.footer-sign {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .1em;
  color: var(--faint);
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .wrap { padding: 0 18px; }
  .topbar { padding: 12px 18px; }
  .hero { padding: 48px 0 34px; }
  .section { padding: 24px 20px 26px; margin: 24px 0; }
  .section-head { gap: 12px; }
  .card-grid { grid-template-columns: 1fr; }
  .refs ul { grid-template-columns: 1fr; }
  #lang-select { max-width: 108px; }
  .motto-note { margin-left: 0; width: 100%; text-align: left; padding-left: 56px; }
  .deco-ham .ham-morse, .deco-ham .ham-label { display: none; }
  .deco-aid .cross-deco { right: -30px; opacity: .7; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
