/* Mathematics and computing: a shared scientific shell, two distinct studios.
   All illustrations below are decorative backgrounds; actual graphs, formulas
   and controls remain the existing interactive HTML, MathML and canvas. */

/* MATHEMATICS — blue paper, ink, and a plotted curve. */
body.studio-page[data-science-subject="mathematics"] {
  --math-ink: #182b4c;
  --math-muted: #526581;
  --math-accent: #315eaa;
  --math-border: #cbd8ed;
  background: #edf2f9;
  color: var(--math-ink);
}
body.studio-page[data-science-subject="mathematics"] :is(button,input,select,textarea) { accent-color: var(--math-accent); }
body.studio-page[data-science-subject="mathematics"] .math-heading {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: end;
  gap: 24px;
  min-height: 210px;
  padding: clamp(26px,3.2vw,48px);
  margin-bottom: 28px;
  border: 1px solid #cedaeb;
  border-radius: 16px;
  background: #e2eaf7;
  overflow: hidden;
}
body.studio-page[data-science-subject="mathematics"] .math-heading::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0;
  width: min(52%,680px);
  height: 100%;
  pointer-events: none;
  opacity: .6;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 240' fill='none'%3E%3Cg stroke='%2388a4cc' stroke-opacity='.35'%3E%3Cpath d='M0 60H600M0 120H600M0 180H600M75 0V240M150 0V240M225 0V240M300 0V240M375 0V240M450 0V240M525 0V240'/%3E%3C/g%3E%3Cpath d='M0 132 C55 25 90 24 145 132 S235 240 290 132 S380 24 435 132 S525 240 600 78' stroke='%234772b7' stroke-width='2.6'/%3E%3Cpath d='M0 184 C80 174 145 154 220 108 S365 25 435 63 S540 169 600 155' stroke='%23739dd4' stroke-width='1.5'/%3E%3C/svg%3E") right center / cover no-repeat;
}
body.studio-page[data-science-subject="mathematics"] .math-heading h1 { color: #142746; font-size: clamp(36px,3.3vw,50px); }
body.studio-page[data-science-subject="mathematics"] .math-heading p { color: #405575; max-width: 520px; }
body.studio-page[data-science-subject="mathematics"] .math-course-selector { position: relative; z-index: 1; }
body.studio-page[data-science-subject="mathematics"] .math-course-selector a {
  background: #f8fbff;
  border: 1px solid #bbcce5;
  border-radius: 7px;
  color: #294a7a;
}
body.studio-page[data-science-subject="mathematics"] .math-course-selector a:hover { background: #dbe8fa; border-color: #7999c9; }
body.studio-page[data-science-subject="mathematics"] .math-ui-tabs { border-bottom-color: #c8d6e9; }
body.studio-page[data-science-subject="mathematics"] .math-ui-tabs .learn-button { color: #5b6c85; }
body.studio-page[data-science-subject="mathematics"] .math-ui-tabs .learn-button[aria-pressed="true"] { color: #254f94; border-bottom-color: #315eaa; }
body.studio-page[data-science-subject="mathematics"] .math-search { color: #405575; }
body.studio-page[data-science-subject="mathematics"] .math-search input { border-color: #bccde5; background: #fff; color: #203b61; }
body.studio-page[data-science-subject="mathematics"] .math-topic-grid { gap: 16px; }
body.studio-page[data-science-subject="mathematics"] .math-topic {
  position: relative;
  isolation: isolate;
  grid-template-columns: minmax(100px,120px) minmax(0,1fr);
  min-height: 166px;
  padding: 27px;
  border: 1px solid var(--math-border);
  border-radius: 12px;
  background: #fbfdff;
  overflow: hidden;
}
body.studio-page[data-science-subject="mathematics"] .math-topic::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 10px;
  width: 126px;
  height: 126px;
  z-index: -1;
  opacity: .35;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 130 130' fill='none' stroke='%238caad0'%3E%3Ccircle cx='65' cy='65' r='50'/%3E%3Ccircle cx='65' cy='65' r='32'/%3E%3Cpath d='M10 65H120M65 10V120M27 103L103 27'/%3E%3C/svg%3E") center / contain no-repeat;
}
body.studio-page[data-science-subject="mathematics"] .math-topic:nth-child(2) { background: #e8f0fc; }
body.studio-page[data-science-subject="mathematics"] .math-topic:nth-child(3) { background: #e7edf8; }
body.studio-page[data-science-subject="mathematics"] .math-topic:nth-child(4) { background: #f3f6fd; }
body.studio-page[data-science-subject="mathematics"] .math-topic:hover { background: #e2ebfa; border-color: #7f9ecb; }
body.studio-page[data-science-subject="mathematics"] .math-topic[aria-pressed="true"] { background: #cadcf5; border-color: #6489c2; }
body.studio-page[data-science-subject="mathematics"] .math-topic-symbol {
  display: block;
  white-space: nowrap;
  min-width: 0;
  color: #345f9c;
  font-size: clamp(27px,2.5vw,35px);
}
body.studio-page[data-science-subject="mathematics"] .math-topic strong { color: #182f51; }
body.studio-page[data-science-subject="mathematics"] .math-topic small { color: #526784; }
body.studio-page[data-science-subject="mathematics"] :is(.math-cards .learn-card,.math-lab) { border-color: #cbd8eb; background: #fbfdff; border-radius: 12px; }
body.studio-page[data-science-subject="mathematics"] .math-cards .learn-formula { color: #315eaa; }
body.studio-page[data-science-subject="mathematics"] .graph-workspace { border-color: #b7cbe2; }
body.studio-page[data-science-subject="mathematics"] .graph-toolbar { background: #172e4c; border-bottom-color: #31506f; }
body.studio-page[data-science-subject="mathematics"] .graph-workspace-mode { background: #294b70; color: #dcecff; border-color: #517699; }
body.studio-page[data-science-subject="mathematics"] .graph-expression.is-selected { background: #e8f0fb; border-left-color: #4b74b0; }
body.studio-page[data-science-subject="mathematics"] .graph-add-expression { background: #edf3fb; border-color: #acc2df; color: #365d93; }

/* COMPUTER SCIENCE — a precise interface with a circuit-and-code masthead. */
body.studio-page[data-science-subject="computer-science"] {
  --cs-ink: #122d36;
  --cs-muted: #496771;
  --cs-accent: #087a89;
  --cs-line: #c5dde1;
  background: #eaf1f2;
  color: var(--cs-ink);
}
body.studio-page[data-science-subject="computer-science"] :is(button,input,select,textarea) { accent-color: var(--cs-accent); }
body.studio-page[data-science-subject="computer-science"] .subject-hero {
  position: relative;
  isolation: isolate;
  min-height: 200px;
  padding: clamp(27px,3vw,44px);
  border: 1px solid #c1d9dd;
  border-radius: 16px;
  background: #d9eaec;
  overflow: hidden;
}
body.studio-page[data-science-subject="computer-science"] .subject-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  top: 0;
  width: min(48%,580px);
  height: 100%;
  opacity: .48;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 240' fill='none'%3E%3Cg stroke='%2358979f' stroke-width='1.4'%3E%3Cpath d='M90 0V55h95v38h100v40h128v65h187M0 180h85v-40h80V95h120M350 0v56h90v39h160'/%3E%3Ccircle cx='185' cy='55' r='5'/%3E%3Ccircle cx='285' cy='93' r='5'/%3E%3Ccircle cx='413' cy='133' r='5'/%3E%3Ccircle cx='440' cy='56' r='5'/%3E%3C/g%3E%3Cg fill='%233e7881' font-family='monospace' font-size='13'%3E%3Ctext x='325' y='150'%3Econst signal = 1;%3C/text%3E%3Ctext x='350' y='173'%3Eif (signal) %7B%3C/text%3E%3Ctext x='374' y='196'%3Ereturn true;%3C/text%3E%3Ctext x='350' y='219'%3E%7D%3C/text%3E%3C/g%3E%3C/svg%3E") right center / cover no-repeat;
}
body.studio-page[data-science-subject="computer-science"] .subject-hero h1 { color: #123441; font-size: clamp(36px,3.3vw,50px); }
body.studio-page[data-science-subject="computer-science"] .subject-hero p { color: #355c66; max-width: 670px; }
body.studio-page[data-science-subject="computer-science"] .cs-search-label { color: #375b64; }
body.studio-page[data-science-subject="computer-science"] .cs-search-label input { background: #fff; border-color: #b8d2d7; color: #173942; }
body.studio-page[data-science-subject="computer-science"] .cs-topics { gap: 16px; }
body.studio-page[data-science-subject="computer-science"] .cs-topic {
  position: relative;
  isolation: isolate;
  min-height: 270px;
  border: 1px solid #c4d9dd;
  border-radius: 12px;
  background: #fbfefe;
  color: #153943;
  overflow: hidden;
}
body.studio-page[data-science-subject="computer-science"] .cs-topic::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 14px;
  top: 12px;
  width: 140px;
  height: 110px;
  opacity: .32;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 110' fill='none' stroke='%237aaab0'%3E%3Crect x='42' y='25' width='56' height='56' rx='5'/%3E%3Crect x='52' y='35' width='36' height='36' rx='2'/%3E%3Cpath d='M52 15v10m12-10v10m12-10v10m12-10v10M52 81v10m12-10v10m12-10v10m12-10v10M32 35h10m-10 12h10m-10 12h10m-10 12h10m56-36h10m-10 12h10m-10 12h10m-10 12h10'/%3E%3C/svg%3E") center / contain no-repeat;
}
body.studio-page[data-science-subject="computer-science"] .cs-topic:first-child:not([data-topic="binary"]) { background: #fbfefe; border-color: #c4d9dd; color: #153943; }
body.studio-page[data-science-subject="computer-science"] .cs-topic:first-child:not([data-topic="binary"]) :is(span,p,b,.cs-topic-preview) { color: #496b72; }
body.studio-page[data-science-subject="computer-science"] .cs-topic:first-child:not([data-topic="binary"])>b { border-color: #c4d9dd; }
body.studio-page[data-science-subject="computer-science"] .cs-topic[data-topic="binary"] { background: #123a47; border-color: #123a47; color: #f4fcfb; }
body.studio-page[data-science-subject="computer-science"] .cs-topic[data-topic="binary"] :is(span,p,b,.cs-topic-preview) { color: #bfe3e2; }
body.studio-page[data-science-subject="computer-science"] .cs-topic[data-topic="binary"]>b { border-color: #477481; }
body.studio-page[data-science-subject="computer-science"] .cs-topic:not([data-topic="binary"]):hover { background: #e7f4f4; border-color: #81b5ba; }
body.studio-page[data-science-subject="computer-science"] .cs-topic[data-topic="binary"]:hover { background: #1c5360; }
body.studio-page[data-science-subject="computer-science"] .cs-topic h2 { color: inherit; }
body.studio-page[data-science-subject="computer-science"] .cs-topic-preview { color: #267f87; overflow-wrap: anywhere; }
body.studio-page[data-science-subject="computer-science"] :is(.cs-lab,.cs-explanation) { border-color: #c4d9dd; border-radius: 12px; }
body.studio-page[data-science-subject="computer-science"] .cs-lab { background: #fbfefe; }
body.studio-page[data-science-subject="computer-science"] .cs-explanation { background: #dceef0; }
body.studio-page[data-science-subject="computer-science"] .cs-bit[aria-pressed="true"] { background: #176f79; border-color: #176f79; color: #fff; }
body.studio-page[data-science-subject="computer-science"] .cs-readout { border-color: #bedce0; }

@media (max-width: 700px) {
  body.studio-page[data-science-subject="mathematics"] .math-heading,
  body.studio-page[data-science-subject="computer-science"] .subject-hero { min-height: 0; padding: 24px 20px; border-radius: 12px; }
  body.studio-page[data-science-subject="mathematics"] .math-heading::after,
  body.studio-page[data-science-subject="computer-science"] .subject-hero::after { width: 60%; opacity: .2; }
  body.studio-page[data-science-subject="mathematics"] .math-heading h1,
  body.studio-page[data-science-subject="computer-science"] .subject-hero h1 { font-size: 34px; }
  body.studio-page[data-science-subject="mathematics"] .math-topic { grid-template-columns: minmax(76px,90px) minmax(0,1fr); min-height: 136px; padding: 20px 17px; gap: 7px 14px; }
  body.studio-page[data-science-subject="mathematics"] .math-topic-symbol { font-size: 26px; }
  body.studio-page[data-science-subject="mathematics"] .math-topic::after { width: 90px; height: 90px; opacity: .18; }
  body.studio-page[data-science-subject="computer-science"] .cs-topic { min-height: 250px; padding: 24px; }
  body.studio-page[data-science-subject="computer-science"] .cs-topic::after { width: 110px; height: 95px; opacity: .2; }
}
@media (prefers-contrast: more) {
  body.studio-page[data-science-subject="mathematics"] :is(.math-heading,.math-topic)::after,
  body.studio-page[data-science-subject="computer-science"] :is(.subject-hero,.cs-topic)::after { display: none; }
}
@media print {
  body.studio-page[data-science-subject="mathematics"],
  body.studio-page[data-science-subject="computer-science"] { background: #fff; color: #111; }
  body.studio-page[data-science-subject="mathematics"] :is(.math-heading,.math-topic),
  body.studio-page[data-science-subject="computer-science"] :is(.subject-hero,.cs-topic) { background: #fff; color: #111; }
  body.studio-page[data-science-subject="mathematics"] :is(.math-heading,.math-topic)::after,
  body.studio-page[data-science-subject="computer-science"] :is(.subject-hero,.cs-topic)::after { display: none; }
}
