/* ============================================================
   B8 — Skill page stratum 3 ("The Floor"): content tabs (F6)
   Design: plan/skill-page-design.md §3 + per-tab layouts (five-tab set).

   Consumes css/codex.css tokens ONLY — no :root here. Prefixes: .sp-tabs /
   .sp-tab / .sp-panel*. The bar deliberately mirrors browse's .event-tab
   recipe (it IS its sibling): Fraunces 17px, tab merges into the panel via a
   -1px bottom margin and an apparatus-colored top rule on the active tab.
   ============================================================ */

.sp-tabs-wrap { margin-top: 22px; }
/* 1px sentinel above the bar; the IntersectionObserver toggles .is-stuck when
   it leaves the viewport (i.e. the bar has stuck to the top). */
.sp-tabs-sentinel { height: 1px; }

.sp-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  position: sticky; top: 0; z-index: 40;
  padding: 6px 2px 0;
  background: var(--paper);
  transition: box-shadow .18s;
}
.sp-tabs.is-stuck { box-shadow: 0 6px 14px -10px rgba(20, 22, 28, .5); }

.sp-tab {
  font-family: var(--font-display); font-optical-sizing: auto; font-weight: 600; font-size: 17px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  padding: 10px 18px 11px;
  margin-bottom: -1px;              /* sit on the panel's top border */
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, color .15s;
}
.sp-tab:hover { background: var(--card); color: var(--ev, var(--gold-deep)); }
.sp-tab.active {
  background: var(--card);
  color: var(--ev, var(--ink));
  border-bottom-color: var(--card);   /* merge into panel */
  border-top: 3px solid var(--ev, var(--gold));
  padding-top: 8px;
  position: relative; z-index: 3;
}
.sp-tab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
.sp-tabcount {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--ev-soft, var(--gold-soft)); color: var(--ev, var(--gold-deep));
  border: 1px solid var(--ev-line, var(--gold-line));
}

.sp-panels {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0 var(--r-md) var(--r-md) var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  position: relative; z-index: 1;
}
/* Panels are rendered server-side (SEO) and hidden with CSS — never removed
   from the DOM. Crossfade on switch. */
.sp-panel[hidden] { display: none; }
.sp-panel { animation: sp-fade .12s ease-out; }
@keyframes sp-fade { from { opacity: 0; } to { opacity: 1; } }

.sp-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 16px;
}
.sp-panel-title {
  font-family: var(--font-display); font-optical-sizing: auto; font-weight: 600; font-size: 21px;
  letter-spacing: -.01em; color: var(--ink); margin: 0;
}

/* ---- Overview spread ------------------------------------------------ */
.sp-overview-grid { display: grid; grid-template-columns: 7fr 5fr; gap: 20px; }
.sp-overview-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sp-ov-block .sp-band-sublabel { margin-bottom: 8px; }

/* "This entry needs" — Wikipedia red-link checklist */
.sp-needs { margin-top: 20px; padding: 16px 18px; border: 1px dashed var(--gold-line); border-radius: var(--r-md); background: var(--gold-soft); }
.sp-needs-title { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 10px; }
.sp-needs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.sp-needs-item a {
  font-size: 13.5px; font-weight: 600; color: var(--bad); text-decoration: none;
  border-bottom: 1px dashed var(--bad); cursor: pointer;
}
.sp-needs-item a:hover { border-bottom-style: solid; }
.sp-needs-complete { font-size: 13.5px; color: var(--good); font-weight: 600; }

.sp-ov-activity { margin-top: 18px; font-size: 12.5px; color: var(--muted); font-style: italic; }
.sp-ov-empty { color: var(--muted); font-style: italic; font-size: 13.5px; }

/* ---- deduction correction ("Fix:") line + program/tag chips --------- */
.sp-fix { margin-top: 8px; font-size: 13px; color: var(--good); }
.sp-fix-label { font-weight: 700; }
.sp-fix-drill { margin-left: 8px; }
.sp-fix-drill a { color: var(--gold-deep); text-decoration: none; border-bottom: 1px solid var(--gold-line); font-weight: 600; }

/* brief highlight when an F7 #<type>-<id> deep link lands on an item */
.sp-anchor-flash { animation: sp-anchor-flash 1.6s ease-out; }
@keyframes sp-anchor-flash {
  0%, 40% { box-shadow: 0 0 0 3px var(--gold-soft), 0 0 0 4px var(--gold); }
  100% { box-shadow: 0 0 0 3px transparent, 0 0 0 4px transparent; }
}

/* org tag chip on a deduction/resource (Q4). "General" = a legacy untagged row. */
.sp-progtag {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 9px; border-radius: var(--r-pill);
}
.sp-progtag--org { color: var(--gold-deep); background: var(--gold-soft); border: 1px solid var(--gold-line); }
.sp-progtag--general { color: var(--muted); background: var(--paper-2); border: 1px solid var(--line); }

/* ---- add-form extras (program select + resource type) --------------- */
.sp-form-progrow { display: flex; flex-wrap: wrap; gap: 12px; }
.sp-form-progrow .formField { flex: 1 1 160px; }

/* ---- mobile: tab bar -> one-line horizontal scroll ------------------ */
@media (max-width: 700px) { .sp-overview-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .sp-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .sp-tabs::-webkit-scrollbar { display: none; }
  .sp-tab { flex: 0 0 auto; }
  .sp-panels { padding: 16px 14px; }
  .sp-panel-title { font-size: 19px; }
}
