/* ============================================================
   GAIBE Learning — TEKS Explorer (Grade 3 Math)
   Page-specific styles. Shared tokens/primitives come from
   ../demo/demo.css (paper · ink-navy · blue→violet).
   ============================================================ */

.teks-wrap { max-width: 1080px; margin: 0 auto; padding: 20px 22px 80px; }

/* ---------------- hero ---------------- */
.teks-hero { padding: 26px 0 8px; text-align: center; max-width: 46em; margin: 0 auto; }
.teks-hero .eyebrow { justify-content: center; }
.teks-hero h1 { font-size: clamp(2.1rem, 5.4vw, 3.5rem); margin: 16px 0 18px; }
.teks-lede { color: var(--ink-soft); font-size: 1.06rem; line-height: 1.6; max-width: 40em; margin: 0 auto; }
.teks-lede b { color: var(--ink); font-weight: 700; }

/* hierarchy chips */
.hier {
  display: flex; align-items: stretch; justify-content: center; flex-wrap: wrap;
  gap: 8px; margin: 30px auto 12px;
}
.hier-step {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 14px; box-shadow: var(--shadow-soft); text-align: left;
}
.hier-step .hier-k { color: var(--ink-faint); font-size: 0.6rem; letter-spacing: 0.12em; }
.hier-step .hier-v { font-size: 0.82rem; color: var(--ink); font-weight: 600; }
.hier-step-hi { border-color: rgba(45,91,255,.4); background: linear-gradient(180deg, rgba(45,91,255,.05), var(--card)); }
.hier-step-hi .hier-k { color: var(--blue); }
.hier-arrow { align-self: center; color: var(--line-strong); font-size: 0.9rem; }
.hier-note { font-size: 0.86rem; color: var(--ink-faint); max-width: 34em; margin: 6px auto 0; }
.hier-note b { color: var(--ink-soft); font-weight: 700; }

/* stat row */
.teks-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin: 30px auto 4px; }
.stat {
  min-width: 140px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 22px; box-shadow: var(--shadow-soft); text-align: center;
}
.stat b { display: block; font-family: var(--font-display); font-size: 2.2rem; font-weight: 600; line-height: 1; }
.stat b span { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat small { display: block; margin-top: 6px; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }

/* ---------------- "the how" band ---------------- */
.how-band { margin: 40px 0 8px; }
.how-inner {
  background: linear-gradient(120deg, rgba(123,92,255,.06), rgba(45,91,255,.04));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px;
  box-shadow: var(--shadow-soft);
}
.how-copy h2 { font-size: 1.5rem; margin: 8px 0 8px; }
.how-copy p { color: var(--ink-soft); font-size: 0.96rem; max-width: 56em; }
.how-copy p em { font-style: italic; color: var(--violet-ink); font-weight: 600; }
.how-copy .btn { margin-top: 14px; }
.how-list { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.how-list[hidden] { display: none; }
.how-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; }
.how-item .hi-code { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 600; color: var(--violet-ink); letter-spacing: 0.04em; }
.how-item .hi-text { font-size: 0.82rem; color: var(--ink-soft); margin-top: 4px; line-height: 1.4; }

/* ---------------- controls (sticky) ---------------- */
.teks-controls {
  position: sticky; top: 59px; z-index: 150;
  margin: 30px 0 22px; padding: 14px; border-radius: var(--radius);
  background: rgba(251, 250, 245, 0.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); box-shadow: var(--shadow-soft);
}
.ctrl-search { position: relative; display: flex; align-items: center; }
.ctrl-search .cs-icn { position: absolute; left: 14px; color: var(--ink-faint); font-size: 1.05rem; pointer-events: none; }
.ctrl-search input {
  width: 100%; font-family: var(--font-body); font-size: 0.98rem; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 11px 40px 11px 40px;
}
.ctrl-search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(45,91,255,.12); }
.cs-clear { position: absolute; right: 12px; width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--paper-deep); color: var(--ink-soft); cursor: pointer; font-size: 0.72rem; display: grid; place-items: center; }
.cs-clear:hover { background: var(--line); }

.ctrl-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.strand-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.spill {
  font-family: var(--font-body); font-size: 0.8rem; font-weight: 600; color: var(--ink-soft);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 13px; cursor: pointer; white-space: nowrap;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
}
.spill:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.spill.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.spill.active.spill-how { background: var(--violet-ink); border-color: var(--violet-ink); }
.spill .sp-n { font-family: var(--font-mono); font-size: 0.7rem; opacity: 0.7; margin-right: 3px; }

.how-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.how-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.how-switch .hs-track { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .25s ease; flex-shrink: 0; }
.how-switch .hs-track::after { content:""; position:absolute; top:3px; left:3px; width:14px; height:14px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.25); transition: transform .25s cubic-bezier(0.34,1.56,0.64,1); }
.how-switch input:checked + .hs-track { background: var(--violet-ink); }
.how-switch input:checked + .hs-track::after { transform: translateX(14px); }
.how-switch input:focus-visible + .hs-track { box-shadow: 0 0 0 3px rgba(123,92,255,.3); }
.how-switch .hs-lbl { color: var(--ink-soft); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------------- strand sections ---------------- */
.strand { margin: 34px 0; scroll-margin-top: 150px; }
.strand-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.strand-badge {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; color: #fff; background: var(--grad);
  box-shadow: 0 8px 18px -8px rgba(45,91,255,.55);
}
.strand-badge.badge-how { background: linear-gradient(120deg, var(--violet-ink), var(--blue)); }
.strand-head .sh-meta { min-width: 0; }
.strand-head .sh-domain { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.15; }
.strand-head .sh-goal { font-size: 0.9rem; color: var(--ink-soft); margin-top: 4px; max-width: 60em; }
.strand-head .sh-count { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin-top: 6px; }

/* SE list */
.se-list { display: flex; flex-direction: column; gap: 12px; }
.se {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-soft); overflow: hidden;
  transition: border-color .3s ease, box-shadow .3s ease;
}
.se.open { border-color: rgba(45,91,255,.32); box-shadow: var(--shadow-lift); }
.se-head { display: flex; align-items: flex-start; gap: 13px; padding: 16px 18px; cursor: pointer; }
.se-head:hover { background: var(--paper-deep); }
.se-code {
  flex-shrink: 0; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; color: var(--blue);
  background: var(--blue-soft); border: 1px solid rgba(45,91,255,.22); border-radius: 8px; padding: 5px 9px; margin-top: 1px;
}
.se.se-how .se-code { color: var(--violet-ink); background: var(--violet-soft); border-color: rgba(123,92,255,.28); }
.se-main { flex: 1; min-width: 0; }
.se-text { font-size: 0.98rem; color: var(--ink); line-height: 1.45; }
.se-text::first-letter { text-transform: capitalize; }
.se-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; align-items: center; }
.se-bcount { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); background: var(--paper-deep); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
.ptag {
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 600; letter-spacing: 0.03em;
  color: var(--violet-ink); background: var(--violet-soft); border: 1px solid rgba(123,92,255,.24);
  border-radius: 999px; padding: 3px 8px;
}
.se-chev { flex-shrink: 0; color: var(--ink-faint); font-size: 1.1rem; line-height: 1; margin-top: 2px; transition: transform .3s ease; }
.se.open .se-chev { transform: rotate(90deg); color: var(--blue); }

/* body (collapsible) */
.se-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .38s cubic-bezier(0.22,1,0.36,1); }
.se.open .se-body { grid-template-rows: 1fr; }
.se-body-inner { overflow: hidden; }
.se-body-pad { padding: 4px 18px 18px; border-top: 1px solid var(--line); }

/* Gaibe example panel */
.ex { margin-top: 14px; }
.ex-lead {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono);
  font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue); font-weight: 600; margin-bottom: 10px;
}
.ex-lead .live-dot { position: static; }
.ex-focus { font-family: var(--font-display); font-size: 1.08rem; line-height: 1.4; color: var(--ink); margin-bottom: 14px; }
.ex-focus em { font-style: italic; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.ex-problem { background: var(--paper-deep); border: 1px solid var(--line); border-radius: 14px; padding: 14px 15px; }
.ex-problem .exp-k { font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
.ex-problem .exp-scenario { font-size: 0.86rem; color: var(--ink-soft); font-style: italic; margin-bottom: 6px; }
.ex-problem .exp-task { font-size: 0.98rem; color: var(--ink); line-height: 1.5; font-weight: 500; }

.ex-answer { margin-top: 10px; }
.ex-answer summary { list-style: none; cursor: pointer; font-family: var(--font-body); font-weight: 600; font-size: 0.86rem; color: var(--green); display: inline-flex; align-items: center; gap: 7px; padding: 4px 0; }
.ex-answer summary::-webkit-details-marker { display: none; }
.ex-answer summary::before { content: "▸"; font-size: 0.7rem; transition: transform .2s ease; display: inline-block; }
.ex-answer[open] summary::before { transform: rotate(90deg); }
.ex-answer .exa-body { font-size: 0.9rem; color: var(--ink); line-height: 1.5; padding: 8px 12px; margin-top: 6px; background: var(--green-soft); border: 1px solid rgba(34,160,107,.25); border-radius: 11px; }

/* misconception + move, side by side */
.ex-mm { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.ex-card { border-radius: 13px; padding: 13px 14px; border: 1px solid var(--line); }
.ex-card .exc-k { display: flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; margin-bottom: 7px; }
.ex-card p { font-size: 0.88rem; line-height: 1.45; color: var(--ink); }
.ex-miss { background: rgba(229,72,77,.05); border-color: rgba(229,72,77,.28); }
.ex-miss .exc-k { color: var(--red); }
.ex-miss .exc-tag { font-weight: 700; color: var(--red); }
.ex-move { background: var(--violet-soft); border-color: rgba(123,92,255,.28); }
.ex-move .exc-k { color: var(--violet-ink); }

/* diagnostics + representations */
.ex-sub { margin-top: 14px; }
.ex-sub .exs-k { font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px; }
.ex-diags { list-style: none; counter-reset: dq; display: flex; flex-direction: column; gap: 7px; }
.ex-diags li { counter-increment: dq; position: relative; padding: 8px 12px 8px 36px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; font-size: 0.86rem; line-height: 1.4; color: var(--ink); }
.ex-diags li::before { content: counter(dq); position: absolute; left: 9px; top: 7px; width: 19px; height: 19px; border-radius: 6px; display: grid; place-items: center; background: var(--grad); color: #fff; font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600; }
.ex-reps { display: flex; flex-wrap: wrap; gap: 6px; }
.rep { font-size: 0.72rem; font-weight: 600; color: var(--ink-soft); background: var(--paper-deep); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }

/* breakouts */
.bk { margin-top: 16px; }
.bk-toggle { background: none; border: none; cursor: pointer; font-family: var(--font-body); font-weight: 600; font-size: 0.82rem; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 7px; padding: 4px 0; }
.bk-toggle::before { content: "▸"; font-size: 0.7rem; transition: transform .2s ease; }
.bk-toggle.open::before { transform: rotate(90deg); }
.bk-toggle b { color: var(--ink); }
.bk-list { list-style: none; margin-top: 10px; display: none; flex-direction: column; gap: 2px; border-left: 2px solid var(--line); padding-left: 4px; }
.bk-list.show { display: flex; }
.bk-item { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 8px; font-size: 0.85rem; color: var(--ink-soft); line-height: 1.4; }
.bk-item:hover { background: var(--paper-deep); }
.bk-num { flex-shrink: 0; font-family: var(--font-mono); font-size: 0.62rem; color: var(--ink-faint); min-width: 26px; }
.bk-item::first-letter { text-transform: capitalize; }

/* strand-1 (process) SEs: lighter, no example */
.se-how .se-body-pad .ex { display: none; }

/* process-tag visibility toggle */
.no-ptags .ptag { display: none; }

/* ---- STAAR readiness / supporting labels (teacher-facing) ---- */
.staar-badge {
  font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.05em; text-transform: uppercase;
  font-weight: 600; border-radius: 999px; padding: 3px 9px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.staar-readiness { color: var(--amber-ink); background: var(--amber-soft); border: 1px solid rgba(245,158,45,.45); }
.staar-supporting { color: var(--blue); background: var(--blue-soft); border: 1px solid rgba(45,91,255,.28); }
.staar-process { color: var(--violet-ink); background: var(--violet-soft); border: 1px solid rgba(123,92,255,.28); }
.staar-not-assessed { color: var(--ink-faint); background: var(--paper-deep); border: 1px solid var(--line); }
/* readiness cards get a gold left-accent so teachers can spot the high-weight standards fast */
.se[data-staar="readiness"] { border-left: 3px solid var(--amber); }

.staar-pills { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.staar-pills .sp-lead { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin-right: 2px; }
.staar-legend { font-size: 0.78rem; color: var(--ink-soft); margin-top: 10px; line-height: 1.5; }
.staar-legend b { color: var(--ink); font-weight: 700; }

/* search highlight */
mark { background: rgba(245,158,45,.32); color: inherit; border-radius: 3px; padding: 0 1px; }

/* no results / misc */
.no-results { text-align: center; color: var(--ink-soft); padding: 40px 0; font-size: 0.95rem; }
.linkbtn { background: none; border: none; color: var(--blue); font-weight: 600; cursor: pointer; font-family: var(--font-body); font-size: inherit; text-decoration: underline; }

.teks-foot { margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line); text-align: center; color: var(--ink-faint); font-size: 0.8rem; }
.teks-foot .mono { color: var(--ink-faint); margin-bottom: 6px; }
.teks-foot a { color: var(--blue); }

/* hidden by filter */
.se[hidden], .strand[hidden] { display: none; }

/* ---------------- responsive ---------------- */
@media (max-width: 680px) {
  .demobar-meta .sub { display: none; }
  .teks-controls { top: 55px; }
  .ex-mm { grid-template-columns: 1fr; }
  .hier-arrow { display: none; }
  .hier { gap: 6px; }
  .hier-step { flex: 1 1 44%; }
  .strand-head .sh-domain { font-size: 1.15rem; }
}
