@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

:root {
  --blue: #185FA5;
  --blue-light: #E6F1FB;
  --blue-dark: #042C53;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --text-faint: #9b9b9b;
  --border: rgba(0,0,0,0.1);
  --border-mid: rgba(0,0,0,0.15);
  --bg: #ffffff;
  --bg-off: #f7f6f3;
  --bg-subtle: #f0efe9;
  --radius: 12px;
  --radius-sm: 6px;
  --font: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --maxw: 1120px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* Images embedded via ![alt](src) markdown inside narrative/description/statement
   body text (rendered by app.js's renderRichText across need/usecase/casestudy/
   tool/news detail pages) - block-level with spacing, not inline with text. */
.nd-block img, .uc-block img, .cs-step img, .tl-narrative img, .ni-narrative img {
  display: block;
  border-radius: var(--radius-sm, var(--radius));
  margin: 4px 0 8px;
}

/* Collapsible end-matter on detail pages: the apparatus that supports an
   article without being part of it - products used, related items, embedded
   data views. Positioned after the prose so the page still reads as one piece.
   Used by casestudy.html and usecase.html. */
.folds { max-width: 900px; margin-top: 40px; display: flex; flex-direction: column; gap: 10px; }
.fold { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); overflow: hidden; }
.fold.open { border-color: var(--border-mid); }
.fold-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 15px 18px; background: none; border: none; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.fold-head:hover { background: var(--bg-off); }
.fold-chev { width: 14px; flex: 0 0 auto; font-size: 10px; color: var(--text-faint); transition: transform 0.15s; }
.fold.open .fold-chev { transform: rotate(90deg); }
.fold-title { font-size: 15px; font-weight: 500; flex: 1; }
.fold-count { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.fold-body { display: none; padding: 4px 18px 20px; }
.fold.open .fold-body { display: block; }
.fold-lead { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.6; }
.fold-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.fold-sub { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin: 22px 0 10px; }
.fold-sub:first-child { margin-top: 0; }
.link-row { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.link-row:last-child { border-bottom: none; }
.link-row .lr-kind { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); flex: 0 0 58px; }

.site-nav { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; height: 58px; background: rgba(255,255,255,0.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.nav-logo { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text); }
.nav-logo:hover { text-decoration: none; }
.nav-logo-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--blue-dark); display: flex; align-items: center; justify-content: center; font-size: 15px; }
.nav-logo-sub { color: var(--text-muted); font-weight: 300; }
.nav-links { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav-links a { font-size: 13px; color: var(--text-muted); padding: 6px 11px; border-radius: var(--radius-sm); transition: background 0.15s, color 0.15s; }
.nav-links a:hover { background: var(--bg-off); color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--text); font-weight: 500; }
.nav-ext { font-size: 12px; color: var(--text-muted); padding: 6px 13px; border: 1px solid var(--border-mid); border-radius: var(--radius-sm); transition: background 0.15s; }
.nav-ext:hover { background: var(--bg-off); text-decoration: none; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }
.section-eyebrow { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); margin-bottom: 8px; }

.badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 4px; letter-spacing: 0.02em; }
.badge-mono { font-family: var(--font-mono); }

.maturity { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 20px; letter-spacing: 0.01em; }
.maturity::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* 5-level maturity vocabulary (schemas/common.schema.json#/$defs/maturity):
   concept -> pilot -> demonstrated -> operational -> scaled */
.maturity.concept      { background: #ECEAE5; color: #5b5750; }
.maturity.pilot        { background: #FAEEDA; color: #8a5008; }
.maturity.demonstrated { background: #E6F1FB; color: #1356a0; }
.maturity.operational  { background: #E1F5EE; color: #0a6a52; }
.maturity.scaled       { background: #EEEDFE; color: #3f3893; }

/* Editorial status - a different axis from maturity (writing progress, not
   deployment progress), same pill visual so the two read as siblings. */
.ed-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 20px; letter-spacing: 0.01em; }
.ed-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ed-status.stub     { background: #F2EEE4; color: #8a7f68; }
.ed-status.draft     { background: #FAEEDA; color: #8a5008; }
.ed-status.review    { background: #E6F1FB; color: #1356a0; }
.ed-status.approved  { background: #E1F5EE; color: #0a6a52; }
.ed-status.archived  { background: #ECEAE5; color: #5b5750; }

/* TAG CHIPS - free-text 'tags' field shared across needs/usecases/casestudies/tools/news */
.tag-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { font-size: 11.5px; padding: 3px 10px; border-radius: 20px; background: var(--bg-subtle); color: var(--text-muted); }

/* STAT CALLOUTS - use-case 'benefits' (expected) and case-study/tool 'key_results' (demonstrated) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.stat-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; background: var(--bg); }
.stat-card .stat-metric { font-size: 19px; font-weight: 500; color: var(--blue-dark); letter-spacing: -0.01em; margin-bottom: 4px; }
.stat-card .stat-statement { font-size: 13px; color: var(--text-muted); line-height: 1.55; }

/* EO VALUE CHAIN - use-case 'steps' */
.chain-list { display: flex; flex-direction: column; }
.chain-step { display: flex; gap: 16px; padding: 4px 0 22px; position: relative; }
.chain-step:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: -2px; width: 1px; background: var(--border-mid); }
.chain-step .chain-n { flex-shrink: 0; width: 27px; height: 27px; border-radius: 50%; background: var(--blue-dark); color: #fff; font-family: var(--font-mono); font-size: 12px; display: flex; align-items: center; justify-content: center; font-weight: 500; z-index: 1; }
.chain-step .chain-title { font-size: 14.5px; font-weight: 500; margin-bottom: 4px; }
.chain-step .chain-desc { font-size: 13.5px; color: var(--text-muted); line-height: 1.65; margin-bottom: 8px; }
.chain-step .chain-products { display: flex; flex-wrap: wrap; gap: 4px; }

/* PRECONDITIONS / ACTORS - use-case supporting lists */
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-list li { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; padding-left: 18px; position: relative; }
.mini-list li::before { content: '—'; position: absolute; left: 0; color: var(--text-faint); }
.actor-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--bg); margin-bottom: 8px; }
.actor-card .actor-role { font-size: 13.5px; font-weight: 500; margin-bottom: 4px; }
.actor-card .actor-desc { font-size: 13px; color: var(--text-muted); line-height: 1.55; }

/* VALUE PROPOSITION callout */
.value-prop { font-size: 16px; line-height: 1.6; color: var(--text); padding: 20px 24px; background: var(--blue-light); border-radius: var(--radius); border-left: 3px solid var(--blue); }

/* READING TIME + facet chips near title */
.meta-inline { font-size: 12px; color: var(--text-faint); display: inline-flex; align-items: center; gap: 5px; }
.facet-chip { font-size: 11px; padding: 3px 9px; border-radius: 4px; background: var(--bg-subtle); color: var(--text-muted); }

/* HERO IMAGE (usecase/casestudy/tool 'hero_image', shown when present) */
.hero-image-wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }
.hero-image-wrap img { width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--radius); margin-top: 20px; }

/* KEY-VALUE GRID - need/requirement 'attributes' open spec bag */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.kv-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--bg); }
.kv-row .kv-key { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 3px; }
.kv-row .kv-val { font-size: 13.5px; color: var(--text); }
.stakeholder-row { font-size: 13.5px; color: var(--text-muted); margin-bottom: 6px; }
.stakeholder-row strong { color: var(--text); font-weight: 500; }

/* SOURCES list - shared 'sources' field (needs/usecases/casestudies) */
.sources-list { display: flex; flex-direction: column; gap: 6px; }
.source-row { font-size: 13px; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.source-row .source-type { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 500; min-width: 66px; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0 18px; }
.filter-btn { font-family: var(--font); font-size: 13px; padding: 7px 15px; border: 1px solid var(--border-mid); border-radius: 8px; background: var(--bg); color: var(--text-muted); cursor: pointer; transition: all 0.13s ease; line-height: 1.2; }
.filter-btn:hover { border-color: var(--text-faint); color: var(--text); background: var(--bg-off); }
.filter-btn.active { background: var(--blue-dark); color: #fff; border-color: var(--blue-dark); }
.filter-btn.active:hover { background: var(--blue-dark); color: #fff; }

.filter-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.filter-row .filter-bar { margin: 22px 0 18px; flex: 1 1 auto; }
.search-box { margin: 22px 0 18px; }
/* The two free-text filters share a row - a search box and a multiselect - so
   the control block above a listing stays compact. Each keeps its own width
   until the row is too narrow, then they stack. */
.filter-text-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin: 22px 0 12px; }
.filter-text-row > * { flex: 1 1 260px; min-width: 0; }
.filter-text-row .search-box { margin: 0; }
.filter-text-row .multiselect-filter { margin: 0; max-width: none; }
.search-input { font-family: var(--font); font-size: 13px; padding: 8px 14px; width: 240px; max-width: 100%; border: 1px solid var(--border-mid); border-radius: 8px; background: var(--bg); color: var(--text); transition: border-color 0.13s ease; }
.search-input:focus { outline: none; border-color: var(--blue); }
.search-input::placeholder { color: var(--text-faint); }

/* MULTI-SELECT SEARCH FILTER - type-to-search dropdown + removable chips, e.g. the
   case studies stakeholder filter (see app.js buildMultiSelectFilter()). */
.multiselect-filter { position: relative; margin: 0 0 18px; max-width: 320px; }
.multiselect-suggestions { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin-top: 4px; max-height: 220px; overflow-y: auto; background: var(--bg); border: 1px solid var(--border-mid); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.multiselect-suggestions button { display: block; width: 100%; text-align: left; padding: 8px 12px; font-size: 13px; background: none; border: 0; cursor: pointer; color: var(--text); font-family: var(--font); }
.multiselect-suggestions button:hover { background: var(--bg-off); }
.multiselect-suggestions .empty { padding: 8px 12px; font-size: 12.5px; color: var(--text-faint); }
.multiselect-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.multiselect-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 6px 4px 10px; border-radius: 20px; background: var(--blue-light); color: var(--blue-dark); }
.multiselect-chip button { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; border: 0; background: none; color: inherit; font-size: 13px; line-height: 1; cursor: pointer; opacity: 0.7; }
.multiselect-chip button:hover { opacity: 1; background: rgba(4,44,83,0.12); }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

.box { border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; background: var(--bg); display: flex; flex-direction: column; text-decoration: none; color: var(--text); min-height: 200px; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; position: relative; overflow: hidden; }
.box::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: var(--box-accent, var(--border-mid)); opacity: 0.85; z-index: 1; }
.box:hover { border-color: var(--border-mid); box-shadow: 0 4px 18px rgba(0,0,0,0.07); transform: translateY(-2px); text-decoration: none; }
/* Optional card thumbnail (hero_image) - bleeds to the card's edges above the
   padded content, clipped by .box's own overflow:hidden + border-radius. */
.box-thumb { display: block; width: calc(100% + 44px); height: 140px; object-fit: cover; margin: -22px -22px 14px -22px; background: var(--bg-subtle); }
/* External-source case studies (classification.site.external_only) - the card
   links straight out via project_link instead of the local detail page. */
.box-external-badge { position: absolute; top: 10px; right: 10px; z-index: 2; font-size: 10.5px; font-weight: 500; padding: 3px 9px; border-radius: 20px; background: rgba(255,255,255,0.92); color: var(--text-muted); backdrop-filter: blur(2px); }
.box-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.box-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.box-id { font-size: 10px; color: var(--text-faint); font-family: var(--font-mono); }
.box-title { font-size: 15.5px; font-weight: 500; line-height: 1.35; margin-bottom: 10px; }
.box-summary { font-size: 13px; color: var(--text-muted); line-height: 1.6; flex: 1; }
.box-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.box-services { display: flex; flex-wrap: wrap; gap: 4px; }
.box-cta { font-size: 12px; color: var(--text-faint); font-weight: 500; }
.box:hover .box-cta { color: var(--blue); }

.page-hero { padding: 48px 32px 36px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--bg-off) 0%, var(--bg) 100%); }
.page-hero h1 { font-size: 30px; font-weight: 300; letter-spacing: -0.02em; margin-bottom: 12px; }
.page-hero p { font-size: 16px; color: var(--text-muted); line-height: 1.7; max-width: 660px; }
.breadcrumb { font-size: 13px; color: var(--text-faint); display: flex; align-items: center; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-faint); }
.breadcrumb a:hover { color: var(--blue); }
.result-count { font-size: 13px; color: var(--text-faint); margin-bottom: 16px; }

.site-footer { margin-top: 72px; border-top: 1px solid var(--border); padding: 40px 32px; background: var(--bg-off); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; flex-wrap: wrap; }
.footer-brand { font-size: 13px; color: var(--text-muted); max-width: 300px; line-height: 1.7; }
.footer-brand strong { display: block; color: var(--text); font-weight: 500; margin-bottom: 6px; }
.footer-links h4 { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 6px; }
.footer-links a { font-size: 13px; color: var(--text-muted); }
.footer-links a:hover { color: var(--blue); }
.footer-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-faint); text-align: center; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

@media (max-width: 640px) {
  .site-nav { padding: 8px 16px; height: auto; flex-wrap: wrap; gap: 8px; }
  .container, .page-hero, .site-footer { padding-left: 16px; padding-right: 16px; }
  .page-hero h1 { font-size: 24px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* NAV DROPDOWN (segments) */
.nav-dd { position: relative; display: inline-block; }
.nav-dd-trigger { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-muted); padding: 6px 11px; border-radius: var(--radius-sm); cursor: pointer; }
.nav-dd-trigger:hover { background: var(--bg-off); color: var(--text); text-decoration: none; }
.nav-dd-trigger.active { color: var(--text); font-weight: 500; }
.dd-caret { font-size: 9px; opacity: 0.7; }
.nav-dd-menu { position: absolute; top: 100%; left: 0; margin-top: 6px; min-width: 240px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,0.10); padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity 0.14s, transform 0.14s, visibility 0.14s; z-index: 120; }
.nav-dd:hover .nav-dd-menu, .nav-dd:focus-within .nav-dd-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-dd-menu a { display: block; font-size: 13px; color: var(--text-muted); padding: 8px 12px; border-radius: 6px; }
.nav-dd-menu a:hover { background: var(--bg-off); color: var(--text); text-decoration: none; }
.nav-dd-menu a.dd-all { color: var(--text); font-weight: 500; border-bottom: 1px solid var(--border); border-radius: 6px 6px 0 0; margin-bottom: 4px; padding-bottom: 10px; }

/* INTEGRATION MODE BADGE */
.mode-badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 4px 11px; border-radius: 20px; letter-spacing: 0.01em; }
.mode-direct  { background: #E1F5EE; color: #0a6a52; }
.mode-fusion  { background: #E6F1FB; color: #1356a0; }
.mode-process { background: #FAEEDA; color: #8a5008; }
.mode-mixed   { background: #EEEDFE; color: #3f3893; }

@media (max-width: 640px) {
  .nav-dd-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: none; padding: 0 0 0 12px; min-width: 0; margin-top: 2px; }
  .nav-dd-menu a.dd-all { display: none; }
}

/* SAMPLE DATA VIEWS - embedded iframe(s) of live Copernicus sample data, shared by
   use case and case study detail pages (see app.js renderDataViews()). */
.dataview-block + .dataview-block { margin-top: 32px; }
.dataview-desc { font-size: 14.5px; line-height: 1.75; color: var(--text); margin-bottom: 14px; }
.dataview-frame-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-off); }
.dataview-frame-wrap iframe { width: 100%; height: 520px; border: 0; display: block; }
/* Cropped variant: source page has no chrome-free embed view, so the iframe is
   rendered at its native desktop width and a [top, top+height] band is scaled to
   fit the card - sized by app.js's sizeCroppedDataviews(), not CSS alone. */
.dataview-frame-wrap.dataview-cropped { position: relative; height: auto; }
.dataview-crop-inner { position: relative; overflow: hidden; transform-origin: top left; }
.dataview-crop-inner iframe { position: absolute; top: 0; left: 0; width: auto; height: auto; }

/* Headings generated by renderRichText() inside a markdown body container.
   Scoped to the body containers rather than global h3-h6, so the pages' own
   uppercase section labels (which are also h3) keep their existing styling.
   These containers are <div>, not <p>: a <p> cannot legally contain block
   elements, and the browser silently dropped injected headings when they were. */
#uc-description h3, #uc-description h4, #uc-description h5, #uc-description h6,
#nd-statement h3, #nd-statement h4, #nd-rationale h3, #nd-rationale h4,
#cs-challenge h3, #cs-approach h3, #cs-results h3,
#cs-challenge h4, #cs-approach h4, #cs-results h4,
.ni-narrative h3, .ni-narrative h4 {
  font-size: 15px; font-weight: 600; color: var(--text);
  text-transform: none; letter-spacing: 0; margin: 22px 0 8px;
}
