/* ===========================================================================
   CORISK BLOG — standalone stylesheet. No build step, no Tailwind runtime.

   Tokens ported verbatim (same oklch values) from the live app's
   CoRisk-web/src/app/globals.css (READ-ONLY source — not edited, only read).

   DARK MODE: the live app toggles dark via a manual button that sets
   [data-theme] on <html>, persisted to localStorage('corisk-theme'); it
   deliberately does NOT read prefers-color-scheme (see globals.css comment).
   A verbatim-served static page can't safely hook into that app-owned
   localStorage key pre-paint without risking a flash, and shipping React to
   read it would violate the no-build-step constraint — so this skin uses the
   OS-level `prefers-color-scheme` media query instead. Same token VALUES,
   different (and here, the only practical) trigger. See site.yaml comment.
   =========================================================================== */

/* ---------- tokens: light (default) ---------- */
:root {
  --color-brand: oklch(0.72 0.20 142);        /* #3ABF36 signal green */
  --color-brand-deep: oklch(0.34 0.1 145);    /* #044002 deep forest */
  --color-brand-tint: oklch(0.95 0.05 142);

  --color-bg: oklch(0.995 0.002 145);
  --color-surface: oklch(1 0 0);
  --color-raised: oklch(0.975 0.004 145);
  --color-text: oklch(0.34 0.012 255);        /* dark slate, never pure black */
  --color-muted: oklch(0.52 0.012 255);
  --color-faint: oklch(0.64 0.010 255);
  --color-line: oklch(0.9 0.005 255);
  --color-line-soft: oklch(0.945 0.004 255);

  --color-accent: oklch(0.50 0.17 142);       /* accent text/links */
  --color-accent-fill: var(--color-brand);    /* button fill */
  --color-on-accent: oklch(0.28 0.09 145);    /* ink on the bright fill */

  --color-info: oklch(0.55 0.13 240);

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

  --gutter: 20px;
  --section-py: 56px;

  --font-sans: 'Gabarito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: oklch(0.18 0.02 145);
    --color-surface: oklch(0.22 0.022 145);
    --color-raised: oklch(0.26 0.024 145);
    --color-text: oklch(0.97 0.005 145);
    --color-muted: oklch(0.74 0.015 145);
    --color-faint: oklch(0.6 0.015 145);
    --color-line: color-mix(in oklch, white 12%, transparent);
    --color-line-soft: color-mix(in oklch, white 7%, transparent);

    --color-accent: oklch(0.72 0.19 142);
    --color-accent-fill: oklch(0.68 0.19 142);
    --color-on-accent: oklch(0.18 0.03 145);
    --color-brand-tint: oklch(0.30 0.055 145);

    color-scheme: dark;
  }
}

/* ---------- reset / base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; hyphens: none; margin: 0; }
:where(a, button):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- layout ---------- */
.shell {
  width: min(1440px, 100% - 20px);
  margin-inline: auto;
  padding-inline: 16px;
}
@media (min-width: 768px) {
  .shell { width: min(1440px, 100% - 32px); padding-inline: 24px; }
}
.prose-w { max-width: none; margin-inline: auto; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-faint);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 160ms ease, background-color 160ms ease, border-color 160ms ease;
}
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 0.875rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--color-accent-fill); color: var(--color-on-accent); }
.btn-primary:hover { opacity: 0.9; }
.btn-ghost { border-color: var(--color-brand); color: var(--color-accent); background: transparent; }
.btn-ghost:hover { background: var(--color-brand-tint); }
.btn-outline { border-color: var(--color-line); color: var(--color-text); background: transparent; }
.btn-outline:hover { background: var(--color-raised); }

/* ---------- card ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.04), 0 8px 24px oklch(0 0 0 / 0.05);
}
@media (prefers-color-scheme: dark) {
  .card { box-shadow: none; border-color: var(--color-line); }
}

/* ===========================================================================
   HEADER — floating pill, matches the app shell (fixed, translucent, blurred)
   =========================================================================== */
.site-header {
  position: sticky;
  top: 10px;
  z-index: 50;
  margin: 10px auto 0;
  width: min(1440px, 100% - 20px);
  border: 1px solid var(--color-line);
  border-radius: 16px;
  background: color-mix(in oklch, var(--color-surface) 78%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}
@media (min-width: 768px) { .site-header { width: min(1440px, 100% - 32px); } }
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
}
@media (min-width: 768px) { .site-header-inner { padding: 12px 24px; } }
.site-logo { display: inline-flex; align-items: center; line-height: 0; }
.site-logo img { height: 26px; width: auto; }
.mark-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .mark-light { display: none; }
  .mark-dark { display: block; }
}
.site-nav {
  display: none;
  align-items: center;
  gap: 28px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-inline: auto 0;
  padding-left: 28px;
}
@media (min-width: 768px) { .site-nav { display: flex; } }
.site-nav a { color: var(--color-muted); text-decoration: none; transition: color 160ms ease; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--color-text); }
.site-header-actions { display: none; align-items: center; gap: 10px; }
@media (min-width: 768px) { .site-header-actions { display: flex; } }

/* the one CTA that never hides, at any width (mirrors the live header) */
.site-header-cta { margin-left: auto; flex-shrink: 0; }
@media (min-width: 768px) { .site-header-cta { margin-left: 0; } }

/* mobile menu — zero-JS <details> disclosure, no hamburger script needed */
.nav-more { position: relative; }
@media (min-width: 768px) { .nav-more { display: none; } }
.nav-more > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--color-line);
  cursor: pointer;
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  display: grid;
  gap: 2px;
  min-width: 200px;
  padding: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px oklch(0 0 0 / 0.12);
}
.nav-more-panel a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--color-text);
}
.nav-more-panel a:hover { background: var(--color-raised); }

/* ===========================================================================
   FOOTER
   =========================================================================== */
.site-footer { margin-top: 64px; border-top: 1px solid var(--color-line-soft); background: var(--color-raised); }
.site-footer-grid {
  display: grid;
  gap: 40px;
  padding: 48px 0;
}
@media (min-width: 860px) {
  .site-footer-grid { grid-template-columns: minmax(0, 1.3fr) auto auto minmax(0, 1fr); gap: 48px; }
}
.site-footer h4.eyebrow { margin-bottom: 12px; }
.site-footer-brand img { height: 26px; width: auto; margin-bottom: 14px; }
.site-footer-brand p { max-width: 52ch; font-size: 0.875rem; line-height: 1.6; color: var(--color-muted); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { text-decoration: none; font-size: 0.9375rem; color: var(--color-muted); }
.site-footer a:hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 2px; }
.site-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  border-top: 1px solid var(--color-line-soft);
  padding: 22px 0 32px;
  font-size: 0.8125rem;
  color: var(--color-faint);
}
.site-footer-bottom p { max-width: 78ch; line-height: 1.6; margin: 0 0 8px; }

/* ===========================================================================
   BLOG HERO (index + category)
   =========================================================================== */
.blog-hero { position: relative; overflow: hidden; padding: 64px 0 40px; text-align: center; isolation: isolate; }
.blog-hero .aurora {
  position: absolute; inset: -30%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 46% at 18% 26%, oklch(0.88 0.13 82 / 0.30), transparent 70%),
    radial-gradient(34% 40% at 70% 18%, oklch(0.89 0.11 52 / 0.22), transparent 70%),
    radial-gradient(44% 52% at 56% 80%, oklch(0.87 0.15 145 / 0.28), transparent 70%),
    radial-gradient(30% 38% at 90% 64%, oklch(0.91 0.10 168 / 0.20), transparent 70%);
  filter: blur(56px) saturate(1.15);
}
@media (prefers-color-scheme: dark) {
  .blog-hero .aurora {
    background:
      radial-gradient(38% 46% at 18% 26%, oklch(0.70 0.12 82 / 0.14), transparent 70%),
      radial-gradient(34% 40% at 70% 18%, oklch(0.68 0.11 52 / 0.10), transparent 70%),
      radial-gradient(44% 52% at 56% 80%, oklch(0.68 0.14 145 / 0.16), transparent 70%),
      radial-gradient(30% 38% at 90% 64%, oklch(0.72 0.10 168 / 0.10), transparent 70%);
  }
}
.blog-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 14px 0 12px;
}
.blog-hero p { max-width: 56ch; margin: 0 auto; font-size: 1.0625rem; line-height: 1.6; color: var(--color-muted); }

/* breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--color-faint);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--color-accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { opacity: 0.5; }
.breadcrumb .current {
  max-width: 40ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 22px 0 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-line);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--color-muted);
  transition: border-color 160ms ease, color 160ms ease;
}
.chip:hover, .chip.active { border-color: var(--color-brand); color: var(--color-accent); background: var(--color-brand-tint); }
.chip .count { opacity: 0.65; margin-left: 4px; }

/* ===========================================================================
   ARTICLE / CATEGORY GRID + CARDS  (rich index — excerpt + date + category + read-time)
   =========================================================================== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 32px 0 40px;
}
@media (max-width: 1023px) { .blog-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; } }
@media (max-width: 639px) { .blog-grid { grid-template-columns: 1fr; gap: 16px; } }

.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.04), 0 8px 24px oklch(0 0 0 / 0.05);
  transition: transform 220ms cubic-bezier(.16,1,.3,1), box-shadow 220ms cubic-bezier(.16,1,.3,1);
}
@media (prefers-color-scheme: dark) { .blog-card { box-shadow: none; border-color: var(--color-line); } }
@media (hover: hover) {
  .blog-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px oklch(0 0 0 / 0.10); }
  .blog-card:hover img { transform: scale(1.03); }
}
.blog-card-img { aspect-ratio: 1200 / 628; overflow: hidden; background: var(--color-raised); }
.blog-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 320ms ease; }
.blog-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.blog-card-category {
  align-self: flex-start;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
  padding: 3px 10px;
  background: var(--color-brand-tint);
  border-radius: 999px;
}
.blog-card-title { font-size: 1rem; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
.blog-card-excerpt {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--color-line-soft);
  font-size: 0.75rem;
  color: var(--color-faint);
}

/* ---------- pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 0 56px; flex-wrap: wrap; }
.page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-line);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-muted);
  text-decoration: none;
}
.page-btn:hover { border-color: var(--color-brand); color: var(--color-accent); background: var(--color-brand-tint); }
.page-btn.current { background: var(--color-accent-fill); border-color: var(--color-accent-fill); color: var(--color-on-accent); }
.page-ellipsis { width: 24px; text-align: center; color: var(--color-faint); }

/* ===========================================================================
   ARTICLE PAGE
   =========================================================================== */
.article-hero { padding: 40px 0 8px; text-align: center; }
.article-hero h1 {
  max-width: none;
  margin: 12px auto 0;
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.16;
}
.article-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 0.8125rem;
  color: var(--color-faint);
}
.article-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; }

.article-container { padding: 24px 0 24px; }
.article-figure { margin: 8px 0 8px; }
.article-figure img {
  width: 100%;
  aspect-ratio: 1200 / 628;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-line-soft);
}
.article-figure figcaption {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--color-faint);
  text-align: right;
}
.article-figure figcaption a { color: var(--color-faint); text-decoration: underline; text-underline-offset: 2px; }

.source-credit {
  margin: 0 0 28px;
  padding: 12px 16px;
  border-left: 3px solid var(--color-brand);
  background: var(--color-brand-tint);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.875rem;
  color: var(--color-muted);
}
.source-credit a { color: var(--color-accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.article-body { font-size: 1.0625rem; line-height: 1.85; letter-spacing: -0.002em; max-width: none; margin: 0 auto; }
.article-body h2 { font-size: clamp(1.375rem, 3vw, 1.75rem); font-weight: 700; letter-spacing: -0.015em; margin: 44px 0 16px; line-height: 1.28; }
.article-body h3 { font-size: 1.1875rem; font-weight: 600; margin: 32px 0 12px; line-height: 1.3; }
.article-body p { margin: 0 0 22px; }
.article-body ul, .article-body ol { margin: 0 0 22px; padding-left: 26px; }
.article-body li { margin-bottom: 8px; line-height: 1.8; }
.article-body strong { font-weight: 700; }
.article-body a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.article-body a:hover { opacity: 0.8; }
.article-body table { width: 100%; border-collapse: collapse; margin: 8px 0 28px; font-size: 0.9375rem; }
.article-body th, .article-body td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-line-soft); }
.article-body th { font-weight: 700; color: var(--color-faint); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.article-body blockquote {
  margin: 28px 0;
  padding: 14px 22px;
  border-left: 3px solid var(--color-brand);
  background: var(--color-raised);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--color-muted);
}

/* ---------- FAQ (native <details>, no JS) ---------- */
.faq { max-width: none; margin: 8px auto 0; }
.faq h2 { font-size: clamp(1.375rem, 3vw, 1.75rem); font-weight: 700; letter-spacing: -0.015em; margin: 44px 0 16px; }
.faq details {
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius-md);
  padding: 4px 18px;
  margin-bottom: 10px;
  background: var(--color-surface);
}
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  font-weight: 600;
  font-size: 0.9375rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  font-size: 1.25rem;
  line-height: 1;
  color: var(--color-accent);
  transition: transform 200ms ease;
  flex-shrink: 0;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 16px; color: var(--color-muted); font-size: 0.9375rem; line-height: 1.7; }

/* ---------- dual CTA band — the one distinctive CoRisk element ---------- */
.cta-band {
  max-width: none;
  margin: 48px auto 0;
  padding: 32px;
  border-radius: var(--radius-lg);
  background: var(--color-raised);
  border: 1px solid var(--color-line-soft);
  display: grid;
  gap: 20px;
}
@media (min-width: 640px) {
  .cta-band { grid-template-columns: 1fr auto auto; align-items: center; padding: 32px 36px; }
}
.cta-band-copy p:first-child { margin: 0 0 4px; font-weight: 700; font-size: 1.0625rem; }
.cta-band-copy p:last-child { margin: 0; font-size: 0.9375rem; color: var(--color-muted); }
.cta-band .btn { white-space: nowrap; }

/* ---------- related ---------- */
.related-posts { max-width: none; margin: 56px auto 0; }
.related-posts h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 18px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 767px) { .related-grid { grid-template-columns: 1fr; } }
.related-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; border: 1px solid var(--color-line-soft); border-radius: var(--radius-lg); overflow: hidden; }
.related-card-img { aspect-ratio: 16/9; background: var(--color-raised); overflow: hidden; }
.related-card-img img { width: 100%; height: 100%; object-fit: cover; }
.related-card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.related-card-category { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-accent); }
.related-card-title { font-size: 0.875rem; font-weight: 700; line-height: 1.4; }
.related-card-date { font-size: 0.75rem; color: var(--color-faint); margin-top: auto; padding-top: 6px; }

/* ---------- prev/next ---------- */
.article-prevnext {
  max-width: none;
  margin: 40px auto 0;
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--color-line-soft);
  padding-top: 24px;
}
@media (min-width: 640px) { .article-prevnext { grid-template-columns: 1fr 1fr; } }
.article-prevnext a { text-decoration: none; padding: 14px 16px; border: 1px solid var(--color-line-soft); border-radius: var(--radius-md); }
.article-prevnext a:hover { border-color: var(--color-brand); }
.article-prevnext .dir { display: block; font-size: 0.75rem; color: var(--color-faint); margin-bottom: 4px; }
.article-prevnext .next { text-align: right; }

/* ---------- category hub header ---------- */
.category-hero p.eyebrow { justify-content: center; }
.category-hero .desc { margin-top: 10px; }

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

/* ---------- mobile tightening ---------- */
@media (max-width: 639px) {
  .blog-hero { padding: 40px 0 28px; }
  .article-hero { padding: 24px 0 4px; }
  .article-body { font-size: 1rem; }
  .cta-band { padding: 24px; }
  .site-footer-bottom { padding-bottom: 40px; }
}
