/* Studio base: the one definition of the Studio look, shared by every Studio page (/studio/, /studio/start/,
   /studio/try/). Tokens, page basics, the academy top bar, .kicker, .band, .win and .btn live here and nowhere
   else, so the bar and the buttons cannot drift between pages. One fixed theme, the same as the main site:
   orange for bands and primary buttons, the yellow mark, ink on paper, and purple only in the logo and the
   STUDIO label. Functional colours (done, error, caution) never double as brand colours.
   Page CSS loads after this file. The pages' CSP allows no inline styles, so every variant here is a class. */

:root {
  color-scheme: light;
  --hero: #FF5A36; --on-hero: #16130E; --mark: #FFD23F; --on-mark: #16130E;
  --b2: #FF5A36; --on-b2: #16130E; --btn: #FF5A36; --on-btn: #16130E; --accent: #B3301A;
  --ink: #16130E; --paper: #FFFAF0; --cream: #FFF8EA; --white: #FFFFFF; --muted: #574F42; --rule: #BEB5A6;
  --logo: #5800FF; /* the logo's purple: the mark and the STUDIO label only */
  /* The dark panels: terminal, code editor, build covers. Only where code or the agent's log is shown. */
  --crt: #0F0D0A; --crt-2: #191610; --crt-line: #2F2A21; --crt-text: #F3EEE3; --crt-muted: #A8A192;
  --ok-dark: #7EE2A8; --warn-dark: #FFB86B; --danger: #A62A12; --danger-bg: #FFE9E3; --caution: #FFD23F;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --pixel: "Silkscreen", ui-monospace, monospace;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --pop: cubic-bezier(.22, 1.55, .36, 1);
  --t-fill: 450ms; --t-lift: 220ms; --t-press: 90ms;
  --bar-h: 64px;
  --gutter: max(clamp(16px, 4vw, 54px), env(safe-area-inset-left, 0px)); /* the page side margin */
}

/* Anything the scripts hide must really hide, whatever display a class sets (.btn, .google-block, selects). */
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-padding-top: calc(var(--bar-h) + 12px); }
body {
  min-height: 100vh; background-color: var(--paper); color: var(--ink); font: 400 1rem/1.55 var(--body);
  /* Engineering paper: a faint ink dot grid. */
  background-image: radial-gradient(circle at 1px 1px, rgb(22 19 14 / .14) 1px, transparent 1.5px);
  background-size: 24px 24px;
}
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--display); line-height: 1.02; letter-spacing: -.03em; text-wrap: balance; }
p { margin: 0; }
::selection { background: var(--mark); color: var(--on-mark); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: 1240px; margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 16px; top: -80px; z-index: 60; padding: 10px 16px; border-radius: 6px; background: var(--ink); color: var(--cream); font-weight: 700; text-decoration: none; }
.skip:focus { top: 10px; }

/* ---------- top bar: the academy header, with Studio in the wordmark slot ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--bar-h); background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--ink); }
.topbar-in { display: flex; align-items: center; gap: 16px; height: 100%; max-width: 1760px; margin-inline: auto; padding-inline: max(clamp(16px, 3vw, 40px), env(safe-area-inset-left, 0px)); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; flex-shrink: 0; text-decoration: none; }
.brand-mark { display: block; width: 40px; height: 40px; flex: none; }
.wordmark { display: grid; gap: 4px; font: 800 1.2rem/1 var(--display); letter-spacing: -.035em; white-space: nowrap; }
.wordmark-sub { color: var(--logo); font: 700 .6rem/1 var(--body); letter-spacing: .24em; text-transform: uppercase; }
.topnav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.topnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 6px; font-weight: 700; font-size: .95rem; text-decoration: none; white-space: nowrap; }
.topnav a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
/* The page you are on: an orange underline, the same mark the site uses for the current section. */
.topnav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--hero); text-decoration-thickness: 4px; text-underline-offset: 8px; }

/* ---------- shared pieces ---------- */
.kicker { display: inline-block; padding: 8px 11px 7px; border-radius: 4px; background: var(--ink); color: var(--mark); font: 400 .72rem/1 var(--pixel); letter-spacing: .08em; text-transform: uppercase; }
.eyebrow { color: var(--accent); font: 700 .74rem/1.35 var(--body); letter-spacing: .12em; text-transform: uppercase; }
.hint { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.note { color: var(--muted); font-size: .92rem; }
.error { margin: 6px 0 0; color: var(--danger); font-weight: 700; font-size: .92rem; }
.error:not(:empty)::before { content: "! "; }
.error:empty { margin: 0; }

/* A saturated orange band, with the homepage hero's scanlines and vignette. */
.band { position: relative; isolation: isolate; overflow: hidden; background: var(--hero); color: var(--on-hero); border-bottom: 2px solid var(--ink); }
.band::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgb(0 0 0 / .07) 0 1px, transparent 1px 3px), radial-gradient(120% 90% at 50% 45%, transparent 55%, rgb(0 0 0 / .24) 100%); }
.band :focus-visible { outline-color: var(--on-hero); }

/* Window chrome from the homepage (.m-win): ink frame, hard shadow. */
.win { position: relative; overflow: hidden; background: var(--white); color: var(--ink); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 7px 7px 0 var(--ink); }
.win-body { padding: clamp(18px, 2.4vw, 26px); }

/* ---------- buttons: the site's fill from the left, lift and squash (transform only) ---------- */
.btn {
  --fill: var(--mark); --fill-text: var(--on-mark);
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border: 2px solid var(--ink); border-radius: 6px;
  background: var(--white); color: var(--ink); box-shadow: 3px 3px 0 var(--ink);
  font: 700 1rem/1.15 var(--body); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform var(--t-lift) var(--ease-out), color var(--t-fill) var(--ease-out);
}
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--fill); transform: scaleX(0); transform-origin: right center; transition: transform var(--t-fill) var(--ease-out); }
.btn:focus-visible { color: var(--fill-text); }
.btn:focus-visible::before { transform: scaleX(1); transform-origin: left center; }
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover { color: var(--fill-text); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
  .btn:not(:disabled):hover::before { transform: scaleX(1); transform-origin: left center; }
}
.btn:not(:disabled):active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); transition-duration: var(--t-press); }
.btn.primary { background: var(--btn); color: var(--on-btn); }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: .92rem; }
.btn.wide { width: 100%; }
.btn.quiet { --fill: transparent; background: transparent; color: inherit; border-color: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: .22em; text-decoration-thickness: 1px; }
.btn.quiet:hover, .btn.quiet:focus-visible { color: inherit; box-shadow: none; text-decoration-thickness: 3px; }
.btn.quiet:active { box-shadow: none; }
.btn .ico, .btn .plus { font-weight: 400; line-height: 1; }
.btn .plus { font: 400 1.3rem/1 var(--display); }
.btn:disabled { cursor: progress; opacity: .7; }
/* Busy: a light sweep runs across a disabled button until the answer comes back (as on the site). */
.btn:disabled::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / .5) 50%, transparent 70%); transform: translateX(-100%); animation: sweep 1.1s var(--ease-out) infinite; }
@keyframes sweep { to { transform: translateX(100%); } }

/* ---------- the bar on phones ---------- */
@media (max-width: 480px) {
  .wordmark { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .topbar-in { gap: 8px; }
  .topnav a { padding: 0 8px; font-size: .9rem; }
}
@media (max-width: 360px) {
  /* At 320px (also 400% zoom) the bar must still fit inside the page margins. */
  .topbar-in { gap: 6px; }
  .brand-mark { width: 34px; height: 34px; }
  .topnav { gap: 0; }
  .topnav a { padding: 0 4px; font-size: .84rem; }
}

/* ---------- reduced motion: buttons stay put, colour changes stay ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn, .btn::before { transition-duration: 1ms !important; }
  .btn:hover, .btn:active { transform: none !important; }
  .btn::before { transform: none !important; opacity: 0; }
  .btn:hover::before, .btn:focus-visible::before { opacity: 1; }
  .btn:disabled::after { display: none; }
}
