/* ==========================================================================
   OgbonMath — Explore Workspace
   --------------------------------------------------------------------------
   Shared treatment for the four Explore destinations:
     body[data-view="playground"]   — Graphing Playground (Three.js canvas)
     body[data-view="hub"]          — Math Hub (scratchpad + solver)
     body[data-view="simulations"]  — Real-World Simulations
     body[data-view="code"]         — Python Code Playground (Skulpt)

   All four share a pattern: title + intro + controls + visualization +
   optional output. Warm treatment scoped per view, with shared cross-
   cutting rules where appropriate.
   ========================================================================== */

/* ==========================================================================
   Shared container + h2/h3 treatment
   ==========================================================================
*/
body[data-view="playground"] #ct,
body[data-view="hub"] #ct,
body[data-view="simulations"] #ct,
body[data-view="code"] #ct {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-4) var(--sp-10);
  font-family: var(--font-sans);
}

body[data-view="playground"] #ct > .ls,
body[data-view="hub"] #ct > .ls,
body[data-view="simulations"] #ct > .ls,
body[data-view="code"] #ct > .ls {
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body[data-view="playground"] #ct h2,
body[data-view="hub"] #ct h2,
body[data-view="simulations"] #ct h2,
body[data-view="code"] #ct h2 {
  font-family: var(--font-display) !important;
  font-size: var(--fs-3xl) !important;
  font-weight: var(--fw-semibold) !important;
  letter-spacing: var(--ls-tight) !important;
  line-height: var(--lh-tight) !important;
  color: var(--tx) !important;
  margin-bottom: var(--sp-2) !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

body[data-view="playground"] #ct > .ls > h2 + p,
body[data-view="hub"] #ct > .ls > h2 + p,
body[data-view="simulations"] #ct > .ls > h2 + p,
body[data-view="code"] #ct > .ls > h2 + p,
body[data-view="playground"] #ct > .ls > p[style*="color:var(--tx2)"],
body[data-view="hub"] #ct > .ls > p[style*="color:var(--tx2)"],
body[data-view="code"] #ct > .ls > p[style*="color:var(--tx3)"] {
  font-family: var(--font-serif) !important;
  font-size: var(--fs-md) !important;
  line-height: var(--lh-relaxed) !important;
  color: var(--tx1) !important;
  margin-bottom: var(--sp-5) !important;
}

body[data-view="playground"] #ct h3,
body[data-view="hub"] #ct h3,
body[data-view="simulations"] #ct h3,
body[data-view="code"] #ct h3 {
  font-family: var(--font-display) !important;
  font-size: var(--fs-lg) !important;
  font-weight: var(--fw-semibold) !important;
  letter-spacing: var(--ls-tight) !important;
  color: var(--tx) !important;
  margin: var(--sp-5) 0 var(--sp-2) !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

/* ==========================================================================
   Shared button treatment — the Explore workspaces render lots of
   inline-styled buttons
   ==========================================================================
*/
body[data-view="playground"] #ct .btn,
body[data-view="hub"] #ct .btn,
body[data-view="simulations"] #ct .btn,
body[data-view="code"] #ct .btn {
  font-family: var(--font-sans) !important;
  font-size: var(--fs-sm) !important;
  font-weight: var(--fw-semibold) !important;
  padding: 9px 16px !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--bdr) !important;
  background: var(--bg2) !important;
  color: var(--tx1) !important;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}

body[data-view="playground"] #ct .btn:hover,
body[data-view="hub"] #ct .btn:hover,
body[data-view="simulations"] #ct .btn:hover,
body[data-view="code"] #ct .btn:hover {
  background: var(--hover-bg) !important;
  border-color: var(--bdr2) !important;
  color: var(--tx) !important;
}

body[data-view="playground"] #ct .btn:active,
body[data-view="hub"] #ct .btn:active,
body[data-view="simulations"] #ct .btn:active,
body[data-view="code"] #ct .btn:active {
  transform: scale(var(--active-scale));
}

/* Primary buttons (btn1) get terracotta */
body[data-view="playground"] #ct .btn.btn1,
body[data-view="hub"] #ct .btn.btn1,
body[data-view="simulations"] #ct .btn.btn1,
body[data-view="code"] #ct .btn.btn1 {
  background: var(--ac) !important;
  color: var(--ac-tx) !important;
  border-color: var(--ac) !important;
}

body[data-view="playground"] #ct .btn.btn1:hover,
body[data-view="hub"] #ct .btn.btn1:hover,
body[data-view="simulations"] #ct .btn.btn1:hover,
body[data-view="code"] #ct .btn.btn1:hover {
  background: var(--ac2) !important;
  border-color: var(--ac2) !important;
  color: var(--ac-tx) !important;
}

/* Input fields in explore views */
body[data-view="playground"] #ct input[type="text"],
body[data-view="playground"] #ct input[type="number"],
body[data-view="hub"] #ct input[type="text"],
body[data-view="hub"] #ct input[type="number"],
body[data-view="simulations"] #ct input[type="text"],
body[data-view="simulations"] #ct input[type="number"],
body[data-view="code"] #ct input[type="text"] {
  font-family: var(--font-mono) !important;
  font-size: var(--fs-base) !important;
  padding: 10px 14px !important;
  border: 1px solid var(--bdr) !important;
  border-radius: var(--radius-md) !important;
  background: var(--bg) !important;
  color: var(--tx) !important;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

body[data-view="playground"] #ct input:focus,
body[data-view="hub"] #ct input:focus,
body[data-view="simulations"] #ct input:focus,
body[data-view="code"] #ct input:focus,
body[data-view="playground"] #ct textarea:focus,
body[data-view="code"] #ct textarea:focus {
  outline: none !important;
  border-color: var(--ac) !important;
  box-shadow: 0 0 0 3px var(--ac-ring) !important;
}

/* ==========================================================================
   Playground-specific
   ==========================================================================
*/
body[data-view="playground"] #ct #gc-2d,
body[data-view="playground"] #ct #gc-3d {
  border: 1px solid var(--bdr) !important;
  border-radius: var(--radius-lg) !important;
  overflow: hidden;
  background: var(--bg2) !important;
  box-shadow: var(--shadow-xs);
}

body[data-view="playground"] #ct .gcc {
  padding: var(--sp-4) !important;
  border-top: 1px solid var(--bdr) !important;
  background: var(--bg2) !important;
}

body[data-view="playground"] #ct .gcc label {
  font-family: var(--font-sans) !important;
  font-size: var(--fs-sm) !important;
  font-weight: var(--fw-medium) !important;
  color: var(--tx1) !important;
  letter-spacing: 0 !important;
}

body[data-view="playground"] #ct .gcc label strong {
  font-family: var(--font-mono);
  color: var(--ac);
  font-weight: var(--fw-bold);
}

body[data-view="playground"] #ct input[type="range"] {
  accent-color: var(--ac);
}

/* Mode toggle buttons (2D/3D) — accent-soft when inactive */
body[data-view="playground"] #ct #gp-2d,
body[data-view="playground"] #ct #gp-3d {
  transition: all var(--dur-fast) var(--ease-out);
}

/* ==========================================================================
   Hub-specific
   ==========================================================================
*/
body[data-view="hub"] #ct .hub-canvas-wrap {
  border: 1px solid var(--bdr) !important;
  border-radius: var(--radius-lg) !important;
  background: var(--bg2) !important;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

body[data-view="hub"] #ct .hub-toolbar {
  padding: var(--sp-3) var(--sp-4) !important;
  background: var(--bg2) !important;
  border: 1px solid var(--bdr) !important;
  border-radius: var(--radius-md) !important;
  margin: var(--sp-3) 0 !important;
  display: flex !important;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

body[data-view="hub"] #ct .hub-toolbar-left {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* Solution cards */
body[data-view="hub"] #ct .hub-solution-wrap {
  background: var(--bg2) !important;
  border: 1px solid var(--bdr) !important;
  border-radius: var(--radius-lg) !important;
  padding: var(--sp-5) !important;
  margin-top: var(--sp-4) !important;
  box-shadow: var(--shadow-xs);
}

body[data-view="hub"] #ct .hub-solution-header {
  font-family: var(--font-sans) !important;
  font-size: var(--fs-xs) !important;
  font-weight: var(--fw-semibold) !important;
  letter-spacing: var(--ls-widest) !important;
  text-transform: uppercase !important;
  color: var(--ac) !important;
  margin-bottom: var(--sp-4) !important;
}

body[data-view="hub"] #ct .hub-intro {
  font-family: var(--font-serif) !important;
  font-size: var(--fs-base) !important;
  line-height: var(--lh-relaxed) !important;
  color: var(--tx) !important;
  margin-bottom: var(--sp-3) !important;
}

body[data-view="hub"] #ct .hub-eq-card {
  background: var(--bg3) !important;
  border: 1px solid var(--bdr) !important;
  border-radius: var(--radius-md) !important;
  padding: var(--sp-4) !important;
  margin: var(--sp-3) 0 !important;
}

body[data-view="hub"] #ct .hub-eq-label {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--tx3);
  margin-bottom: var(--sp-2);
}

body[data-view="hub"] #ct .hub-eq-math {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  color: var(--tx);
}

body[data-view="hub"] #ct .hub-step {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--bdr);
}

body[data-view="hub"] #ct .hub-step:first-of-type {
  border-top: none;
  padding-top: 0;
}

body[data-view="hub"] #ct .hub-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--ac-soft);
  border: 1px solid var(--ac);
  color: var(--ac);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

body[data-view="hub"] #ct .hub-step-body {
  flex: 1;
  min-width: 0;
}

body[data-view="hub"] #ct .hub-step-title {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--tx);
  margin-bottom: var(--sp-1);
}

body[data-view="hub"] #ct .hub-step-text {
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--tx1);
}

body[data-view="hub"] #ct .hub-final-card {
  background: var(--ac-soft) !important;
  border: 1px solid var(--ac) !important;
  border-radius: var(--radius-md) !important;
  padding: var(--sp-4) !important;
  margin: var(--sp-4) 0 0 !important;
}

body[data-view="hub"] #ct .hub-final-label {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--ac);
  margin-bottom: var(--sp-2);
}

body[data-view="hub"] #ct .hub-final-math {
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  color: var(--tx);
  font-weight: var(--fw-semibold);
}

/* Active hub-tool button */
body[data-view="hub"] #ct .hub-tool-active {
  background: var(--ac) !important;
  color: var(--ac-tx) !important;
  border-color: var(--ac) !important;
}

/* ==========================================================================
   Simulations-specific
   ==========================================================================
*/
body[data-view="simulations"] #ct canvas {
  border: 1px solid var(--bdr) !important;
  border-radius: var(--radius-lg);
  background: var(--bg2);
  display: block;
  max-width: 100%;
  box-shadow: var(--shadow-xs);
}

body[data-view="simulations"] #ct select {
  font-family: var(--font-sans) !important;
  font-size: var(--fs-sm) !important;
  padding: 8px 12px !important;
  border: 1px solid var(--bdr) !important;
  border-radius: var(--radius-md) !important;
  background: var(--bg) !important;
  color: var(--tx) !important;
  cursor: pointer;
}

/* ==========================================================================
   Code Playground-specific
   ==========================================================================
*/
body[data-view="code"] #ct #cp-editor {
  font-family: var(--font-mono) !important;
  font-size: var(--fs-sm) !important;
  background: var(--bg2) !important;
  color: var(--tx) !important;
  border: 1px solid var(--bdr) !important;
  border-radius: var(--radius-lg) !important;
  padding: var(--sp-4) !important;
  line-height: var(--lh-normal);
  tab-size: 4;
  resize: vertical;
}

body[data-view="code"] #ct #cp-editor:focus {
  outline: none !important;
  border-color: var(--ac) !important;
  box-shadow: 0 0 0 3px var(--ac-ring) !important;
}

body[data-view="code"] #ct #cp-output {
  font-family: var(--font-mono) !important;
  font-size: var(--fs-sm) !important;
  background: var(--bg2) !important;
  color: var(--tx) !important;
  border: 1px solid var(--bdr) !important;
  border-radius: var(--radius-lg) !important;
  padding: var(--sp-4) !important;
  min-height: 100px;
  white-space: pre-wrap;
  line-height: var(--lh-normal);
}

body[data-view="code"] #ct [data-cp-preset] {
  /* Inherits from .btn.btn2 already styled above */
}

/* ==========================================================================
   Mobile
   ==========================================================================
*/
@media (max-width: 560px) {
  body[data-view="playground"] #ct,
  body[data-view="hub"] #ct,
  body[data-view="simulations"] #ct,
  body[data-view="code"] #ct {
    padding: var(--sp-4) var(--sp-3) var(--sp-6);
  }
  body[data-view="playground"] #ct h2,
  body[data-view="hub"] #ct h2,
  body[data-view="simulations"] #ct h2,
  body[data-view="code"] #ct h2 {
    font-size: var(--fs-2xl) !important;
  }
}
