/* =============================================================================
   dashboard.css — Projects Dashboard page only (/dashboard/).

   Loaded after site.css. Reuses shared foundation classes wherever possible
   (.section, .section--alt, .section--pro, .section__head, .eyebrow,
   .display-*, .body-l, .caption, .chip, .chip__dot, .tile, .figure__value/
   __label, .btn, .link-more) and only adds what's genuinely new: the
   breadcrumb, the hero chip row, case-study internals (KPI tiles, filters,
   charts, insight cards, method details), the Live SQL console, and the
   methods/about grid.

   Chart colors are read from CSS variables at render time by dashboard.js
   (getComputedStyle), so they stay in sync with the site's tokens and
   re-render automatically when [data-theme] changes. --dash-mono and the
   --dash-* chart palette below are the only tokens this file adds; --dash-sky
   and --dash-neutral just alias existing site tokens (--blue/--ink-3) and
   --dash-amber aliases --acc-solar, so they already flip with theme. The
   remaining categorical hues (violet/mint/coral) have no site equivalent, so
   a dark-mode variant is defined here too. Everything else reuses
   var(--blue)/var(--acc-*)/var(--ink*)/var(--bg*)/var(--line*).
============================================================================= */

:root {
  --dash-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --dash-sky: var(--blue);
  --dash-violet: #7c5cff;
  --dash-mint: #0bab8d;
  --dash-amber: var(--acc-solar);
  --dash-coral: #ff453a;
  --dash-neutral: var(--ink-3);
}
:root[data-theme="dark"] {
  --dash-violet: #a08bff;
  --dash-mint: #34d8b9;
  --dash-coral: #ff6961;
}

/* ---------- breadcrumb ---------- */
.breadcrumb {
  font-size: 14px;
  color: var(--ink-3);
  margin-bottom: clamp(20px, 3vw, 32px);
}
.section--pro .breadcrumb { color: var(--ink-3); }
.breadcrumb a { color: inherit; }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb__sep { margin: 0 6px; }

/* ---------- HERO (dark "Pro" band, matches home's dashboard teaser) ---------- */
.dash-hero { padding-top: clamp(132px, 17vw, 188px); }
.dash-hero__inner { position: relative; z-index: 1; }
.dash-hero .chip { margin-bottom: 24px; }
.dash-hero__title { max-width: 14ch; margin-top: 4px; }
.dash-hero__sub { margin-top: 22px; max-width: 640px; }
.dash-hero__note { margin-top: 14px; max-width: 640px; }

/* headline line-mask reveal, mirrors home.js's hero treatment */
.dash-hero__title .split-line-wrap { display: block; overflow: hidden; }
.dash-hero__title .split-line { display: block; padding-bottom: 0.08em; }

.dash-hero__chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 40px; }
.dash-case-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 13px 17px;
  min-width: 168px;
  transition: transform 0.24s var(--ease-out), border-color 0.24s ease, background 0.24s ease;
}
html.js .dash-case-chip:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.22); }
.dash-case-chip .k {
  display: block;
  font-family: var(--dash-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}
.dash-case-chip .t { display: block; font-weight: 600; font-size: 14px; margin-top: 5px; color: #f5f5f7; }
.dash-chip-loading { color: var(--ink-3); font-size: 14px; }

/* ---------- case study sections ---------- */
.case-sec { scroll-margin-top: 84px; }
.case-head { max-width: 78ch; }
.role-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.role-chips-label { font-size: 13px; color: var(--ink-3); font-weight: 500; align-self: center; margin-right: 2px; }
.role-chip {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}
.section--alt .role-chip { background: var(--card); }
.case-question {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: clamp(21px, 2.6vw, 30px);
  line-height: 1.28;
  margin-top: 24px;
  max-width: 30ch;
  color: var(--ink);
}

/* ---------- KPI tiles ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 40px; }
@media (max-width: 760px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi-tile { padding: 22px 22px; }
.kpi-num { font-size: clamp(24px, 2.8vw, 32px); font-weight: 700; letter-spacing: -0.015em; font-variant-numeric: tabular-nums lining-nums; color: var(--ink); }
.kpi-label { color: var(--ink-2); font-size: 14px; font-weight: 500; margin-top: 6px; line-height: 1.4; }
.kpi-note { color: var(--ink-3); font-size: 12.5px; margin-top: 8px; line-height: 1.4; }

/* ---------- filters ---------- */
.filters-row { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 34px; }
.filter-group { display: flex; flex-direction: column; gap: 8px; }
.filter-label { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.07em; }
.segmented { display: inline-flex; background: var(--bg-alt); border-radius: 12px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.section--alt .segmented { background: var(--card); }
.seg-btn { border: none; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500; padding: 8px 15px; border-radius: 9px; cursor: pointer; transition: background 0.2s, color 0.2s, box-shadow 0.2s; }
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); font-weight: 600; }
.section--alt .seg-btn[aria-pressed="true"] { background: var(--bg); }

/* ---------- charts ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 40px; }
@media (max-width: 860px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-fig { padding: 24px 22px 20px; }
.chart-fig h3 { font-weight: 700; font-size: 16px; letter-spacing: -0.005em; }
.chart-fig .chart-sub { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; line-height: 1.45; max-width: 64ch; }
.chart-mount { margin-top: 18px; min-height: 220px; position: relative; }
.chart-mount svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-mount .chart-loading { color: var(--ink-3); font-size: 13px; padding: 60px 0; text-align: center; }
.chart-fig figcaption.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.simple-table-wrap { overflow-x: auto; margin-top: 16px; }
table.data-table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.data-table th, table.data-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data-table th { color: var(--ink-3); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; }
table.data-table td.num, table.data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- finding / recommendation / in-role ---------- */
.insight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 44px; }
@media (max-width: 860px) { .insight-grid { grid-template-columns: 1fr; } }
.insight-card { padding: 26px 24px; }
.insight-card.dark { background: var(--ink); border-color: var(--ink); }
:root[data-theme="dark"] .insight-card.dark { background: var(--card); }
.insight-card.dark p { color: rgba(255, 255, 255, 0.78); }
:root[data-theme="dark"] .insight-card.dark p { color: var(--ink-2); }
.insight-label { font-family: var(--dash-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue); margin-bottom: 12px; }
.insight-card.dark .insight-label { color: #6cb4ff; }
:root[data-theme="dark"] .insight-card.dark .insight-label { color: var(--blue); }
.insight-card p { color: var(--ink-2); font-size: 15px; line-height: 1.6; }

/* ---------- method details ---------- */
details.method { margin-top: 40px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 20px; padding: 6px 26px; }
.section--alt details.method { background: var(--card); }
details.method summary {
  cursor: pointer;
  padding: 18px 0;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
details.method summary::-webkit-details-marker { display: none; }
details.method summary::after { content: "+"; font-size: 20px; color: var(--ink-3); font-weight: 400; transition: transform 0.2s; }
details.method[open] summary::after { transform: rotate(45deg); }
.method-body { padding: 0 0 28px; }
.method-sub-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); margin: 22px 0 10px; }
.method-sub-label:first-child { margin-top: 4px; }
.source-line { font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }
.source-line a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.source-stats { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.source-stats b { color: var(--ink-2); }
.caveat { font-size: 13.5px; color: var(--ink-3); margin-top: 8px; font-style: italic; }
ul.clean-list { padding-left: 20px; }
ul.clean-list li { color: var(--ink-2); font-size: 14px; line-height: 1.6; margin-bottom: 4px; }
.code-block { background: var(--ink); color: #d8f0ff; border-radius: 14px; padding: 18px 20px; overflow-x: auto; font-family: var(--dash-mono); font-size: 13px; line-height: 1.6; white-space: pre; margin-top: 8px; }
:root[data-theme="dark"] .code-block { background: #000; border: 1px solid var(--line); }
.run-sql-btn {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.run-sql-btn:hover { background: var(--blue-hover); }
.dict-wrap { overflow-x: auto; margin-top: 8px; }
table.dict-table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.dict-table th, table.dict-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
table.dict-table th { color: var(--ink-3); font-weight: 600; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.05em; }
table.dict-table td.colname { font-family: var(--dash-mono); font-size: 13px; color: var(--ink); }
table.dict-table td.coltype { color: var(--ink-3); font-family: var(--dash-mono); font-size: 12px; }

/* ---------- Live SQL ---------- */
.sql-explain { color: var(--ink-2); font-size: 16px; margin-top: 14px; max-width: 62ch; }
.sql-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; margin-top: 36px; align-items: start; }
@media (max-width: 900px) { .sql-layout { grid-template-columns: 1fr; } }
.sql-side { display: flex; flex-direction: column; gap: 22px; }
.sql-panel { padding: 18px 18px; }
.sql-panel h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 10px; }
.table-list-btn {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 8px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--dash-mono);
  font-size: 13px;
  color: var(--ink-2);
}
.table-list-btn:hover { background: var(--bg-alt); color: var(--ink); }
.section--alt .table-list-btn:hover { background: var(--bg); }
.table-list-btn .rows { color: var(--ink-3); font-family: var(--font); }
.sq-group { margin-bottom: 14px; }
.sq-group:last-child { margin-bottom: 0; }
.sq-group-title { font-size: 11px; color: var(--blue); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.sq-btn { display: block; width: 100%; text-align: left; background: none; border: none; padding: 7px 8px; border-radius: 9px; cursor: pointer; color: var(--ink-2); font-size: 13px; line-height: 1.4; }
.sq-btn:hover { background: var(--bg-alt); color: var(--ink); }
.section--alt .sq-btn:hover { background: var(--bg); }
.sql-main { padding: 20px; min-width: 0; }
.sql-editor-wrap { border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: #1d1d1f; }
.cm-editor { height: 160px; font-size: 13.5px; }
textarea#sql-fallback {
  width: 100%;
  height: 160px;
  resize: vertical;
  background: #1d1d1f;
  color: #d8f0ff;
  border: none;
  font-family: var(--dash-mono);
  font-size: 13.5px;
  padding: 14px 16px;
  line-height: 1.6;
}
textarea#sql-fallback:focus { outline: none; }
.sql-controls { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.run-btn {
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.run-btn:hover { opacity: 0.85; }
.run-btn:disabled { opacity: 0.5; cursor: wait; }
.sql-status { font-size: 13px; color: var(--ink-3); font-family: var(--dash-mono); }
.sql-results-wrap { margin-top: 18px; max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; min-width: 0; max-width: 100%; }
table.results-table { border-collapse: collapse; width: 100%; font-size: 13px; }
table.results-table th, table.results-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
table.results-table th { position: sticky; top: 0; background: var(--card); color: var(--ink-3); font-weight: 600; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.05em; }
table.results-table td.num, table.results-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sql-error { color: #c62828; font-size: 13.5px; margin-top: 12px; background: #fdecea; border-radius: 10px; padding: 10px 14px; }
:root[data-theme="dark"] .sql-error { color: #ff8a80; background: rgba(255, 69, 58, 0.12); }

/* ---------- methods / about ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; margin-top: 40px; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; gap: 28px; } }
.about-block h3 { font-weight: 700; font-size: 18px; margin-bottom: 12px; }
.about-block p { color: var(--ink-2); font-size: 15px; line-height: 1.65; margin-bottom: 12px; }
.stack-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.stack-chip { font-size: 13px; font-weight: 500; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; }
.source-list { display: grid; gap: 14px; margin-top: 4px; }
.source-item { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.source-item:last-child { border-bottom: none; }
.source-item b { color: var(--ink); }
.source-item a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.source-item .lic { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  .dash-hero__title .split-line { transform: none !important; }
}
