/* ═══════════════════════════════════════════
   Ifa Periodic Table — Design System
   CENProject · toe.cenproject.org
   ═══════════════════════════════════════════ */

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

:root {
  /* Brand */
  --primary:      #0036F7;
  --primary-lt:   #3d6aff;
  --primary-dk:   #0025b3;
  --secondary:    #363C4F;
  --gold:         #f5c518;

  /* Backgrounds */
  --bg:           #07090f;
  --surface-1:    #0f1320;
  --surface-2:    #161c2e;
  --surface-3:    #1e2740;

  /* Text */
  --text:         #eaedf5;
  --text-2:       #9aa3ba;
  --text-3:       #5c6580;

  /* Border */
  --border-1:     #1f2840;
  --border-2:     #2e3a58;

  /* Category colours */
  --cat-primordial: #c9a227;
  --cat-cognitive:  #4361ee;
  --cat-vital:      #e63946;
  --cat-social:     #daa520;
  --cat-active:     #2d9e6b;
  --cat-strategic:  #5e72b4;
  --cat-sacred:     #7c4dff;
  --cat-abundant:   #e9498a;

  /* Sizing */
  --cell:         62px;
  --radius:       8px;
  --radius-lg:    14px;
  --header-h:     102px;
  --controls-h:   56px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  /* Adire Eleko-inspired diamond lattice — very subtle */
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent, transparent 30px,
      rgba(201,162,39,0.016) 30px, rgba(201,162,39,0.016) 31px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent, transparent 30px,
      rgba(201,162,39,0.016) 30px, rgba(201,162,39,0.016) 31px
    );
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ══════════════════════════════════════════
   HEADER
══════════════════════════════════════════ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: linear-gradient(180deg, #0a0e1e 0%, rgba(7,9,15,0.96) 100%);
  border-bottom: 1px solid var(--border-1);
  backdrop-filter: blur(16px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.header__topbar {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg,
    rgba(0,20,120,0.0) 0%,
    rgba(0,36,200,0.32) 25%,
    rgba(0,44,220,0.38) 50%,
    rgba(0,36,200,0.32) 75%,
    rgba(0,20,120,0.0) 100%
  );
  border-bottom: 1px solid rgba(61,106,255,0.2);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* Subtle shimmer line across the top */
.header__topbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(197,162,39,0.4) 30%,
    rgba(197,162,39,0.7) 50%,
    rgba(197,162,39,0.4) 70%,
    transparent 100%
  );
}

.header__topbar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: transparent;
  background: linear-gradient(90deg, #e8c040 0%, #f5d978 45%, #c9a227 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  position: relative;
}

/* Palm silhouettes in header corners */
.header__palm {
  position: absolute;
  bottom: -14px;
  height: 96px;
  color: var(--gold);
  opacity: 0.07;
  pointer-events: none;
}
.header__palm--left  { left: -4px; }
.header__palm--right { right: -4px; transform: scaleX(-1); }

/* Opon Ifa watermark in header */
.header__opon-bg {
  position: absolute;
  right: 12%;
  top: 50%;
  transform: translateY(-50%);
  width: 84px;
  height: 84px;
  color: var(--gold);
  opacity: 0.05;
  pointer-events: none;
}

/* ══════════════════════════════════════════
   IFA HERO STRIP  (Isese · Ifa · Palm · Orisa)
══════════════════════════════════════════ */
.ifa-hero {
  position: relative;
  height: 112px;
  background: linear-gradient(180deg,
    #07090f 0%,
    #0b1022 40%,
    #0e1430 60%,
    #07090f 100%
  );
  border-bottom: 1px solid var(--border-1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Yoruba aso-oke / textile colour stripes */
.ifa-hero__stripe {
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #c9a227 0px,  #c9a227 14px,
    #0036F7 14px, #0036F7 28px,
    #e63946 28px, #e63946 42px,
    #2d9e6b 42px, #2d9e6b 56px,
    #7c4dff 56px, #7c4dff 70px,
    #e9498a 70px, #e9498a 84px,
    #daa520 84px, #daa520 98px,
    #5e72b4 98px, #5e72b4 112px
  );
  opacity: 0.6;
}
.ifa-hero__stripe--top { top: 0; }
.ifa-hero__stripe--bot { bottom: 0; }

/* Palm tree silhouettes */
.ifa-hero__palm {
  position: absolute;
  bottom: -10px;
  color: var(--gold);
  pointer-events: none;
}
.ifa-hero__palm--l1 { left: -8px;  height: 138px; opacity: 0.16; }
.ifa-hero__palm--l2 { left: 90px;  height: 106px; opacity: 0.07; transform: scaleX(-1); }
.ifa-hero__palm--r1 { right: -8px; height: 138px; opacity: 0.16; transform: scaleX(-1); }
.ifa-hero__palm--r2 { right: 90px; height: 106px; opacity: 0.07; }

/* Opon Ifa (divination tray) watermark */
.ifa-hero__opon {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 130px; height: 130px;
  color: var(--gold);
  opacity: 0.055;
  pointer-events: none;
}

/* Centre text content */
.ifa-hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}


.ifa-hero__tagline {
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: 'Times New Roman', Georgia, serif;
  opacity: 0.85;
}

.ifa-hero__tradition {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.16em;
  font-family: 'Times New Roman', Georgia, serif;
  opacity: 0.75;
}

.header__inner {
  width: 100%;
  flex: 1;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__logo {
  height: 56px;
  width: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(0,54,247,0.3), 0 0 0 1px rgba(255,255,255,0.08);
  transition: box-shadow 0.3s ease;
}

.header__logo:hover {
  box-shadow: 0 0 32px rgba(0,54,247,0.5), 0 0 0 1px rgba(61,106,255,0.3);
}

.header__logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: brightness(1.1) contrast(1.05);
  border-radius: 50%;
}

.header__title h1 {
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, #fff 20%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header__title p {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-top: 2px;
}

.header__stats {
  display: flex;
  gap: 28px;
}

.stat {
  text-align: center;
  padding: 4px 16px;
  border-left: 1px solid rgba(255,255,255,0.08);
}

.stat:first-child {
  border-left: none;
}

.stat__number {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}

.stat__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
  display: block;
}

/* ══════════════════════════════════════════
   IFABOK BANNER
══════════════════════════════════════════ */
.ifabok-banner {
  position: relative;
  background: var(--bg);
  border-bottom: 1px solid var(--border-1);
  padding: 36px 20px 40px;
  overflow: hidden;
}

/* Faint full-width glow behind the table */
.ifabok-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 50%,
    rgba(0, 54, 247, 0.06) 0%,
    rgba(197, 162, 39, 0.04) 50%,
    transparent 75%);
  pointer-events: none;
}

.ifabok-banner__inner {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.ifabok-banner__figure {
  margin: 0;
  display: flex;
  justify-content: center;
}

.ifabok-banner__img {
  width: 100%;
  max-width: 1040px;
  height: auto;
  border-radius: 14px;
  /*
    invert(1)          — white bg → black, black text → white
    hue-rotate(180deg) — rotates inverted hues back ~toward original colours
    brightness(0.88)   — brings the result in line with the dark UI
    contrast(1.1)      — crispens cell borders and text
    saturate(1.25)     — restores vibrancy lost to invert+rotate
  */
  filter: invert(1) hue-rotate(180deg) brightness(0.88) contrast(1.1) saturate(1.25);
  border: 1px solid rgba(61, 106, 255, 0.2);
  box-shadow:
    0 0 0 1px rgba(61, 106, 255, 0.08),
    0 4px 40px rgba(0, 0, 0, 0.7),
    0 1px 12px rgba(0, 0, 0, 0.5);
  transition: filter 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

.ifabok-banner__img:hover {
  filter: invert(1) hue-rotate(180deg) brightness(0.94) contrast(1.12) saturate(1.35);
  box-shadow:
    0 0 0 1px rgba(61, 106, 255, 0.25),
    0 8px 64px rgba(0, 54, 247, 0.28),
    0 2px 16px rgba(0, 0, 0, 0.45);
  transform: translateY(-2px);
}

/* ══════════════════════════════════════════
   IFA PERIODIC TABLE INTRO
══════════════════════════════════════════ */
.ifapt-intro {
  position: relative;
  background: linear-gradient(160deg, var(--surface-2) 0%, var(--bg) 60%, var(--surface-1) 100%);
  border-bottom: 1px solid var(--border-1);
  padding: 48px 24px 52px;
  overflow: hidden;
}

/* Decorative corner accent lines */
.ifapt-intro::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--primary) 0%, var(--cat-primordial) 16.6%, var(--cat-cognitive) 33.2%,
      var(--cat-vital) 50%, var(--cat-active) 66.6%, var(--cat-sacred) 83.2%, var(--cat-abundant) 100%) top / 100% 2px no-repeat,
    linear-gradient(90deg, var(--cat-abundant) 0%, var(--cat-sacred) 16.6%, var(--cat-active) 33.2%,
      var(--cat-vital) 50%, var(--cat-cognitive) 66.6%, var(--cat-primordial) 83.2%, var(--primary) 100%) bottom / 100% 2px no-repeat;
  pointer-events: none;
  opacity: 0.5;
}

/* Central radial glow */
.ifapt-intro::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  height: 280px;
  background: radial-gradient(ellipse, rgba(0, 54, 247, 0.07) 0%, transparent 65%);
  pointer-events: none;
}

.ifapt-intro__inner {
  max-width: 820px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.ifapt-intro__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}

.ifapt-intro__body > p {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text-2);
  max-width: 700px;
}

.ifapt-intro__body > p strong {
  color: var(--text);
  font-weight: 600;
}

.ifapt-intro__body > p em {
  color: var(--text);
  font-style: italic;
}

.ifapt-intro__accent {
  color: var(--primary-lt) !important;
  font-weight: 700 !important;
}

.ifapt-intro__accent--gold {
  color: var(--gold) !important;
}

.ifapt-intro__note {
  font-size: 0.85em;
  color: var(--text-3);
  font-style: italic;
}

/* Stats row */
.ifapt-intro__stats {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}

.ifapt-intro__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 40px;
  gap: 4px;
  position: relative;
}

.ifapt-intro__stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-lt);
  line-height: 1;
  letter-spacing: -0.02em;
}

.ifapt-intro__stat-lbl {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
}

.ifapt-intro__divider {
  width: 1px;
  height: 48px;
  background: var(--border-2);
  flex-shrink: 0;
}

.ifapt-intro__closing {
  font-size: 1.05rem !important;
  color: var(--text-2) !important;
}

.ifapt-intro__expanded {
  font-size: 0.97rem;
  line-height: 1.85;
  color: var(--text-2);
  max-width: 680px;
  text-align: center;
  padding: 18px 24px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(0, 54, 247, 0.05) 0%, rgba(197, 162, 39, 0.04) 100%);
  position: relative;
}

/* Left accent bar */
.ifapt-intro__expanded::before {
  content: '';
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary-lt), var(--gold));
}

.ifapt-intro__expanded strong {
  color: var(--text);
  font-weight: 600;
}

.ifapt-intro__expanded em {
  font-style: normal;
  color: var(--text);
  font-weight: 500;
  border-bottom: 1px dashed rgba(61, 106, 255, 0.4);
}

/* ══════════════════════════════════════════
   IFAPT GALLERY
══════════════════════════════════════════ */
.ifapt-gallery {
  background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface-2) 100%);
  border-top: 1px solid var(--border-2);
  padding: 48px 24px 56px;
}

.ifapt-gallery__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* Row: two wide images side by side */
.ifapt-gallery__row--duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Row: single centred image */
.ifapt-gallery__row--solo {
  display: flex;
  justify-content: center;
}

.ifapt-gallery__row--solo .ifapt-gallery__figure {
  width: 100%;
  max-width: 720px;
}

.ifapt-gallery__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.ifapt-gallery__img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  transition: box-shadow 0.3s ease, filter 0.3s ease;
}

/* Light-background images → invert + tint to match dark theme */
.ifapt-gallery__img--light {
  filter: invert(1) hue-rotate(180deg) brightness(0.88) contrast(1.08) saturate(1.2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.05);
}

.ifapt-gallery__img--light:hover {
  filter: invert(1) hue-rotate(180deg) brightness(0.94) contrast(1.12) saturate(1.35);
  box-shadow: 0 6px 28px rgba(0,0,0,0.55), 0 0 0 1px rgba(61,106,255,0.25);
}

/* Dark-background images → subtle boost only */
.ifapt-gallery__img--dark {
  filter: brightness(0.95) contrast(1.06) saturate(1.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.08);
}

.ifapt-gallery__img--dark:hover {
  filter: brightness(1.02) contrast(1.1) saturate(1.2);
  box-shadow: 0 6px 28px rgba(0,0,0,0.6), 0 0 0 1px rgba(61,106,255,0.25);
}

.ifapt-gallery__caption {
  font-size: 0.82rem;
  color: var(--text-2);
  text-align: center;
  font-style: italic;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

@media (max-width: 800px) {
  .ifapt-gallery__row--duo,
  .ifapt-gallery__row--trio {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════
   IFATOM INTRO
══════════════════════════════════════════ */
.ifatom-intro {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface-1) 100%);
  border-top: 1px solid var(--border-2);
  border-bottom: 1px solid var(--border-1);
  padding: 40px 24px;
  overflow: hidden;
}

/* Subtle radial glow behind the diagram */
.ifatom-intro::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(0, 54, 247, 0.09) 0%, transparent 70%);
  pointer-events: none;
}

.ifatom-intro__inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  position: relative;
}

.ifatom-intro__diagram {
  width: 100%;
  max-width: 580px;
  height: auto;
  border-radius: 12px;
  /* Invert B&W and shift toward the app's blue palette */
  filter: invert(1) sepia(0.25) hue-rotate(185deg) saturate(1.6) brightness(0.88) contrast(1.08);
  border: 1px solid rgba(61, 106, 255, 0.3);
  box-shadow:
    0 0 0 1px rgba(61, 106, 255, 0.12),
    0 4px 32px rgba(0, 36, 180, 0.35),
    0 1px 8px rgba(0, 0, 0, 0.6);
  transition: box-shadow 0.3s ease, filter 0.3s ease;
}

.ifatom-intro__diagram:hover {
  filter: invert(1) sepia(0.2) hue-rotate(185deg) saturate(1.8) brightness(0.92) contrast(1.1);
  box-shadow:
    0 0 0 1px rgba(61, 106, 255, 0.3),
    0 6px 48px rgba(0, 54, 247, 0.45),
    0 2px 12px rgba(0, 0, 0, 0.5);
}

.ifatom-intro__desc {
  font-size: 1rem;
  font-style: italic;
  color: var(--text-2);
  text-align: center;
  line-height: 1.7;
  max-width: 520px;
  letter-spacing: 0.01em;
  padding: 14px 20px;
  border-left: 3px solid var(--primary-lt);
  border-right: 3px solid var(--primary-lt);
  border-radius: 4px;
  background: rgba(0, 54, 247, 0.05);
}

/* ══════════════════════════════════════════
   CONTROLS
══════════════════════════════════════════ */
.controls {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: rgba(15, 19, 32, 0.97);
  border-bottom: 1px solid var(--border-1);
  backdrop-filter: blur(12px);
  padding: 10px 24px;
}

.controls__heading {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  text-align: center;
  margin: 0 0 8px;
  opacity: 0.75;
}

.controls__inner {
  max-width: 1700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Search */
.search {
  position: relative;
  flex-shrink: 0;
}

.search__icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 13px;
  pointer-events: none;
}

.search__input {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  padding: 7px 12px 7px 32px;
  color: var(--text);
  font-size: 13px;
  width: 200px;
  outline: none;
  transition: border-color 0.15s, width 0.2s;
}

.search__input::placeholder { color: var(--text-3); }
.search__input:focus {
  border-color: var(--primary);
  width: 240px;
}

/* Filter chips */
.chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex: 1;
}

.chip {
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid;
  transition: opacity 0.15s, transform 0.1s;
  background: transparent;
  user-select: none;
}

.chip--inactive { opacity: 0.3; }
.chip:hover { opacity: 0.8; transform: translateY(-1px); }
.chip--active { opacity: 1; }

/* View toggle */
.view-toggle {
  display: flex;
  gap: 3px;
  margin-left: auto;
  flex-shrink: 0;
}

.view-btn {
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.view-btn--active,
.view-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ══════════════════════════════════════════
   MAIN
══════════════════════════════════════════ */
.main {
  max-width: 1700px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

/* Legend */
.pt-table-headers {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-1);
  padding-bottom: 10px;
}

.pt-table-header {
  flex: 1;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Times New Roman', Georgia, serif;
  line-height: 1.3;
}

.pt-table-header__sub {
  display: flex;
  gap: 8px;
  font-size: 9.5px;
  font-weight: 400;
  color: var(--text-3);
  margin-top: 2px;
}

/* ══════════════════════════════════════════
   PERIODIC TABLE
══════════════════════════════════════════ */
.table-scroll {
  width: 100%;
  padding-bottom: 4px;
}

.pt-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr) 82px;
  gap: 3px;
  width: 100%;
}

/* Column headers */
.pt-col-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 2px 6px;
  gap: 2px;
  cursor: default;
}

.pt-col-header__ifacat {
  font-size: 8px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.pt-col-header__apola {
  font-size: 7.5px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

/* Corner — row-header column label (vertical text) */
.pt-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  gap: 4px;
  padding: 6px 0;
}

.pt-corner__label {
  font-size: 8px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  font-family: 'Times New Roman', Georgia, serif;
}

.pt-corner__sub {
  font-size: 7px;
  font-weight: 400;
  color: var(--text-3);
  white-space: nowrap;
}

/* Row headers */
.pt-row-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 0 4px 6px;
  gap: 1px;
}

.pt-row-header__ifacomp {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
}

/* Base Pair row header */
.pt-row-header--basepair {
  justify-content: center;
  border-left: 2px solid var(--cat-primordial);
}

.pt-row-header__basepair {
  font-size: 8px;
  font-weight: 700;
  color: var(--cat-primordial);
  white-space: nowrap;
  letter-spacing: 0.06em;
}

/* Placeholder cell — empty slot in Base Pair / IfaComp 1 rows */
.pt-cell-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: transparent;
}

/* ══════════════════════════════════════════
   ODU CELL
══════════════════════════════════════════ */
.cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  transition: transform 0.14s, box-shadow 0.14s, opacity 0.2s;
  padding: 3px 2px 2px;
  gap: 1px;
  user-select: none;
}

/* Tinted background via pseudo-element for smooth opacity control */
.cell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0.11;
  transition: opacity 0.14s;
  border-radius: inherit;
}

.cell:hover { transform: scale(1.1); z-index: 20; }
.cell:hover::before { opacity: 0.22; }
.cell:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.5); }

/* Principal Odu (Meji — diagonal) */
.cell--meji {
  border-color: currentColor;
  border-width: 2px;
}
.cell--meji::before { opacity: 0.17; }

/* Dimmed (filtered out) */
.cell--dim { opacity: 0.08; pointer-events: none; }

/* Cell content */
.cell__num {
  font-size: 8px;
  font-weight: 700;
  opacity: 0.55;
  line-height: 1;
  position: relative;
  align-self: flex-start;
  padding-left: 2px;
}

.cell__glyph {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  font-family: 'Times New Roman', Georgia, serif;
  font-weight: 700;
  position: relative;
  gap: 0px;
}

.cell__glyph-sec {
  font-size: 7px;
  opacity: 0.75;
}

.cell__glyph-pri {
  font-size: 13px;
  line-height: 1;
}

.cell__name {
  font-size: 7px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  max-width: 58px;
  position: relative;
  opacity: 0.85;
}

/* ══════════════════════════════════════════
   LIST VIEW
══════════════════════════════════════════ */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.odu-card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.odu-card:hover {
  border-color: var(--primary-lt);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,54,247,0.12);
}

.odu-card__badge {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  flex-shrink: 0;
  position: relative;
}

.odu-card__badge::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.16;
}

.odu-card__badge span { position: relative; }

.odu-card__body { flex: 1; min-width: 0; }

.odu-card__name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.odu-card__yoruba {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}

.odu-card__cat {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.odu-card__desc {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 6px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: overlayIn 0.2s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: 18px;
  max-width: 660px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
  z-index: 10;
  line-height: 1;
}

.modal__close:hover { background: var(--border-2); color: var(--text); }

/* Modal header */
.modal__header {
  padding: 24px 24px 0;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.modal__badge {
  width: 68px;
  min-height: 68px;
  border-radius: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 5px;
  padding: 10px 8px;
}

.modal__badge::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.18;
}

.modal__badge-num {
  font-size: 12px;
  font-weight: 800;
  opacity: 0.7;
  position: relative;
}

.modal__badge-marks {
  display: flex;
  gap: 5px;
  position: relative;
}

.modal__mark-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.modal__dot--zero {
  opacity: 0.2;
  outline: 1px solid currentColor;
  background: transparent;
}

.modal__title { flex: 1; }

.modal__title h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.15;
}

.modal__yoruba {
  font-size: 14px;
  color: var(--text-2);
  margin-top: 3px;
}

.modal__tag {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid;
}

/* Modal body */
.modal__body {
  padding: 20px 24px 24px;
}

.modal__section {
  margin-bottom: 20px;
}

.modal__section:last-child { margin-bottom: 0; }

.modal__section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 8px;
}

.modal__meaning {
  font-size: 14px;
  line-height: 1.7;
  color: #c4cad8;
}

/* Domain chips */
.domain-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.domain-chip {
  padding: 4px 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text);
}

/* IFABit visual */
.ifabit {
  display: flex;
  align-items: center;
  gap: 20px;
}

.ifabit__cols {
  display: flex;
  gap: 12px;
}

.ifabit__col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.ifabit__col-label {
  font-size: 9px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  text-align: center;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ifabit__mark {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 12px;
}

.ifabit__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.ifabit__dot--zero {
  background: transparent;
  outline: 1.5px solid currentColor;
  opacity: 0.3;
}

.ifabit__code {
  font-family: 'Courier New', monospace;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.1em;
  word-break: break-all;
}

/* Info 2-col */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.info-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: default;
}

.info-card--link { cursor: pointer; transition: border-color 0.15s; }
.info-card--link:hover { border-color: var(--primary-lt); }

.info-card__label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.info-card__value {
  font-size: 15px;
  font-weight: 700;
}

.info-card__sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
}

/* STEAMSEX tags */
.steamsex-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.steamsex-tag {
  padding: 4px 10px;
  background: rgba(0, 54, 247, 0.1);
  border: 1px solid rgba(0, 54, 247, 0.25);
  border-radius: 5px;
  font-size: 12px;
  color: #7fa3ff;
}

/* Dual Odu */
.dual-row {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.dual-row:hover { border-color: var(--primary-lt); }

.dual-badge {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  position: relative;
  flex-shrink: 0;
}

.dual-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.15;
}

.dual-badge span { position: relative; }

.dual-name { font-size: 14px; font-weight: 700; flex: 1; }
.dual-yoruba { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.dual-arrow { font-size: 16px; color: var(--text-3); }

/* Divider */
.divider {
  height: 1px;
  background: var(--border-1);
  margin: 16px 0;
}

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
/* ══════════════════════════════════════════
   DUAL LAWS
══════════════════════════════════════════ */
.dual-laws {
  border-top: 1px solid var(--border-1);
  padding: 14px 24px;
  background: var(--bg);
}

.dual-laws__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.dual-laws__label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dual-laws__chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.dual-chip {
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid;
  background: transparent;
  user-select: none;
}

/* ══════════════════════════════════════════
   PTOE DIAGRAMS
══════════════════════════════════════════ */
.ptoe-diagrams {
  position: relative;
  background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface-2) 100%);
  border-top: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-2);
  padding: 40px 24px 48px;
  overflow: hidden;
}

/* Twin glow spots behind each image */
.ptoe-diagrams::before,
.ptoe-diagrams::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 700px;
  height: 600px;
  transform: translateY(-50%);
  pointer-events: none;
}

.ptoe-diagrams::before {
  left: 10%;
  background: radial-gradient(ellipse, rgba(197, 162, 39, 0.07) 0%, transparent 70%);
}

.ptoe-diagrams::after {
  right: 10%;
  background: radial-gradient(ellipse, rgba(0, 54, 247, 0.07) 0%, transparent 70%);
}

.ptoe-diagrams__inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: center;
  position: relative;
}

.ptoe-diagrams__img {
  width: 100%;
  max-width: 1200px;
  height: auto;
  border-radius: 12px;
  /* Invert B&W then tint — first image gets gold warmth, second blue */
  filter: invert(1) sepia(0.2) hue-rotate(185deg) saturate(1.5) brightness(0.87) contrast(1.06);
  border: 1px solid rgba(61, 106, 255, 0.25);
  box-shadow:
    0 0 0 1px rgba(61, 106, 255, 0.1),
    0 4px 36px rgba(0, 36, 180, 0.3),
    0 1px 10px rgba(0, 0, 0, 0.55);
  transition: box-shadow 0.3s ease, filter 0.3s ease, transform 0.3s ease;
}

.ptoe-diagrams__img:hover {
  filter: invert(1) sepia(0.15) hue-rotate(185deg) saturate(1.7) brightness(0.92) contrast(1.1);
  box-shadow:
    0 0 0 1px rgba(61, 106, 255, 0.28),
    0 8px 56px rgba(0, 54, 247, 0.4),
    0 2px 14px rgba(0, 0, 0, 0.45);
  transform: translateY(-3px);
}

/* Give the first image (generalized table) a gold accent on hover */
.ptoe-diagrams__img:first-child:hover {
  filter: invert(1) sepia(0.35) hue-rotate(10deg) saturate(1.6) brightness(0.9) contrast(1.08);
  box-shadow:
    0 0 0 1px rgba(197, 162, 39, 0.28),
    0 8px 56px rgba(197, 162, 39, 0.28),
    0 2px 14px rgba(0, 0, 0, 0.45);
}

/* ══════════════════════════════════════════
   MENDELEEV REFERENCE
══════════════════════════════════════════ */
.mendeleev-ref {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface-1) 100%);
  border-top: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-2);
  padding: 44px 24px 48px;
  overflow: hidden;
}

/* Warm gold radial glow — nods to the colourful ACS table */
.mendeleev-ref::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 900px;
  height: 340px;
  background: radial-gradient(ellipse, rgba(197, 162, 39, 0.06) 0%, transparent 65%);
  pointer-events: none;
}

.mendeleev-ref__inner {
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.mendeleev-ref__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 0;
}

.mendeleev-ref__img {
  width: 100%;
  max-width: 880px;
  height: auto;
  border-radius: 12px;
  /* Keep original colours — just lift contrast and add dark vignette shadow */
  filter: brightness(0.96) contrast(1.04) saturate(1.05);
  border: 1px solid rgba(197, 162, 39, 0.2);
  box-shadow:
    0 0 0 1px rgba(197, 162, 39, 0.08),
    0 6px 48px rgba(0, 0, 0, 0.55),
    0 2px 12px rgba(0, 0, 0, 0.4);
  transition: filter 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

.mendeleev-ref__img:hover {
  filter: brightness(1.0) contrast(1.06) saturate(1.12);
  box-shadow:
    0 0 0 1px rgba(197, 162, 39, 0.28),
    0 10px 64px rgba(197, 162, 39, 0.22),
    0 4px 20px rgba(0, 0, 0, 0.35);
  transform: translateY(-3px);
}

.mendeleev-ref__caption {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-3);
  text-align: center;
  letter-spacing: 0.03em;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border-1);
}

/* ══════════════════════════════════════════
   STANDARD MODEL REFERENCE
══════════════════════════════════════════ */
.standard-model-ref {
  position: relative;
  background: linear-gradient(160deg, var(--bg) 0%, var(--surface-1) 50%, var(--bg) 100%);
  border-top: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-2);
  padding: 48px 24px 52px;
  overflow: hidden;
}

/* Multi-colour particle glow — fermion blue left, boson violet right */
.standard-model-ref::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 45% 70% at 25% 50%, rgba(67, 97, 238, 0.08) 0%, transparent 65%),
    radial-gradient(ellipse 45% 70% at 75% 50%, rgba(124, 77, 255, 0.08) 0%, transparent 65%);
  pointer-events: none;
}

/* Thin category rainbow bars — top only, mirroring the hero strip */
.standard-model-ref::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--cat-primordial) 0%,
    var(--cat-cognitive)  14.3%,
    var(--cat-vital)      28.6%,
    var(--cat-social)     42.9%,
    var(--cat-active)     57.1%,
    var(--cat-strategic)  71.4%,
    var(--cat-sacred)     85.7%,
    var(--cat-abundant)   100%
  );
  opacity: 0.55;
  pointer-events: none;
}

.standard-model-ref__inner {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.standard-model-ref__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 0;
}

.standard-model-ref__img {
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: 14px;
  /* Image is already dark — subtle lift + saturate only */
  filter: brightness(0.97) contrast(1.05) saturate(1.1);
  border: 1px solid rgba(124, 77, 255, 0.25);
  box-shadow:
    0 0 0 1px rgba(67, 97, 238, 0.12),
    0 0 40px rgba(124, 77, 255, 0.18),
    0 8px 48px rgba(0, 0, 0, 0.65),
    0 2px 10px rgba(0, 0, 0, 0.5);
  transition: filter 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

.standard-model-ref__img:hover {
  filter: brightness(1.03) contrast(1.07) saturate(1.18);
  box-shadow:
    0 0 0 1px rgba(124, 77, 255, 0.35),
    0 0 64px rgba(124, 77, 255, 0.3),
    0 12px 60px rgba(0, 0, 0, 0.55),
    0 4px 16px rgba(67, 97, 238, 0.25);
  transform: translateY(-4px);
}

.standard-model-ref__caption {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--text-3);
  text-align: center;
  letter-spacing: 0.03em;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border-1);
}

/* ══════════════════════════════════════════
   TENFOLD TOPOLOGICAL TABLE
══════════════════════════════════════════ */
.tenfold-ref {
  position: relative;
  background: linear-gradient(160deg, var(--surface-1) 0%, var(--bg) 55%, var(--surface-2) 100%);
  border-top: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-2);
  padding: 48px 24px 52px;
  overflow: hidden;
}

/* Violet-teal dual glow — evokes quantum topology */
.tenfold-ref::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 70% at 30% 50%, rgba(94, 114, 180, 0.09) 0%, transparent 65%),
    radial-gradient(ellipse 55% 70% at 70% 50%, rgba(45, 158, 107, 0.07) 0%, transparent 65%);
  pointer-events: none;
}

/* Thin dual-colour top bar — strategic + active category colours */
.tenfold-ref::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    var(--cat-strategic) 0%,
    var(--cat-cognitive) 35%,
    var(--cat-sacred)    65%,
    var(--cat-active)    100%
  );
  opacity: 0.6;
  pointer-events: none;
}

.tenfold-ref__inner {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.tenfold-ref__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  margin: 0;
}

.tenfold-ref__img {
  width: 100%;
  max-width: 680px;
  height: auto;
  border-radius: 12px;
  /*
    B&W table: invert flips white→dark, black→white text.
    Slight violet hue-rotate tints the result to match the app palette.
    saturate stays low — the table is monochrome by design.
  */
  filter: invert(1) sepia(0.2) hue-rotate(200deg) saturate(1.3) brightness(0.87) contrast(1.1);
  border: 1px solid rgba(94, 114, 180, 0.3);
  box-shadow:
    0 0 0 1px rgba(94, 114, 180, 0.1),
    0 0 36px rgba(94, 114, 180, 0.16),
    0 6px 48px rgba(0, 0, 0, 0.65),
    0 2px 10px rgba(0, 0, 0, 0.5);
  transition: filter 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

.tenfold-ref__img:hover {
  filter: invert(1) sepia(0.18) hue-rotate(200deg) saturate(1.5) brightness(0.93) contrast(1.12);
  box-shadow:
    0 0 0 1px rgba(94, 114, 180, 0.35),
    0 0 60px rgba(94, 114, 180, 0.28),
    0 10px 56px rgba(0, 0, 0, 0.55),
    0 4px 16px rgba(45, 158, 107, 0.18);
  transform: translateY(-3px);
}

.tenfold-ref__caption {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--text-3);
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.65;
  max-width: 600px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border-1);
}

.footer {
  border-top: 1px solid var(--border-1);
  padding: 18px 24px;
  text-align: center;
}

.footer p {
  font-size: 12px;
  color: var(--text-3);
}

.footer a {
  color: var(--primary-lt);
  text-decoration: none;
}

.footer a:hover { text-decoration: underline; }

.footer__sub {
  margin-top: 5px;
  font-size: 11px;
  color: var(--text-3);
  opacity: 0.6;
}

.footer__launch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 8px 16px 8px 12px;
  border: 1px solid #2e3a58;
  border-radius: 8px;
  background: rgba(67, 97, 238, 0.07);
  text-decoration: none !important;
  transition: border-color 0.2s, background 0.2s;
}

.footer__launch:hover {
  border-color: #4361ee;
  background: rgba(67, 97, 238, 0.14);
  text-decoration: none !important;
}

.footer__launch-glyph {
  font-size: 20px;
  font-weight: 700;
  font-family: 'Times New Roman', Georgia, serif;
  color: #4361ee;
  line-height: 1;
  opacity: 0.9;
}

.footer__launch-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.footer__launch-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.footer__launch-url {
  font-size: 9.5px;
  color: #4361ee;
  opacity: 0.8;
  letter-spacing: 0.01em;
}

.footer__launch-arrow {
  font-size: 14px;
  color: #4361ee;
  opacity: 0.7;
  margin-left: 4px;
}

/* ══════════════════════════════════════════
   TOOLTIP
══════════════════════════════════════════ */
.tooltip {
  position: fixed;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--text);
  pointer-events: none;
  z-index: 500;
  white-space: nowrap;
  transition: opacity 0.08s;
}

/* ════════════════════════════════════════════════════════════
   IFA NETWORKS
════════════════════════════════════════════════════════════ */

.ifa-net__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ifa-net__card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 140px;
  transition: border-color 0.18s, background 0.18s, transform 0.15s;
}
.ifa-net__card:hover {
  border-color: var(--border-2);
  background: var(--surface-3);
  transform: translateY(-2px);
}
.ifa-net__card--odu {
  background: var(--surface-2);
  border-color: var(--border-2);
}

.ifa-net__badge {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  align-self: flex-start;
}
.ifa-net__badge--ifa   { background: rgba(245,197,24,0.12);  color: var(--gold); }
.ifa-net__badge--orisa { background: rgba(255,255,255,0.05); color: var(--text-2); }
.ifa-net__badge--trad  { background: rgba(45,158,107,0.14);  color: #4eca8b; }

.ifa-net__card--ejiodi { border-color: rgba(45,158,107,0.2); }
.ifa-net__card--ejiodi:hover { border-color: rgba(45,158,107,0.5); background: rgba(45,158,107,0.05); }

.ifa-net__name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 2px;
}

.ifa-net__sub {
  font-size: 0.68rem;
  color: var(--text-3);
}

/* ════════════════════════════════════════════════════════════
   WIKIPEDIA KNOWLEDGE INTEGRATION
════════════════════════════════════════════════════════════ */

.wiki-loading {
  display: flex;
  gap: 6px;
  padding: 12px 0;
}

.wiki-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  animation: wikiPulse 1.1s ease-in-out infinite;
}

@keyframes wikiPulse {
  0%, 100% { opacity: 0.25; transform: scale(0.75); }
  50%       { opacity: 1;    transform: scale(1); }
}
.wiki-dot:nth-child(2) { animation-delay: 0.2s; }
.wiki-dot:nth-child(3) { animation-delay: 0.4s; }

.wiki-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.wiki-card {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.wiki-card:hover {
  border-color: var(--border-2);
  background: var(--surface-3);
  transform: translateY(-2px);
}

.wiki-card__thumb {
  width: 100%;
  height: 88px;
  object-fit: cover;
  display: block;
  opacity: 0.82;
}

.wiki-card__body {
  padding: 10px 12px 12px;
  flex: 1;
}

.wiki-card__title {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}

.wiki-card__extract {
  font-size: 0.71rem;
  color: var(--text-2);
  line-height: 1.55;
}

.wiki-empty {
  font-size: 0.75rem;
  color: var(--text-3);
  padding: 8px 0;
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */

/* ── Tablet (≤ 900px) ── */
@media (max-width: 900px) {
  :root {
    --cell:     50px;
    --header-h: 80px;
  }

  .header__stats    { display: none; }
  .info-grid        { grid-template-columns: 1fr; }

  .header__topbar-title { font-size: 13px; }

  /* Intro stats: 2 × 2 on tablet */
  .ifapt-intro__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .ifapt-intro__divider:nth-child(2) { display: none; }

  .ifapt-intro__stat { padding: 14px 20px; }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
  :root {
    --header-h: 66px;
  }

  /* === HEADER === */
  .header__topbar { height: 28px; }
  .header__topbar-title { font-size: 11px; letter-spacing: 0.08em; }
  .header__inner  { padding: 0 12px; }
  .header__logo   { width: 40px; height: 40px; }
  .header__logo-img { width: 34px; height: 34px; }
  .header__left   { gap: 8px; }
  .header__title h1 { font-size: 15px; }
  .header__title p  { font-size: 10px; }
  .header__opon-bg  { display: none; }

  /* === HERO === */
  .ifa-hero { height: 88px; }
  .ifa-hero__palm--l2,
  .ifa-hero__palm--r2 { display: none; }

  /* === PERIODIC TABLE: horizontal scroll === */
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    /* Subtle scroll hint */
    background: linear-gradient(to right, transparent 85%, rgba(0,54,247,0.08) 100%) no-repeat right;
  }
  .pt-grid {
    min-width: 540px;
    width: max-content;
    gap: 2px;
  }

  /* === CONTROLS === */
  .controls { padding: 8px 12px; }
  .controls__inner {
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 1;
    padding-bottom: 2px;
  }
  .chips::-webkit-scrollbar { display: none; }
  .search__input { width: 140px; }
  .search__input:focus { width: 160px; }

  /* === MAIN === */
  .main { padding: 14px 12px 36px; }
  .pt-table-headers { display: none; }

  /* === INTRO === */
  .ifapt-intro { padding: 32px 16px 36px; }
  .ifapt-intro__stats {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .ifapt-intro__stat { padding: 12px 14px; }
  .ifapt-intro__stat-num { font-size: 1.6rem; }

  /* === GALLERY === */
  .ifapt-gallery { padding: 32px 16px 40px; }
  .ifapt-gallery__row--duo,
  .ifapt-gallery__row--trio { grid-template-columns: 1fr; }

  /* === SECTIONS === */
  .ifabok-banner  { padding: 24px 14px 28px; }
  .ifatom-intro   { padding: 28px 16px; }
  .ptoe-diagrams  { padding: 28px 16px 36px; }
  .mendeleev-ref  { padding: 28px 16px 32px; }
  .standard-model-ref { padding: 28px 16px 32px; }
  .tenfold-ref    { padding: 28px 16px 32px; }

  /* === MODAL === */
  .overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    animation: modalInMobile 0.26s cubic-bezier(0.34, 1.1, 0.64, 1);
  }
  @keyframes modalInMobile {
    from { opacity: 0; transform: translateY(60px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .modal__header { padding: 20px 18px 0; gap: 14px; }
  .modal__body   { padding: 16px 18px 24px; }
  .modal__title h2 { font-size: 18px; }
  .modal__badge { width: 56px; min-height: 56px; }

  /* === DUAL LAWS === */
  .dual-laws { padding: 12px 16px; }

  /* === FOOTER === */
  .footer { padding: 16px 16px; }
}

/* ── Small mobile (≤ 480px) ── */
@media (max-width: 480px) {
  :root { --header-h: 56px; }

  /* Hide topbar entirely — more room for content */
  .header__topbar { display: none; }
  .header__inner  { flex: 1; height: 56px; }

  .header__title h1 { font-size: 14px; }
  .header__title p  { display: none; }

  /* Hero strip compact */
  .ifa-hero { height: 72px; }
  .ifa-hero__palm--l1,
  .ifa-hero__palm--r1 { height: 100px; }

  /* Table: smaller gap, tighter */
  .pt-grid { gap: 2px; min-width: 480px; }
  .cell__name { font-size: 6px; }
  .cell__glyph-pri { font-size: 11px; }
  .cell__glyph-sec { font-size: 6.5px; }
  .cell__num  { font-size: 7px; }

  /* Chips hidden — too narrow; use search + view toggle only */
  .chips        { display: none; }
  .search__input { width: 100%; }
  .controls__inner { gap: 6px; flex-wrap: nowrap; overflow-x: visible; }
  .search { flex: 1; }

  /* Intro stats: 2-col stays, tighter */
  .ifapt-intro__stat { padding: 10px 10px; }
  .ifapt-intro__stat-num { font-size: 1.4rem; }
  .ifapt-intro__stat-lbl { font-size: 0.62rem; }

  /* Card list: 1 col */
  .list-grid { grid-template-columns: 1fr; }

  /* Modal: sheet style */
  .modal__close { top: 10px; right: 10px; }
  .ifabit { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ── Very small (≤ 360px) ── */
@media (max-width: 360px) {
  .main { padding: 10px 8px 28px; }
  .controls { padding: 6px 8px; }
  .pt-grid { min-width: 420px; gap: 1px; }
  .cell { border-radius: 4px; }
}
