:root {
  --brand-blue: #2563EB;
  --brand-blue-dark: #1D4ED8;
  --brand-orange: #F97316;
  --brand-orange-dark: #EA580C;
  --brand-navy: #1E293B;
  --text-primary: #1F2937;
  --text-secondary: #64748B;
  --background: #FFFFFF;
  --surface: #F8FAFC;
  --surface-blue: #EFF6FF;
  --border: #E2E8F0;
  --success: #16A34A;
  --shadow: 0 10px 30px rgba(30, 41, 59, 0.06);
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --max: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand-blue-dark); text-decoration: none; }
a:hover { color: var(--brand-orange-dark); text-decoration: none; }
:focus-visible {
  outline: 3px solid var(--brand-blue);
  outline-offset: 3px;
}
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--brand-navy);
  color: white;
  padding: 0.5rem 0.8rem;
  z-index: 10;
}
.skip:focus { top: 0.5rem; color: white; }

.wrap { width: min(var(--max), calc(100% - 2rem)); margin: 0 auto; }
.site-header {
  background: var(--background);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.header-row, .nav-row, .card-grid, .split, .tool-grid, .meta-row {
  display: flex;
  gap: 1rem;
}
.header-row { align-items: center; justify-content: space-between; padding: 0.7rem 0 0.55rem; }
.brand { display: flex; align-items: center; text-decoration: none; color: inherit; }
.brand-logo { display: block; height: 52px; width: auto; }
.nav-toggle {
  display: none;
  background: var(--background);
  color: var(--brand-navy);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-weight: 650;
}
.nav-toggle:hover { background: var(--surface-blue); color: var(--brand-blue-dark); }
.nav-row {
  align-items: center;
  padding: 0.45rem 0 0.7rem;
  border-top: 1px solid var(--border);
}
.nav-row nav { width: 100%; }
.nav-links { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; width: 100%; gap: 0.35rem 1rem; list-style: none; margin: 0; padding: 0; }
.nav-links a { text-decoration: none; font-weight: 650; font-size: 0.95rem; color: var(--text-primary); white-space: nowrap; }
.nav-links a:hover { color: var(--brand-blue); }
.search-form { display: flex; gap: 0.4rem; }
.search-form input, .field input, .field select, .field textarea {
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  width: 100%;
}
.search-form input { width: 14rem; }
button, .button {
  background: var(--brand-blue);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: var(--brand-blue-dark); color: white; }
button.secondary, .button.secondary { background: transparent; color: var(--brand-blue-dark); border: 1px solid var(--brand-blue); }
button.secondary:hover, .button.secondary:hover { background: var(--surface-blue); color: var(--brand-blue-dark); }
button.danger { background: var(--brand-orange-dark); }
button.danger:hover { background: var(--brand-orange); color: white; }

.hero { padding: 2.5rem 0 1rem; }
.hero h1, .page-title, article h1 { font-family: var(--serif); font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; }
.hero h1 { font-size: clamp(2rem, 4vw, 3.4rem); margin: 0 0 0.6rem; max-width: 16ch; }
.lede, .intro { font-size: 1.12rem; max-width: 68ch; }
.hero-search { margin-top: 1.2rem; max-width: 36rem; }
.hero-search input { width: 100%; }

.section { padding: 1.2rem 0 2rem; }
.section h2, .card h3, article h2, article h3 { font-family: var(--serif); line-height: 1.25; }
.card-grid, .tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card, .panel, .result, .tool-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.card a, .tool-card a { text-decoration: none; }
.kicker { color: var(--brand-orange-dark); font-size: 0.78rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.muted { color: var(--text-secondary); }
.featured {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 1rem;
  align-items: center;
}
.diagram {
  background: linear-gradient(160deg, var(--surface-blue), var(--background));
  border-radius: 16px;
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
}
.crumbs { font-size: 0.92rem; color: var(--text-secondary); margin: 1rem 0; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; padding: 0; margin: 0; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 1.5rem; align-items: start; }
article .summary { font-size: 1.15rem; }
article h2 { margin-top: 1.8rem; }
.toc { position: sticky; top: 6rem; }
.toc ol { margin: 0; padding-left: 1.1rem; }
.meta-row { flex-wrap: wrap; gap: 0.6rem 1rem; color: var(--text-secondary); font-size: 0.92rem; }
.faq details { background: var(--background); border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 1rem; margin-bottom: 0.6rem; }
.faq summary { cursor: pointer; font-weight: 700; }
.sources li { margin-bottom: 0.8rem; }
.callout { background: var(--surface-blue); border-left: 4px solid var(--brand-orange); padding: 0.8rem 1rem; border-radius: 8px; }
.site-footer { background: var(--background); color: var(--text-primary); margin-top: 2rem; }
.footer-accent { height: 4px; background: linear-gradient(90deg, var(--brand-blue), var(--brand-orange)); }
.site-footer a { color: var(--text-primary); }
.site-footer a:hover { color: var(--brand-blue); }
.footer-grid { display: flex; justify-content: space-between; align-items: flex-start; gap: 4rem; padding: 2.25rem 0 2rem; }
.footer-brand-block { flex: 1 1 20rem; max-width: 34rem; }
.footer-columns { display: grid; grid-template-columns: repeat(3, max-content); gap: 1.5rem 3rem; flex: 0 0 auto; }
.footer-columns a { white-space: nowrap; }
.footer-logo { display: block; height: 46px; width: auto; }
.footer-brand { display: inline-block; margin-bottom: 0.9rem; }
.site-footer h2 { margin: 0 0 0.85rem; font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand-orange-dark); }
.site-footer p { margin: 0 0 0.75rem; color: var(--text-secondary); line-height: 1.55; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 0 0 0.55rem; line-height: 1.4; }
.site-footer li:last-child { margin-bottom: 0; }
.legal { background: var(--brand-navy); color: #F8FAFC; }
.legal .wrap { padding: 1rem 0; }
.legal p { max-width: none; color: #F8FAFC; margin: 0; padding: 0; font-size: 0.85rem; line-height: 1.5; }
.legal p + p { margin-top: 0.35rem; }

.tool-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.8rem; }
.field label { font-weight: 700; }
.check { display: flex; gap: 0.5rem; align-items: flex-start; margin-bottom: 0.45rem; }
.result-box { background: var(--surface-blue); border-radius: 12px; padding: 1rem; }
.error-text { color: var(--brand-orange-dark); font-weight: 700; }
.admin-bar { background: var(--brand-navy); color: white; }
.admin-bar a { color: white; margin-right: 1rem; }
.admin-bar button.secondary { color: white; border-color: white; }
.admin-bar button.secondary:hover { background: transparent; color: var(--brand-orange); }
.table { width: 100%; border-collapse: collapse; background: var(--background); }
.table th, .table td { border-bottom: 1px solid var(--border); text-align: left; padding: 0.55rem; vertical-align: top; }
.honeypot, .sr-only { position: absolute; left: -9999px; }
.admin-inner { padding: 0.4rem 0; }
.inline-form { display: inline; }

@media (max-width: 860px) {
  .card-grid, .tool-grid, .featured, .layout, .tool-layout { grid-template-columns: 1fr; }
  .footer-grid { flex-direction: column; gap: 1.75rem; padding: 1.75rem 0 1.5rem; }
  .footer-brand-block { max-width: none; }
  .footer-columns { grid-template-columns: 1fr; gap: 1.5rem; width: 100%; }
  .footer-columns a { white-space: normal; }
  .brand-logo, .footer-logo { height: 40px; }
  .header-row { flex-wrap: wrap; }
  .brand { order: 1; margin-right: auto; }
  .nav-toggle { order: 2; display: inline-block; }
  .header-search { order: 3; flex: 1 1 100%; }
  .nav-links { display: none; flex-direction: column; align-items: flex-start; justify-content: flex-start; width: 100%; flex-wrap: wrap; gap: 0.15rem; }
  .nav-links.open { display: flex; }
  .nav-row { flex-wrap: wrap; }
  .search-form, .search-form input { width: 100%; }
  .toc { position: static; }
}
