:root {
  --paper: #fbf7ef;
  --paper-strong: rgba(255, 255, 255, 0.92);
  --paper-soft: rgba(255, 255, 255, 0.72);
  --ink: #18243b;
  --muted: #5a667b;
  --red: #d61e2b;
  --red-deep: #a51625;
  --blue: #165fa9;
  --blue-deep: #0f4a87;
  --navy: #12213b;
  --line: rgba(22, 95, 169, 0.14);
  --line-strong: rgba(22, 95, 169, 0.22);
  --shadow: 0 28px 56px rgba(18, 33, 59, 0.12);
  --shadow-soft: 0 14px 30px rgba(18, 33, 59, 0.08);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 22px;
  --space-5: 30px;
  --space-6: 42px;
  --text-xs: 0.82rem;
  --text-sm: 0.94rem;
  --text-base: 1.02rem;
  --text-lg: 1.12rem;
  --text-xl: 1.28rem;
  --text-2xl: clamp(1.75rem, 3vw, 2.5rem);
  --text-hero: clamp(2.6rem, 5.6vw, 4.8rem);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  background:
    radial-gradient(circle at top left, rgba(214, 30, 43, 0.10), transparent 28%),
    radial-gradient(circle at top right, rgba(22, 95, 169, 0.15), transparent 32%),
    linear-gradient(180deg, #fffbf4 0%, #f7efe3 50%, #efe1cf 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.06;
  background-image:
    linear-gradient(rgba(22, 95, 169, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 95, 169, 0.18) 1px, transparent 1px);
  background-size: 108px 108px;
}

a {
  color: inherit;
}

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

[hidden] {
  display: none !important;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-top: 0;
  border-radius: 0 0 24px 24px;
  background: rgba(255, 251, 245, 0.8);
  box-shadow: 0 18px 34px rgba(18, 33, 59, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-soft);
  object-fit: contain;
  padding: 0;
}

.brand-copy {
  display: grid;
  gap: 5px;
}

.brand-title {
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 1.66rem;
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.brand-doc {
  color: var(--red);
}

.brand-valuable {
  color: var(--blue-deep);
}

.brand-tag {
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.68rem;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.93rem;
}

.site-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  transition: transform 140ms ease, color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  transform: translateY(-1px);
  color: var(--blue-deep);
}

.site-nav .active {
  background: rgba(22, 95, 169, 0.10);
  color: var(--blue-deep);
}

.site-nav .utility {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 96px;
}

.hero-copy,
.hero-feature,
.sidebar-card,
.post-card,
.system-card,
.tier-card,
.archive-card,
.tools-card,
.article-card,
.aside-card,
.form-card,
.output-card,
.not-found-card,
.about-card,
.bio-card,
.timeline-card {
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow-soft);
}

.hero-grid,
.home-grid,
.archive-layout,
.article-grid,
.about-grid,
.bio-grid,
.timeline-grid,
.system-grid,
.tier-grid {
  display: grid;
  gap: 20px;
}

.hero-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(350px, 0.9fr);
  align-items: stretch;
}

.home-grid {
  grid-template-columns: minmax(0, 1.14fr) minmax(280px, 0.86fr);
  margin-top: 32px;
}

.archive-layout {
  grid-template-columns: 320px minmax(0, 1fr);
  margin-top: 30px;
  align-items: start;
}

.article-grid {
  grid-template-columns: minmax(0, 1.14fr) 320px;
  align-items: start;
}

.about-grid {
  grid-template-columns: minmax(0, 1.02fr) minmax(280px, 0.98fr);
  align-items: stretch;
}

.bio-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.timeline-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.system-grid,
.tier-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-copy,
.about-card {
  position: relative;
  padding: 34px;
  overflow: hidden;
}

.hero-copy::after,
.about-card::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -90px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(214, 30, 43, 0.10), transparent 70%);
  pointer-events: none;
}

.hero-feature,
.bio-card.bio-accent {
  padding: 28px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.10), transparent 40%),
    linear-gradient(180deg, #182743 0%, #11305f 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 26px 58px rgba(18, 33, 59, 0.22);
}

.hero-feature h2,
.hero-feature h3,
.hero-feature strong,
.hero-feature p,
.hero-feature li,
.hero-feature .meta-pill,
.hero-feature .format-chip,
.hero-feature .access-chip,
.hero-feature .text-link,
.bio-card.bio-accent h3,
.bio-card.bio-accent p,
.bio-card.bio-accent strong,
.bio-card.bio-accent li {
  color: #ffffff;
}

.hero-feature .meta-pill,
.hero-feature .format-chip,
.hero-feature .access-chip,
.bio-card.bio-accent .meta-pill {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.10);
}

.kicker {
  margin: 0 0 12px;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: var(--text-xs);
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--red-deep);
}

.hero-feature .kicker,
.bio-card.bio-accent .kicker {
  color: rgba(255, 255, 255, 0.68);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--navy);
  letter-spacing: -0.04em;
}

h1 {
  max-width: 12ch;
  font-size: var(--text-hero);
  line-height: 0.95;
}

h2 {
  font-size: var(--text-2xl);
  line-height: 1.02;
}

h3 {
  font-size: var(--text-xl);
  line-height: 1.14;
}

p {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.78;
  color: var(--muted);
}

.hero-copy p + p,
.section-head p + p,
.article-body p + p,
.about-card p + p {
  margin-top: 16px;
}

.hero-copy .hero-wordmark {
  width: min(360px, 100%);
  margin: -28px 0 -12px -24px;
  object-fit: contain;
}

.button-row,
.meta-row,
.footer-links,
.jump-list,
.logo-row,
.stat-row,
.format-chip-row,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-row {
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button-primary {
  color: #fffaf5;
  background: linear-gradient(135deg, var(--red), var(--blue));
  box-shadow: 0 16px 28px rgba(22, 95, 169, 0.20);
}

.button-secondary {
  color: var(--blue-deep);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
}

.button-subtle {
  color: var(--red-deep);
  background: rgba(255, 247, 247, 0.84);
  border: 1px solid rgba(214, 30, 43, 0.16);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(22, 95, 169, 0.12);
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--blue-deep);
}

.format-chip,
.access-chip,
.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.79rem;
  line-height: 1;
}

.format-chip {
  color: var(--red-deep);
  background: rgba(255, 247, 247, 0.9);
  border: 1px solid rgba(214, 30, 43, 0.16);
}

.access-chip {
  color: var(--blue-deep);
  background: rgba(241, 247, 255, 0.92);
  border: 1px solid rgba(22, 95, 169, 0.14);
}

.filter-row {
  margin-bottom: 18px;
}

.filter-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  cursor: pointer;
}

.filter-chip.is-active {
  color: #fffaf5;
  border-color: transparent;
  background: linear-gradient(135deg, var(--red), var(--blue));
}

.signal-list,
.note-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}

.signal-list li,
.note-list li {
  position: relative;
  padding-left: 18px;
  font-size: 0.98rem;
  line-height: 1.7;
}

.signal-list li + li,
.note-list li + li {
  margin-top: 10px;
}

.signal-list li::before,
.note-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--blue));
  transform: translateY(-50%);
}

.section {
  margin-top: 58px;
}

.section-head {
  max-width: 780px;
  margin-bottom: 22px;
}

.section-head p {
  margin-top: 14px;
}

.main-column,
.side-column,
.archive-main,
.article-main {
  display: grid;
  gap: 20px;
  align-content: start;
}

.post-grid,
.archive-main {
  display: grid;
  gap: 18px;
}

.post-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.archive-main {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-card,
.sidebar-card,
.system-card,
.tier-card,
.archive-card,
.tools-card,
.article-card,
.aside-card,
.form-card,
.output-card,
.bio-card,
.timeline-card {
  padding: 24px;
}

.post-card h3,
.archive-card h3,
.timeline-card h3,
.bio-card h3,
.system-card h3,
.tier-card h3 {
  margin-top: 12px;
}

.post-card p,
.archive-card p,
.timeline-card p,
.bio-card p,
.system-card p,
.tier-card p {
  margin-top: 12px;
}

.system-card,
.tier-card {
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow-soft);
}

.tier-card-featured {
  background:
    radial-gradient(circle at top right, rgba(214, 30, 43, 0.12), transparent 34%),
    rgba(255, 252, 247, 0.92);
  border-color: rgba(22, 95, 169, 0.18);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--blue-deep);
}

.text-link::after {
  content: "->";
  font-size: 0.92em;
}

.hero-feature .text-link,
.bio-card.bio-accent .text-link {
  color: #ffffff;
}

.tools-card,
.aside-card {
  position: sticky;
  top: 104px;
}

.search-input,
.form-input,
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font: inherit;
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
}

.search-input:focus,
.form-input:focus,
.form-textarea:focus {
  outline: 2px solid rgba(22, 95, 169, 0.22);
  outline-offset: 2px;
}

.tools-card .helper,
.form-card .helper,
.output-card .helper {
  margin-top: 12px;
  font-size: var(--text-sm);
}

.search-count {
  margin-top: 14px;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: var(--text-sm);
  color: var(--blue-deep);
}

.jump-label {
  margin-top: 20px;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: var(--text-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.jump-list {
  margin-top: 14px;
  gap: 10px;
}

.jump-list a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.86rem;
  color: var(--blue-deep);
}

.empty-state {
  margin-top: 14px;
  color: var(--red-deep);
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
}

.article-shell {
  margin-top: 24px;
}

.article-card {
  padding: 30px;
}

.article-card header p {
  margin-top: 14px;
}

.article-body {
  margin-top: 24px;
}

.article-body p {
  font-size: 1.06rem;
  line-height: 1.86;
}

.locked-card {
  margin-top: 28px;
  padding: 22px;
  border-radius: var(--radius-md);
  background: rgba(18, 33, 59, 0.05);
  border: 1px solid var(--line);
}

.locked-card h3 {
  margin-top: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: var(--text-sm);
  color: var(--blue-deep);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
}

.output-card {
  margin-top: 20px;
}

.code-output {
  width: 100%;
  min-height: 240px;
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: #fffdfa;
  color: var(--ink);
  font: 0.92rem/1.5 ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  resize: vertical;
}

.status {
  margin-top: 14px;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--blue-deep);
}

.logo-panel {
  display: grid;
  gap: 18px;
  justify-items: center;
  align-content: center;
}

.logo-panel .logo-mark-large {
  width: min(220px, 68%);
  filter: drop-shadow(0 16px 28px rgba(18, 33, 59, 0.12));
}

.logo-panel .logo-wordmark-large {
  width: min(360px, 100%);
  margin: -20px auto -10px;
}

.stat-row {
  margin-top: 18px;
}

.stat-chip {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: var(--text-sm);
  color: var(--blue-deep);
}

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 40px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.7;
}

.footer a {
  color: var(--blue-deep);
  text-decoration: none;
}

.not-found-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.not-found-card {
  width: min(760px, 100%);
  padding: 34px;
}

.not-found-card .footer-links {
  margin-top: 26px;
}

@media (max-width: 1120px) {
  .hero-grid,
  .home-grid,
  .archive-layout,
  .article-grid,
  .about-grid,
  .bio-grid,
  .timeline-grid,
  .system-grid,
  .tier-grid {
    grid-template-columns: 1fr;
  }

  .post-grid,
  .archive-main {
    grid-template-columns: 1fr;
  }

  .tools-card,
  .aside-card {
    position: static;
  }
}

@media (max-width: 760px) {
  .site-header {
    padding: 16px 18px;
    border-radius: 0 0 20px 20px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .brand-title {
    font-size: 1.34rem;
  }

  .brand-tag {
    font-size: 0.62rem;
  }

  .page-shell {
    padding-top: 30px;
  }

  .hero-copy,
  .hero-feature,
  .sidebar-card,
  .post-card,
  .system-card,
  .tier-card,
  .archive-card,
  .tools-card,
  .article-card,
  .aside-card,
  .form-card,
  .output-card,
  .not-found-card,
  .about-card,
  .bio-card,
  .timeline-card {
    padding: 22px;
  }

  h1 {
    max-width: none;
    font-size: clamp(2.28rem, 13vw, 4rem);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
