/* sap-scenarios.css - SAP Scenarios page styles
   Token block duplicated from .impeccable.md cross-site spec. */

:root {
  --color-text: #1a1a1a;
  --color-text-secondary: #666;
  --color-text-muted: #707070;
  --color-bg: #fff;
  --color-bg-subtle: #f8f8f8;
  --color-border: #e5e5e5;
  --color-accent: #1979a7;
  --color-accent-hover: #136185;
  --color-accent-subtle: #edf6fa;
  --color-highlight: #b35c00;
  --font-stack: system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* Hero -------------------------------------------------------------------- */

header.hero {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
}

header.hero h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

header.hero p {
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  margin: 0;
}

/* School lookup ----------------------------------------------------------- */

section.lookup {
  position: relative;
  margin-bottom: 2rem;
}

#school-lookup {
  font-family: var(--font-stack);
  font-size: 1rem;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  background: var(--color-bg);
  appearance: none;
}

#school-lookup:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: -1px;
  border-color: var(--color-accent);
}

#school-lookup::placeholder {
  color: var(--color-text-muted);
}

@media (min-width: 480px) {
  #school-lookup {
    max-width: 440px;
  }
}

#school-lookup-results {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
}

@media (min-width: 480px) {
  #school-lookup-results {
    right: auto;
    min-width: 440px;
  }
}

#school-lookup-results[hidden] { display: none; }

#school-lookup-results li {
  border-bottom: 1px solid var(--color-border);
}

#school-lookup-results li:last-child {
  border-bottom: none;
}

#school-lookup-results button {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.9rem;
  background: none;
  border: none;
  font-family: var(--font-stack);
  font-size: 0.9375rem;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
}

#school-lookup-results button:hover {
  background: var(--color-accent-subtle);
}

#school-lookup-results button span {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Round 2 primary section ------------------------------------------------- */

section.round2 {
  margin-bottom: 3rem;
}

section.round2 > h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

section.round2 > .section-subhead {
  margin: 0 0 1.75rem;
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  max-width: 60ch;
}

section.round2-bucket {
  margin-bottom: 2.25rem;
  scroll-margin-top: 1rem;
}

section.round2-bucket > h3 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

.round2-bucket-label {
  color: var(--color-text);
}

.round2-bucket-count {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.round2-bucket-gloss {
  margin: 0 0 0.875rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  max-width: 60ch;
}

h4.round2-sub-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin: 1rem 0 0.35rem;
}

ul.round2-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

ul.round2-list li {
  border-top: 1px solid var(--color-border);
  padding: 0.55rem 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.5;
}

ul.round2-list li:last-child {
  border-bottom: 1px solid var(--color-border);
}

ul.round2-list li a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  font-weight: 500;
}

ul.round2-list li a:hover {
  color: var(--color-accent-hover);
  background: var(--color-accent-subtle);
  border-radius: 2px;
}

.round2-compound {
  font-size: 0.8125rem;
  color: var(--color-highlight);
  font-style: italic;
  white-space: nowrap;
}

/* No-change bucket: collapsed by default since it's the long tail */
details.round2-no-change,
details.round2-evolution {
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

details.round2-no-change {
  margin-top: 1.5rem;
}

details.round2-no-change summary,
details.round2-evolution summary {
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

details.round2-no-change summary::-webkit-details-marker,
details.round2-evolution summary::-webkit-details-marker { display: none; }

details.round2-no-change summary::before,
details.round2-evolution summary::before {
  content: "+";
  color: var(--color-accent);
  font-weight: 600;
  margin-right: 0.2rem;
}

details.round2-no-change[open] summary::before,
details.round2-evolution[open] summary::before {
  content: "-";
}

details.round2-no-change summary:hover,
details.round2-evolution summary:hover {
  background: var(--color-bg-subtle);
  border-radius: 5px;
}

details.round2-no-change > .round2-bucket-gloss {
  padding: 0.5rem 0.9rem 0;
}

details.round2-no-change > ul.round2-list {
  margin: 0;
}

details.round2-no-change > ul.round2-list li {
  padding-left: 0.9rem;
  padding-right: 0.9rem;
  border-top: 1px solid var(--color-border);
  border-bottom: none;
}

details.round2-no-change > ul.round2-list li:last-child {
  border-bottom: none;
}

details.round2-evolution[open] {
  padding-bottom: 0.5rem;
}

details.round2-evolution > h3 {
  padding: 0 0.9rem;
  margin-top: 1rem;
}

details.round2-evolution > ul {
  padding: 0 0.9rem;
}

/* News section ------------------------------------------------------------ */

section.news {
  margin-bottom: 2.5rem;
}

section.news h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

section.news h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin: 0 0 0.5rem;
}

section.news ul {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

section.news ul:last-child {
  margin-bottom: 0;
}

section.news li {
  border-top: 1px solid var(--color-border);
  padding: 0.55rem 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.5;
}

section.news li:last-child {
  border-bottom: 1px solid var(--color-border);
}

section.news li a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  font-weight: 500;
}

section.news li a:hover {
  color: var(--color-accent-hover);
  background: var(--color-accent-subtle);
  border-radius: 2px;
}

/* Quoted action text gets visual distinction */
section.news li em,
section.news li q {
  font-style: normal;
  font-weight: 500;
  color: var(--color-text);
}

/* Refinement-only section ------------------------------------------------- */

section.refinement-only {
  margin-bottom: 2.5rem;
}

section.refinement-only h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

.section-subhead {
  margin: 0.25rem 0 0.875rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

section.refinement-only details {
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

section.refinement-only summary {
  padding: 0.65rem 0.9rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

section.refinement-only summary::-webkit-details-marker { display: none; }

section.refinement-only summary::before {
  content: "+ ";
  color: var(--color-accent);
  font-weight: 600;
}

section.refinement-only details[open] summary::before {
  content: "- ";
}

section.refinement-only summary:hover {
  background: var(--color-bg-subtle);
  border-radius: 5px;
}

section.refinement-only ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}

section.refinement-only li {
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
}

section.refinement-only li:last-child {
  border-bottom: none;
}

section.refinement-only li a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

section.refinement-only li a:hover {
  color: var(--color-accent-hover);
}

/* School panel ------------------------------------------------------------ */

#school-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 480px;
  height: 100vh;
  background: var(--color-bg);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  z-index: 200;
}

#school-panel[hidden] { display: none; }

@media (max-width: 767px) {
  #school-panel {
    inset: 0;
    width: 100%;
    height: 100%;
  }
}

#school-panel-close {
  position: sticky;
  top: 0;
  float: right;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  border: none;
  font-size: 1.375rem;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom-left-radius: 4px;
  z-index: 10;
  padding: 0;
}

#school-panel-close:hover {
  color: var(--color-text);
  background: var(--color-bg-subtle);
}

#school-panel-close:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

#school-panel-content {
  padding: 0 1.25rem 2rem;
  clear: both;
}

/* Panel header (rendered by JS) */
#school-panel-content header {
  padding-top: 0.25rem;
  margin-bottom: 1rem;
}

#school-panel-content header h3 {
  font-size: 1.1875rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
  line-height: 1.3;
}

.cluster-line {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
}

/* Status glance box */
.status-glance {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
}

.status-glance p {
  margin: 0 0 0.25rem;
  line-height: 1.5;
}

.status-glance p:last-child {
  margin-bottom: 0;
}

.status-glance strong {
  font-weight: 600;
}

/* Quote sections inside the panel */
#school-panel-content section {
  margin-bottom: 1.25rem;
}

#school-panel-content section h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin: 0 0 0.4rem;
}

#school-panel-content blockquote {
  margin: 0;
  padding: 0.6rem 0.9rem;
  border-left: 3px solid var(--color-accent);
  background: var(--color-accent-subtle);
  border-radius: 0 4px 4px 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-text);
}

/* Cross-links nav */
.cross-links {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.9375rem;
}

.cross-links a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  font-weight: 500;
  padding: 0.2rem 0;
  display: inline-block;
}

.cross-links a:hover {
  color: var(--color-accent-hover);
}

/* Parse warning */
.parse-warning {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 1rem;
  line-height: 1.5;
}

.parse-warning a {
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.parse-warning a:hover {
  color: var(--color-accent);
}

/* Quote block + per-quote source citation */
.quote-block { margin: 1.25rem 0; }
/* The `#school-panel-content blockquote` rule above has id-level specificity,
 * so we anchor this rule under the same id to win the cascade. We need the
 * bare border so the round-2 highlight border (next task) doesn't sit on a
 * teal wash. */
#school-panel-content .quote-block blockquote {
  margin: 0;
  padding: 0.6rem 0.875rem;
  border-left: 3px solid var(--color-accent);
  background: none;
  color: var(--color-text);
}
.quote-block .quote-source {
  display: block;
  margin-top: 0.375rem;
  padding-left: 0.875rem;
  font-size: 0.8125rem;
  font-style: normal;
  color: var(--color-text-muted);
}
.quote-block .quote-source a { color: inherit; text-decoration: underline; }
.quote-block .quote-source a:hover { color: var(--color-accent-hover); }

/* Round-specific blockquote borders. Anchored under #school-panel-content to
 * match the specificity of the base rule above; without the id anchor these
 * would lose the cascade and the borders would all stay teal. */
#school-panel-content .quote-block.round-round1 blockquote {
  border-left-color: var(--color-accent);
}
#school-panel-content .quote-block.round-round2 blockquote {
  border-left-color: var(--color-highlight);
}
#school-panel-content .quote-block.round-interim blockquote {
  border-left-color: var(--color-border);
}

/* Round chip prefix on each <h4> inside a quote-block. Painted by the JS
 * panel renderer; chip text is one of three hardcoded literals (R1/R2/interim),
 * so the JS does not escape it. */
.round-chip {
  display: inline-block;
  padding: 0.0625rem 0.4375rem;
  margin-right: 0.4375rem;
  border-radius: 3px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  vertical-align: middle;
}
.round-round1 .round-chip { background: var(--color-accent); }
.round-round2 .round-chip { background: var(--color-highlight); }
.round-interim .round-chip {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.hero-meta {
  margin-top: 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}
.hero-meta strong { color: var(--color-text); font-weight: 600; }

/* Round groups: R1 + interim live in one wrapper, R2 in its own. The wrapper
 * carries the round identity (chip + colored left border) so per-block chips
 * become redundant. The interim note is styled as a smaller, muted child of
 * the R1 wrapper to make the narrative arc R1 -> interim -> R2 visible. */
.round-group {
  margin: 1.5rem 0;
  padding: 0.875rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}
.round-group-heading {
  margin: 0 0 0.625rem;
  font-size: 1rem;
  color: var(--color-text);
}
.round-group-heading .round-chip { margin-right: 0.5rem; }
.round-group-r1 { border-left: 3px solid var(--color-accent); }
.round-group-r2 { border-left: 3px solid var(--color-highlight); }

.interim-note {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg-subtle);
  border-left: 2px solid var(--color-border);
  font-size: 0.9375rem;
}
.interim-note h5 {
  margin: 0 0 0.375rem;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: none;
}
.interim-note blockquote {
  margin: 0;
  padding: 0;
  border-left: none;
  background: none;
  font-size: inherit;
}

/* Overview matrix table --------------------------------------------------- */

.overview { margin: 2rem 0; }
.overview details summary { cursor: pointer; padding: 0.375rem 0; color: var(--color-accent); }
.overview table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.875rem;
}
.overview th, .overview td {
  text-align: left;
  padding: 0.4375rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.overview th {
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg-subtle);
}
.overview th[data-sort] { user-select: none; }
.overview th[data-sort]:focus { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.overview th[aria-sort="ascending"]::after { content: " ▲"; font-size: 0.75em; color: var(--color-accent); }
.overview th[aria-sort="descending"]::after { content: " ▼"; font-size: 0.75em; color: var(--color-accent); }
.overview tr:hover td { background: var(--color-accent-subtle); }
.change-marker {
  display: inline-block;
  padding: 0.0625rem 0.4375rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.change-unchanged { color: var(--color-text-muted); border: 1px solid var(--color-border); }
.change-reversal { color: #fff; background: var(--color-accent); }
.change-new-addition { color: #fff; background: var(--color-highlight); }
.change-reclassified { color: var(--color-highlight); border: 1px solid var(--color-highlight); background: #fdf6e9; }
.change-refined { color: var(--color-text-muted); border: 1px solid var(--color-border); background: var(--color-bg-subtle); }

@media (max-width: 720px) {
  .overview table { font-size: 0.8125rem; }
  .overview th[data-sort="cluster"], .overview td:nth-child(2),
  .overview th[data-sort="level"], .overview td:nth-child(3) { display: none; }
}

/* Search box magnifier glyph ---------------------------------------------- */

.lookup-inputwrap { position: relative; }
.lookup-icon {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  font-size: 1.125rem;
}
#school-lookup { padding-left: 2rem; }

/* Status-glance heading --------------------------------------------------- */
/* Anchored under #school-panel-content to win specificity over the generic
 * `#school-panel-content section h4` rule above (which uppercases + shrinks). */

#school-panel-content .status-glance h4 {
  margin: 0 0 0.4375rem;
  font-size: 0.9375rem;
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
}
