/* The /activities workshop (activity_page.html): the homepage's Studio identity around the classroom activities.
   Ivory page, deep-indigo type, violet for primary actions and the learner's construction, teal for supporting cues.
   Values follow the Studio theme in themes.css and studio.css; the activity card is restyled through the --act-* tokens
   that activities.css defines, so the live tutor (which also loads activities.css) keeps its own look. */
@font-face { font-family: "Instrument Sans"; src: url(/static/fonts/InstrumentSans-Latin.woff2) format("woff2"); font-weight: 400 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --page: #f8f7f3; --surface: #fff; --raised: #fcfbf8;
  --ink: #20204a; --ink-2: #43435f; --muted: #686878;
  --line: #e9e7ed; --line-2: #d9d6e3; --line-3: #b5afc8;
  --violet: #6c4cf1; --violet-deep: #5939d8; --violet-ink: #5735ce; --violet-soft: #ece6ff; --violet-wash: #f5f2ff; --lilac: #f4f1fd;
  --teal: #0f766e; --teal-ink: #0b5e57; --teal-wash: #e4f4f1;
  --amber-ink: #946110; --amber-wash: #fff2d4; --amber-line: #f0d9a6;
  --card-radius: 20px; --button-radius: 12px; --content: 1120px; --gutter: 48px;
  --lift: 0 5px 14px rgb(108 76 241 / 15%);
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang TC", sans-serif;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235735ce' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body.workshop { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.55 var(--sans); -webkit-text-size-adjust: 100%; }
.workshop :focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.workshop button, .workshop select { font: inherit; color: inherit; }
.sr-only, body[data-active=true] #page-title {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.site-header, .workshop main, .site-footer { width: min(100% - var(--gutter), var(--content)); margin-inline: auto; }

/* Header: the homepage's brand and navigation */
.site-header { display: flex; align-items: center; gap: 24px; min-height: 88px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--ink); font-size: 20px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; text-decoration: none; }
.site-nav { display: flex; align-items: center; gap: clamp(18px, 2.6vw, 38px); margin-inline: auto; }
.site-nav a { padding: 9px 0; color: var(--ink-2); font-size: 14.5px; font-weight: 550; text-decoration: none; white-space: nowrap; }
.site-nav a:hover { color: var(--violet-ink); }
body[data-auth=in] .site-nav { display: none; }   /* these anchors live on the signed-out homepage */
.site-account { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.account-link { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 4px; border-radius: var(--button-radius);
  color: var(--ink); font-size: 14.5px; font-weight: 600; text-decoration: none; }
.account-link:hover { color: var(--violet-ink); }

/* Breadcrumb and language */
.crumbs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding-top: 20px; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 14.5px; }
.crumbs li + li::before { content: "/"; margin-right: 10px; color: var(--line-3); }
.crumbs a { color: var(--violet-ink); font-weight: 550; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; text-underline-offset: 4px; }
.language { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface); color: var(--teal); cursor: pointer; }
.language:hover { border-color: var(--line-3); }
.language:has(select:focus-visible) { outline: 3px solid var(--violet); outline-offset: 2px; }
.language select { appearance: none; min-height: 40px; padding: 0 22px 0 0; border: 0; background: transparent var(--chevron) no-repeat right center;
  color: var(--ink); font-size: 14.5px; font-weight: 550; cursor: pointer; }
.language select:focus-visible { outline: none; }

/* Heading and activity picker */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px 48px; padding: 30px 0 32px; }
.eyebrow { margin: 0; color: var(--teal); font: 700 .78rem/1.5 var(--sans); letter-spacing: .14em; text-transform: uppercase; }
.intro h1 { max-width: 760px; margin: 12px 0 14px; font: 700 clamp(2.5rem, 5.2vw, 4.1rem)/1.03 var(--sans); letter-spacing: -.05em; }
.lede { max-width: 580px; margin: 0; color: var(--ink-2); font-size: clamp(1.05rem, 1.5vw, 1.2rem); line-height: 1.6; }
.picker { display: grid; gap: 8px; width: min(100%, 440px); }
.picker label { color: var(--ink-2); font-size: 13.5px; font-weight: 600; }
.picker-row { display: flex; gap: 10px; }
.picker select { flex: 1; min-width: 0; min-height: 52px; padding: 0 42px 0 16px; border: 1px solid var(--line-2); border-radius: var(--button-radius);
  appearance: none; background: var(--surface) var(--chevron) no-repeat right 16px center; color: var(--ink); font-size: 16px; font-weight: 550; cursor: pointer;
  box-shadow: 0 1px 2px rgb(32 32 74 / 4%); }
.picker select:hover { border-color: var(--line-3); }
.button-primary, #open { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px; border: 0;
  border-radius: var(--button-radius); background: var(--violet); color: #fff; font-size: 16px; font-weight: 650; text-decoration: none; cursor: pointer;
  box-shadow: var(--lift); transition: background .15s ease, box-shadow .15s ease, transform .15s ease; }
:is(.button-primary, #open):hover:not(:disabled) { background: var(--violet-deep); transform: translateY(-1px); }
#open:disabled { opacity: .5; cursor: default; box-shadow: none; }
#open[data-busy=true]:disabled { opacity: 1; cursor: progress; }
.spinner { display: none; width: 16px; height: 16px; border: 2px solid rgb(255 255 255 / 45%); border-top-color: #fff; border-radius: 50%; animation: workshop-spin .8s linear infinite; }
#open[data-busy=true] .spinner { display: block; }
.picker-status { min-height: 1.45em; margin: 0; color: var(--muted); font-size: 13.5px; }
body[data-active=true] .intro { align-items: center; padding: 22px 0 14px; }
body[data-active=true] #page-intro { display: none; }
#page-error { margin: 0 0 20px; padding: 12px 16px; border: 1px solid var(--amber-line); border-radius: var(--button-radius); background: var(--amber-wash); color: var(--amber-ink); }

/* Signed out: an intentional sign-in card with a preview of an activity */
.signin-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; gap: clamp(28px, 4.5vw, 60px);
  padding: clamp(24px, 4vw, 44px); border: 1px solid var(--line); border-radius: var(--card-radius); background: var(--surface);
  box-shadow: 0 2px 4px rgb(32 32 74 / 2%), 0 12px 32px rgb(32 32 74 / 5%); }
.signin-kicker { display: inline-flex; margin: 0; padding: 5px 11px; border-radius: 999px; background: var(--teal-wash); color: var(--teal);
  font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
#signin-title { margin: 16px 0 10px; font: 700 clamp(1.85rem, 3.2vw, 2.5rem)/1.08 var(--sans); letter-spacing: -.04em; }
.signin-text { max-width: 46ch; margin: 0; color: var(--ink-2); }
.topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 28px; padding: 0; list-style: none; }
.topics li { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--raised); color: var(--ink-2); font-size: 13px; font-weight: 550; }
.signin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.text-link { color: var(--violet-ink); font-size: 14.5px; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.text-link:hover { text-decoration-thickness: 2px; }
.signin-preview { padding: 18px 18px 16px; border: 1px solid #e7e1fb; border-radius: 16px; background: var(--lilac); }
.preview-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 12px; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.preview-top code { flex: none; white-space: nowrap; padding: 4px 10px; border-radius: 999px; background: var(--violet-soft); color: var(--violet-ink); font: 500 13px ui-monospace, Consolas, monospace; letter-spacing: 0; text-transform: none; }
.preview-graph { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--surface); }
.preview-legend { display: flex; align-items: center; gap: 8px; margin: 12px 4px 0; color: var(--ink-2); font-size: 12.5px; }
.key-line, .key-dash { width: 24px; border-top: 3px solid var(--violet); border-radius: 2px; }
.key-dash { margin-left: 14px; border-top: 2.5px dashed var(--teal); }
.preview-slider { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 14px; border-radius: var(--button-radius); background: var(--surface); font-size: 13px; font-weight: 600; }
.preview-slider .track { position: relative; flex: 1; height: 6px; border-radius: 99px; background: #e4def7; }
.preview-slider .fill { position: absolute; inset: 0 38% 0 0; border-radius: inherit; background: var(--violet); }
.preview-slider .thumb { position: absolute; top: 50%; left: 62%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border: 3px solid #fff; border-radius: 50%;
  background: var(--violet); box-shadow: 0 1px 4px rgb(32 32 74 / 25%); }
.preview-slider .value { min-width: 34px; padding: 3px 8px; border-radius: 8px; background: var(--violet-wash); color: var(--violet-ink); text-align: center; font-variant-numeric: tabular-nums; }

/* The activity: its title leads the page, then one card with the plotting area, a lilac control panel and the answer */
.workshop .math-activity {
  --act-ink: #20204a; --act-soft: #686878; --act-line: #d9d6e3;
  --act-learner: #6c4cf1; --act-learner-deep: #5939d8; --act-given: #0f766e; --act-attention: #946110;
  --act-axis: #b5afc8; --act-tick: #e9e7ed; --act-grid: #ebe8f2; --act-empty: #efedf5; --act-selected: #ddd3ff;
  --act-panel: #f4f1fd; --act-wash: #ece6ff; --act-feedback-bg: #f5f2ff; --act-hint-bg: #fff2d4; --act-hint-line: #f0d9a6;
  overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-family: var(--sans);
}
.workshop .act-idle { padding: 76px 24px; border: 1px dashed var(--line-3); border-radius: var(--card-radius); color: var(--muted); font-size: 15px;
  background: linear-gradient(#f1eff6 1px, transparent 1px) center / 32px 32px, linear-gradient(90deg, #f1eff6 1px, transparent 1px) center / 32px 32px, var(--surface); }
.workshop .act-head { align-items: flex-start; gap: 20px; padding: 0; }
.workshop .act-head h2 { margin: 0; color: var(--ink); font: 700 clamp(2.1rem, 4.6vw, 3.5rem)/1.04 var(--sans); letter-spacing: -.048em; }
.workshop .act-prompt { max-width: 62ch; margin: 12px 0 26px; padding: 0; color: var(--ink-2); font-size: clamp(1.05rem, 1.6vw, 1.25rem); }
.workshop .act-workspace { grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); gap: 14px; padding: 14px;
  border: 1px solid var(--line); border-bottom: 0; border-radius: var(--card-radius) var(--card-radius) 0 0; background: var(--surface); }
.workshop .act-workspace:has(> .act-controls[hidden]) { grid-template-columns: minmax(0, 1fr); }
.workshop .act-workspace:has(+ .act-response[hidden]) { border-bottom: 1px solid var(--line); border-radius: var(--card-radius); }
.workshop .act-scene { min-height: 380px; padding: 16px 16px 12px; background: transparent; }
.workshop .act-graph { max-width: none; height: 440px; }   /* the per-activity sizes in activities.css still win */
.workshop .act-solid { height: 420px; }
.workshop .act-graph .JXGtext { font-family: var(--sans) !important; }
.workshop .act-legend { gap: 10px 24px; margin-top: 12px; font-size: 13.5px; font-weight: 600; }
.workshop .act-legend span { display: inline-flex; align-items: center; gap: 9px; }
.workshop .act-legend span::before { content: ""; width: 28px; border-top: 3px solid currentColor; border-radius: 2px; }
.workshop .math-activity[data-preset=graph_mission] .act-legend span:nth-child(2)::before { border-top-style: dashed; }
.workshop .act-controls { gap: 18px; padding: 22px 20px; border: 0; border-radius: 16px; background: var(--act-panel); }
.workshop .act-control label { margin-bottom: 8px; color: var(--ink); font-size: 14.5px; font-weight: 650; }
.workshop .act-control-row { gap: 12px; }
.workshop .act-control-row input[type=number] { width: 76px; text-align: center; font-weight: 600; }
.workshop .act-readout { padding: 14px 16px; border-radius: var(--button-radius); background: #ebe6fb; color: var(--ink); font-size: 17px; font-weight: 550; }
.workshop .act-controls .act-note { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* Controls and fields: 12px corners and subtle borders; mathematical pieces keep their own shapes */
.workshop .math-activity button:not(.act-tile, .act-tile-slot, .act-fraction-cell, .act-fraction-placed, .act-fraction-piece),
.workshop .math-activity :is(input:not([type=radio], [type=checkbox], [type=range]), select, textarea) {
  border-color: var(--line-2); border-radius: var(--button-radius); transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.workshop .math-activity button:not(.act-tile, .act-tile-slot, .act-fraction-cell, .act-fraction-placed, .act-fraction-piece, .act-primary) { padding-inline: 16px; color: var(--ink); font-weight: 600; }
.workshop .math-activity :is(input:not([type=radio], [type=checkbox], [type=range]), select, textarea) { min-height: 48px; padding: 10px 14px; }
.workshop .math-activity :is(input, select, textarea):hover:not(:disabled) { border-color: var(--line-3); }
.workshop .math-activity :is(input, select, textarea):focus { border-color: var(--violet); }
.workshop .math-activity ::placeholder { color: #8a8a99; }
.workshop .math-activity :focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.workshop .math-activity input[type=range] { min-height: 32px; padding: 0; border: 0; background: transparent; appearance: none; cursor: pointer; }
.workshop .math-activity input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: #dcd4f6; }
.workshop .math-activity input[type=range]::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -7px; border: 3px solid #fff; border-radius: 50%;
  appearance: none; background: var(--violet); box-shadow: 0 1px 4px rgb(32 32 74 / 28%); }
.workshop .math-activity input[type=range]::-moz-range-track { height: 6px; border-radius: 99px; background: #dcd4f6; }
.workshop .math-activity input[type=range]::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--violet); }
.workshop .math-activity input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; background: var(--violet); box-shadow: 0 1px 4px rgb(32 32 74 / 28%); }
.workshop .math-activity input[type=range]:disabled { cursor: default; }
.workshop .math-activity input[type=range]:disabled::-webkit-slider-thumb { background: var(--line-3); }
.workshop .math-activity input[type=range]:disabled::-moz-range-thumb { background: var(--line-3); }
.workshop .math-activity input[type=range]:focus-visible { border-radius: 8px; }
.workshop .act-choice { padding: 10px 14px; border-color: var(--line-2); border-radius: var(--button-radius); background: var(--surface); font-weight: 550; }
.workshop .act-fraction-card { border-radius: 14px; }

/* The answer: its own section under the construction */
.workshop .act-response { gap: 18px; padding: 24px 28px 26px; border: 1px solid var(--line); border-radius: 0 0 var(--card-radius) var(--card-radius); background: var(--surface); }
.workshop .act-field label, .workshop .math-activity legend { color: var(--ink); font-size: 15px; font-weight: 650; }
.workshop .act-toolbar { gap: 10px; }
.workshop .act-toolbar .act-note { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.workshop .math-activity .act-primary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 24px;
  border-color: transparent; background: var(--violet); color: #fff; font-weight: 650; box-shadow: var(--lift); }
.workshop .math-activity .act-primary:hover:not(:disabled) { background: var(--violet-deep); color: #fff; }
.workshop .math-activity .act-primary[data-busy=true]::before { content: ""; width: 16px; height: 16px; border: 2px solid rgb(255 255 255 / 45%);
  border-top-color: #fff; border-radius: 50%; animation: workshop-spin .8s linear infinite; }
.workshop .math-activity .act-primary[data-busy=true]:disabled { opacity: 1; cursor: progress; }
.workshop .act-feedback { padding: 14px 18px; border-color: #ddd5f7; border-radius: var(--button-radius); color: var(--ink); }
.workshop .act-feedback[data-outcome=correct] { border-color: #a7dccf; background: var(--teal-wash); color: var(--teal-ink); }
.workshop .act-feedback[data-outcome=incorrect] { border-color: var(--amber-line); background: var(--amber-wash); color: var(--amber-ink); }
.workshop .act-hint { padding: 14px 18px; border-radius: var(--button-radius); }
.workshop .act-error { padding: 14px 0 0; color: var(--amber-ink); }

.site-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; margin-top: 8px; padding: 22px 0 32px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer p { margin: 0; }
.site-footer .brand { font-size: 15px; }
.workshop main { padding-bottom: 56px; }

.workshop :is(h1, h2) { text-wrap: balance; }
.workshop :is(.lede, .signin-text, .act-prompt) { text-wrap: pretty; }
/* Chinese and Cantonese headings keep normal spacing between characters and break at punctuation, not inside a word */
.workshop :is(h1, h2):is(:lang(zh), :lang(yue)) { letter-spacing: -.01em; word-break: keep-all; overflow-wrap: anywhere; }

@keyframes workshop-spin { to { transform: rotate(1turn); } }

@media (max-width: 860px) {
  .site-nav { display: none; }
  .intro { grid-template-columns: 1fr; align-items: start; }
  .picker { width: 100%; }
  .signin-card { grid-template-columns: 1fr; }
}
@media (max-width: 740px) {
  .workshop .act-workspace { grid-template-columns: 1fr; padding: 10px; }
  .workshop .act-controls { padding: 16px; }
  .workshop .act-graph { height: 340px; }
  .workshop .act-solid { height: 320px; }
  .workshop .act-response { padding: 18px 16px 20px; }
  .workshop .act-head h2 { font-size: clamp(1.75rem, 7vw, 2.3rem); }
}
@media (max-width: 600px) {
  :root { --gutter: 32px; }
  .workshop .act-controls { grid-template-columns: 1fr; }   /* sliders get the full width */
  .site-header { min-height: 72px; padding: 14px 0; gap: 12px; }
  .brand { gap: 9px; font-size: 16px; }
  .intro { padding: 22px 0 24px; }
  .intro h1 { font-size: clamp(2.2rem, 10vw, 2.8rem); }
  .preview-legend, .preview-slider { font-size: 12px; }
}
@media (max-width: 420px) {
  #account-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .picker-row { flex-direction: column; }
  .workshop .act-graph { height: 300px; }
  .signin-actions .button-primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .workshop *, .workshop *::before { transition: none !important; animation: none !important; }
}
