@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Lora:ital,wght@0,400;0,600;0,700;1,400&family=Merriweather:wght@400;700&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,600;0,6..72,700;1,6..72,400&family=Playfair+Display:wght@600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --nw-bg: #FBF9F5;
  --nw-surface: #FFFFFF;
  --nw-stone: #F3EFE8;
  --nw-ink: #141413;
  --nw-ink-sec: #4B4944;
  --nw-ink-muted: #757067;
  --nw-rule: #E5DFD3;
  --nw-rule-strong: #CEC5B4;
  --nw-forest: #1F3A2E;
  --nw-terracotta: #A43820;
  --nw-accent: #1F3A2E;
  --nw-font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --nw-font-serif: 'Newsreader', Georgia, serif;
  --nw-font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.nw-public {
  margin: 0;
  background: var(--nw-bg);
  color: var(--nw-ink);
  font-family: var(--nw-font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.nw-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Top Ecosystem Strip */
.nw-topstrip {
  background: #141413;
  color: #EAE5DC;
  font-size: 0.78rem;
  border-bottom: 1px solid #2A2926;
}

.nw-topstrip__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  flex-wrap: wrap;
  padding-top: 4px;
  padding-bottom: 4px;
}

.nw-topstrip__links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nw-topstrip a {
  color: #D8D2C7;
  text-decoration: none;
  transition: color 0.15s ease;
}

.nw-topstrip a:hover,
.nw-topstrip a.is-active {
  color: #FFFFFF;
}

.nw-topstrip__sep {
  color: #524F49;
}

/* Masthead Header */
.nw-masthead {
  background: var(--nw-surface);
  border-bottom: 1px solid var(--nw-rule);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nw-masthead__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
}

.nw-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--nw-ink);
}

.nw-brand__mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--nw-forest);
  color: #FBF9F5;
  font-family: var(--nw-font-serif);
  font-weight: 700;
  font-size: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nw-brand__title {
  display: block;
  font-family: var(--nw-font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.nw-brand__sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nw-ink-muted);
  margin-top: 3px;
}

.nw-masthead__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nw-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.nw-search-box input {
  width: 240px;
  padding: 8px 12px 8px 34px;
  border-radius: 999px;
  border: 1px solid var(--nw-rule-strong);
  background: var(--nw-bg);
  font-family: inherit;
  font-size: 0.84rem;
  color: var(--nw-ink);
  outline: none;
  transition: border-color 0.15s ease, width 0.2s ease;
}

.nw-search-box input:focus {
  border-color: var(--nw-forest);
  background: #FFFFFF;
}

.nw-search-box svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--nw-ink-muted);
  pointer-events: none;
}

.nw-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--nw-rule-strong);
  background: #FFFFFF;
  color: var(--nw-ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nw-btn:hover {
  border-color: var(--nw-ink);
}

.nw-btn--primary {
  background: var(--nw-forest);
  border-color: var(--nw-forest);
  color: #FFFFFF;
}

.nw-btn--primary:hover {
  background: #162B22;
}

/* Category Ribbon */
.nw-catbar {
  border-top: 1px solid var(--nw-rule);
  background: #FCFBF8;
  overflow-x: auto;
  scrollbar-width: none;
}

.nw-catbar::-webkit-scrollbar {
  display: none;
}

.nw-catbar__inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 0;
  white-space: nowrap;
}

.nw-catpill {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--nw-ink-sec);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.nw-catpill:hover {
  background: var(--nw-stone);
  color: var(--nw-ink);
}

.nw-catpill.is-active {
  background: var(--nw-forest);
  color: #FFFFFF;
}

/* Hero Featured Story */
.nw-hero {
  padding: 36px 0 28px;
}

.nw-hero-card {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  background: var(--nw-surface);
  border: 1px solid var(--nw-rule);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(20, 20, 19, 0.04);
}

.nw-hero-card__media {
  background: var(--nw-stone);
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid var(--nw-rule);
}

.nw-hero-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nw-hero-card__body {
  padding: 34px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.nw-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--nw-terracotta);
  margin-bottom: 12px;
}

.nw-badge-featured {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
}

.nw-hero-card__title {
  font-family: var(--nw-font-serif);
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.18;
  margin: 0 0 14px;
  color: var(--nw-ink);
}

.nw-hero-card__title a {
  color: inherit;
  text-decoration: none;
}

.nw-hero-card__title a:hover {
  color: var(--nw-forest);
}

.nw-hero-card__sub {
  font-size: 0.98rem;
  color: var(--nw-ink-sec);
  margin: 0 0 20px;
  line-height: 1.6;
}

.nw-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.79rem;
  color: var(--nw-ink-muted);
}

/* Stream Grid */
.nw-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--nw-rule);
  padding-bottom: 12px;
  margin: 20px 0 24px;
}

.nw-section-head h2 {
  font-family: var(--nw-font-serif);
  font-size: 1.5rem;
  margin: 0;
}

.nw-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 48px;
}

.nw-card {
  background: var(--nw-surface);
  border: 1px solid var(--nw-rule);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.nw-card:hover {
  transform: translateY(-2px);
  border-color: var(--nw-rule-strong);
  box-shadow: 0 10px 26px rgba(20, 20, 19, 0.06);
}

.nw-card__cover {
  aspect-ratio: 16 / 9;
  background: var(--nw-stone);
  overflow: hidden;
  border-bottom: 1px solid var(--nw-rule);
}

.nw-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nw-card__body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.nw-card__cat {
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--card-accent, var(--nw-forest));
  margin-bottom: 8px;
}

.nw-card__title {
  font-family: var(--nw-font-serif);
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.28;
  margin: 0 0 10px;
  color: var(--nw-ink);
}

.nw-card__excerpt {
  font-size: 0.88rem;
  color: var(--nw-ink-sec);
  line-height: 1.55;
  margin: 0 0 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nw-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--nw-ink-muted);
  padding-top: 12px;
  border-top: 1px solid var(--nw-rule);
}

/* Reading Progress Bar */
.nw-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--nw-accent, var(--nw-forest));
  z-index: 999;
  transition: width 0.08s linear;
}

/* Article Detail Page & Rich Content Styles (shared with Studio Live Preview!) */
.nw-article-wrap {
  padding: 36px 0 64px;
}

.nw-article-header {
  max-width: 860px;
  margin: 0 auto 28px;
}

.nw-article-header--centered {
  text-align: center;
}

.nw-article-header--centered .nw-meta-line {
  justify-content: center;
}

.nw-article-title {
  font-family: var(--nw-font-serif);
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.02em;
  margin: 10px 0 16px;
  color: var(--nw-ink);
}

.nw-article-subtitle {
  font-size: 1.16rem;
  color: var(--nw-ink-sec);
  line-height: 1.6;
  margin: 0 0 20px;
}

.nw-author-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--nw-rule);
  border-bottom: 1px solid var(--nw-rule);
}

.nw-author-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nw-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--nw-accent, var(--nw-forest));
  color: #FFFFFF;
  font-weight: 800;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nw-article-cover {
  max-width: 980px;
  margin: 0 auto 34px;
}

.nw-article-cover img {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--nw-rule);
  display: block;
  background: var(--nw-stone);
}

.nw-article-cover figcaption {
  font-size: 0.8rem;
  color: var(--nw-ink-muted);
  text-align: center;
  margin-top: 8px;
}

.nw-article-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 740px);
  gap: 44px;
  justify-content: center;
  align-items: start;
}

.nw-toc {
  position: sticky;
  top: 96px;
  background: var(--nw-surface);
  border: 1px solid var(--nw-rule);
  border-radius: 12px;
  padding: 16px;
  font-size: 0.81rem;
}

.nw-toc__title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nw-ink-muted);
  margin-bottom: 10px;
}

.nw-toc a {
  display: block;
  color: var(--nw-ink-sec);
  text-decoration: none;
  padding: 5px 0;
  line-height: 1.35;
  border-left: 2px solid transparent;
  padding-left: 10px;
}

.nw-toc a:hover {
  color: var(--nw-accent, var(--nw-forest));
  border-left-color: var(--nw-accent, var(--nw-forest));
}

/* Rich Prose Body (used both on public Article page AND inside Studio Editor!) */
.nw-prose {
  background: var(--nw-surface);
  border: 1px solid var(--nw-rule);
  border-radius: 16px;
  padding: 40px 46px;
  font-size: 1.05rem;
  line-height: 1.76;
  color: var(--nw-ink);
}

.nw-prose h1,
.nw-prose h2,
.nw-prose h3,
.nw-prose h4 {
  color: var(--nw-ink);
  line-height: 1.25;
  margin-top: 1.8em;
  margin-bottom: 0.65em;
}

.nw-prose h2 {
  font-family: var(--nw-font-serif);
  font-size: 1.65rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--nw-rule);
}

.nw-prose h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.nw-prose p {
  margin: 0 0 1.15em;
}

.nw-prose a {
  color: var(--nw-accent, var(--nw-forest));
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.nw-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.nw-block-lead {
  font-size: 1.2rem;
  font-weight: 500;
  color: #292826;
  line-height: 1.68;
  padding-left: 18px;
  border-left: 3px solid var(--nw-accent, var(--nw-forest));
  margin-bottom: 1.5em !important;
}

.nw-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 12px;
  margin: 22px 0;
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
}

.nw-callout--info { background: #EFF6FF; border-color: #BFDBFE; }
.nw-callout--success { background: #ECFDF5; border-color: #A7F3D0; }
.nw-callout--warning { background: #FFFBEB; border-color: #FDE68A; }
.nw-callout--official { background: #F4EFE7; border-color: #CEC5B4; }

.nw-callout__icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.nw-callout__title {
  font-weight: 800;
  font-size: 0.98rem;
  margin-bottom: 4px;
  color: var(--nw-ink);
}

.nw-callout__text {
  font-size: 0.94rem;
  color: var(--nw-ink-sec);
  line-height: 1.58;
}

.nw-quote {
  margin: 28px 0;
  padding: 24px 28px;
  background: var(--nw-stone);
  border-left: 4px solid var(--nw-accent, var(--nw-forest));
  border-radius: 0 14px 14px 0;
}

.nw-quote p {
  font-family: var(--nw-font-serif);
  font-size: 1.35rem;
  font-style: italic;
  line-height: 1.48;
  margin: 0 0 10px !important;
  color: var(--nw-ink);
}

.nw-quote footer {
  font-size: 0.86rem;
  color: var(--nw-ink-sec);
}

.nw-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.nw-kpi-card {
  background: var(--nw-bg);
  border: 1px solid var(--nw-rule);
  border-radius: 12px;
  padding: 16px 18px;
  text-align: center;
}

.nw-kpi-card__val {
  font-family: var(--nw-font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--nw-accent, var(--nw-forest));
}

.nw-kpi-card__lbl {
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 5px;
  color: var(--nw-ink);
}

.nw-kpi-card__sub {
  font-size: 0.74rem;
  color: var(--nw-ink-muted);
  margin-top: 3px;
}

.nw-cols {
  display: grid;
  gap: 16px;
  margin: 24px 0;
}

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

.nw-col-card {
  background: var(--nw-bg);
  border: 1px solid var(--nw-rule);
  border-radius: 12px;
  padding: 18px;
}

.nw-col-card h4 {
  margin: 0 0 8px !important;
  font-size: 1rem;
}

.nw-col-card p {
  font-size: 0.9rem;
  color: var(--nw-ink-sec);
  margin: 0 !important;
  line-height: 1.55;
}

.nw-timeline {
  border-left: 2px solid var(--nw-rule-strong);
  margin: 24px 0 24px 10px;
  padding-left: 22px;
}

.nw-timeline__item {
  position: relative;
  margin-bottom: 18px;
}

.nw-timeline__item::before {
  content: '';
  position: absolute;
  left: -29px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--nw-accent, var(--nw-forest));
  border: 2px solid #FFFFFF;
}

.nw-timeline__date {
  font-family: var(--nw-font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--nw-terracotta);
  text-transform: uppercase;
}

.nw-timeline__title {
  font-weight: 800;
  font-size: 1rem;
  margin: 2px 0 4px;
}

.nw-timeline__desc {
  font-size: 0.92rem;
  color: var(--nw-ink-sec);
}

.nw-changelog {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 20px 22px;
  margin: 24px 0;
}

.nw-changelog__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.nw-changelog__ver {
  background: #0F172A;
  color: #FFFFFF;
  font-family: var(--nw-font-mono);
  font-size: 0.73rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.nw-changelog__date {
  margin-left: auto;
  font-size: 0.78rem;
  color: #64748B;
}

.nw-changelog ul {
  margin: 0;
  padding-left: 20px;
  font-size: 0.94rem;
}

.nw-changelog li {
  margin-bottom: 6px;
}

.nw-media {
  margin: 24px 0;
  text-align: center;
}

.nw-media img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--nw-rule);
}

.nw-media figcaption {
  font-size: 0.8rem;
  color: var(--nw-ink-muted);
  margin-top: 7px;
}

.nw-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 26px 0 10px;
}

.nw-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  background: var(--nw-accent, var(--nw-forest));
  color: #FFFFFF !important;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--nw-accent, var(--nw-forest));
  transition: opacity 0.15s ease;
}

.nw-cta-btn:hover {
  opacity: 0.92;
}

.nw-cta-btn--outline {
  background: #FFFFFF;
  color: var(--nw-ink) !important;
  border-color: var(--nw-rule-strong);
}

.nw-divider {
  border: 0;
  border-top: 1px solid var(--nw-rule);
  margin: 30px 0;
}

/* Reaction Bar & Tags */
.nw-reactions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--nw-rule);
}

.nw-react-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--nw-rule-strong);
  background: var(--nw-bg);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.nw-react-btn:hover,
.nw-react-btn.is-done {
  border-color: var(--nw-accent, var(--nw-forest));
  background: #FFFFFF;
}

/* Footer */
.nw-footer {
  background: #141413;
  color: #D8D2C7;
  padding: 48px 0 32px;
  margin-top: 56px;
}

.nw-footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid #2A2926;
}

.nw-footer h4 {
  color: #FFFFFF;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
}

.nw-footer a {
  display: block;
  color: #B9B2A6;
  text-decoration: none;
  font-size: 0.86rem;
  margin-bottom: 8px;
}

.nw-footer a:hover {
  color: #FFFFFF;
}

.nw-footer__bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 20px;
  font-size: 0.8rem;
  color: #8F897E;
}

@media (max-width: 980px) {
  .nw-hero-card { grid-template-columns: 1fr; }
  .nw-hero-card__media { border-right: 0; border-bottom: 1px solid var(--nw-rule); min-height: 220px; }
  .nw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nw-article-layout { grid-template-columns: 1fr; }
  .nw-toc { position: static; }
  .nw-cols--2, .nw-cols--3 { grid-template-columns: 1fr; }
  .nw-footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .nw-masthead__main { flex-wrap: wrap; }
  .nw-search-box { width: 100%; order: 3; }
  .nw-search-box input { width: 100%; }
  .nw-grid { grid-template-columns: 1fr; }
  .nw-prose { padding: 24px 20px; }
  .nw-hero-card__body { padding: 24px 22px; }
  .nw-footer__grid { grid-template-columns: 1fr; }
}
