:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #eef6f8;
  --surface-strong: #15212f;
  --text: #1c2430;
  --muted: #5d6a7a;
  --border: #d8e0e8;
  --accent: #0078d4;
  --accent-strong: #005a9e;
  --teal: #0f766e;
  --green: #2f7d32;
  --magenta: #b83280;
  --amber: #a15c00;
  --shadow: 0 12px 30px rgba(21, 33, 47, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", Aptos, Calibri, system-ui, -apple-system, BlinkMacSystemFont, sans-serif; line-height: 1.6; }
img { display: block; max-width: 100%; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
a:focus-visible, button:focus-visible { outline: 3px solid rgba(0, 120, 212, 0.35); outline-offset: 3px; }
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 10; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); }
.skip-link:focus { top: 16px; }
.site-header { position: sticky; top: 0; z-index: 4; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(14px); }
.site-nav, .hero, .content-section, .section-band, .site-footer { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.site-nav { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 8px; background: var(--surface-strong); color: #ffffff; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 0.78rem; }
.nav-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nav-links a { border-radius: 6px; color: var(--text); font-weight: 650; padding: 8px 10px; text-decoration: none; }
.nav-links a:hover { background: var(--surface-soft); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr); gap: 40px; align-items: center; padding: 64px 0 44px; }
.hero-copy { min-width: 0; }
.eyebrow { color: var(--magenta); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; margin: 0 0 10px; text-transform: uppercase; }
h1, h2, h3 { color: var(--text); line-height: 1.12; margin: 0; }
h1 { font-size: clamp(2.4rem, 7vw, 5.2rem); max-width: 760px; }
h2 { font-size: clamp(1.7rem, 3.8vw, 3rem); }
h3 { font-size: 1.15rem; }
.lead { color: var(--muted); font-size: 1.18rem; max-width: 680px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.button { align-items: center; border: 1px solid var(--border); border-radius: 6px; display: inline-flex; font-weight: 750; justify-content: center; min-height: 44px; padding: 10px 16px; text-decoration: none; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.button.primary:hover { background: var(--accent-strong); color: #ffffff; }
.button.secondary, .button:hover { background: var(--surface); }
.hero-visual { margin: 0; }
.hero-visual img, .pattern-card img, .article figure img { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.hero-visual figcaption, .article figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.content-section, .section-band { padding: 48px 0; }
.section-band { border-top: 1px solid var(--border); }
.section-heading { max-width: 760px; margin-bottom: 22px; }
.section-heading p:not(.eyebrow) { color: var(--muted); margin: 10px 0 0; }
.feature-grid, .article-grid, .pattern-grid { display: grid; gap: 16px; }
.feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.article-grid { grid-template-columns: repeat(5, minmax(220px, 1fr)); overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.pattern-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 20px; }
.pattern-grid.expanded { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.article-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.feature-panel, .post-card, .pattern-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-width: 0; padding: 20px; }
.feature-panel { border-top: 4px solid var(--magenta); }
.post-card { scroll-snap-align: start; }
.post-card:nth-child(2) { border-top: 4px solid var(--accent); }
.post-card:nth-child(3) { border-top: 4px solid var(--teal); }
.post-card:nth-child(4) { border-top: 4px solid var(--green); }
.post-card:nth-child(5) { border-top: 4px solid var(--amber); }
.post-card h3 a, .text-link { color: var(--text); text-decoration-color: rgba(0, 120, 212, 0.35); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.post-card h3 a:hover, .text-link:hover { color: var(--accent-strong); }
.post-card p, .feature-panel p, .pattern-card p { color: var(--muted); margin-bottom: 0; }
.post-card .meta, .meta { color: var(--teal); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; margin: 0 0 10px; text-transform: uppercase; }
.pattern-card img { aspect-ratio: 16 / 10; object-fit: contain; padding: 12px; width: 100%; }
.pattern-card h3 { margin-top: 16px; }
.pattern-card .text-link { display: inline-block; font-weight: 750; margin-top: 14px; }
.compact-hero { padding-bottom: 24px; }
.resource-list { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.resource-list a { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-weight: 700; padding: 14px 16px; text-decoration: none; }
.resource-list a:hover { border-color: var(--accent); color: var(--accent-strong); }
.site-footer { align-items: center; border-top: 1px solid var(--border); color: var(--muted); display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; padding: 28px 0 40px; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); font-weight: 650; }
.article-shell { width: min(860px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 64px; }
.article { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: clamp(22px, 5vw, 48px); }
.article h1 { font-size: clamp(2rem, 5vw, 3.8rem); }
.article h2 { font-size: clamp(1.35rem, 3vw, 2rem); margin-top: 34px; }
.article p, .article li { color: var(--muted); }
.article .intro { color: var(--text); font-size: 1.12rem; }
.article figure { margin: 28px 0; }
.article table { border-collapse: collapse; display: block; margin: 22px 0; overflow-x: auto; width: 100%; }
.article th, .article td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; }
.article th { background: var(--surface-soft); color: var(--text); }
.article-callout { background: var(--surface-soft); border-left: 4px solid var(--accent); border-radius: 8px; margin: 28px 0; padding: 16px 18px; }
.not-found { min-height: 54vh; }
.filter-controls { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.filter-search { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: inherit; font-size: 1rem; max-width: 400px; padding: 10px 14px; }
.filter-search:focus { border-color: var(--accent); outline: 3px solid rgba(0, 120, 212, 0.2); outline-offset: 0; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-btn { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; color: var(--muted); cursor: pointer; font-family: inherit; font-size: 0.82rem; font-weight: 700; padding: 6px 14px; transition: background 0.1s, border-color 0.1s, color 0.1s; white-space: nowrap; }
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.filter-empty { color: var(--muted); margin-top: 16px; }
.filter-reset { background: none; border: none; color: var(--accent); cursor: pointer; font-family: inherit; font-size: inherit; font-weight: 700; padding: 0; text-decoration: underline; }

/* Reveal animations */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.visible { opacity: 1; transform: none; }
.reveal:nth-child(2) { transition-delay: 0.08s; }
.reveal:nth-child(3) { transition-delay: 0.16s; }
.reveal:nth-child(4) { transition-delay: 0.24s; }
.reveal:nth-child(5) { transition-delay: 0.32s; }
.reveal:nth-child(6) { transition-delay: 0.40s; }

/* Reading progress bar */
#reading-progress { position: fixed; top: 0; left: 0; width: 100%; height: 3px; background: var(--accent); transform: scaleX(0); transform-origin: left; z-index: 100; transition: transform 0.08s linear; }

/* Enhanced card hover */
.post-card, .pattern-card, .feature-panel, .topic-tile { transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.post-card:hover, .pattern-card:hover, .feature-panel:hover { transform: translateY(-3px); box-shadow: 0 20px 44px rgba(21, 33, 47, 0.14); }

/* Stats band */
.stats-band { background: var(--surface-strong); padding: 28px 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.stat-item { border-right: 1px solid rgba(255, 255, 255, 0.1); padding: 10px 24px; text-align: center; }
.stat-item:last-child { border-right: none; }
.stat-number { display: block; color: #ffffff; font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 800; line-height: 1; }
.stat-label { color: rgba(255, 255, 255, 0.6); display: block; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.07em; margin-top: 6px; text-transform: uppercase; }

/* Service strip */
.service-strip { background: var(--surface); border-bottom: 1px solid var(--border); overflow: hidden; padding: 14px 0; }
.service-track { display: flex; gap: 8px; margin: 0 auto; overflow-x: auto; padding: 0 16px 4px; scrollbar-width: none; width: min(1120px, 100%); }
.service-track::-webkit-scrollbar { display: none; }
.service-badge { align-items: center; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 20px; color: var(--muted); display: inline-flex; font-size: 0.8rem; font-weight: 700; gap: 7px; padding: 5px 12px; white-space: nowrap; text-decoration: none; transition: border-color 0.15s, color 0.15s; }
.service-badge:hover { border-color: var(--accent); color: var(--accent); }
.service-dot { border-radius: 50%; flex-shrink: 0; height: 8px; width: 8px; }

/* Topic tiles */
.topic-grid { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); margin-top: 10px; }
.topic-tile { align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); display: flex; flex-direction: column; gap: 10px; padding: 20px; text-decoration: none; }
.topic-tile:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); box-shadow: 0 10px 28px rgba(21, 33, 47, 0.10); }
.topic-icon { align-items: center; border-radius: 8px; display: flex; height: 40px; justify-content: center; width: 40px; flex-shrink: 0; }
.topic-tile strong { display: block; font-size: 0.95rem; }
.topic-tile span { color: var(--muted); display: block; font-size: 0.82rem; }

@media print {
  .site-header, .skip-link, .hero-visual, .hero .actions, .filter-controls, .site-footer, .section-band, .stats-band, .service-strip { display: none !important; }
  body { background: white; color: black; font-size: 11pt; }
  .article-shell { width: 100%; padding: 0; }
  .article { border: none; box-shadow: none; padding: 0; }
  .article h1 { font-size: 22pt; }
  .article h2 { font-size: 15pt; break-after: avoid; }
  h3 { break-after: avoid; }
  .article table { display: table; overflow: visible; }
  tr { break-inside: avoid; }
  .article-callout { background: #f0f8ff; border-left: 3px solid #0078d4; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .article th { background: #eef6f8; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a[href]::after { content: none; }
  .pattern-card { break-inside: avoid; border: 1px solid #ccc; box-shadow: none; }
}

@media (max-width: 900px) {
  .hero, .feature-grid, .pattern-grid, .resource-list { grid-template-columns: 1fr; }
  .site-nav { align-items: flex-start; flex-direction: column; padding: 12px 0; }
  .nav-links { justify-content: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .site-nav, .hero, .content-section, .section-band, .site-footer, .article-shell { width: min(100% - 24px, 1120px); }
  .hero { padding-top: 36px; }
  .nav-links a { padding-left: 0; }
  .filter-search { max-width: 100%; }
  .topic-grid { grid-template-columns: 1fr; }
  .stat-item { border-right: none; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
  .stat-item:last-child { border-bottom: none; }
}