/* =============================================================
   terms.css  —  Shared by terms.html and glossaries.html
   Works with leagal.css (loaded first) + netstuts.css variables.
   ============================================================= */

/* ── Reset leagal.css body overrides ────────────────────────── */
body {
  background: var(--bg-page, #f3f6fb);
  color: var(--text-main, #1f2937);
  padding: 0;
  font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.7;
}

/* ── Layout — centres content like other pages ───────────────── */
.ad-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-content {
  flex: 1 !important;
  width: 100% !important;
  max-width: 900px !important;
  margin: 0 auto !important;
  padding: 40px 16px 60px !important;
  box-sizing: border-box !important;
}

.wrapper {
  width: 100% !important;
  max-width: 900px !important;
  margin: 0 auto !important;
  padding: 0 16px !important;
  box-sizing: border-box !important;
}

/* ── Card container ──────────────────────────────────────────── */
.container {
  background: var(--bg-card, #ffffff);
  border-radius: 16px;
  padding: 44px 48px;
  box-shadow: var(--shadow-soft, 0 18px 40px rgba(0,0,0,0.08));
  border: 1px solid var(--border-soft, #e5e7eb);
  position: relative;
  overflow: hidden;
  max-width: 100%;
  margin: 0 auto;
}

/* Top accent bar */
.container::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 5px;
  background: linear-gradient(90deg, #2563eb, #4f46e5, #7c3aed);
}

/* ── Page H1 ─────────────────────────────────────────────────── */
h1 {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 800;
  color: var(--primary, #2563eb);
  margin: 0 0 1.6rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-align: center;
  position: relative;
  padding-bottom: 1rem;
}

h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 72px; height: 4px;
  background: linear-gradient(90deg, #2563eb, #4f46e5);
  border-radius: 2px;
}

/* ── Terms.html H2 section headings ──────────────────────────── */
.container > h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main, #1f2937);
  margin: 2rem 0 0.7rem;
  padding: 10px 14px;
  background: var(--bg-soft, #f8fafc);
  border-left: 4px solid var(--primary, #2563eb);
  border-radius: 0 8px 8px 0;
}

/* ── Terms.html paragraphs ───────────────────────────────────── */
.container > p {
  font-size: 0.975rem;
  color: var(--text-muted, #4b5563);
  margin: 0 0 1rem;
  line-height: 1.75;
}

.container > p:first-of-type {
  font-size: 1rem;
  color: var(--text-main, #1f2937);
  background: var(--info-bg, #f0f9ff);
  border-left: 4px solid var(--info-border, #0284c7);
  border-radius: 0 8px 8px 0;
  padding: 13px 16px;
  margin-bottom: 1.4rem;
}

p:has(strong:only-child) {
  margin-top: 1.8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft, #e5e7eb);
  font-size: 0.88rem;
  color: var(--text-light, #6b7280);
}

/* ── Alphabet TOC (glossaries.html) ─────────────────────────── */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 20px 0 8px;
  margin: 0 0 8px;
}

.toc a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-soft, #f8fafc);
  border: 1.5px solid var(--border-soft, #e5e7eb);
  color: var(--primary, #2563eb);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.18s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.toc a:hover {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
  text-decoration: none;
}

/* ── Letter section heading (H2 with id="A","B"...) ─────────── */
h2[id] {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary, #2563eb);
  margin: 2.8rem 0 1.2rem;
  padding: 12px 18px;
  background: linear-gradient(135deg, #eff6ff, #eef2ff);
  border-left: 5px solid var(--primary, #2563eb);
  border-radius: 0 10px 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

h2[id]:first-of-type {
  margin-top: 1.8rem;
}

/* ── Individual term card ────────────────────────────────────── */
.term {
  background: var(--bg-soft, #f8fafc);
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 14px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.term:hover {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 4px 16px rgba(37,99,235,0.08);
}

/* ── Term name (H3) ──────────────────────────────────────────── */
h3 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main, #1f2937);
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft, #e5e7eb);
}

/* ── Definition paragraph ────────────────────────────────────── */
p.definition {
  font-size: 0.92rem;
  color: var(--text-muted, #4b5563);
  margin: 0 0 8px;
  line-height: 1.7;
  max-width: 100% !important;
  width: 100% !important;
}

/* ── Usage paragraph ─────────────────────────────────────────── */
p.usage {
  font-size: 0.88rem;
  color: var(--text-light, #6b7280);
  margin: 0 0 6px;
  line-height: 1.6;
  padding-top: 6px;
  border-top: 1px dashed var(--border-soft, #e5e7eb);
  max-width: 100% !important;
  width: 100% !important;
}

/* ── Example paragraph ───────────────────────────────────────── */
p.example {
  font-size: 0.88rem;
  color: #065f46;
  background: #ecfdf5;
  border-left: 3px solid #10b981;
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  margin: 6px 0 0;
  line-height: 1.6;
  max-width: 100% !important;
  width: 100% !important;
}

/* ── Override netstuts.css p { max-width: 74ch } for all term content ── */
.term p,
.term p.definition,
.term p.usage,
.term p.example {
  max-width: 100% !important;
}

/* ── Strong ──────────────────────────────────────────────────── */
strong {
  font-weight: 700;
  color: var(--text-main, #1f2937);
}

/* ── Links ───────────────────────────────────────────────────── */
a {
  color: var(--primary, #2563eb);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-dark, #1d4ed8);
  text-decoration: underline;
}

/* ── Lists ───────────────────────────────────────────────────── */
ul, ol { margin: 0 0 1rem 1.2rem; padding: 0; }

li {
  font-size: 0.975rem;
  color: var(--text-muted, #4b5563);
  margin-bottom: 0.45rem;
  line-height: 1.7;
}

/* ── DARK MODE ───────────────────────────────────────────────── */
[data-theme="dark"] body, body.dark-mode {
  background: #0f1117; color: #e2e8f0;
}
[data-theme="dark"] .container, body.dark-mode .container {
  background: #1a1d27; border-color: #2d3148;
  box-shadow: 0 18px 40px rgba(0,0,0,0.5);
}
[data-theme="dark"] h1, body.dark-mode h1 { color: #60a5fa; }
[data-theme="dark"] .container > h2, body.dark-mode .container > h2 {
  color: #93c5fd; background: #0f172a; border-left-color: #3b82f6;
}
[data-theme="dark"] .container > p, body.dark-mode .container > p { color: #cbd5e1; }
[data-theme="dark"] .container > p:first-of-type, body.dark-mode .container > p:first-of-type {
  background: #0c1a2e; border-left-color: #3b82f6; color: #93c5fd;
}
[data-theme="dark"] p:has(strong:only-child), body.dark-mode p:has(strong:only-child) {
  border-top-color: #2d3148; color: #64748b;
}
/* TOC dark */
[data-theme="dark"] .toc a, body.dark-mode .toc a {
  background: #1e293b; border-color: #334155; color: #93c5fd;
}
[data-theme="dark"] .toc a:hover, body.dark-mode .toc a:hover {
  background: #2563eb; border-color: #2563eb; color: #ffffff;
}
/* Letter headings dark */
[data-theme="dark"] h2[id], body.dark-mode h2[id] {
  color: #93c5fd;
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  border-left-color: #3b82f6;
}
/* Term cards dark */
[data-theme="dark"] .term, body.dark-mode .term {
  background: #0f172a; border-color: #1e293b;
}
[data-theme="dark"] .term:hover, body.dark-mode .term:hover {
  border-color: #3b82f6; box-shadow: 0 4px 16px rgba(59,130,246,0.12);
}
[data-theme="dark"] h3, body.dark-mode h3 {
  color: #e2e8f0; border-bottom-color: #1e293b;
}
[data-theme="dark"] p.definition, body.dark-mode p.definition { color: #94a3b8; }
[data-theme="dark"] p.usage, body.dark-mode p.usage {
  color: #64748b; border-top-color: #1e293b;
}
[data-theme="dark"] p.example, body.dark-mode p.example {
  background: #052e16; border-left-color: #22c55e; color: #86efac;
}
[data-theme="dark"] strong, body.dark-mode strong { color: #f1f5f9; }
[data-theme="dark"] li, body.dark-mode li { color: #94a3b8; }
[data-theme="dark"] a, body.dark-mode a { color: #60a5fa; }
[data-theme="dark"] a:hover, body.dark-mode a:hover { color: #93c5fd; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  .main-content { padding: 20px 10px 40px; }
  .container { padding: 28px 18px; border-radius: 12px; }
  h1 { font-size: 1.5rem; }
  .toc a { width: 34px; height: 34px; font-size: 0.88rem; border-radius: 8px; }
  h2[id] { font-size: 1rem; padding: 10px 14px; }
  h3 { font-size: 0.92rem; }
  p.definition, p.usage, p.example { font-size: 0.85rem; }
  .term { padding: 14px 16px; }
}

@media (max-width: 480px) {
  .main-content { padding: 12px 8px 28px; }
  .container { padding: 22px 14px; }
  h1 { font-size: 1.3rem; }
  .toc { gap: 6px; }
  .toc a { width: 30px; height: 30px; font-size: 0.82rem; }
}
