/* Codeday — design tokens and base styles.
   Identity: a highlighter on code. Cool paper, navy ink, one marker yellow that
   means "look here" everywhere — in the player, on buttons, in the hero. */

:root {
  --paper: #f2f5f1;
  --paper-2: #e8ede7;
  --card: #ffffff;
  --ink: #13233a;
  --ink-2: #4a5a70;
  --ink-3: #75839a;
  --line: #d3dbd5;
  --marker: #f5c518;
  --marker-soft: rgba(245, 197, 24, 0.32);
  --leaf: #1f7a55;
  --leaf-soft: rgba(31, 122, 85, 0.14);
  --clay: #c2412d;
  --clay-soft: rgba(194, 65, 45, 0.14);
  --focus: #2f6fde;

  --ed-bg: #0e1a2b;
  --ed-bg-2: #13233a;
  --ed-line: #22344d;
  --ed-text: #e7edf5;
  --ed-gutter: #5d6b80;

  --f-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --f-code: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.563rem;
  --step-3: 1.953rem;
  --step-4: 2.441rem;
  --step-5: 3.052rem;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--f-body);
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--marker); text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.12; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: var(--step-4); font-weight: 700; }
h2 { font-size: var(--step-2); font-weight: 650; }
h3 { font-size: var(--step-1); font-weight: 650; }
p { margin: 0 0 1em; max-width: 68ch; }
code, kbd, pre { font-family: var(--f-code); font-size: 0.92em; }
kbd { background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 0.8em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--ink-2); }
.small { font-size: var(--step--1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mark { background: linear-gradient(transparent 55%, var(--marker-soft) 55%); }

/* ---- buttons & forms ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 var(--step-0)/1 var(--f-body); padding: 12px 18px; border-radius: var(--r-md);
  border: 1.5px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background .15s ease;
}
.btn:hover { text-decoration: none; background: #0b1729; }
.btn:active { transform: translateY(1px); }
.btn-marker { background: var(--marker); color: var(--ink); border-color: var(--marker); }
.btn-marker:hover { background: #e6b70c; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--card); border-color: var(--ink-3); }
.btn-run { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.btn-run:hover { background: #18663f; }
.btn-danger { background: transparent; color: var(--clay); border-color: var(--clay-soft); }
.btn-sm { padding: 7px 12px; font-size: var(--step--1); border-radius: var(--r-sm); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label { display: block; font-weight: 600; margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.hint { color: var(--ink-2); font-size: var(--step--1); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--marker-soft); }
textarea.code { font-family: var(--f-code); font-size: 13px; line-height: 1.55; min-height: 320px; tab-size: 2; }
.alert { padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 16px; border-left: 4px solid; }
.alert-error { background: var(--clay-soft); border-color: var(--clay); }
.alert-ok { background: var(--leaf-soft); border-color: var(--leaf); }
.alert-note { background: var(--marker-soft); border-color: var(--marker); }

/* ---- header ---- */
.site-head { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 20; }
.site-head .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.wordmark { font: 800 1.35rem/1 var(--f-display); text-decoration: none; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 2px; }
.wordmark .caret { width: 9px; height: 1.05em; background: var(--marker); display: inline-block; margin-left: 3px; border-radius: 1px; }
.site-nav { display: flex; gap: 18px; margin-left: auto; align-items: center; }
.site-nav a { text-decoration: none; font-weight: 600; color: var(--ink-2); }
.site-nav a:hover, .site-nav a[aria-current=page] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--marker); text-decoration-thickness: 3px; }
.site-nav form { margin: 0; }
.linkish { background: none; border: 0; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; padding: 0; }
.linkish:hover { color: var(--ink); }

main.page { padding: 40px 0 80px; }
.site-foot { border-top: 1px solid var(--line); padding: 28px 0; color: var(--ink-3); font-size: var(--step--1); }

/* ---- home hero ---- */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 48px; align-items: center; padding: 32px 0 56px; }
.hero h1 { font-size: clamp(2.2rem, 4vw, 3.2rem); font-weight: 800; letter-spacing: -0.03em; }
.hero .lede { font-size: var(--step-1); color: var(--ink-2); max-width: 34ch; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.demo { background: var(--ed-bg); border-radius: var(--r-lg); color: var(--ed-text); overflow: hidden; box-shadow: 0 1px 0 var(--ed-line), 0 24px 48px -28px rgba(19, 35, 58, .55); }
.demo-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--ed-line); font: 500 12px/1 var(--f-code); color: var(--ed-gutter); }
.demo-code { font: 15px/1.7 var(--f-code); padding: 22px 20px; min-height: 120px; white-space: pre; }
.demo-code .hl { background: var(--marker-soft); box-shadow: inset 0 -2px var(--marker); border-radius: 2px; }
.demo-cursor { display: inline-block; width: 2px; height: 1.15em; vertical-align: -3px; background: var(--marker); animation: blink 1s steps(1) infinite; }
.demo-console { border-top: 1px solid var(--ed-line); padding: 12px 20px; font: 13px/1.6 var(--f-code); color: #b9c6d8; min-height: 46px; }
.demo-caption { background: var(--ed-bg-2); padding: 12px 20px; font-size: 15px; color: #dbe3ee; min-height: 48px; }
.demo-caption .w { opacity: .45; transition: opacity .15s; }
.demo-caption .w.on { opacity: 1; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- course cards / lists ---- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 8px 0 18px; }
.courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.course-card { display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 20px; text-decoration: none; min-height: 190px; }
.course-card:hover { border-color: var(--ink); text-decoration: none; }
.course-card h3 { margin: 0; font-size: 1.3rem; }
.course-card .facts { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-2); font-size: var(--step--1); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); }
.pill-draft { background: var(--marker-soft); color: var(--ink); }
.pill-live { background: var(--leaf-soft); color: var(--leaf); }
.empty { border: 1.5px dashed var(--line); border-radius: var(--r-md); padding: 32px; text-align: left; }
.empty p { margin-bottom: 12px; }

/* course page */
.course-top { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; }
.course-side { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 20px; position: sticky; top: 88px; }
.course-side .bar { height: 8px; background: var(--paper-2); border-radius: 99px; overflow: hidden; margin: 8px 0 14px; }
.course-side .bar span { display: block; height: 100%; background: var(--leaf); }
.module { margin-top: 28px; }
.module h2 { font-size: var(--step-1); margin-bottom: 8px; }
.lesson-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.lesson-list li { border-bottom: 1px solid var(--line); }
.lesson-list a, .lesson-list .locked { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 12px 4px; text-decoration: none; }
.lesson-list a:hover { background: var(--card); }
.lesson-list .num { font: 600 13px/1 var(--f-code); color: var(--ink-3); }
.lesson-list .done .num { color: var(--leaf); }
.lesson-list .dur { color: var(--ink-3); font-size: var(--step--1); }
.lesson-list .locked { color: var(--ink-3); }

/* auth */
.auth { max-width: 420px; margin: 24px auto; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 32px; }
.auth h1 { font-size: var(--step-3); }

/* ---- studio ---- */
.studio-head { background: #000; color: #fff; }
.studio-head .logo { display: inline-flex; align-items: center; gap: 8px; color: #fff; font: 800 1.15rem/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: -.02em; text-decoration: none; }
.studio-head .logo .ic, .studio-head .logo-tld { color: #977dff; }
.studio-head .wrap { display: flex; align-items: center; gap: 24px; height: 60px; max-width: 1400px; }
.studio-head .wordmark { color: #fff; }
.studio-head nav { display: flex; gap: 18px; margin-left: auto; align-items: center; }
.studio-head nav a, .studio-head .linkish { color: #c9d4e3; text-decoration: none; font-weight: 600; }
.studio-head nav a:hover, .studio-head nav a[aria-current=page] { color: #fff; }
.studio-main { max-width: 1400px; margin: 0 auto; padding: 28px 20px 80px; }
.crumbs { color: var(--ink-2); font-size: var(--step--1); margin-bottom: 8px; }
.crumbs a { color: var(--ink-2); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.toolbar .spacer { flex: 1; }
.panel { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 20px; margin-bottom: 20px; }
.panel h2 { font-size: var(--step-1); }
.table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.table th { text-align: left; font-weight: 700; color: var(--ink-2); border-bottom: 1.5px solid var(--line); padding: 8px; }
.table td { border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: middle; }
.status-switch { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.status-switch button { border: 0; background: var(--card); padding: 9px 14px; font: 600 var(--step--1) var(--f-body); cursor: pointer; color: var(--ink-2); }
.status-switch button[aria-pressed=true] { background: var(--ink); color: #fff; }
.status-switch button[data-status=published][aria-pressed=true] { background: var(--leaf); }
.cur-module { border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--card); margin-bottom: 14px; }
.cur-module header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.cur-module header input { border: 0; background: transparent; font: 650 var(--step-1) var(--f-display); padding: 4px 0; }
.cur-module header input:focus { box-shadow: none; border-bottom: 2px solid var(--marker); border-radius: 0; }
.cur-lessons { list-style: none; margin: 0; padding: 4px 0; min-height: 12px; }
.cur-lessons li { display: grid; grid-template-columns: 20px 1fr auto auto; gap: 12px; align-items: center; padding: 8px 14px; border-radius: 6px; }
.cur-lessons li:hover { background: var(--paper); }
.cur-lessons li.dragging { opacity: .4; }
.handle { cursor: grab; color: var(--ink-3); font-size: 18px; line-height: 1; user-select: none; }
.cur-lessons a { font-weight: 600; text-decoration: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; }
.dot.on { background: var(--leaf); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: 600 var(--step-0) var(--f-body); color: var(--ink-2); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1.5px; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--marker); }
.report { font-size: var(--step--1); }
.report li { margin-bottom: 4px; }
.report .err { color: var(--clay); }
.report .warn { color: #8a6a00; }
.keybox { font-family: var(--f-code); background: var(--paper-2); padding: 10px 12px; border-radius: var(--r-sm); word-break: break-all; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r-md); z-index: 100; font-weight: 600; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); }
.toast.err { background: var(--clay); }

@media (max-width: 900px) {
  .hero, .course-top, .grid-2 { grid-template-columns: 1fr; }
  .course-side { position: static; }
  .site-nav { gap: 12px; }
}
@media (max-width: 560px) {
  .site-nav .hide-sm { display: none; }
  h1 { font-size: var(--step-3); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
