/* ===========================================================
   AGI Risk — agirisk.com
   Clean / scientific reference design
   =========================================================== */

:root {
  --ink:        #0e1726;   /* near-black navy text */
  --ink-soft:   #38465c;   /* secondary text */
  --ink-mute:   #64748b;   /* muted / captions */
  --line:       #e2e8f0;   /* hairlines */
  --line-soft:  #eef2f7;
  --bg:         #ffffff;
  --bg-tint:    #f7f9fc;   /* section tint */
  --bg-tint2:   #eef3fa;
  --blue:       #1d4ed8;   /* primary accent */
  --blue-dark:  #1e3a8a;
  --blue-soft:  #3b82f6;
  --blue-wash:  #eaf1fe;
  --red:        #c0392b;   /* danger / severity */
  --red-wash:   #fbecea;
  --amber:      #b45309;
  --amber-wash: #fdf4e7;
  --green:      #15803d;
  --green-wash: #e9f6ee;

  --maxw: 1180px;
  --readw: 760px;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --radius: 10px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.05);
  --shadow-lg: 0 4px 12px rgba(15,23,42,.08), 0 24px 48px rgba(15,23,42,.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--blue-wash); }

img { max-width: 100%; display: block; }

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

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.readable { max-width: var(--readw); }

section { padding: 72px 0; }
section.tint { background: var(--bg-tint); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }

.eyebrow {
  font-size: 12.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--blue); margin: 0 0 14px;
}
.eyebrow.muted { color: var(--ink-mute); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { color: var(--ink); line-height: 1.18; font-weight: 700; letter-spacing: -.012em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); margin: 0 0 .5em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); margin: 0 0 .6em; }
h3 { font-size: 1.28rem; margin: 2em 0 .5em; }
h4 { font-size: 1.05rem; margin: 1.6em 0 .4em; }
p  { margin: 0 0 1.1em; }
.lead { font-size: 1.24rem; line-height: 1.6; color: var(--ink-soft); }

.prose { }
.prose p, .prose li { color: var(--ink-soft); }
.prose h2 { margin-top: 1.6em; padding-top: .2em; }
.prose h3 { color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.25em; margin: 0 0 1.2em; }
.prose li { margin: .35em 0; }
.prose strong { color: var(--ink); }

.muted { color: var(--ink-mute); }
.small { font-size: .9rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; font-size: 1.06rem; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; flex: none; }
.brand small { display:block; font-size:10.5px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color: var(--ink-mute); margin-top:-2px;}

.nav-links { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 8px 11px; border-radius: 7px;
  color: var(--ink-soft); font-size: 14.5px; font-weight: 500;
}
.nav-links a:hover { background: var(--bg-tint); color: var(--ink); text-decoration: none; }
.nav-links a.active { color: var(--blue); font-weight: 600; }
.nav-cta {
  margin-left: 8px; background: var(--blue); color: #fff !important;
  padding: 8px 16px !important; border-radius: 7px; font-weight: 600 !important;
}
.nav-cta:hover { background: var(--blue-dark); text-decoration: none !important; }

.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; width: 42px; height: 38px; cursor: pointer; align-items: center; justify-content: center; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: ""; display: block; width: 18px; height: 2px; background: var(--ink); position: relative; transition: .2s;
}
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after  { position: absolute; top: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 12px 22px; border-radius: 9px; border: 1px solid transparent;
  transition: transform .06s ease, background .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-lg { padding: 15px 30px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Hero ---------- */
.hero { padding: 90px 0 70px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 80% at 80% -10%, var(--blue-wash) 0%, transparent 60%),
    radial-gradient(50% 60% at 0% 110%, #f0f5ff 0%, transparent 55%);
}
.hero h1 { max-width: 16ch; }
.hero .lead { max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }

/* ---------- Stat band ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: #fff; padding: 26px 22px; }
.stat .num { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; color: var(--blue-dark); }
.stat .lbl { font-size: 13.5px; color: var(--ink-mute); margin-top: 4px; line-height:1.45; }
.stat .src { font-size: 11.5px; color: var(--ink-mute); margin-top: 6px; }
.stat .src a { color: var(--ink-mute); text-decoration: underline; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card.link:hover { border-color: var(--blue-soft); box-shadow: var(--shadow); transform: translateY(-2px); }
.card h3 { margin: 0 0 .4em; font-size: 1.16rem; }
.card p { color: var(--ink-soft); margin: 0; font-size: .97rem; }
.card .kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 10px; }
.card .more { display:inline-block; margin-top: 14px; font-weight: 600; font-size: 14px; }

.card-num { width: 34px; height: 34px; border-radius: 8px; background: var(--blue-wash); color: var(--blue-dark); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 15px; margin-bottom: 14px; }

/* topic cards on home */
.topic { display: flex; flex-direction: column; }
.topic .more { margin-top: auto; }

/* ---------- Concept blocks (taxonomy) ---------- */
.concept { border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 32px; margin: 22px 0; background: #fff; scroll-margin-top: 84px; }
.concept > h3 { margin-top: 0; display: flex; align-items: baseline; gap: 12px; }
.concept .tag-row { margin: 0 0 14px; }
.concept .ex { background: var(--bg-tint); border-left: 3px solid var(--blue-soft); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 14px 0; font-size: .95rem; }
.concept .ex strong { color: var(--blue-dark); }
.sources { margin: 16px 0 0; padding: 14px 0 0; border-top: 1px dashed var(--line); }
.sources .sources-h { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 8px; }
.sources ul { list-style: none; padding: 0; margin: 0; }
.sources li { font-size: 13.5px; color: var(--ink-mute); margin: 5px 0; padding-left: 16px; position: relative; }
.sources li::before { content: "→"; position: absolute; left: 0; color: var(--blue-soft); }

/* ---------- Tags / pills ---------- */
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 10px; border-radius: 100px; }
.tag-blue { background: var(--blue-wash); color: var(--blue-dark); }
.tag-red { background: var(--red-wash); color: var(--red); }
.tag-amber { background: var(--amber-wash); color: var(--amber); }
.tag-green { background: var(--green-wash); color: var(--green); }
.tag-gray { background: var(--bg-tint2); color: var(--ink-soft); }

/* ---------- Severity meter ---------- */
.sev { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.sev .dots { display: inline-flex; gap: 3px; }
.sev .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.sev .dot.on { background: var(--red); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; background: #fff; min-width: 560px; }
table.data th, table.data td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data thead th { background: var(--bg-tint); font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-mute); font-weight: 700; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--bg-tint); }
table.data td.num { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Callout / note ---------- */
.note { border-radius: var(--radius); padding: 18px 22px; margin: 22px 0; font-size: .96rem; border: 1px solid var(--line); background: var(--bg-tint); }
.note.flag { background: var(--amber-wash); border-color: #f4e2c4; color: #6b4a12; }
.note.key  { background: var(--blue-wash); border-color: #cfe0fd; }
.note .note-h { font-weight: 700; color: var(--ink); display: block; margin-bottom: 4px; }

/* quote */
.pullquote { font-family: var(--serif); font-size: clamp(1.3rem, 2.4vw, 1.7rem); line-height: 1.4; color: var(--ink); border-left: 4px solid var(--blue); padding: 6px 0 6px 26px; margin: 30px 0; }
.pullquote cite { display: block; font-family: var(--sans); font-size: .95rem; font-style: normal; color: var(--ink-mute); margin-top: 14px; }

/* ---------- TOC / side nav ---------- */
.with-toc { display: grid; grid-template-columns: 240px 1fr; gap: 56px; align-items: start; }
.toc { position: sticky; top: 84px; font-size: 14px; }
.toc .toc-h { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 12px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc li a { display: block; padding: 6px 0 6px 16px; margin-left: -2px; color: var(--ink-soft); border-left: 2px solid transparent; line-height:1.35; }
.toc li a:hover { color: var(--blue); text-decoration: none; }
.toc li a.active { color: var(--blue); border-left-color: var(--blue); font-weight: 600; }

/* ---------- Directory ---------- */
.dir-group { margin: 38px 0; }
.dir-list { display: grid; gap: 14px; }
.dir-item { display: grid; grid-template-columns: 220px 1fr; gap: 22px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background:#fff; }
.dir-item:hover { border-color: var(--blue-soft); }
.dir-item .dn { font-weight: 700; color: var(--ink); }
.dir-item .dn a { color: var(--ink); }
.dir-item .dn .durl { display: block; font-size: 12.5px; font-weight: 500; margin-top: 4px; word-break: break-word; }
.dir-item .dd { color: var(--ink-soft); font-size: .95rem; }

/* ---------- Glossary ---------- */
.glossary-search { width: 100%; max-width: 420px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; font-family: inherit; }
.glossary-search:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-wash); }
.gloss-list { margin-top: 30px; }
.gloss { padding: 18px 0; border-bottom: 1px solid var(--line-soft); scroll-margin-top: 84px; }
.gloss dt { font-weight: 700; color: var(--ink); font-size: 1.06rem; }
.gloss dd { margin: 6px 0 0; color: var(--ink-soft); }
.alpha-index { display: flex; flex-wrap: wrap; gap: 4px; margin: 20px 0 0; }
.alpha-index a { font-size: 13px; font-weight: 600; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--bg-tint); color: var(--ink-soft); }
.alpha-index a:hover { background: var(--blue); color: #fff; text-decoration: none; }

/* ---------- FAQ ---------- */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-q { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; font-family: inherit; font-size: 1.12rem; font-weight: 600; color: var(--ink); padding: 22px 44px 22px 0; position: relative; }
.faq-q::after { content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-size: 1.6rem; font-weight: 400; color: var(--blue); transition: transform .2s; }
.faq-item.open .faq-q::after { content: "−"; }
.faq-a { display: none; padding: 0 40px 24px 0; }
.faq-item.open .faq-a { display: block; }
.faq-a p { color: var(--ink-soft); }

/* ---------- Forms ---------- */
.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 15px; color: var(--ink); background: #fff;
}
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-wash); }
.field .hint { font-size: 12.5px; color: var(--ink-mute); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- CTA band ---------- */
.cta-band { background: linear-gradient(135deg, var(--blue-dark), #0b1f4d); color: #fff; border-radius: 16px; padding: 56px; text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: #c7d6f4; max-width: 54ch; margin: 0 auto 28px; }
.cta-band .btn-ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.28); color: #fff; }
.cta-band .btn-ghost:hover { background: rgba(255,255,255,.16); color:#fff; }
.cta-band .btn-primary { background: #fff; color: var(--blue-dark); }
.cta-band .btn-primary:hover { background: #eaf1fe; }

/* ---------- Footer ---------- */
.site-footer { background: #0b1426; color: #9fb0c9; padding: 56px 0 30px; font-size: 14.5px; }
.site-footer a { color: #c4d2e8; }
.foot-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 40px; }
.foot-brand .brand { color: #fff; }
.foot-brand p { color: #8295b0; max-width: 34ch; margin-top: 14px; font-size: 14px; }
.foot-col h4 { color: #fff; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 14px; }
.foot-col ul { list-style: none; padding: 0; margin: 0; }
.foot-col li { margin: 9px 0; }
.foot-col a:hover { color: #fff; }
.foot-bottom { border-top: 1px solid #1c2a44; margin-top: 44px; padding-top: 22px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: #6f82a0; font-size: 13px; }
.foot-bottom .disclaimer { max-width: 70ch; }

/* ---------- Breadcrumb / page header ---------- */
.page-head { padding: 56px 0 10px; background: var(--bg-tint); border-bottom: 1px solid var(--line); }
.crumb { font-size: 13px; color: var(--ink-mute); margin-bottom: 14px; }
.crumb a { color: var(--ink-mute); }
.page-head h1 { margin-bottom: .3em; }
.page-head .lead { max-width: 70ch; }

/* ---------- Misc ---------- */
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; align-items:center; }
.updated { font-size: 12.5px; color: var(--ink-mute); }
.anchor-link { color: var(--ink-mute); font-weight: 400; font-size: .8em; opacity: 0; transition: opacity .15s; text-decoration: none; }
.concept:hover .anchor-link, h2:hover .anchor-link { opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .with-toc { grid-template-columns: 1fr !important; gap: 0; }
  .toc { display: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  section { padding: 52px 0; }
  .nav-links {
    position: fixed; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: #fff; border-bottom: 1px solid var(--line); padding: 12px 16px; gap: 2px;
    box-shadow: var(--shadow-lg); display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; }
  .nav-cta { margin: 6px 0 0; text-align: center; }
  .nav-toggle { display: inline-flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .dir-item { grid-template-columns: 1fr; gap: 6px; }
  .form-row { grid-template-columns: 1fr; }
  .cta-band { padding: 36px 24px; }
  .foot-grid { grid-template-columns: 1fr; }
  .concept { padding: 22px; }
  .hero { padding: 60px 0 40px; }
}
