@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@300;400;600;700&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,600;0,8..60,700;1,8..60,400&display=swap');

:root {
  --indigo:    #0c0e1e;
  --indigo-mid:#131628;
  --indigo-lt: #1e2240;
  --pearl:     #f0ece2;
  --pearl-lt:  #faf8f4;
  --ivory:     #e8e0cc;
  --text:      #c0c8d8;
  --muted:     #7880a0;
  --border:    rgba(255,255,255,.07);
  --bg-card:   rgba(255,255,255,.03);
  --blue:      #4870d8;
  --blue-lt:   #7098f0;
  --cyan:      #38b8d0;
  --cyan-lt:   #60d0e8;
  --gold:      #c8a840;
  --gold-lt:   #e8c860;
  --red:       #c04848;
  --red-lt:    #e07070;
  --green:     #38a878;
  --green-lt:  #60c898;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Josefin Sans', sans-serif;
  background: var(--indigo);
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
  letter-spacing: .01em;
}

/* Subtle dot grid */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ── HEADER ── */
.site-header {
  background: linear-gradient(165deg, #04040e 0%, #090b1c 35%, #10143a 70%, #161c4a 100%);
  border-bottom: 1px solid var(--border);
  overflow: hidden; position: relative;
}

.header-inner {
  max-width: 1020px; margin: auto;
  padding: 68px 44px 62px;
  position: relative; z-index: 1;
  display: flex; gap: 50px; align-items: center;
}

.header-eyebrow {
  font-size: 10px; font-weight: 600;
  letter-spacing: 5px; text-transform: uppercase;
  color: var(--blue-lt); margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px;
}
.header-eyebrow::before { content: ''; width: 28px; height: 1px; background: var(--blue); }

.header-title {
  font-family: 'Source Serif 4', serif;
  font-size: clamp(54px, 8.5vw, 96px);
  font-weight: 700; line-height: .88;
  letter-spacing: -3px; color: var(--pearl-lt);
  margin-bottom: 22px;
}

.header-subtitle {
  font-size: 15px; font-weight: 300; letter-spacing: .02em;
  color: var(--muted); max-width: 490px; line-height: 1.72;
}

/* Dental arch SVG */
.header-arch { width: 200px; flex-shrink: 0; opacity: .14; }

/* ── NAV ── */
.topic-nav {
  background: rgba(10,11,24,.93);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(18px);
}
.topic-nav-inner {
  max-width: 1020px; margin: auto; padding: 0 44px;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
}
.topic-nav-inner::-webkit-scrollbar { display: none; }
.nav-pill {
  flex-shrink: 0; padding: 13px 18px;
  font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .2s; white-space: nowrap;
  background: none; border-top: none; border-left: none; border-right: none;
}
.nav-pill:hover, .nav-pill.active { color: var(--blue-lt); border-bottom-color: var(--blue); }

/* ── LAYOUT ── */
.main { max-width: 1020px; margin: auto; padding: 56px 44px 90px; position: relative; z-index: 1; }

.section { margin-bottom: 68px; opacity: 0; transform: translateY(28px); transition: opacity .65s, transform .65s; }
.section.visible { opacity: 1; transform: none; }

.section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 5px; text-transform: uppercase;
  color: var(--blue); margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.section-title {
  font-family: 'Source Serif 4', serif;
  font-size: 28px; font-weight: 700;
  color: var(--pearl); margin-bottom: 18px;
}

p { color: var(--text); margin-bottom: 14px; }
p strong { color: var(--pearl); }
p em { color: var(--ivory); font-style: italic; }

/* ── DENTAL ARCH DIAGRAM ── */
.arch-diagram {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; margin: 28px 0;
}

.arch-row { display: flex; gap: 6px; justify-content: center; align-items: flex-end; }
.arch-row.lower { align-items: flex-start; margin-top: 4px; }

.tooth {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; transition: transform .2s;
}
.tooth:hover { transform: translateY(-4px); }
.tooth:hover .tooth-svg rect, .tooth:hover .tooth-svg path { fill: rgba(72,112,216,.3); stroke: var(--blue-lt); }
.arch-row.lower .tooth:hover { transform: translateY(4px); }

.tooth-svg { width: 28px; height: 32px; }
.tooth-svg rect, .tooth-svg path { fill: rgba(255,255,255,.06); stroke: rgba(255,255,255,.25); stroke-width: 1; transition: all .2s; }
.tooth.incisor .tooth-svg { width: 22px; }
.tooth.canine  .tooth-svg { width: 22px; height: 36px; }
.tooth.premolar .tooth-svg { width: 26px; }
.tooth.molar .tooth-svg { width: 32px; height: 28px; }

.tooth-label { font-size: 8px; color: var(--muted); letter-spacing: .5px; }
.arch-label {
  font-size: 10px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase;
  color: var(--blue); margin: 4px 0;
}
.arch-gap { height: 12px; border-left: 1px dashed rgba(255,255,255,.1); width: 1px; }
.arch-caption { font-size: 11px; color: var(--muted); margin-top: 10px; font-style: italic; }

/* ── CARDS ── */
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 16px; margin-top: 24px;
}
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 13px; padding: 22px;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); border-color: rgba(72,112,216,.3); box-shadow: 0 14px 36px rgba(0,0,0,.5); }

.card-tag {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  background: rgba(72,112,216,.15); color: var(--blue-lt); margin-bottom: 12px;
}
.card-tag-cyan  { background: rgba(56,184,208,.15); color: var(--cyan-lt); }
.card-tag-gold  { background: rgba(200,168,64,.15); color: var(--gold-lt); }
.card-tag-red   { background: rgba(192,72,72,.15); color: var(--red-lt); }
.card-tag-green { background: rgba(56,168,120,.15); color: var(--green-lt); }

.card-title {
  font-family: 'Source Serif 4', serif; font-size: 17px; font-weight: 600;
  color: var(--pearl); margin-bottom: 8px;
}
.card-body { font-size: 13.5px; color: var(--muted); line-height: 1.65; }

/* ── TOOTH STRUCTURE ── */
.tooth-structure {
  display: flex; gap: 30px; margin-top: 28px; align-items: flex-start;
}
.tooth-struct-svg { width: 130px; flex-shrink: 0; }
.tooth-parts { flex: 1; display: flex; flex-direction: column; gap: 0; }
.tooth-part {
  display: flex; gap: 14px; padding: 13px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start; transition: background .2s;
  border-radius: 6px; padding-left: 10px; padding-right: 10px;
}
.tooth-part:hover { background: rgba(72,112,216,.05); }
.tooth-part:last-child { border-bottom: none; }
.tp-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.tp-name { font-family: 'Source Serif 4', serif; font-size: 15px; font-weight: 600; color: var(--pearl); margin-bottom: 3px; }
.tp-info { font-size: 12.5px; color: var(--muted); }

/* ── ERUPTION TABLE ── */
.erupt-table { width: 100%; border-collapse: collapse; margin-top: 22px; font-size: 13.5px; }
.erupt-table th {
  text-align: left; padding: 11px 16px;
  font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--blue); border-bottom: 1px solid var(--border); font-weight: 700;
}
.erupt-table td {
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.04);
  color: var(--muted); vertical-align: top;
}
.erupt-table tr:hover td { background: rgba(72,112,216,.04); }
.erupt-table td:first-child { color: var(--pearl); font-weight: 600; font-family: 'Source Serif 4', serif; }

/* ── FORMULA BOX ── */
.formula-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px 28px; margin: 24px 0;
  text-align: center;
}
.formula-title { font-size: 10px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--blue); margin-bottom: 14px; }
.formula-content {
  font-family: 'Source Serif 4', serif; font-size: 22px; color: var(--pearl);
  letter-spacing: 2px; line-height: 1.8;
}
.formula-legend { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.8; }

/* ── PATHO TABLE ── */
.patho-table { width: 100%; border-collapse: collapse; margin-top: 22px; font-size: 13.5px; }
.patho-table th {
  text-align: left; padding: 11px 16px;
  font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--blue); border-bottom: 1px solid var(--border); font-weight: 700;
}
.patho-table td { padding: 13px 16px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: top; color: var(--muted); }
.patho-table tr:hover td { background: rgba(72,112,216,.04); }
.patho-table td:first-child { color: var(--pearl); font-weight: 600; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .5px; }
.badge-blue  { background: rgba(72,112,216,.15); color: var(--blue-lt); }
.badge-red   { background: rgba(192,72,72,.15); color: var(--red-lt); }
.badge-gold  { background: rgba(200,168,64,.15); color: var(--gold-lt); }
.badge-green { background: rgba(56,168,120,.15); color: var(--green-lt); }
.badge-cyan  { background: rgba(56,184,208,.15); color: var(--cyan-lt); }

/* ── HIGHLIGHT BOX ── */
.highlight-box {
  background: rgba(72,112,216,.08); border: 1px solid rgba(72,112,216,.22);
  border-radius: 10px; padding: 20px 24px; margin: 24px 0;
}
.highlight-box strong { color: var(--blue-lt); }

/* ── STATS ── */
.stats-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 52px; }
.stat-pill {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 24px;
  display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 130px;
}
.stat-num {
  font-family: 'Source Serif 4', serif; font-size: 30px; font-weight: 700;
  color: var(--blue-lt); line-height: 1;
}
.stat-label { font-size: 11.5px; color: var(--muted); font-weight: 400; letter-spacing: .3px; }

footer {
  text-align: center; padding: 28px; font-size: 11.5px; color: var(--muted);
  border-top: 1px solid var(--border); position: relative; z-index: 1;
}

@media (max-width: 680px) {
  .header-inner { flex-direction: column; padding: 40px 22px; gap: 20px; }
  .header-arch { display: none; }
  .main { padding: 30px 22px 60px; }
  .topic-nav-inner { padding: 0 22px; }
  .tooth-structure { flex-direction: column; }
  .tooth-struct-svg { width: 90px; margin: auto; }
}
