:root {
  color-scheme: dark;
  --ink: #f5f1e8;
  --muted: rgba(245, 241, 232, .57);
  --hairline: rgba(255, 255, 255, .14);
  --panel: rgba(14, 14, 17, .88);
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #08080a; }

body {
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.atlas {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 520px;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 68% 45%, rgba(60, 64, 97, .16), transparent 36%),
    radial-gradient(circle at 22% 68%, rgba(62, 107, 101, .09), transparent 32%),
    #08080a;
}

.atlas::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at 62% 50%, transparent 22%, rgba(8, 8, 10, .18) 66%, rgba(8, 8, 10, .68) 100%);
}

#graphCanvas { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#graphCanvas.is-dragging { cursor: grabbing; }

.brand, .intro, .filters, .detail-panel, .instruction, .filter-toggle, .tooltip { position: absolute; z-index: 2; }

.brand {
  top: clamp(22px, 4vh, 42px);
  left: clamp(22px, 4vw, 64px);
  display: flex;
  align-items: center;
  gap: 11px;
  letter-spacing: .04em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 50%;
  font-family: "Songti SC", STSong, serif;
  font-size: 17px;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; font-weight: 650; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }

.intro {
  top: 34%;
  left: clamp(22px, 4vw, 64px);
  width: min(32vw, 460px);
  transform: translateY(-50%);
  transition: opacity .45s ease, transform .45s ease;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 18px;
  color: rgba(245,241,232,.67);
  font-size: 11px;
  letter-spacing: .19em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0;
  font-family: "Songti SC", STSong, "Noto Serif CJK SC", serif;
  font-size: clamp(46px, 4.8vw, 76px);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.055em;
  text-wrap: balance;
}

.intro-copy { max-width: 360px; margin: 24px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.metrics { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 10px 0 0; color: rgba(245,241,232,.45); font-size: 11px; }
.metrics b { color: var(--ink); font-size: 14px; font-weight: 500; }

.atlas.is-focused .intro { opacity: .13; transform: translateY(-50%) translateX(-16px); }

.filters {
  bottom: clamp(22px, 4vh, 44px);
  left: clamp(22px, 4vw, 64px);
  width: 302px;
  padding: 15px 16px 14px;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: rgba(14, 14, 17, .68);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 70px rgba(0,0,0,.22);
}

.filter-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.filter-heading p { margin: 0; color: rgba(245,241,232,.52); font-size: 10px; letter-spacing: .08em; }
.filter-heading button, .reset-view { padding: 0; border: 0; background: transparent; color: rgba(245,241,232,.48); font-size: 10px; cursor: pointer; }
.filter-heading button:hover, .reset-view:hover { color: var(--ink); }

.grade-filters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 14px; }
.grade-button {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: opacity .2s ease;
}
.grade-button[aria-pressed="false"] { opacity: .26; }
.grade-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--grade-color); box-shadow: 0 0 12px color-mix(in srgb, var(--grade-color) 75%, transparent); }
.grade-count { color: rgba(245,241,232,.36); font-variant-numeric: tabular-nums; }

.layer-heading { margin: 9px 0 5px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.1); color: rgba(245,241,232,.42); font-size: 9px; letter-spacing: .1em; }
.role-filters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 10px; }
.role-button {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 7px;
  min-height: 25px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 10px;
  text-align: left;
  cursor: pointer;
  transition: opacity .2s ease;
}
.role-button[aria-pressed="false"] { opacity: .25; }
.role-mark { width: 7px; height: 7px; border-radius: 50%; background: rgba(245,241,232,.82); }
.role-button[data-role="standard-practice"] .role-mark { background: transparent; border: 1px solid rgba(245,241,232,.9); box-shadow: 0 0 0 2px rgba(245,241,232,.12); }
.role-button[data-role="textbook-enrichment"] .role-mark { border-radius: 1px; transform: rotate(45deg); background: rgba(245,178,82,.9); }
.role-button[data-role="school-extension"] .role-mark { background: transparent; border: 1px solid rgba(199,119,232,.92); }
.role-count { color: rgba(245,241,232,.34); font-variant-numeric: tabular-nums; }

.search-field { display: flex; align-items: center; gap: 8px; margin-top: 9px; padding: 8px 0 5px; border-top: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
.search-field svg { width: 14px; fill: none; stroke: rgba(245,241,232,.42); stroke-width: 1.7; }
.search-field input { width: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; }
.search-field input::placeholder { color: rgba(245,241,232,.36); }
.reset-view { margin-top: 9px; }

.filter-toggle { display: none; }

.instruction { right: clamp(22px, 3vw, 46px); bottom: 27px; margin: 0; color: rgba(245,241,232,.42); font-size: 10px; letter-spacing: .05em; }

.detail-panel {
  top: clamp(22px, 4vh, 42px);
  right: clamp(22px, 3vw, 46px);
  width: min(350px, calc(100vw - 44px));
  max-height: calc(100vh - 105px);
  padding: 26px 28px 25px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 5px;
  background: rgba(16, 16, 19, .91);
  box-shadow: 0 28px 90px rgba(0,0,0,.42);
  backdrop-filter: blur(22px);
  scrollbar-width: thin;
  animation: detail-in .28s ease both;
}

@keyframes detail-in { from { opacity: 0; transform: translateX(14px); } }
.detail-panel[hidden] { display: none; }
.detail-close { position: absolute; top: 15px; right: 16px; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: rgba(245,241,232,.56); font-size: 22px; cursor: pointer; }
.detail-meta { margin: 0 36px 13px 0; color: rgba(245,241,232,.5); font-size: 10px; letter-spacing: .13em; }
.detail-panel h2 { margin: 0; font-family: "Songti SC", STSong, serif; font-size: 29px; font-weight: 400; line-height: 1.18; letter-spacing: -.035em; }
.detail-description { margin: 14px 0 18px; color: rgba(245,241,232,.61); font-size: 12px; line-height: 1.72; }
.standard-section { margin: 0 0 16px !important; padding: 12px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.standard-list { display: grid; gap: 5px; }
.standard-item { color: rgba(245,241,232,.76); font-size: 10px; line-height: 1.5; }
.standard-item span { color: rgba(245,241,232,.4); }
.competency-copy { margin: 8px 0 0; color: rgba(245,241,232,.46); font-size: 9px; line-height: 1.55; }
.detail-stat { display: flex; align-items: baseline; gap: 7px; padding: 12px 0 16px; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.detail-stat strong { font-family: Georgia, serif; font-size: 35px; font-weight: 400; }
.detail-stat span { color: rgba(245,241,232,.47); font-size: 10px; }
.detail-panel section { margin-top: 18px; }
.detail-panel h3 { margin: 0 0 8px; color: rgba(245,241,232,.45); font-size: 9px; font-weight: 500; letter-spacing: .15em; }
.relation-list { display: flex; flex-wrap: wrap; gap: 6px; }
.relation-list button { max-width: 100%; padding: 6px 8px; border: 1px solid rgba(255,255,255,.13); border-radius: 2px; background: rgba(255,255,255,.035); color: rgba(245,241,232,.79); font-size: 10px; text-align: left; cursor: pointer; }
.relation-list button:hover { border-color: rgba(255,255,255,.35); color: #fff; }
.empty-relation { margin: 0; color: rgba(245,241,232,.3); font-size: 10px; }
.evidence-list { margin: 0; padding-left: 16px; color: rgba(245,241,232,.66); font-size: 11px; line-height: 1.65; }
.evidence-list li + li { margin-top: 4px; }
.resource-list { display: grid; gap: 6px; }
.resource-item { display: block; padding: 9px 10px; border-left: 2px solid var(--accent, #8ea6ff); background: rgba(255,255,255,.035); color: inherit; text-decoration: none; transition: background .18s ease; }
.resource-item[href]:hover { background: rgba(255,255,255,.08); }
.resource-item strong, .resource-item span { display: block; }
.resource-item strong { font-size: 10px; font-weight: 520; }
.resource-item span { margin-top: 3px; color: rgba(245,241,232,.42); font-size: 9px; }

.tooltip { max-width: 230px; padding: 7px 9px; border: 1px solid rgba(255,255,255,.14); border-radius: 3px; background: rgba(14,14,17,.92); color: var(--ink); font-size: 10px; line-height: 1.35; pointer-events: none; transform: translate(12px, 12px); backdrop-filter: blur(10px); }
.tooltip[hidden] { display: none; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .intro { top: 25%; width: min(76vw, 430px); }
  .intro h1 { font-size: clamp(42px, 9vw, 66px); }
  .intro-copy { max-width: 310px; }
  .instruction { display: none; }
}

@media (max-width: 640px) {
  .atlas { min-height: 0; }
  .brand { top: max(17px, env(safe-area-inset-top)); left: 18px; }
  .brand-mark { width: 31px; height: 31px; font-size: 15px; }
  .intro { top: 19%; left: 18px; width: calc(100vw - 36px); transform: none; }
  .intro h1 { font-size: clamp(39px, 12.2vw, 54px); line-height: 1.01; }
  .intro-copy { width: 88%; margin-top: 15px; font-size: 11px; line-height: 1.65; }
  .eyebrow { margin-bottom: 10px; font-size: 9px; }
  .metrics { margin-top: 12px; }
  .atlas.is-focused .intro { opacity: 0; transform: translateY(-10px); }
  .filter-toggle { display: block; left: 18px; bottom: max(18px, env(safe-area-inset-bottom)); padding: 9px 12px; border: 1px solid var(--hairline); border-radius: 3px; background: rgba(14,14,17,.75); font-size: 10px; backdrop-filter: blur(14px); }
  .filters { left: 18px; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 44px); width: calc(100vw - 36px); transform: translateY(14px); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
  .filters.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .detail-panel { top: auto; right: 10px; bottom: 10px; width: calc(100vw - 20px); max-height: 62vh; padding: 22px 22px max(22px, env(safe-area-inset-bottom)); border-radius: 6px; animation-name: sheet-in; }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(20px); } }
  .detail-panel h2 { font-size: 25px; }
  .detail-description { margin-bottom: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}


.site-return {
  position: absolute;
  z-index: 3;
  top: clamp(27px, 4vh, 47px);
  left: clamp(218px, 17vw, 278px);
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 3px;
  background: rgba(14,14,17,.58);
  color: rgba(245,241,232,.66);
  font-size: 10px;
  text-decoration: none;
  backdrop-filter: blur(12px);
}
.site-return:hover { color: #fff; border-color: rgba(255,255,255,.34); }
@media (max-width: 640px) {
  .site-return { top: max(18px, env(safe-area-inset-top)); right: 18px; left: auto; }
}
