/* Base: reset, type, background, utilities */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
  scrollbar-gutter: stable;
}

html[data-presenter="on"] {
  font-size: 122%;
}

/* Scrollbars: a slim brand-blue thumb that widens on hover. The page keeps a
   quiet track; windows and scrolling panels get a clear one. Firefox only
   takes the two plain colors. */
@supports not selector(::-webkit-scrollbar) {
  html {
    scrollbar-color: var(--sb-thumb) var(--sb-track);
  }
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

/* The page's own scrollbar (Chrome styles it through body) */
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: var(--sb-track);
  box-shadow: inset 1px 0 0 var(--line);
}

::-webkit-scrollbar-thumb {
  min-height: 48px;
  background: linear-gradient(180deg, var(--sb-thumb-a), var(--sb-thumb-b)) padding-box;
  border: 3px solid transparent;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:horizontal {
  min-width: 48px;
  background-image: linear-gradient(90deg, var(--sb-thumb-a), var(--sb-thumb-b));
}

::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:active {
  background-image: linear-gradient(180deg, var(--sb-hover-a), var(--sb-hover-b));
  border-width: 2px;
}

::-webkit-scrollbar-thumb:horizontal:hover,
::-webkit-scrollbar-thumb:horizontal:active {
  background-image: linear-gradient(90deg, var(--sb-hover-a), var(--sb-hover-b));
}

/* Cursors: a small blue dot that turns white over anything clickable and
   hollow over the 3D mountain. Text fields keep the text cursor.
   js/cursor.js adds the trailing ring. */
:root {
  --cur-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='4.2' fill='none' stroke='%23ffffff' stroke-opacity='.4' stroke-width='3.4'/%3E%3Ccircle cx='10' cy='10' r='4.2' fill='%235fb4ff' stroke='%23041d45' stroke-width='1.4'/%3E%3C/svg%3E") 10 10, default;
  --cur-pointer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='5' fill='none' stroke='%235fb4ff' stroke-opacity='.55' stroke-width='3.4'/%3E%3Ccircle cx='10' cy='10' r='5' fill='%23ffffff' stroke='%23063271' stroke-width='1.4'/%3E%3C/svg%3E") 10 10, pointer;
  --cur-grab: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='5' fill='none' stroke='%23041d45' stroke-width='3.4'/%3E%3Ccircle cx='10' cy='10' r='5' fill='none' stroke='%239fd0ff' stroke-width='1.6'/%3E%3Ccircle cx='10' cy='10' r='1.6' fill='%239fd0ff'/%3E%3C/svg%3E") 10 10, grab;
  --cur-grabbing: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='3.6' fill='%239fd0ff' stroke='%23041d45' stroke-width='1.4'/%3E%3C/svg%3E") 10 10, grabbing;
}

html {
  cursor: var(--cur-default);
}

a[href],
button,
select,
summary,
label[for],
[role="button"],
[role="tab"] {
  cursor: var(--cur-pointer);
}

button:disabled {
  cursor: var(--cur-default);
}

input,
textarea,
[contenteditable="true"] {
  cursor: text;
}

html.is-locked {
  overflow: hidden;
}

html.cursor-hidden,
html.cursor-hidden * {
  cursor: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img,
svg {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

/* Blueprint background: two glows of the brand color and a drafting grid */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(64rem 42rem at 88% -12%, var(--bg-glow-1), transparent 70%),
    radial-gradient(52rem 38rem at -12% 38%, var(--bg-glow-2), transparent 72%),
    var(--bg);
}

.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 20%, #000 35%, transparent 85%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 20%, #000 35%, transparent 85%);
}

/* Type */
h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 110%;
  line-height: 1.08;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

/* No ligatures in code: students should see >= and => exactly as typed */
code,
kbd,
pre {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

:not(pre) > code {
  font-size: 0.88em;
  padding: 0.08em 0.36em;
  border-radius: 3px;
  color: var(--accent-2);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 0.12em 0.45em;
  font-size: 0.82em;
  line-height: 1.4;
  text-align: center;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.grad-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* Layout */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

html[data-presenter="on"] .wrap {
  max-width: 1500px;
}

main {
  display: block;
}

main:focus {
  outline: none;
}

/* Utilities */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 200;
  padding: 10px 14px;
  font-weight: 700;
  color: var(--text-on-accent);
  background: var(--accent);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Reduced motion: keep every state change, drop the movement */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}
