/* ─── Design System: Nur Azhar Technical Portfolio ─────────────── */
/* v3 — dark-first Architectural Ink & Cobalt theme. Light mode is the
   accessible fallback via [data-theme="light"] (theme toggle in nav). */

/* ─── Fonts ────────────────────────────────────────────────────── */
/* Self-hosted: one variable file per family, latin subset, nothing from a
   third-party origin. Inter is preloaded in the head; mono loads on use. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2?v=3100e775e8') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/jbm-mono-latin.woff2?v=83c005d49d') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

/* ─── Custom Properties (Dark-First: Architectural Ink & Cobalt) ─ */
:root {
  color-scheme: dark;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Monaco', 'Menlo', 'Consolas', monospace;

  /* 3-step body type scale */
  --text-heading: clamp(1.5rem, 2.5vw, 1.875rem);
  --text-body: 1rem;
  --text-sm: 0.875rem;

  /* WCAG AA on dark: #e6ecf2 on #0b1117 is 14.8:1; #9ba8b7 is 7.5:1; #7b8a9b is 5.2:1 */
  --color-bg: #0b1117;
  --color-surface: #111922;
  --color-surface-2: #16202c;
  --color-text: #e6ecf2;
  --color-text-secondary: #9ba8b7;
  --color-text-tertiary: #7b8a9b;
  --color-accent: #3b82f6;
  --color-accent-hover: #60a5fa;
  --color-accent-subtle: rgba(59, 130, 246, 0.12);
  --color-emerald: #22c55e;
  --color-emerald-subtle: rgba(34, 197, 94, 0.12);
  --color-danger: #ef4444;
  --color-danger-subtle: rgba(239, 68, 68, 0.12);
  --color-border: #1e2a38;
  --color-border-light: #16202c;
  --color-code-bg: #0f161f;
  --color-tag-bg: rgba(59, 130, 246, 0.12);
  --color-tag-text: #93c5fd;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);

  --transition: 180ms cubic-bezier(0.22, 1, 0.36, 1);

  --max-width: 1200px;
  --content-width: 72ch;
  --gap: clamp(16px, 3vw, 32px);
}

/* ─── Light Mode (Gallery Stone & Deep Cobalt) ─────────────────── */
[data-theme="light"] {
  color-scheme: light;
  --color-bg: #f6f7f9;
  --color-surface: #ffffff;
  --color-surface-2: #edf1f5;
  --color-text: #0f172a;
  --color-text-secondary: #475569;
  --color-text-tertiary: #64748b;
  --color-accent: #1d4ed8;
  --color-accent-hover: #1e40af;
  --color-accent-subtle: rgba(29, 78, 216, 0.08);
  --color-emerald: #15803d;
  --color-emerald-subtle: rgba(21, 128, 61, 0.1);
  --color-danger: #b91c1c;
  --color-danger-subtle: rgba(185, 28, 28, 0.08);
  --color-border: #d8e0e8;
  --color-border-light: #e6ecf2;
  --color-code-bg: #eef2f6;
  --color-tag-bg: rgba(29, 78, 216, 0.08);
  --color-tag-text: #1e40af;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);
}

/* ─── Theme Toggle ──────────────────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  white-space: nowrap;
}

.theme-toggle:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.theme-toggle:focus-visible,
.social-link:focus-visible,
.post-card:focus-visible,
.card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.theme-toggle .icon-moon {
  display: inline;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: inline;
}

/* ─── Base ─────────────────────────────────────────────────────── */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap);
  padding-left: max(var(--gap), env(safe-area-inset-left));
  padding-right: max(var(--gap), env(safe-area-inset-right));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition), 
              color var(--transition), 
              border-color var(--transition),
              box-shadow var(--transition);
}

/* Smooth transitions for static text and container blocks during theme toggle */
.post-content code, pre, th, td, blockquote {
  transition: background-color var(--transition), 
              color var(--transition), 
              border-color var(--transition),
              box-shadow var(--transition);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent-hover);
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ─── Navigation ───────────────────────────────────────────────── */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 0 24px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
  touch-action: manipulation;
}

.nav-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-left h1 {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.tagline {
  font-size: 0.82rem;
  color: var(--color-text-tertiary);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  padding: 10px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.social-link:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.social-link svg {
  width: 20px;
  height: 20px;
}

/* ─── Index: Post List ─────────────────────────────────────────── */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
}

.post-card {
  display: block;
  padding: 20px 16px;
  border-radius: var(--radius-md);
  touch-action: manipulation;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}

.post-card:hover {
  background: var(--color-surface);
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.post-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-text);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.post-card:hover .post-card-title {
  color: var(--color-accent);
}

.post-card-meta {
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.post-card-description {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.55;
}

/* ─── Single Post ──────────────────────────────────────────────── */
.post {
  background: transparent;
  padding: 0;
  margin-bottom: 30px;
}

.post-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.post-title {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-text);
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.post-meta {
  font-size: 0.85rem;
  color: var(--color-text-tertiary);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}

.post-date {
  color: var(--color-text-tertiary);
  font-weight: 500;
}

.post-author {
  color: var(--color-text-secondary);
  font-weight: 600;
}

.post-tags {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.post-tag {
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
}

.post-tag:hover {
  background: var(--color-accent);
  color: white;
}

.tag-header {
  margin-bottom: 24px;
  font-size: 1.3rem;
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
}

/* ─── Post Content Typography ──────────────────────────────────── */
.post-content {
  font-size: 1.06rem;
  line-height: 1.8;
  color: var(--color-text);
  max-width: min(var(--content-width), 100%);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.post-content > * + * {
  margin-top: 1.25em;
}

.post-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 2.5em;
  margin-bottom: 0.75em;
  letter-spacing: -0.02em;
  line-height: 1.3;
  scroll-margin-top: 2rem;
}

.post-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 2em;
  margin-bottom: 0.5em;
  letter-spacing: -0.01em;
  scroll-margin-top: 2rem;
}

.post-content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  scroll-margin-top: 2rem;
}

.post-content p {
  margin-top: 0;
  margin-bottom: 1.25em;
}

.post-content strong {
  font-weight: 600;
  color: var(--color-text);
}

.post-content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(188, 65, 35, 0.3);
  transition: text-decoration-color var(--transition);
}

.post-content a:hover {
  text-decoration-color: var(--color-accent);
}

/* ─── Code ─────────────────────────────────────────────────────── */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-code-bg);
  color: var(--color-text);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  font-weight: 400;
}

.post-content pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  overflow-x: auto;
  margin: 1.75em 0;
  box-shadow: var(--shadow-sm);
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--color-text);
}

/* ─── Blockquote ───────────────────────────────────────────────── */
.post-content blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 16px 20px;
  margin: 1.75em 0;
  background: var(--color-accent-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--color-text-secondary);
  font-style: normal;
}

.post-content blockquote p {
  margin-bottom: 0;
}

.post-content blockquote p + p {
  margin-top: 0.75em;
}

/* ─── Lists ────────────────────────────────────────────────────── */
.post-content ul,
.post-content ol {
  padding-left: 1.5em;
  margin: 1em 0;
}

.post-content li {
  margin-bottom: 0.4em;
  line-height: 1.7;
}

.post-content li + li {
  margin-top: 0.25em;
}

/* ─── Tables ───────────────────────────────────────────────────── */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75em 0;
  font-size: 0.9rem;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.post-content th,
.post-content td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

.post-content th {
  background: var(--color-code-bg);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-content tr:last-child td {
  border-bottom: none;
}

/* ─── Images ───────────────────────────────────────────────────── */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1.75em 0;
  border: 1px solid var(--color-border);
}

/* ─── Horizontal Rule ──────────────────────────────────────────── */
.post-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5em 0;
}

/* ─── Comparison Tables ────────────────────────────────────────── */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75em 0;
  font-size: 0.9rem;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.comparison-table th,
.comparison-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

.comparison-table th {
  background: var(--color-code-bg);
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.comparison-table td:first-child {
  font-weight: 500;
}

/* ─── Diagram Cards ────────────────────────────────────────────── */
.diagram-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 1.75em 0;
}

.card-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.card {
  background: var(--color-surface);
  color: var(--color-text);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  text-align: center;
  min-width: 200px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
}

.card h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  font-weight: 600;
}

.card p {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.arrow {
  font-size: 1.5em;
  color: var(--color-accent);
  margin: 8px 0;
}

/* ─── Docs Page ────────────────────────────────────────────────── */
.docs-lede {
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--color-text-secondary);
  margin-bottom: 2em;
}

.docs-table-wrapper {
  overflow-x: auto;
  margin: 1.5em 0;
  -webkit-overflow-scrolling: touch;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  min-width: 600px;
}

.docs-table th,
.docs-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
  line-height: 1.55;
}

.docs-table th {
  background: var(--color-code-bg);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.docs-table tr:last-child td {
  border-bottom: none;
}

.docs-table td:first-child {
  font-weight: 500;
  white-space: nowrap;
}

.docs-table td code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--color-code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.pdpa-row {
  background: var(--color-accent-subtle);
}

.docs-code {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  overflow-x: auto;
  margin: 1.25em 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

.docs-severity {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.docs-severity.critical {
  background: #3b1515;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
}

.docs-severity.high {
  background: #3b1515;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
}

.docs-severity.medium {
  background: #3b2f15;
  color: #fde68a;
  border: 1px solid #7c5f10;
}

.docs-severity.low {
  background: #152e1c;
  color: #bbf7d0;
  border: 1px solid #14532d;
}

[data-theme="light"] .docs-severity.critical {
  background: #fde8e8;
  color: #991b1b;
  border-color: #fca5a5;
}

[data-theme="light"] .docs-severity.high {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

[data-theme="light"] .docs-severity.medium {
  background: #fef6e0;
  color: #78350f;
  border-color: #fde68a;
}

[data-theme="light"] .docs-severity.low {
  background: #eaf6ee;
  color: #14532d;
  border-color: #bbf7d0;
}

.docs-meta {
  font-size: 0.82rem;
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* ─── Footer ───────────────────────────────────────────────────── */
.site-footer {
  margin-top: 48px;
  padding: 24px 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: 0.82rem;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* ─── Portfolio: Brand & Nav ───────────────────────────────────── */
.brand-link {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--transition);
}

.brand-link:hover {
  color: var(--color-accent);
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.nav-links .nav-link {
  padding: 6px 10px;
  min-height: 0;
  font-size: 0.8rem;
}

/* ─── Portfolio: Hero ──────────────────────────────────────────── */
.home {
  display: flex;
  flex-direction: column;
  gap: 56px;
  padding: 40px 0 24px;
}

.hero {
  max-width: var(--content-width);
}

.hero-prompt {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-emerald);
  margin-bottom: 18px;
}

.hero-name {
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--color-text);
  margin-bottom: 14px;
}

.hero-sub {
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.hero-focus {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}

.hero-bio {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--color-text-secondary);
  max-width: 62ch;
  margin-bottom: 28px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 6px 14px;
  transition: border-color var(--transition), color var(--transition);
}

.badge::before {
  content: "●";
  font-size: 0.6rem;
  color: var(--color-emerald);
}

.badge:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

/* ─── Hero: primary call-to-action ─────────────────────────────── */
/* Visually separated from the informational .badge pills: larger,
   solid accent fill, dark text — readable in both themes since the
   accent hues hold contrast on dark and light surfaces alike. */
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #062a30;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 13px 26px;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
  box-shadow: 0 4px 18px -4px var(--color-accent);
}

.cta-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 8px 26px -4px var(--color-accent);
  color: #062a30;
}

.cta-primary:focus-visible {
  outline: 2px solid var(--color-accent-hover);
  outline-offset: 3px;
}

.cta-primary .cta-arrow,
.cta-secondary .cta-arrow {
  font-weight: 700;
}

/* Secondary CTA: outline variant matching primary height/padding (44px target) */
.cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 13px 26px;
  min-height: 44px;
  text-decoration: none;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), color var(--transition);
}

.cta-secondary:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
  transform: translateY(-2px);
}

.cta-secondary:focus-visible {
  outline: 2px solid var(--color-accent-hover);
  outline-offset: 3px;
}

/* Expertise-area stack meta line */
.expertise-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 8px;
}

/* Business/regulatory outcome line on project cards */
.project-outcome {
  font-size: 0.85rem;
  line-height: 1.6;
  font-weight: 600;
  color: var(--color-emerald);
  margin-bottom: 12px;
}

/* Light theme deepens the accent gradient (#0e7490 → #155e75), so the
   near-black text used on dark mode drops to ~2:1 contrast. Flip to
   white (~5.8:1, WCAG AA) under [data-theme="light"]. */
[data-theme="light"] .cta-primary {
  color: #ffffff;
}

[data-theme="light"] .cta-primary:hover {
  color: #ffffff;
}

/* ─── Portfolio: Sections ──────────────────────────────────────── */
.home-section {
  max-width: var(--content-width);
}

.section-title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: "#";
  color: var(--color-accent);
}

.section-lede {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.65;
  margin-bottom: 22px;
  max-width: 60ch;
}

/* ─── Portfolio: Focus Areas ───────────────────────────────────── */
.focus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.focus-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.focus-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-index {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.focus-card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
  margin-bottom: 8px;
}

.focus-card-body {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

/* ─── Portfolio: Projects ──────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.project-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  text-decoration: none;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.project-name {
  display: block;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.project-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.project-link {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--color-text-tertiary);
  transition: color var(--transition);
}

.project-card:hover .project-link {
  color: var(--color-emerald);
}

/* ─── Portfolio: Contact ───────────────────────────────────────── */
.contact {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: 32px 28px;
}

.contact-lede {
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
  max-width: 55ch;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.contact-email {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-emerald);
  border: 1px solid var(--color-emerald);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.contact-email:hover {
  background: var(--color-emerald-subtle);
  color: var(--color-emerald);
}

.contact-social {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), color var(--transition);
}

.contact-social:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* ─── Portfolio: Home Research List ────────────────────────────── */
.home-posts {
  margin-top: 0;
}

/* ─── Archive Page ─────────────────────────────────────────────── */
.archive-list {
  margin-top: 8px;
}

.archive-header {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.post-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: 0.82rem;
}

/* ─── Responsive ───────────────────────────────────────────────── */

/* Mobile: < 640px */
@media (max-width: 640px) {
  .nav {
    padding: 20px 0 16px;
    flex-wrap: wrap;
    row-gap: 12px;
  }

  /* Keep the four fixed-size controls from clipping at 320px widths. */
  .nav > div:last-child {
    width: 100%;
    justify-content: flex-end;
  }

  .nav-left h1 {
    font-size: 1.05rem;
  }

  .home {
    gap: 40px;
    padding: 24px 0 16px;
  }

  .hero-name {
    font-size: clamp(2.2rem, 9vw, 2.8rem);
  }

  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .cta-primary,
  .cta-secondary {
    width: 100%;
    justify-content: center;
  }

  .focus-grid,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .contact {
    padding: 24px 18px;
  }

  .post-title {
    font-size: clamp(1.35rem, 5vw, 1.5rem);
  }

  .post-content {
    font-size: 1rem;
  }

  .post-card {
    padding: 16px 12px;
  }

  .post-card-title {
    font-size: 0.98rem;
  }

  .post-content pre {
    padding: 16px;
    margin-left: calc(-1 * var(--gap));
    margin-right: calc(-1 * var(--gap));
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .card {
    min-width: 100%;
  }
}

/* Tablet: 640px - 1024px */
@media (min-width: 641px) and (max-width: 1024px) {
  .post-title {
    font-size: clamp(1.5rem, 3vw, 1.75rem);
  }
}

/* Desktop: > 1024px */
@media (min-width: 1025px) {
  .post-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }
}

/* Wide Desktop: > 1400px */
@media (min-width: 1400px) {
  .post-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ─── Agentic AI Security Page ─────────────────────────────────── */
.agentic-page {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 76px) 0 72px;
}

.agentic-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(250px, 0.65fr);
  gap: clamp(28px, 6vw, 84px);
  align-items: end;
  padding-bottom: clamp(44px, 8vw, 96px);
  border-bottom: 1px solid var(--color-border);
}

.agentic-hero-copy {
  max-width: 700px;
}

.agentic-eyebrow,
.agentic-promo-kicker,
.agentic-signal-label,
.agentic-final-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.agentic-eyebrow {
  margin-bottom: 20px;
}

.agentic-title {
  max-width: 720px;
  font-family: var(--font-mono);
  font-size: clamp(2.45rem, 7vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
  color: var(--color-text);
  text-wrap: balance;
}

.agentic-lede {
  max-width: 640px;
  margin-top: 26px;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.55;
  color: var(--color-text-secondary);
}

.agentic-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.agentic-primary,
.agentic-secondary {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
}

.agentic-primary {
  color: #061116;
  background: var(--color-accent);
}

.agentic-primary:hover {
  color: #061116;
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.agentic-secondary {
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.agentic-secondary:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.agentic-signal {
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.agentic-signal-label {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border-light);
}

.agentic-signal-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
}

.agentic-signal-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.agentic-signal-row strong {
  color: var(--color-emerald);
  font-weight: 500;
}

.agentic-section {
  padding: clamp(52px, 8vw, 108px) 0;
  border-bottom: 1px solid var(--color-border);
}

.agentic-section-tinted {
  padding-left: clamp(18px, 4vw, 52px);
  padding-right: clamp(18px, 4vw, 52px);
  background: var(--color-surface);
}

.agentic-section-title {
  max-width: 720px;
  font-family: var(--font-mono);
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: var(--color-text);
}

.agentic-section-intro {
  max-width: 650px;
  margin-top: 14px;
  color: var(--color-text-secondary);
}

.agentic-chain {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 38px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
}

.agentic-chain-step {
  min-height: 235px;
  padding: 22px;
  background: var(--color-bg);
}

.agentic-step-number {
  display: block;
  margin-bottom: 40px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-accent);
}

.agentic-chain-step h3,
.agentic-control h3,
.agentic-matrix-row h3,
.agentic-research-card h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.35;
  color: var(--color-text);
}

.agentic-chain-step p,
.agentic-control p,
.agentic-matrix-row p,
.agentic-research-card p {
  margin-top: 10px;
  color: var(--color-text-secondary);
  font-size: 0.93rem;
  line-height: 1.6;
}

.agentic-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 36px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
}

.agentic-control {
  min-height: 190px;
  padding: 24px;
  background: var(--color-surface-2);
}

.agentic-matrix {
  margin-top: 32px;
  border-top: 1px solid var(--color-border);
}

.agentic-matrix-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.3fr);
  gap: 30px;
  padding: 23px 0;
  border-bottom: 1px solid var(--color-border);
}

.agentic-matrix-row p {
  margin-top: 0;
}

.agentic-delivery {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(28px, 8vw, 120px);
  align-items: start;
}

.agentic-delivery-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}

.agentic-delivery-list li {
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.agentic-delivery-list li::before {
  content: "+";
  display: inline-block;
  width: 30px;
  color: var(--color-accent);
  font-family: var(--font-mono);
}

.agentic-research-section {
  border-bottom: 0;
}

.agentic-research-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 32px;
}

.agentic-research-card {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: inherit;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}

.agentic-research-card:hover {
  color: inherit;
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
  transform: translateY(-2px);
}

.agentic-research-card span {
  margin-top: auto;
  padding-top: 22px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-accent);
}

.agentic-final {
  padding: clamp(42px, 7vw, 80px) clamp(20px, 6vw, 90px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  text-align: center;
}

.agentic-final h2 {
  max-width: 680px;
  margin: 14px auto 0;
  font-family: var(--font-mono);
  font-size: clamp(1.55rem, 3.5vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.agentic-final p:not(.agentic-final-label) {
  max-width: 620px;
  margin: 18px auto 26px;
  color: var(--color-text-secondary);
}

.agentic-promo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 28px 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.agentic-promo-kicker {
  margin-bottom: 8px;
}

.agentic-promo .section-title {
  margin-bottom: 8px;
}

.agentic-promo .section-lede {
  max-width: 650px;
  margin: 0;
}

.agentic-promo-link {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 760px) {
  .agentic-page {
    padding-top: 34px;
  }

  .agentic-hero,
  .agentic-delivery {
    grid-template-columns: 1fr;
  }

  .agentic-title {
    font-size: clamp(2.35rem, 12vw, 4rem);
  }

  .agentic-signal {
    max-width: 520px;
  }

  .agentic-chain,
  .agentic-research-grid {
    grid-template-columns: 1fr;
  }

  .agentic-chain-step {
    min-height: auto;
  }

  .agentic-step-number {
    margin-bottom: 24px;
  }

  .agentic-matrix-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .agentic-matrix-row p {
    margin-top: 5px;
  }

  .agentic-promo {
    grid-template-columns: 1fr;
  }

  .agentic-promo-link {
    justify-self: start;
  }
}
/* ─── Accessibility: skip link ─────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius-sm) 0;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

/* ─── Blog: year groups ────────────────────────────────────────── */
.year-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}
.year-nav a {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 2px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: var(--transition);
}
.year-nav a:hover,
.year-nav a:focus-visible {
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.year-heading {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
  margin: 32px 0 12px;
  scroll-margin-top: 80px;
}
.year-group:first-of-type .year-heading {
  margin-top: 8px;
}

/* ─── Search ───────────────────────────────────────────────────── */
.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--color-text-secondary);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.search-trigger:hover,
.search-trigger:focus-visible {
  color: var(--color-text);
  border-color: var(--color-accent);
}
.search-trigger kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 4px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  opacity: 0.7;
}
.search-dialog {
  width: min(640px, 92vw);
  margin: 12vh auto auto;
  padding: 0;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.search-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
}
.search-input {
  flex: 1;
  padding: 8px 4px;
  font: inherit;
  font-size: 16px;
  color: var(--color-text);
  background: transparent;
  border: 0;
  outline: none;
}
.search-input::placeholder {
  color: var(--color-text-tertiary);
}
.search-close {
  font: inherit;
  font-size: 18px;
  line-height: 1;
  color: var(--color-text-tertiary);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.search-close:hover {
  color: var(--color-text);
}
.search-results {
  max-height: min(60vh, 480px);
  overflow-y: auto;
  padding: 8px;
}
.search-hint {
  padding: 12px;
  font-size: 14px;
  color: var(--color-text-tertiary);
}
.search-hit {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.search-hit:hover,
.search-hit:focus-visible {
  background: var(--color-surface-2);
}
.search-hit-title {
  display: block;
  font-weight: 600;
  color: var(--color-text);
}
.search-hit-desc {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* ─── Blog: pager ─────────────────────────────────────────────── */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 36px 0 8px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
  font-size: 14px;
}
.pager-link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-accent);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.pager-link:hover,
.pager-link:focus-visible {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}
.pager-where {
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  font-size: 12px;
}
.pager-gap {
  min-width: 88px;
}


/* ─── Enhanced Blog Index UI/UX ─────────────────────────────────── */
.blog-hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}
.blog-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.blog-hero .archive-header {
  margin: 0;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}
.blog-count-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-accent);
  background: var(--color-accent-subtle);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
}
.blog-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.blog-filter-input {
  flex: 1 1 240px;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.blog-filter-input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-subtle);
}
.archive-list .post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  margin-bottom: 10px;
  padding: 18px 20px;
}
.archive-list .post-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.year-heading {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--color-border);
}


/* ─── v4 Architectural Editorial System (index / hire / agentic) ── */
body.page-editorial {
  max-width: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-body);
  line-height: 1.65;
  overflow-x: clip;
}

.ed-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color var(--transition), border-color var(--transition);
}

.ed-header.is-scrolled {
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--color-border);
}

.ed-header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 40px);
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.ed-header-left {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 36px);
  min-width: 0;
}

.ed-brand {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition);
}

.ed-brand:hover {
  color: var(--color-accent);
}

.ed-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ed-nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  padding: 8px 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition), background-color var(--transition);
}

.ed-nav a:hover,
.ed-nav a[aria-current="page"] {
  color: var(--color-text);
  background: var(--color-accent-subtle);
}

.ed-nav a[aria-current="page"] {
  color: var(--color-accent-hover);
}

[data-theme="light"] .ed-nav a[aria-current="page"] {
  color: var(--color-accent);
}

.ed-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ed-header-actions .theme-toggle {
  min-height: 38px;
  min-width: 38px;
  padding: 8px 12px;
  font-size: var(--text-sm);
}

.ed-header-actions .social-link {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
}

/* Full-bleed Hero Stage (bleeds to y = 0 behind borderless header) */
.ed-hero {
  position: relative;
  margin-top: -68px;
  padding: calc(68px + clamp(28px, 4.5vh, 52px)) clamp(20px, 4vw, 40px) clamp(44px, 6vh, 64px);
  background-color: var(--color-bg);
  background-image:
    radial-gradient(ellipse 75% 55% at 50% 0%, rgba(59, 130, 246, 0.14), transparent 72%),
    linear-gradient(to right, var(--color-border-light) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-border-light) 1px, transparent 1px);
  background-size: 100% 100%, 64px 64px, 64px 64px;
  background-position: top center, center top, center top;
  border-bottom: 1px solid var(--color-border);
}

[data-theme="light"] .ed-hero {
  background-image:
    radial-gradient(ellipse 75% 55% at 50% 0%, rgba(29, 78, 216, 0.08), transparent 72%),
    linear-gradient(to right, rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
}

.ed-hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  text-align: center;
}

.ed-hero-title {
  font-family: var(--font-body);
  font-size: clamp(2.35rem, 5.2vw, 4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--color-text);
  max-width: 19ch;
  margin: 0 auto;
  text-wrap: balance;
}

.ed-hero-lede {
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--color-text-secondary);
  max-width: 56ch;
  margin: 16px auto 22px;
}

.ed-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 22px;
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 600;
  color: #ffffff;
  background: var(--color-accent);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition);
}

.ed-btn-primary:hover {
  background: var(--color-accent-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Interactive Bounded Agent Policy Stage */
.gate-stage {
  max-width: 1040px;
  margin: clamp(24px, 3.5vh, 36px) auto 0;
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.gate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.gate-bar-title {
  font-weight: 600;
  color: var(--color-text);
}

.gate-bar-path {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.gate-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.gate-control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gate-control-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.seg-group {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  overflow: hidden;
}

.seg-group input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg-option {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  border-right: 1px solid var(--color-border);
  transition: background-color var(--transition), color var(--transition);
  user-select: none;
}

.seg-option:last-of-type {
  border-right: 0;
}

.seg-group input[type="radio"]:checked + .seg-option {
  background: var(--color-accent);
  color: #ffffff;
}

.seg-group input[type="radio"]:focus-visible + .seg-option {
  outline: 2px solid var(--color-accent-hover);
  outline-offset: -2px;
}

.gate-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  min-height: 38px;
}

.gate-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}

.gate-switch input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.gate-output {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.gate-pane {
  padding: 20px;
}

.gate-pane + .gate-pane {
  border-left: 1px solid var(--color-border);
  background: var(--color-code-bg);
}

.gate-pane-heading {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.gate-kv {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px 16px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.gate-kv dt {
  color: var(--color-text-tertiary);
}

.gate-kv dd {
  color: var(--color-text);
  margin: 0;
  word-break: break-word;
}

.gate-verdict-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.gate-verdict {
  font-family: var(--font-mono);
  font-size: var(--text-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gate-verdict[data-state="permit"] {
  color: var(--color-emerald);
}

.gate-verdict[data-state="forbid"] {
  color: var(--color-danger);
}

.gate-rule {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-align: right;
  word-break: break-word;
}

.gate-reason {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.55;
  margin-bottom: 14px;
}

.gate-hash {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  word-break: break-all;
}

/* Editorial Content Bands */
.ed-band {
  width: 100%;
  padding: clamp(56px, 8vw, 96px) clamp(20px, 4vw, 40px);
  border-bottom: 1px solid var(--color-border);
}

.ed-band-surface {
  background: var(--color-surface);
}

.ed-container {
  max-width: 1080px;
  margin: 0 auto;
}

.ed-h2 {
  font-family: var(--font-body);
  font-size: var(--text-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--color-text);
  margin-bottom: 14px;
}

.ed-prose {
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--color-text-secondary);
  max-width: 62ch;
}

.ed-prose + .ed-prose {
  margin-top: 14px;
}

.ed-split {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}

.ed-sticky {
  position: sticky;
  top: 96px;
}

.ed-text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 22px;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--color-accent-hover);
  text-decoration: none;
  transition: color var(--transition);
}

[data-theme="light"] .ed-text-link {
  color: var(--color-accent);
}

.ed-text-link:hover {
  color: var(--color-text);
}

/* Ruled Ledger Rows (no card cages, no 01/02 numbers) */
.ed-ledger {
  border-top: 1px solid var(--color-border);
}

.ed-ledger-row {
  padding: 22px 0;
  border-bottom: 1px solid var(--color-border);
}

.ed-ledger-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.ed-h3 {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
}

.ed-meta {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.ed-ledger-row p {
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--color-text-secondary);
  max-width: 62ch;
}

/* Practice Matrix */
.ed-matrix {
  margin-top: 28px;
  border-top: 1px solid var(--color-border);
}

.ed-matrix-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 12px clamp(24px, 5vw, 64px);
  padding: 24px 0;
  border-bottom: 1px solid var(--color-border);
  align-items: start;
}

.ed-matrix-row p {
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--color-text-secondary);
  max-width: 62ch;
}

/* Writing List */
.ed-writing-list {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(28px, 5vw, 64px);
  border-top: 1px solid var(--color-border);
}

.ed-writing-item {
  display: block;
  padding: 22px 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition);
}

.ed-writing-item:hover {
  border-bottom-color: var(--color-accent);
}

.ed-writing-item:hover .ed-h3 {
  color: var(--color-accent-hover);
}

[data-theme="light"] .ed-writing-item:hover .ed-h3 {
  color: var(--color-accent);
}

.ed-writing-item p {
  margin-top: 8px;
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--color-text-secondary);
}

/* Bullet list at strict body scale */
.ed-list {
  list-style: none;
  margin-top: 20px;
  border-top: 1px solid var(--color-border);
}

.ed-list li {
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--color-text-secondary);
}

.ed-list strong {
  color: var(--color-text);
  font-weight: 600;
}

/* Closing Contact Band */
.ed-contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 28px;
  margin-top: 28px;
}

.ed-inline-links {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  font-size: var(--text-body);
}

.ed-inline-links a {
  color: var(--color-text-secondary);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
}

.ed-inline-links a:hover {
  color: var(--color-text);
}

/* Footer for editorial pages */
.ed-footer {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 28px clamp(20px, 4vw, 40px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.ed-footer a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.ed-footer a:hover {
  color: var(--color-text);
}

@media (max-width: 820px) {
  .ed-split,
  .gate-output,
  .ed-matrix-row,
  .ed-writing-list {
    grid-template-columns: 1fr;
  }

  .ed-sticky {
    position: static;
  }

  .gate-pane + .gate-pane {
    border-left: 0;
    border-top: 1px solid var(--color-border);
  }
}

@media (max-width: 640px) {
  .ed-header-inner {
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .ed-header-left {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 12px;
  }

  .ed-nav {
    flex-wrap: wrap;
    width: 100%;
    gap: 4px 6px;
  }

  .ed-nav a {
    padding: 6px 10px;
    min-height: 36px;
  }

  .ed-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .ed-hero {
    margin-top: 0;
    padding-top: 32px;
  }

  .seg-group {
    flex-wrap: wrap;
  }

  .seg-option {
    flex: 1 1 auto;
    justify-content: center;
    padding: 8px 10px;
  }

  .gate-kv {
    grid-template-columns: 112px minmax(0, 1fr);
  }
}

.ed-article-wrap {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 56px) clamp(20px, 4vw, 40px) 64px;
}

/* ─── Interactive Archify Embeds ───────────────────────────────── */
.archify-figure {
  /* A diagram is the argument, not an illustration: give it the page's width
     instead of the text column's. Left+transform keeps it centred whatever
     the column measures at this breakpoint. */
  width: min(1100px, calc(100vw - 2rem));
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin: 28px 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}

.archify-embed {
  display: block;
  width: 100%;
  height: 540px;
  border: 0;
  background: var(--color-bg);
}

.archify-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.archify-open {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent-hover);
  text-decoration: none;
  white-space: nowrap;
}

[data-theme="light"] .archify-open {
  color: var(--color-accent);
}

.archify-open:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .archify-embed {
    height: 420px;
  }
}
