/* ==========================================================================
   Sovereign Circuit — Grading Rubric page
   Extends style.css + spec.css. Only components new to this page live here.
   ========================================================================== */

.dim {
  color: var(--color-text-faint);
}
.strong {
  font-weight: 600;
}
.fine {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ---------- three axes ---------- */
.axes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin: var(--space-8) 0 var(--space-10);
}
.axis {
  position: relative;
  padding: var(--space-6);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.axis--new {
  border-color: var(--color-primary);
  box-shadow: inset 3px 0 0 var(--color-primary);
}
.axis-code {
  font-family: var(--font-display);
  font-size: 2.75rem;
  line-height: 1;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}
.axis h3 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-base);
}
.axis-range {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
}
.axis p:last-child {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ---------- field classes ---------- */
.classes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin: var(--space-6) 0 var(--space-10);
}
.classcard {
  padding: var(--space-5) var(--space-6);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.classcard h3 {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-base);
}
.classcard p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.cls {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0;
}
.cls--m {
  background: var(--color-info-soft);
  color: var(--color-info);
}
.cls--h {
  background: var(--color-warn-soft);
  color: var(--color-warn);
}

/* ---------- tables ---------- */
.tablewrap {
  margin: var(--space-6) 0 var(--space-8);
  overflow-x: auto;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  -webkit-overflow-scrolling: touch;
}
.tablewrap table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.tablewrap th,
.tablewrap td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-divider);
}
.tablewrap thead th {
  background: var(--color-surface-offset);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.tablewrap tbody tr:last-child td {
  border-bottom: 0;
}
.tablewrap code {
  font-size: 0.78rem;
  white-space: nowrap;
}
.btable tr.hi {
  background: color-mix(in srgb, var(--color-primary) 6%, transparent);
}
.ftable {
  min-width: 720px;
}
/* The registry is 66 rows. Give it its own scroll box so its header can stick
   usefully, instead of sticking to the page and colliding with the site header. */
.tablewrap--tall {
  max-height: 34rem;
  overflow-y: auto;
}
.tablewrap--tall thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.tablewrap--tall .grp th {
  position: sticky;
  top: 2.1rem;
  z-index: 1;
}
.ftable tr.grp th {
  position: static;
  padding-top: var(--space-4);
  background: var(--color-surface-offset);
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
}
.ftable td:nth-child(2),
.ftable td:nth-child(3),
.ftable td:nth-child(4) {
  white-space: nowrap;
}

.vtable {
  min-width: 700px;
}
.vtable td:first-child,
.vtable td:nth-child(3) {
  white-space: nowrap;
}
.vnote {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.vload {
  padding: 0.25rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-primary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
.vload:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
}

/* ---------- tier badge ---------- */
.tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  height: 1.7rem;
  padding: 0 0.35rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
}
.tier--A,
.tier--B,
.tier--C,
.tier--D {
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
}
.tier--L {
  background: var(--color-info-soft);
  color: var(--color-info);
}
.tier--P {
  background: var(--color-warn-soft);
  color: var(--color-warn);
}
.tier--R {
  background: var(--color-alert-soft);
  color: var(--color-alert);
}

/* ---------- floors, steps, phases ---------- */
.floors {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-5) 0 var(--space-6);
  padding: 0;
  list-style: none;
}
.floors li {
  padding: 0.4rem 0.8rem;
  background: var(--color-primary-soft);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-primary-hover);
}

.steps {
  margin: var(--space-5) 0 var(--space-6);
  padding-left: 1.4rem;
}
.steps li {
  margin-bottom: var(--space-2);
}

.phases {
  margin: var(--space-6) 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}
.phases li {
  display: grid;
  grid-template-columns: 2rem 8.5rem 1fr;
  gap: var(--space-3);
  align-items: baseline;
  padding: 0.6rem 0.85rem;
  border-left: 3px solid var(--color-primary);
  background: var(--color-surface-2);
  margin-bottom: 2px;
}
.phases li.ph--other {
  border-left-color: var(--color-border);
  opacity: 0.72;
}
.ph-n {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.ph-t {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.ph-d {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ---------- vector pairs ---------- */
.pairs {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-10);
}
.pair {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.pair-k {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-primary);
  padding-top: 0.15rem;
}
.pair p {
  margin: 0;
  font-size: var(--text-sm);
}

/* ---------- sources ---------- */
.srcs {
  margin: var(--space-6) 0 0;
  padding: 0;
  list-style: none;
}
.srcs li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
}
.srcs li:last-child {
  border-bottom: 0;
}
.srcs a {
  font-weight: 500;
}
.srcs span {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ---------- ladder stop rung ---------- */
.rung--stop {
  border-left-color: var(--color-alert) !important;
}
.rung--stop .rung-n {
  background: var(--color-alert-soft);
  color: var(--color-alert);
}

/* ==========================================================================
   THE GRADER
   ========================================================================== */
.grader {
  margin-top: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.g-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-divider);
}
.g-presets label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
}
.g-presets select {
  flex: 1 1 15rem;
  min-width: 0;
}
.g-presets .btn {
  padding: 0.45rem 0.9rem;
  font-size: var(--text-xs);
}

.g-main {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
}
@media (max-width: 900px) {
  .g-main {
    grid-template-columns: 1fr;
  }
}

.g-controls {
  padding: var(--space-5);
  display: grid;
  gap: var(--space-6);
  align-content: start;
}
.g-group h4 {
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-primary);
}
.g-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: var(--space-2) var(--space-5);
}
.g-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.g-row--bool {
  justify-content: center;
  padding: 0.1rem 0;
}
.g-lab {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.35;
}
.g-row input[type='number'],
.g-row input[type='text'],
.g-row select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--color-text);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.g-row input:focus-visible,
.g-row select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.g-key {
  display: none;
}

/* accessible checkbox */
.g-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  /* the visually-hidden input is absolutely positioned; without this it
     escapes the label and can overlay unrelated content */
  position: relative;
}
.g-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.g-box {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  position: relative;
  transition:
    background 0.14s ease,
    border-color 0.14s ease;
}
.g-check input:checked + .g-box {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.g-check input:checked + .g-box::after {
  content: '';
  position: absolute;
  left: 0.28rem;
  top: 0.1rem;
  width: 0.3rem;
  height: 0.55rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
.g-check input:focus-visible + .g-box {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.g-check .g-lab {
  font-size: var(--text-xs);
  color: var(--color-text);
}

/* ---------- output panel ---------- */
.g-out {
  padding: var(--space-5);
  background: var(--color-surface-deep);
  color: var(--color-text-inverse);
  border-left: 1px solid var(--color-divider);
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
}
@media (max-width: 900px) {
  .g-out {
    position: static;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--color-divider);
  }
}
.g-code {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #45c68f;
  line-height: 1.1;
}
.g-tier {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  font-size: var(--text-sm);
}
.g-axes {
  margin: 0 0 var(--space-5);
  display: grid;
  gap: 0.55rem;
}
.g-axes > div {
  display: grid;
  grid-template-columns: 6.4rem 1fr;
  gap: var(--space-3);
  align-items: baseline;
}
.g-axes dt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(245, 247, 244, 0.5);
}
.g-axes dd {
  margin: 0;
  font-size: var(--text-sm);
}
.g-why h4 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(245, 247, 244, 0.5);
}
.g-why ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}
.g-why li {
  font-size: var(--text-xs);
  line-height: 1.5;
  color: rgba(245, 247, 244, 0.86);
}
.g-why li.dim {
  color: rgba(245, 247, 244, 0.45);
}
.why-k {
  display: inline-block;
  min-width: 4.6rem;
  margin-right: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #45c68f;
}
.g-floor {
  margin-top: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  line-height: 1.5;
  border-left: 3px solid;
}
.g-floor--ok {
  background: rgba(69, 198, 143, 0.1);
  border-left-color: #45c68f;
  color: rgba(245, 247, 244, 0.88);
}
.g-floor--bad {
  background: rgba(214, 96, 118, 0.13);
  border-left-color: #d66076;
  color: rgba(245, 247, 244, 0.95);
}

/* reveal — matches spec.css, scoped so content is visible without JS */
html.js-reveal .reveal {
  opacity: 0;
  transform: translateY(12px);
}
html.js-reveal .reveal.in {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}
@media (prefers-reduced-motion: reduce) {
  html.js-reveal .reveal,
  html.js-reveal .reveal.in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- hero button row ----------
   `.artifacts` in spec.css is a file-manifest list, not a button row. */
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* `a.btn` sets inverse (near-white) text for solid buttons. spec.css only
   corrects ghost buttons inside `.doc`, so a ghost button anywhere else —
   the hero, for instance — renders white-on-grey. Correct it unconditionally. */
a.btn--ghost,
a.btn--ghost:hover,
.hero-cta a.btn--ghost {
  color: var(--color-text);
}

/* `.doc strong` in spec.css forces dark text, and the grader's output panel
   lives inside `.doc` on a near-black surface — so bold text inside it
   rendered dark-on-dark. Restore inheritance there. */
.g-out strong,
.doc .g-out strong {
  color: inherit;
  font-weight: 600;
}
