/* calibr.fyi — internal reference dashboard.
   Deep slate base, off-white type, one calibration-blue accent.
   Instrument-like: square corners, hairline rules, mono for data.
   Docs-site layout — sidebar of pillars, one content pane. No cards. */

:root {
  --slate: #0f1923;
  --slate-lift: #141f2b;
  --slate-rule: #22303c;
  --paper: #f0eee9;
  --paper-dim: #8e9aa4;
  --muted: #4a5568;
  --blue: #2d7dd2;
  --amber: #d9a441;
  --purple: #9b7ede;
  --green: #4fa87a;

  --ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --sidebar: 16.5rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--slate);
  color: var(--paper);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.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;
}

/* ---- Masthead ---------------------------------------------------------- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  padding: 0.875rem var(--gutter);
  border-bottom: 1px solid var(--slate-rule);
}

.wordmark {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.masthead__tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--paper-dim);
}

.masthead__right {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--paper-dim);
}

/* ---- Shell ------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: 1.5rem 0 3rem;
  border-right: 1px solid var(--slate-rule);
}

.nav__heading {
  margin: 0;
  padding: 0 var(--gutter) 0.5rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav__group + .nav__group {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--slate-rule);
}

.nav__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__link {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  width: 100%;
  padding: 0.4375rem var(--gutter);
  border: 0;
  border-left: 2px solid transparent;
  background: none;
  color: var(--paper);
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.nav__link:hover {
  background: var(--slate-lift);
}

.nav__link[aria-current='page'] {
  border-left-color: var(--blue);
  background: var(--slate-lift);
  font-weight: 500;
}

.nav__code {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--paper-dim);
  min-width: 2.5rem;
}

.nav__link[aria-current='page'] .nav__code {
  color: var(--blue);
}

.nav__count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
}

.nav__ext::after {
  content: '↗';
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---- Main pane --------------------------------------------------------- */

.pane {
  min-width: 0;
  padding: clamp(1.75rem, 4vw, 3rem) var(--gutter) 6rem;
  max-width: 62rem;
}

.pane__eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}

.pane h1 {
  margin: 0.5rem 0 0;
  font-size: clamp(1.5rem, 3.5vw, 2.125rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.pane__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 0.875rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--paper-dim);
}

.pane__meta b {
  color: var(--paper);
  font-weight: 500;
}

.blurb {
  margin: 1.25rem 0 0;
  max-width: 60ch;
  color: #cbd3da;
}

.section {
  margin-top: 2.75rem;
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--slate-rule);
}

.section__head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.section__note {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
}

.prose {
  max-width: 62ch;
  color: #cbd3da;
}

/* ---- Badges ------------------------------------------------------------ */

.badges {
  display: inline-flex;
  gap: 0.25rem;
  vertical-align: middle;
}

.badge {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  padding: 0.0625rem 0.375rem;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.badge--AUTO {
  color: var(--blue);
}
.badge--SELF {
  color: var(--amber);
}
.badge--EXPERT {
  color: var(--purple);
}

/* ---- Sub-pillar list --------------------------------------------------- */

.sub {
  border-bottom: 1px solid var(--slate-rule);
}

.sub__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.875rem 0;
  cursor: pointer;
  list-style: none;
}

.sub__summary::-webkit-details-marker {
  display: none;
}

.sub__summary:hover .sub__name {
  color: var(--blue);
}

.sub__id {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--paper-dim);
  min-width: 2.25rem;
}

.sub__name {
  font-size: 1rem;
  font-weight: 500;
}

.sub__chev {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: auto;
}

.sub[open] .sub__chev {
  transform: rotate(90deg);
}

.sub__body {
  padding: 0 0 1.5rem 2.75rem;
}

.sub__note {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--amber);
}

/* Level dots — the working-score control */

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
}

.dots__legend {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  padding: 0 0.5rem 0 0;
  float: left;
}

.dot {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--slate-rule);
  background: none;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.6875rem;
  cursor: pointer;
}

.dot::after {
  content: '○';
  font-size: 0.75rem;
  line-height: 1;
}

.dot:hover {
  border-color: var(--muted);
  color: var(--paper);
}

.dot[aria-checked='true'] {
  border-color: var(--blue);
  color: var(--blue);
}

.dot[aria-checked='true']::after {
  content: '●';
}

/* Level descriptors */

.levels {
  margin: 0;
  border-top: 1px solid var(--slate-rule);
}

.levels__row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--slate-rule);
}

.levels__row:last-child {
  border-bottom: 0;
}

.levels__row--set {
  background: var(--slate-lift);
}

.levels__key {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
}

.levels__row--set .levels__key {
  color: var(--blue);
}

.levels__text {
  font-size: 0.9375rem;
  color: #cbd3da;
}

.levels__row--set .levels__text {
  color: var(--paper);
}

/* ---- Tables ------------------------------------------------------------ */

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.table th,
.table td {
  padding: 0.625rem 0.75rem 0.625rem 0;
  text-align: left;
  vertical-align: top;
  font-weight: 400;
  border-bottom: 1px solid var(--slate-rule);
}

.table thead th {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.table td.num,
.table th.num {
  font-family: var(--mono);
  font-size: 0.875rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* A right-aligned number only loses its right padding when nothing follows it,
   otherwise the value collides with the next column. */
.table td.num:last-child,
.table th.num:last-child {
  padding-right: 0;
}

.table td.num:not(:last-child),
.table th.num:not(:last-child) {
  padding-right: 1.25rem;
}

.table .key {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--paper-dim);
  white-space: nowrap;
}

.table .muted {
  color: var(--paper-dim);
  font-size: 0.9375rem;
}

.table__wrap {
  overflow-x: auto;
}

/* ---- Status pips ------------------------------------------------------- */

.pip {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--paper-dim);
}

.pip::before {
  content: '● ';
  color: var(--muted);
}

.pip--live::before,
.pip--done::before {
  color: var(--green);
}
.pip--in_progress::before,
.pip--partial::before,
.pip--partially_started::before {
  color: var(--amber);
}
.pip--pending::before,
.pip--briefed::before,
.pip--doing::before {
  color: var(--blue);
}
.pip--open::before {
  color: var(--amber);
}
.pip--resolved::before {
  color: var(--green);
}

/* ---- Phase blocks ------------------------------------------------------ */

.phase {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--slate-rule);
}

.phase__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.875rem;
}

.phase__num {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--blue);
}

.phase__name {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 500;
}

.phase__status {
  margin-left: auto;
}

.phase__desc {
  margin: 0.5rem 0 0;
  max-width: 62ch;
  color: #cbd3da;
  font-size: 0.9375rem;
}

.checklist {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 2rem;
}

.checklist li {
  break-inside: avoid;
  font-size: 0.875rem;
  color: #cbd3da;
  padding-left: 1.375rem;
  text-indent: -1.375rem;
}

.checklist li::before {
  font-family: var(--mono);
  margin-right: 0.5rem;
}

.checklist--done li::before {
  content: '[x]';
  color: var(--green);
}

.checklist--todo li::before {
  content: '[ ]';
  color: var(--amber);
}

/* ---- Next actions ------------------------------------------------------ */

.action {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 0.25rem 0.875rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--slate-rule);
  align-items: baseline;
}

.action__pri {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
}

.action__title {
  font-size: 0.9375rem;
  font-weight: 500;
}

.action--done .action__title {
  color: var(--paper-dim);
  text-decoration: line-through;
}

.action__detail {
  grid-column: 2;
  font-size: 0.8125rem;
  color: var(--paper-dim);
  max-width: 60ch;
}

.action__toggle {
  grid-row: 1 / span 2;
  grid-column: 3;
  align-self: center;
  padding: 0.1875rem 0.5rem;
  border: 1px solid var(--slate-rule);
  background: none;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

.action__toggle:hover {
  border-color: var(--muted);
  color: var(--paper);
}

.action__toggle[data-state='doing'] {
  border-color: var(--blue);
  color: var(--blue);
}

.action__toggle[data-state='done'] {
  border-color: var(--green);
  color: var(--green);
}

/* ---- Score summary ----------------------------------------------------- */

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  padding: 1rem 0 1.25rem;
  border-bottom: 1px solid var(--slate-rule);
}

.stat__label {
  display: block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat__value {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.stat__value--accent {
  color: var(--blue);
}

.stat__sub {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Horizontal meter for pillar means */

.meter {
  display: block;
  width: 100%;
  min-width: 7rem;
  height: 6px;
  background: var(--slate-rule);
}

.meter__fill {
  display: block;
  height: 100%;
  background: var(--blue);
}

/* ---- Notes & footer ---------------------------------------------------- */

.note {
  margin-top: 1rem;
  padding: 0.75rem 0.875rem;
  border-left: 2px solid var(--blue);
  background: var(--slate-lift);
  font-size: 0.875rem;
  color: #cbd3da;
}

.note--warn {
  border-left-color: var(--amber);
}

.pane__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--slate-rule);
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
}

.linkbtn {
  border: 1px solid var(--slate-rule);
  background: none;
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.linkbtn:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--paper-dim);
  border: 1px solid var(--slate-rule);
  padding: 0.125rem 0.4375rem;
}

/* ---- Narrow screens ---------------------------------------------------- */

@media (max-width: 60rem) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    max-height: none;
    padding-bottom: 1.5rem;
    border-right: 0;
    border-bottom: 1px solid var(--slate-rule);
  }

  .checklist {
    columns: 1;
  }

  .action {
    grid-template-columns: 2rem minmax(0, 1fr);
  }

  .action__toggle {
    grid-row: auto;
    grid-column: 2;
    justify-self: start;
    margin-top: 0.375rem;
  }

  .sub__body {
    padding-left: 0;
  }
}
