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

:root {
  --ink: #0a0a0a;
  --ink2: #444;
  --ink3: #767676;
  --surface: #fafaf8;
  --s2: #f2f0eb;
  --s3: #e8e5de;
  --accent: #e8562a;
  --ah: #c94420;
  --teal: #00bdd6;
  --navy: #14203b;
  --border: rgba(0, 0, 0, 0.08);
  --b2: rgba(0, 0, 0, 0.14);
  --r: 4px;
  --rl: 10px;
  --max: 1140px;
  --read: 760px;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Geist', system-ui, sans-serif
}

html { scroll-behavior: smooth }
body { font-family: var(--sans); background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased }

/* HERO */
.di-hero { background: var(--navy); color: #fff; padding: 5rem 2rem 4rem }
.di-hero-i { max-width: var(--max); margin: 0 auto }
.di-eyebrow { font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(232, 86, 42, 0.95); margin-bottom: 1.1rem }
.di-h1 { font-family: var(--serif); font-size: 4rem; font-weight: 400; line-height: 1.05; letter-spacing: -0.015em; margin-bottom: 1.4rem }
.di-sub { font-size: 1.12rem; color: rgba(255, 255, 255, 0.82); line-height: 1.7; max-width: 680px }
.di-hero-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 2.2rem }
.di-hero-link { font-size: 0.82rem; color: rgba(255, 255, 255, 0.72); text-decoration: none; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 100px; padding: 0.45rem 1rem; transition: all 0.18s }
.di-hero-link:hover { color: #fff; border-color: var(--accent); background: rgba(232, 86, 42, 0.14) }

/* BODY */
.di-body { max-width: var(--max); margin: 0 auto; padding: 0 2rem }
.di-section { padding: 3.8rem 0; border-bottom: 1px solid var(--border) }
.di-section > p { max-width: var(--read); font-size: 1.02rem; color: var(--ink2); line-height: 1.78; margin-bottom: 1.1rem }
.di-section h2 { font-family: var(--serif); font-size: 2.1rem; font-weight: 400; line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 1.2rem; max-width: var(--read) }
.di-section h3 { font-size: 1.05rem; font-weight: 500; color: var(--ink); margin-bottom: 0.45rem }

/* DEFINITION BLOCK */
.di-defn { background: var(--navy); border-radius: var(--rl); padding: 2rem 2.2rem; margin-bottom: 2rem; max-width: var(--read); border-left: 3px solid var(--teal) }
.di-defn-label { font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--teal); margin-bottom: 0.9rem }
.di-defn-text { font-family: var(--serif); font-size: 1.5rem; line-height: 1.4; color: #fff; letter-spacing: -0.005em }
.di-lead { font-size: 1.12rem !important; color: var(--ink) !important }
.di-provenance { background: var(--s2); border-radius: var(--r); padding: 1.1rem 1.3rem; font-size: 0.92rem !important; color: var(--ink2) !important; max-width: var(--read); margin-top: 1.6rem }
.di-provenance strong { color: var(--ink); font-weight: 500 }

/* FIVE LAYERS */
.di-layers { list-style: none; counter-reset: layer; max-width: var(--read); margin: 2rem 0 1.6rem }
.di-layers li { counter-increment: layer; position: relative; padding: 1.2rem 0 1.2rem 3.6rem; border-top: 1px solid var(--border) }
.di-layers li:last-child { border-bottom: 1px solid var(--border) }
.di-layers li::before { content: counter(layer); position: absolute; left: 0; top: 1.15rem; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--s2); color: var(--ink3); font-size: 0.85rem; font-weight: 500; display: flex; align-items: center; justify-content: center }
.di-layers p { font-size: 0.98rem; color: var(--ink2); line-height: 1.72 }
.di-note { font-size: 0.95rem !important; color: var(--ink3) !important; margin-top: 1.4rem }
.di-note a, .di-section p a { color: var(--ah); text-decoration: none; border-bottom: 1px solid rgba(201, 68, 32, 0.3); transition: border-color 0.18s }
.di-note a:hover, .di-section p a:hover { border-bottom-color: var(--ah) }

/* COMPARISON TABLE */
.di-table-wrap { overflow-x: auto; margin: 2rem 0 1.6rem; border: 1px solid var(--border); border-radius: var(--rl); background: #fff }
.di-table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 0.88rem }
.di-table th, .di-table td { text-align: left; padding: 0.95rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: top; line-height: 1.5 }
.di-table thead th { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink3); font-weight: 500; background: var(--s2); border-bottom: 1px solid var(--b2) }
.di-table tbody th { font-weight: 500; color: var(--ink); width: 15% }
.di-table td { color: var(--ink2) }
.di-table tbody tr:last-child th, .di-table tbody tr:last-child td { border-bottom: none }
.di-table .di-col-hl { background: rgba(232, 86, 42, 0.05); color: var(--ink) }
.di-table thead .di-col-hl { background: rgba(232, 86, 42, 0.12); color: var(--ah) }

/* SELF TEST */
.di-test { max-width: var(--read); margin: 1.8rem 0 2.4rem; padding-left: 1.4rem }
.di-test li { font-size: 1rem; color: var(--ink2); line-height: 1.72; margin-bottom: 0.9rem; padding-left: 0.4rem }
.di-test li::marker { color: var(--accent); font-weight: 500 }

/* DIAGNOSTIC CTA */
.di-cta { display: flex; align-items: center; gap: 1.8rem; flex-wrap: wrap; background: var(--s2); border: 1px solid var(--border); border-radius: var(--rl); padding: 1.7rem 1.9rem; max-width: var(--read) }
.di-cta-text { flex: 1; min-width: 260px }
.di-cta-label { font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink3); margin-bottom: 0.5rem }
.di-cta-body { font-size: 0.95rem; color: var(--ink2); line-height: 1.65 }
.di-cta-btn { flex-shrink: 0; background: var(--accent); color: #fff; text-decoration: none; padding: 0.78rem 1.4rem; border-radius: var(--r); font-size: 0.88rem; font-weight: 500; transition: background 0.18s }
.di-cta-btn:hover { background: var(--ah) }

/* IMPLEMENTATIONS */
.di-impl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.3rem; margin-top: 2rem }
.di-impl { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: var(--rl); padding: 1.6rem; text-decoration: none; color: inherit; transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s }
.di-impl:hover { border-color: var(--b2); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05) }
.di-impl:hover .di-impl-go { color: var(--accent) }
.di-impl-label { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink3); margin-bottom: 0.6rem }
.di-impl h3 { font-family: var(--serif); font-size: 1.5rem; font-weight: 400; margin-bottom: 0.7rem }
.di-impl-body { font-size: 0.9rem; color: var(--ink2); line-height: 1.68; flex: 1; margin-bottom: 1.2rem }
.di-impl-go { font-size: 0.85rem; color: var(--ink3); transition: color 0.18s }

/* READING LIBRARY */
.di-reading { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin-top: 2rem }
.di-read-group h3 { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink3); font-weight: 500; padding-bottom: 0.7rem; margin-bottom: 0.9rem; border-bottom: 1px solid var(--border) }
.di-read-group ul { list-style: none }
.di-read-group li { margin-bottom: 0.8rem }
.di-read-group a { font-size: 0.92rem; color: var(--ink); text-decoration: none; line-height: 1.5; transition: color 0.18s }
.di-read-group a:hover { color: var(--ah) }

/* FAQ */
#faq h3 { font-size: 1.02rem; font-weight: 500; margin-top: 1.8rem; margin-bottom: 0.5rem; max-width: var(--read) }
#faq h3:first-of-type { margin-top: 0 }

/* CLOSING */
.di-close { background: var(--navy); border-radius: var(--rl); padding: 3.4rem 2.4rem; margin: 3.8rem 0 4.5rem; color: #fff }
.di-close-h { font-family: var(--serif); font-size: 2.2rem; font-weight: 400; line-height: 1.18; letter-spacing: -0.01em; margin-bottom: 1.1rem; max-width: 620px }
.di-close-body { font-size: 1rem; color: rgba(255, 255, 255, 0.78); line-height: 1.72; max-width: 620px; margin-bottom: 2rem }
.di-close-btns { display: flex; gap: 0.8rem; flex-wrap: wrap }
.di-btn-p { background: var(--accent); color: #fff; text-decoration: none; padding: 0.85rem 1.6rem; border-radius: var(--r); font-size: 0.9rem; font-weight: 500; transition: background 0.18s }
.di-btn-p:hover { background: var(--ah) }
.di-btn-s { background: transparent; color: rgba(255, 255, 255, 0.82); text-decoration: none; padding: 0.85rem 1.6rem; border: 1px solid rgba(255, 255, 255, 0.24); border-radius: var(--r); font-size: 0.9rem; transition: all 0.18s }
.di-btn-s:hover { border-color: rgba(255, 255, 255, 0.6); color: #fff }

/* RESPONSIVE */
@media (max-width: 900px) {
  .di-impl-grid, .di-reading { grid-template-columns: 1fr }
  .di-h1 { font-size: 3rem }
}

@media (max-width: 640px) {
  .di-hero { padding: 3.5rem 1.3rem 3rem }
  .di-body { padding: 0 1.3rem }
  .di-h1 { font-size: 2.4rem }
  .di-sub { font-size: 1rem }
  .di-section h2 { font-size: 1.7rem }
  .di-defn { padding: 1.5rem 1.5rem }
  .di-defn-text { font-size: 1.25rem }
  .di-close { padding: 2.4rem 1.5rem }
  .di-close-h { font-size: 1.75rem }
  .di-close-btns a { width: 100%; text-align: center }
}

/* FOOTER — footer.js injects the link content, not the layout;
   every page carries its own copy of this block */
footer { background: var(--navy); color: rgba(255, 255, 255, 0.45); padding: 3.5rem 2rem 2rem }
.foot-i { max-width: var(--max); margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 3rem }
.foot-logo { font-family: var(--serif); font-size: 1.3rem; color: #fff; text-decoration: none }
.foot-logo span { color: var(--accent) }
.foot-tag { font-size: 0.85rem; color: rgba(255, 255, 255, 0.55); margin-top: 0.6rem; line-height: 1.55; max-width: 280px }
.foot-social { display: flex; gap: 1rem; margin-top: 1.4rem; flex-wrap: wrap }
.foot-social-link { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: rgba(255, 255, 255, 0.65); text-decoration: none }
.foot-social-link:hover { color: var(--accent) }
.foot-col h5 { font-size: 0.8rem; color: #fff; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 1rem; font-weight: 500 }
.foot-col ul { list-style: none }
.foot-col li { margin-bottom: 0.55rem }
.foot-col a { font-size: 0.85rem; color: rgba(255, 255, 255, 0.6); text-decoration: none }
.foot-col a:hover { color: var(--accent) }
.foot-btm { max-width: var(--max); margin: 2.5rem auto 0; padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; justify-content: space-between; font-size: 0.78rem; color: rgba(255, 255, 255, 0.45); flex-wrap: wrap; gap: 1rem }
.foot-btm a { color: rgba(255, 255, 255, 0.55); text-decoration: none }
.foot-btm a:hover { color: rgba(255, 255, 255, 0.85) }

@media (max-width: 900px) {
  .foot-i, .foot-i--wide { grid-template-columns: 1fr 1fr; gap: 2rem }
}

@media (max-width: 640px) {
  .foot-i, .foot-i--wide { grid-template-columns: 1fr }
}
