/* ============================================================
   GRANTFIELD · US R&D Funding Intelligence
   Design system, adopted from a LayerZero-spirit aesthetic:
   near-black canvas, off-white type, strict gray hierarchy,
   monospace technical labels, fine grid texture, page-frame chrome.
   ============================================================ */

:root {
  /* Surfaces */
  --bg:        #0A0A0A;
  --bg-1:      #0E0E0E;
  --bg-2:      #131313;
  --bg-3:      #181818;
  --bg-hover:  #1B1B1B;

  /* Ink hierarchy (brand: F2F2F2 / 757575 / 525252), nudged up for WCAG AA
     contrast on the dark canvas while keeping the grey-step feel. */
  --ink:   #F2F2F2;
  --ink-2: #A7A7A7;   /* readable body */
  --ink-3: #969696;   /* labels / secondary (was #757575) */
  --ink-4: #808080;   /* faint / tertiary (was #525252) */
  --ink-5: #666666;   /* ghost (was #343434) */

  /* Lines */
  --line:   rgba(242,242,242,0.11);
  --line-2: rgba(242,242,242,0.06);
  --line-3: rgba(242,242,242,0.03);

  /* Status palette: open=green, forecasted=amber, closed=red. Red is owned by
     closed and urgent deadlines here; this tool surfaces no error state in red. */
  --ok:     #4ADE9E;   /* open */
  --warn:   #E6B450;   /* forecasted */
  --idle:   #6B6B6B;   /* unused: closed reads as red (--bad) by design */
  --bad:    #EC5A5F;   /* closed status + urgent deadline (attention); was #E5484D, raised for AA as text */
  --ok-dim:   rgba(74,222,158,0.14);
  --warn-dim: rgba(230,180,80,0.14);
  --idle-dim: rgba(140,140,140,0.12);

  --focus: #F2F2F2;

  /* Type */
  --sans: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", "SFMono-Regular", ui-monospace, "JetBrains Mono", monospace;

  /* Type scale: one source of truth, shared by the masthead strip here and the
     intro card rail in sing-styles.css (custom properties cascade globally from
     :root), so the two systems can never drift apart again. */
  --t-display: clamp(34px, 5vw, 68px);   /* hero headline */
  --t-figure:  clamp(30px, 3.3vw, 44px); /* stat counts: 2,710 / 1,861 / 57 */
  --t-date:    clamp(20px, 2.2vw, 28px); /* refresh date, a deliberate step down */
  --t-unit:    13px;                     /* "accepting" */
  --t-label:   10.5px;                   /* mono card labels */
  --t-sub:     10.5px;                   /* grey descriptor line */

  /* Frame */
  --pad-x: clamp(20px, 4vw, 72px);
  --maxw: 1680px;
  --radius: 3px;

  /* Density-driven */
  --row-pad-y: 22px;
  --row-gap: 12px;
}

[data-density="compact"] {
  --row-pad-y: 13px;
  --row-gap: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow-x: hidden; }

::selection { background: rgba(242,242,242,0.18); }

/* Scrollbars, quiet */
* { scrollbar-width: thin; scrollbar-color: #2a2a2a transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #262626; border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: #333; }
*::-webkit-scrollbar-track { background: transparent; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; cursor: pointer; }

/* ---- Focus visibility (WCAG 2.4.7) ----
   A clearly visible keyboard-focus ring for every interactive element. The ring
   only shows for keyboard/AT focus (:focus-visible), so mouse clicks stay clean.
   Offset + paired outline keeps it visible on both light and dark surfaces. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.dd-toggle:focus-visible,
.seg button:focus-visible,
.fb-search input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(10,10,10,0.9);
}
/* Suppress the default focus ring only when focus did not arrive via keyboard. */
:focus:not(:focus-visible) { outline: none; }

/* ---- Mono label primitives ---- */
.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mono-sm { font-size: 10px; letter-spacing: 0.08em; }
.slash { color: var(--ink-4); }

/* ============================================================
   BACKGROUND TEXTURE
   ============================================================ */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.grid-bg {
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(to right, var(--line-3) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-3) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  opacity: 1;
  transition: opacity .4s ease;
}
.deco { position: absolute; opacity: 0.5; transition: opacity .4s ease; }
.deco svg { display: block; }

/* Intensity reactions */
[data-intensity="balanced"] .grid-bg { opacity: 0.45; }
[data-intensity="balanced"] .deco   { opacity: 0.28; }
[data-intensity="restrained"] .grid-bg { opacity: 0; }
[data-intensity="restrained"] .deco   { opacity: 0; }

/* Mono // markers, hide some flourish in calmer modes */
[data-intensity="restrained"] .flourish { display: none; }
[data-intensity="balanced"] .flourish.opt2 { display: none; }

/* ============================================================
   PAGE FRAME / CHROME
   ============================================================ */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.frame-top, .frame-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--pad-x);
  gap: 16px;
}
.frame-top {
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
  background: rgba(10,10,10,0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.frame-bottom {
  border-top: 1px solid var(--line);
  margin-top: 40px;
}
.frame-top .left, .frame-bottom .left { display: flex; align-items: center; gap: 18px; }
.frame-top .right, .frame-bottom .right { display: flex; align-items: center; gap: 18px; }

/* GrantField identity mark */
.brand {
  display: inline-flex; align-items: center; gap: 7px;
  letter-spacing: 0.02em;
}
.brand .mark {
  width: 24px; height: 24px; position: relative; flex: none;
}
.brand .mark i {
  position: absolute; display: block; background: var(--ink);
}
.brand .mark i:nth-child(1){ left:0; top:0; width:18px; height:5px; }
.brand .mark i:nth-child(2){ left:0; top:7px; width:11px; height:4px; opacity:.65; }
.brand .mark i:nth-child(3){ left:0; top:13px; width:18px; height:5px; opacity:.35; }
.brand .mark.singularity-orb {
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.95) 0%, rgba(228,228,228,0.62) 20%, rgba(165,165,165,0.30) 44%, rgba(95,95,95,0.10) 68%, rgba(0,0,0,0) 100%);
  animation: singOrbPulse 3s ease-in-out infinite;
}
@keyframes singOrbPulse {
  0%, 100% { transform: scale(0.94); opacity: 0.9; }
  50%      { transform: scale(1.1); opacity: 1; }
}
@keyframes singOrbReform { from { transform: scale(0.46); } to { transform: scale(0.94); } }
.brand .word { font-family: var(--mono); font-weight: 400; font-size: 14px; letter-spacing: 0.18em; text-transform: uppercase; }
.brand .word b { font-weight: 600; }

.tag-right { color: var(--ink-4); }
.tag-right b { color: var(--ink-3); font-weight: 500; }

/* ============================================================
   MAIN COLUMN
   ============================================================ */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

/* ---- Masthead ---- */
.masthead { padding: 46px 0 30px; }
.masthead .eyebrow {
  display: flex; align-items: center; gap: 10px; margin-bottom: 22px;
}
.masthead h1 {
  font-weight: 500;
  font-size: var(--t-display);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 0;
  color: var(--ink);
  max-width: 17ch;
}
.masthead h1 .dim { color: var(--ink-4); }
.masthead .lede {
  margin: 22px 0 0;
  max-width: 56ch;
  color: var(--ink-2);
  font-size: clamp(14px, 1.2vw, 16px);
  line-height: 1.55;
}

/* ---- Stat strip ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  margin-top: 34px;
}
.stat {
  padding: 20px 22px 22px;
  border-right: 1px solid var(--line);
  position: relative;
  min-height: 116px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.stat:last-child { border-right: 0; }
.stat .k { display: flex; align-items: center; gap: 8px; }
.stat .v {
  font-size: var(--t-figure);
  font-weight: 500; letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
/* The refresh date (last card) steps down from a count so the full date fits. */
.stat:last-child .v { font-size: var(--t-date); letter-spacing: -0.02em; }
.stat .v .unit { font-size: var(--t-unit); color: var(--ink-4); letter-spacing: 0; margin-left: 6px; font-weight: 400;}
.stat .k .mono { font-size: var(--t-label); letter-spacing: 0.07em; }
.stat .sub { color: var(--ink-4); font-size: var(--t-sub); font-family: var(--mono); letter-spacing: 0.02em; }
.stat .idx { position: absolute; top: 16px; right: 16px; color: var(--ink-5); }
.stat .bars { display:flex; gap:3px; align-items:flex-end; height:18px; }
.stat .bars span { width:4px; background: var(--ink-4); display:block; }

/* SOURCES card: clickable, opens a centered breakdown modal */
.stat-clickable { cursor: pointer; transition: background .14s ease; }
.stat-clickable:hover { background: var(--bg-2); }
.stat-clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.src-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3);
}
.stat-clickable:hover .src-cta { color: var(--ink); }
.refresh-body p { margin-top: 14px; color: var(--ink-2); font-size: 14px; line-height: 1.62; }
.refresh-body p:first-child { margin-top: 18px; }

/* intro animation: typewriter cursor + ticking dots */
.type-cursor {
  display: inline-block; width: 0.5ch; height: 0.78em; margin-left: 6px;
  background: var(--ink); vertical-align: baseline; border-radius: 1px;
  animation: tw-blink 1.05s steps(1) infinite;
}
.dots-reveal { position: relative; display: inline-block; }
.dots-reveal .dr-reserve { visibility: hidden; }
.dots-reveal .dr-overlay { position: absolute; left: 0; top: 0; white-space: pre; }
.dr-dots { color: var(--ink-3); letter-spacing: 0.06em; animation: tw-think 1.1s ease-in-out infinite; }
@keyframes tw-think { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes tw-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* sources breakdown modal table */
.src-table { margin-top: 20px; display: flex; flex-direction: column; }
.src-mrow {
  display: grid; grid-template-columns: minmax(0,1fr) 100px 72px; align-items: center; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid var(--line-2);
}
.src-mrow .src-mname { font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-mrow .src-mbar { height: 6px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.src-mrow .src-mbar i { display: block; height: 100%; background: var(--ink-4); }
.src-mrow .src-mn { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink); }

@media (max-width: 900px){
  .stats { grid-template-columns: repeat(2,1fr); }
  .stat:nth-child(2){ border-right:0; }
  .stat:nth-child(1),.stat:nth-child(2){ border-bottom:1px solid var(--line); }
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.section-head {
  display: flex; align-items: center; gap: 14px;
  padding: 38px 0 12px;
}
.section-head .rule { flex: 1; height: 1px; background: var(--line); }

.filterbar {
  border: 1px solid var(--line);
  background: var(--bg-1);
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(130px, 1fr));
  align-items: stretch;
}
/* With the category filter present the bar has six controls; widen to six
   columns so they share one row instead of orphaning FUNDING onto a second. */
.filterbar.has-category { grid-template-columns: minmax(190px, 1.4fr) repeat(5, minmax(112px, 1fr)); }
/* The v2 taxonomy filters (domain, technology) sit on a second row that
   appears only once the snapshot carries those facets; cells share the row. */
.filterbar-tax { border-top: 0; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.fb-cell {
  border-right: 1px solid var(--line);
  padding: 11px 14px 12px;
  display: flex; flex-direction: column; gap: 7px;
  min-width: 0;
}
.fb-cell:last-child { border-right: 0; }
.fb-cell > label { display:flex; align-items:center; gap:7px; }

.fb-search { display: flex; align-items: center; gap: 9px; }
.fb-search input {
  background: transparent; border: 0; outline: 0; color: var(--ink);
  font-family: var(--sans); font-size: 15px; width: 100%; padding: 2px 0;
  letter-spacing: -0.01em;
}
.fb-search input::placeholder { color: var(--ink-4); }
.fb-search .ic { color: var(--ink-3); flex: none; }

/* custom select */
.sel {
  position: relative;
}
.sel select {
  appearance: none; -webkit-appearance: none;
  background: transparent; border: 0; outline: 0;
  color: var(--ink); font-family: var(--sans); font-size: 14.5px;
  width: 100%; padding: 2px 22px 2px 0; cursor: pointer; letter-spacing: -0.01em;
}
.sel select option { background: #141414; color: var(--ink); }
.sel::after {
  content: ""; position: absolute; right: 4px; top: 50%;
  width: 7px; height: 7px; border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3); transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

/* custom dropdown: replaces native selects with a site-styled menu and a
   full-box click target. Used by the filters (bare) and sort (boxed). */
.dd { position: relative; min-width: 0; }
.dd-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: 0; padding: 0; cursor: pointer; text-align: left;
  color: var(--ink); font-family: var(--sans); font-size: 14.5px; letter-spacing: -0.01em;
}
.dd-toggle .dd-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-prefix {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); flex: none;
}
.dd-caret {
  flex: none; width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3);
  transform: translateY(-2px) rotate(45deg); transition: transform .15s ease;
}
.dd.open .dd-caret { transform: translateY(1px) rotate(-135deg); }

.dd-boxed .dd-toggle {
  border: 1px solid var(--line); border-radius: 2px; background: var(--bg-1);
  padding: 8px 13px; gap: 10px; transition: background .15s, border-color .15s;
}
.dd-boxed .dd-toggle:hover { background: var(--bg-hover); border-color: rgba(242,242,242,0.22); }
.dd-mono .dd-value { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }

/* filter dropdowns: the whole cell is the click target (like .stat-clickable) */
.dd-cell { cursor: pointer; transition: background .14s ease; }
.dd-cell:hover { background: var(--bg-2); }
.dd-cell:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.dd-cell-row { display: flex; align-items: center; gap: 10px; }
.dd-cell-row .dd-value {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink); font-family: var(--sans); font-size: 14.5px; letter-spacing: -0.01em;
}

.dd-menu {
  position: absolute; z-index: 55; top: calc(100% + 8px); left: 0;
  min-width: 100%; width: max-content; max-width: min(340px, 80vw);
  max-height: 320px; overflow-y: auto;
  background: #111; border: 1px solid var(--line); border-radius: 3px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.62); padding: 5px;
}
.dd-menu.right { left: auto; right: 0; }
.dd-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 2px; padding: 9px 10px; cursor: pointer;
  color: var(--ink-2); font-family: var(--sans); font-size: 13.5px; letter-spacing: -0.01em; white-space: nowrap;
}
.dd-opt:hover { background: var(--bg-3); color: var(--ink); }
.dd-opt.sel { color: var(--ink); }
.dd-opt.sel::after { content: ""; margin-left: auto; width: 5px; height: 5px; background: var(--ink); flex: none; }
.dd-mono .dd-opt { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }

/* facet scoping: per-option result counts on both dropdown kinds, and the
   multi-select pieces (check square, pinned label, clear row) */
.dd-count { margin-left: auto; flex: none; font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); letter-spacing: 0.04em; }
.dd-opt.sel .dd-count { margin-right: 6px; }
.dd-opt.on { color: var(--ink); }
.dd-opt .dd-opt-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dd-check { flex: none; width: 9px; height: 9px; border: 1px solid var(--ink-4); border-radius: 1px; background: transparent; }
.dd-check[data-on="true"] { background: var(--ink); border-color: var(--ink); }
.dd-clear { color: var(--ink-3); font-size: 12.5px; border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 4px; }
.dd-none { color: var(--ink-4); cursor: default; }

/* segmented control (deadline window) */
.seg { display: flex; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; width: fit-content; }
.seg button {
  background: transparent; border: 0; border-right: 1px solid var(--line);
  color: var(--ink-3); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em;
  padding: 9px 16px; transition: background .15s, color .15s;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink-2); background: var(--bg-2); }
.seg button[data-on="true"] { background: var(--ink); color: #0A0A0A; }

/* status select pills inside select cell */
.statusdot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.dot-open { background: var(--ok); }
.dot-forecasted { background: var(--warn); }
.dot-closed { background: var(--bad); }
.dot-archived { background: var(--ink-3); }
[data-statuscolor="off"] .statusdot { background: var(--ink-3) !important; }

.filterbar-foot {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); border-top: 0;
  padding: 10px 14px; gap: 14px; flex-wrap: wrap;
  background: var(--bg-1);
}
.active-chips { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-height: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 2px;
  padding: 3px 7px 3px 9px; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.04em; color: var(--ink-2); text-transform: uppercase;
  background: var(--bg-2);
}
.chip b { color: var(--ink); font-weight: 500; }
.chip button { background: none; border: 0; color: var(--ink-4); padding: 0; line-height: 1; font-size: 13px; }
.chip button:hover { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--bg-2);
  color: var(--ink-2); font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.07em; text-transform: uppercase; padding: 8px 13px; border-radius: 2px;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--bg-hover); color: var(--ink); border-color: rgba(242,242,242,0.22); }
.btn-ghost { background: transparent; }
.btn-primary { background: var(--ink); color: #0A0A0A; border-color: var(--ink); }
.btn-primary:hover { background: #fff; color:#000; }

@media (max-width: 1080px){
  .filterbar, .filterbar.has-category { grid-template-columns: 1fr 1fr; }
  .fb-cell:nth-child(odd){ border-right: 1px solid var(--line); }
  .fb-cell { border-bottom: 1px solid var(--line); }
  .fb-cell:nth-child(1){ grid-column: 1 / -1; }
}

/* ============================================================
   RESULTS
   ============================================================ */
.results-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 26px 0 12px; flex-wrap: wrap;
}
.count-line { display: flex; align-items: baseline; gap: 10px; }
.count-line .n { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

.sortsel {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 2px; padding: 7px 12px; background: var(--bg-1);
}
.sortsel .sel { min-width: 124px; }
.sortsel .sel select { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }

.results { display: flex; flex-direction: column; border-top: 1px solid var(--line); }

.row {
  display: grid;
  grid-template-columns: 26px minmax(0,1fr) 150px 150px 120px;
  gap: 18px;
  align-items: center;
  padding: var(--row-pad-y) 8px var(--row-pad-y) 6px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  position: relative;
  transition: none; /* instant highlight so fast pointer movement always lands */
}
.row:hover { background: var(--bg-3); }
.row.is-active { background: var(--bg-hover); }
.row::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: -1px; width: 2px;
  background: var(--ink); transform: scaleY(0); transform-origin: top; transition: transform .1s ease;
}
.row:hover::before, .row.is-active::before { transform: scaleY(1); }

.row .rstatus { display: flex; align-items: center; justify-content: center; }
.row .rmain { min-width: 0; }
.row .rtitle {
  font-size: clamp(15px, 1.35vw, 18px); font-weight: 500; letter-spacing: -0.02em;
  line-height: 1.22; color: var(--ink); margin: 0 0 7px;
  text-wrap: pretty;
}
.row:hover .rtitle { color: #fff; }
.row .rmeta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.row .rmeta .pipe { color: var(--ink-5); }

.bchips { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.bchip {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-3); border: 1px solid var(--line); border-radius: 2px; padding: 2px 6px;
  white-space: nowrap;
}

.row .rcol { display: flex; flex-direction: column; gap: 5px; }
.row .rcol .lab { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4); }
.row .rcol .val { font-size: 14.5px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--ink); }
.row .rcol .val.muted { color: var(--ink-3); }
.row .deadline .when { font-size: 10.5px; font-family: var(--mono); letter-spacing: 0.03em; }
.when.soon { color: var(--warn); }
.when.urgent { color: var(--bad); }
.when.rolling { color: var(--ink-3); }
.when.normal { color: var(--ink-3); }

.row .ropen {
  justify-self: end; display:inline-flex; align-items:center; gap:8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-4); transition: color .14s, gap .14s;
}
.row:hover .ropen { color: var(--ink); gap: 12px; }

.statusbadge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2);
}

@media (max-width: 1080px){
  .row { grid-template-columns: 22px 1fr auto; row-gap: 12px; }
  .row .rcol.funding { grid-column: 2; }
  .row .rcol.deadline { grid-column: 3; align-items: flex-end; }
  .row .ropen { display: none; }
}

.empty {
  border-bottom: 1px solid var(--line); padding: 60px 20px; text-align: center; color: var(--ink-3);
}
.empty .big { color: var(--ink-2); font-size: 16px; margin-bottom: 8px; }

/* ============================================================
   DETAIL  (slide-over / modal / page)
   ============================================================ */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5,5,5,0.6); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.scrim.show { opacity: 1; pointer-events: auto; }

.detail {
  font-family: var(--sans);
}
.detail .d-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
.detail .d-eyebrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.detail h2 {
  font-size: clamp(24px, 2.6vw, 38px); font-weight: 500; letter-spacing: -0.03em;
  line-height: 1.04; margin: 0; text-wrap: pretty;
}
.d-close {
  flex: none; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 2px;
  background: transparent; color: var(--ink-3); display: grid; place-items: center;
  transition: background .15s, color .15s, border-color .15s;
}
.d-close:hover { background: var(--bg-2); color: var(--ink); border-color: rgba(242,242,242,0.25); }

.d-facts { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); margin: 22px 0; }
.d-fact { padding: 15px 16px; border-right: 1px solid var(--line); display:flex; flex-direction:column; gap:9px; }
.d-fact:last-child { border-right: 0; }
.d-fact .fv { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; line-height:1.1; }
.d-fact .fv.sm { font-size: 14px; }

.d-sec { padding: 22px 0; border-bottom: 1px solid var(--line); }
.d-sec:last-of-type { border-bottom: 0; }
.d-sec h3 { margin: 0 0 14px; }
.d-sec p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.6; max-width: 70ch; }

.expander summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); color: var(--ink-2);
}
.expander summary::-webkit-details-marker { display: none; }
.expander summary .chev { transition: transform .2s ease; color: var(--ink-4); }
.expander[open] summary .chev { transform: rotate(90deg); }
.expander .ebody { padding: 4px 0 18px; color: var(--ink-2); font-size: 14.5px; line-height: 1.65; max-width: 74ch; }
.expander .ebody .verbatim {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.75; color: var(--ink-2);
  border-left: 1px solid var(--line); padding-left: 16px; white-space: pre-wrap;
}

.d-cta { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 22px; }
.cta-main {
  display: inline-flex; align-items: center; gap: 12px; background: var(--ink); color: #0A0A0A;
  border: 1px solid var(--ink); border-radius: 2px; padding: 14px 22px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500;
  transition: background .15s, transform .15s;
}
.cta-main:hover { background: #fff; transform: translateY(-1px); }

.d-metarow { display:flex; flex-wrap:wrap; gap: 26px 40px; padding-top: 6px; }
.d-metarow .mi { display:flex; flex-direction:column; gap:6px; }
.d-metarow .mi .mv { font-size: 14px; color: var(--ink-2); letter-spacing:-0.01em; }

/* --- slide-over --- */
.panel-slideover {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width: min(640px, 94vw);
  background: var(--bg-1); border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px rgba(0,0,0,0.55);
  transform: translateX(100%); transition: transform .32s cubic-bezier(.4,0,.1,1);
  display: flex; flex-direction: column;
  pointer-events: none; /* closed panel must not intercept clicks */
}
.panel-slideover.show { transform: translateX(0); pointer-events: auto; }
.panel-slideover .d-inner { overflow-y: auto; padding: 22px 30px 40px; }
.panel-slideover .d-railhead {
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 30px; border-bottom: 1px solid var(--line); flex: none;
}

/* --- modal --- */
.panel-modal {
  position: fixed; z-index: 70; inset: 0; display: grid; place-items: center; padding: 30px;
  pointer-events: none;
}
.panel-modal .card {
  width: min(840px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 40px 120px rgba(0,0,0,0.6);
  padding: 28px 34px 36px;
  transform: scale(.97) translateY(8px); opacity: 0; transition: transform .26s ease, opacity .26s ease;
  pointer-events: none; /* closed modal must not intercept clicks behind it */
}
.panel-modal.show .card { transform: none; opacity: 1; pointer-events: auto; }

/* --- full page --- */
.panel-page {
  position: fixed; inset: 0; z-index: 70; background: var(--bg);
  overflow-y: auto;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.panel-page.show { opacity: 1; pointer-events: auto; }
.panel-page .pp-head {
  position: sticky; top: 0; background: rgba(10,10,10,0.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 12px var(--pad-x);
  display: flex; align-items: center; justify-content: space-between; z-index: 2;
}
.panel-page .pp-body { max-width: 980px; margin: 0 auto; padding: 40px var(--pad-x) 80px; }
.back-link {
  display:inline-flex; align-items:center; gap:10px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
}
.back-link:hover { color: var(--ink); }

@media (max-width: 720px){
  .d-facts { grid-template-columns: 1fr 1fr; }
  .d-fact:nth-child(2){ border-right:0; }
  .d-fact:nth-child(1),.d-fact:nth-child(2){ border-bottom: 1px solid var(--line); }
  /* keep modals centered and fully on-screen on phones */
  .panel-modal { padding: 12px; }
  .panel-modal .card { padding: 22px 18px 26px; max-height: 92vh; }
}

/* entrance hook kept as a no-op: content is always visible (capture/print safe) */
.rise { opacity: 1; transform: none; }

/* footer privacy link (replaces the static "INTERNAL" label) */
.footer-link {
  font: inherit; color: inherit; background: none; border: 0; padding: 0;
  letter-spacing: inherit; text-transform: inherit; cursor: pointer;
  border-bottom: 1px solid var(--line); transition: color .15s, border-color .15s;
}
.footer-link:hover { color: var(--ink); border-color: rgba(242,242,242,0.4); }

/* privacy modal: working-draft note at the top of the scrollable card */
.privacy-note {
  color: var(--ink-3); font-size: 12.5px; font-style: italic; line-height: 1.55;
  border: 1px solid var(--line); border-radius: 2px; padding: 10px 13px; margin: 0 0 4px;
}

/* ============================================================
   SKIP TO CONTENT  (WCAG 2.4.1 bypass blocks)
   Visually hidden until it receives keyboard focus, then pinned
   top-left as a clearly visible, high-contrast control.
   ============================================================ */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: #0A0A0A;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  border-radius: 2px;
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 12px;
  top: 12px;
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ============================================================
   REDUCED MOTION  (WCAG 2.3.3)
   Honors the OS "reduce motion" setting: disable non-essential
   animation/transition and the looping decorative motion.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* Stop the looping logo-orb pulse and the typewriter/think cues outright. */
  .brand .mark.singularity-orb,
  .type-cursor,
  .dr-dots {
    animation: none !important;
  }
}

/* utility */
.flex { display: flex; }
.aic { align-items: center; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.nowrap { white-space: nowrap; }
