/* Stylesheet of the learning platform, carried over from the frozen mockup.
   Plain CSS, no build step, as the stack
   rules require for the real thing. Palette from the Deep Data Ocean logo:
   three blues from its square grid, cool paper, dark ink. The one bold
   element is the course spine on the left: modules and chapters as a
   sequence of squares that encode progress, the same squares as the logo. */

:root {
  --ocean: #13334a;      /* finished, headings */
  --tide: #2e6b8a;       /* current, links, primary action */
  --shallow: #8fb8cc;    /* open, borders of the spine */
  --foam: #dbe7ee;       /* quiet surfaces */
  --paper: #f4f6f8;      /* page */
  --ink: #1a222b;
  --ink-soft: #55636f;
  --good: #2c7a5a;
  --flag: #a8521f;
  --rule: #cfd8de;
  --surface: #fff;       /* cards, inputs, the spine */
  --surface-here: #f3f8fb; /* the current chapter in the spine */
  --hover: #e4e9ed;      /* hovered icon buttons */
  --on-tide: #fff;       /* text on a tide button */
  --measure: 76ch;      /* prose line length; tables and code in a reading use the full column */
  --spine: 280px;
  color-scheme: light;
  font-family: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}

/* The dark scheme: the same blues lifted so they read on dark paper, the
   surfaces one step lighter than the page. Chosen explicitly on the
   account page or by the PyCharm plugin (data-theme), or by the browser's
   preference when nothing was chosen. */
:root[data-theme="dark"] {
  --ocean: #d3e4ee;
  --tide: #7cb8d8;
  --shallow: #3f6a82;
  --foam: #202d37;
  --paper: #13181d;
  --ink: #e4e9ed;
  --ink-soft: #9aa8b3;
  --good: #5fc096;
  --flag: #e2915f;
  --rule: #2b3842;
  --surface: #1b2228;
  --surface-here: #22303a;
  --hover: #2b3842;
  --on-tide: #0e1a22;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ocean: #d3e4ee;
    --tide: #7cb8d8;
    --shallow: #3f6a82;
    --foam: #202d37;
    --paper: #13181d;
    --ink: #e4e9ed;
    --ink-soft: #9aa8b3;
    --good: #5fc096;
    --flag: #e2915f;
    --rule: #2b3842;
    --surface: #1b2228;
    --surface-here: #22303a;
    --hover: #2b3842;
    --on-tide: #0e1a22;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); }
a { color: var(--tide); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: "IBM Plex Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
/* Inline code reads as a term: a quiet surface behind it; inside a block the block's surface stays. */
code { background: var(--foam); padding: 1px 5px; border-radius: 3px; }
pre code { background: transparent; padding: 0; }
pre { background: var(--surface); border: 1px solid var(--rule); padding: 12px 14px; overflow: auto; }
h1, h2, h3 { color: var(--ocean); line-height: 1.2; margin: 0 0 0.4em; font-weight: 600; }
h1 { font-size: 1.9rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; margin-top: 2rem; }
h3 { font-size: 1.05rem; margin-top: 1.4rem; }
p { margin: 0 0 1em; max-width: var(--measure); }
button, .button {
  font: inherit; color: var(--on-tide); background: var(--tide); border: 0; border-radius: 3px;
  padding: 9px 16px; cursor: pointer;
}
button.quiet, .button.quiet { background: var(--surface); color: var(--tide); border: 1px solid var(--shallow); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--shallow); outline-offset: 2px;
}
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule);
  border-radius: 3px; padding: 9px 11px; width: 100%;
}
textarea { min-height: 9em; resize: vertical; }
label { display: block; font-size: 0.95rem; color: var(--ink-soft); margin: 14px 0 5px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--ink-soft); font-weight: 500; font-size: 0.92rem; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.9rem; }

/* Top bar: wordmark, environment, account. */
.top {
  display: flex; align-items: center; gap: 24px; padding: 10px 24px;
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.top .brand { display: flex; align-items: center; gap: 10px; color: var(--ocean); font-weight: 600; }
.top .brand img { height: 40px; }
.top .env { font-size: 0.85rem; color: var(--flag); border: 1px solid currentColor; border-radius: 3px; padding: 1px 7px; }
.top .grow { flex: 1; }
.top nav a { margin-left: 18px; color: var(--ink-soft); }
.top nav a.here { color: var(--ocean); font-weight: 600; }

/* Page frame: spine + content. */
.frame { display: grid; grid-template-columns: var(--spine) 1fr; min-height: calc(100vh - 51px); }
.content { padding: 32px 40px 80px; max-width: 1180px; }
.content.wide { max-width: none; }

/* The spine. Squares encode progress: filled ocean = finished, tide outline
   with a dot = current, shallow outline = open. Chapters are a real
   sequence, so the numbering is information. */
.spine { background: var(--surface); border-right: 1px solid var(--rule); padding: 0 0 40px; }
.spine .module { padding: 0; }
/* Module rows are grey bands with a rule above and below; the chapters
   below them stay on white, and inactive modules follow each other directly. */
.spine .module-title {
  display: flex; align-items: baseline; gap: 10px; color: var(--ocean); font-weight: 600;
  background: var(--foam); padding: 10px 10px 10px 8px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.spine .inactive + .inactive .module-title { border-top: 0; }
.spine .inactive .module-title { background: var(--paper); }
.spine .module-title .pct { margin-left: auto; color: var(--ink-soft); font-weight: 400; font-size: 0.85rem; white-space: nowrap; padding-left: 8px; }
.spine ol { list-style: none; margin: 4px 0 4px; padding: 0; }
.spine li a {
  display: grid; grid-template-columns: 14px 1.1em 1fr; gap: 0 3px; align-items: start;
  padding: 7px 10px 7px 8px; color: var(--ink); line-height: 1.3;
}
.spine li a:hover { background: var(--paper); text-decoration: none; }
.spine li a.here { background: var(--surface-here); box-shadow: inset 3px 0 0 var(--tide); }
.sq { width: 14px; height: 14px; margin-top: 4px; border: 2px solid var(--shallow); background: var(--surface); position: relative; }
/* Finished: a green square with a white checkmark drawn by two borders. */
.sq.done { background: var(--good); border-color: var(--good); }
.sq.done::after {
  content: ""; position: absolute; left: 3px; top: 0px; width: 3px; height: 7px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.sq.now { border-color: var(--tide); background: radial-gradient(circle, var(--tide) 40%, var(--surface) 44%); }
/* The navigator and the chapter's task list show state without boxes
   (2026-11-24): finished is a green checkmark, in progress a dot, not
   started nothing. The overview's progress squares keep their boxes. */
.spine li a .sq, .tasks .sq { border: 0; background: none; margin-top: 3px; }
.spine li a .sq.done::after, .tasks .sq.done::after {
  left: 4px; top: 0; width: 4px; height: 9px; border-color: var(--good); border-width: 0 2px 2px 0;
}
.spine li a .sq.now::after, .tasks .sq.now::after {
  content: ""; position: absolute; left: 4px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--tide);
}
.spine .inactive .module-title { color: var(--ink-soft); }
.spine .inactive .sq { border-color: var(--rule); }
/* A plain spine entry (the admin's module list): square and text, no number column. */
.spine li .entry { display: grid; grid-template-columns: 14px 1fr; gap: 0 8px; align-items: start; padding: 7px 10px 7px 8px; color: var(--ink); line-height: 1.3; }
.spine .num { color: var(--ink-soft); font-size: 0.85rem; text-align: right; padding-top: 2px; padding-right: 2px; }

/* Module overview cards: not identical boxes; a rule and a progress bar of squares. */
.modules { display: grid; gap: 28px; max-width: 900px; }
.module-card { border-top: 3px solid var(--ocean); padding-top: 14px; }
.module-card.inactive { border-top-color: var(--rule); color: var(--ink-soft); }
.module-card h2 { margin-top: 0; }
.progress-squares { display: flex; gap: 5px; margin: 10px 0 14px; }
.progress-squares .sq { margin: 0; width: 14px; height: 14px; }
.next-step { background: var(--foam); padding: 12px 16px; border-left: 4px solid var(--tide); max-width: var(--measure); }

/* Chapter page pieces. The jump line stays at the top while scrolling. */
.jump { display: flex; gap: 22px; margin: 4px 0 18px; padding: 8px 0; border-bottom: 1px solid var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 2; }
.jump a { color: var(--ink-soft); }
.jump a:hover { color: var(--tide); text-decoration: none; }
html { scroll-behavior: smooth; scroll-padding-top: 48px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.video { width: 100%; background: #000; aspect-ratio: 16 / 9; display: block; }
.transcript { border: 1px solid var(--rule); background: var(--surface); max-height: 360px; overflow: auto; }
.transcript p {
  margin: 0; padding: 8px 14px; border-bottom: 1px solid var(--foam); cursor: pointer; max-width: none;
  display: grid; grid-template-columns: 2.6em 1fr; gap: 4px; align-items: start;
}
.transcript p time { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.transcript p.live { background: var(--foam); }
.transcript p:hover { background: var(--paper); }
/* Readings and instructions: prose keeps the measure, tables, code blocks and
   images span the column, aligned with the video and the transcript (2026-11-24). */
.reading { max-width: none; }
.reading p, .reading ul, .reading ol, .reading h2, .reading h3, .reading blockquote { max-width: var(--measure); }
/* A reading's picture (the architecture diagram) spans the column and stays white in the dark theme. */
.reading img { display: block; max-width: 100%; height: auto; margin: 14px 0; border: 1px solid var(--rule); background: #fff; }
.reading img { cursor: zoom-in; }
.zoomable { position: relative; }
.zoomable .enlarge {
  position: absolute; top: 22px; right: 8px; padding: 2px 9px; font-size: 1.1rem; line-height: 1.3;
  background: var(--surface); color: var(--tide); border: 1px solid var(--shallow); opacity: 0.85;
}
.zoomable .enlarge:hover { opacity: 1; }
/* The enlarged picture: the whole window, the image at its natural size, scrollable. */
dialog.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: #fff; overflow: auto; cursor: zoom-out;
}
dialog.lightbox::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog.lightbox img { display: block; min-width: 100%; max-width: none; height: auto; }
.tasks { list-style: none; padding: 0; margin: 0; max-width: 820px; }
.tasks li { display: grid; grid-template-columns: 18px 1fr auto; gap: 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.tasks .kind { color: var(--ink-soft); font-size: 0.9rem; }
.tasks .score { text-align: right; white-space: nowrap; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tasks .score.good { color: var(--good); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.sticky { position: sticky; top: 20px; }
.assistant { border: 1px solid var(--rule); background: var(--surface); display: flex; flex-direction: column; max-height: 80vh; }
.assistant .log { padding: 14px; overflow: auto; flex: 1; display: flex; flex-direction: column; }
/* The learner's question as a quiet bubble on the right, the answer below it across the width. */
.assistant .q { align-self: flex-end; max-width: 85%; background: var(--foam); border-radius: 14px; padding: 8px 12px; margin-bottom: 10px; white-space: pre-line; }
.assistant .a { align-self: stretch; margin-bottom: 18px; white-space: pre-line; }
.assistant .a cite.unanswered { color: var(--flag); }
/* File names and commands the assistant writes between backticks: grey, in Courier. */
.assistant code { font-family: "Courier New", Courier, monospace; font-size: 0.92em; background: var(--foam); padding: 1px 5px; border-radius: 3px; }
.assistant .a cite { display: block; font-style: normal; font-size: 0.85rem; color: var(--tide); margin-top: 4px; }
.assistant form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--rule); }
.assistant .hint { margin: 0; padding: 0 10px 8px; font-size: 0.8rem; color: var(--ink-soft); }
.assistant textarea { flex: 1; min-height: 0; max-height: 160px; resize: none; overflow-y: auto; line-height: 1.4; }
.context { font-size: 0.85rem; color: var(--ink-soft); padding: 8px 14px; border-bottom: 1px solid var(--rule); }

/* Task page: rubric and feedback. */
.rubric { max-width: 820px; }
.rubric th:last-child, .rubric td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.evidence { color: var(--ink-soft); font-size: 0.92rem; margin-top: 4px; }
.verdict { display: flex; align-items: baseline; gap: 18px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--rule); border-left: 5px solid var(--good); max-width: 820px; margin: 18px 0; }
.verdict.fail { border-left-color: var(--flag); }
.verdict .big { font-size: 1.6rem; font-weight: 600; color: var(--ocean); font-variant-numeric: tabular-nums; white-space: nowrap; }
.attempts { display: flex; gap: 10px; margin: 8px 0 20px; }
.attempts span { padding: 4px 10px; border: 1px solid var(--rule); border-radius: 3px; font-size: 0.9rem; }
.attempts span.here { border-color: var(--tide); color: var(--tide); }
.checkline { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; }
.checkline .ok { color: var(--good); }
.checkline .no { color: var(--flag); }

/* Skills on the overview: a quiet bar per skill, no percentages in prose. */
.skills { max-width: 900px; }
.skills td:nth-child(3) { white-space: nowrap; }
.bar { display: inline-block; width: 120px; height: 10px; border: 1px solid var(--shallow); background: var(--surface); vertical-align: middle; margin-right: 10px; }
.bar span { display: block; height: 100%; background: var(--tide); }

/* Login. */
.login { max-width: 400px; margin: 10vh auto; background: var(--surface); border: 1px solid var(--rule); padding: 32px; }
.login .brand { display: flex; align-items: center; gap: 10px; color: var(--ocean); font-weight: 600; margin-bottom: 18px; }
.login .brand img { height: 44px; }
.login button { width: 100%; margin-top: 18px; }

@media (max-width: 900px) {
  .frame { grid-template-columns: 1fr; }
  .spine { border-right: 0; border-bottom: 1px solid var(--rule); }
  .two { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .content { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Messages after a form post, and the consent page. */
.flash { background: var(--foam); border-left: 4px solid var(--tide); padding: 10px 14px; margin: 0 0 18px; max-width: var(--measure); }
.flash.error { border-left-color: var(--flag); }
.token { font-family: "IBM Plex Mono", Menlo, Consolas, monospace; background: var(--surface); border: 1px solid var(--rule); padding: 10px 12px; word-break: break-all; }
.consent { max-width: var(--measure); margin: 6vh auto; background: var(--surface); border: 1px solid var(--rule); padding: 32px; }
.admin-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 10px; align-items: end; max-width: 1000px; }
.admin-form label { margin: 0 0 5px; }

/* The result dialog after an attempt: the attempt block in a centred box. */
dialog.modal { border: 1px solid var(--rule); border-radius: 4px; padding: 24px 28px; width: min(820px, 92vw); max-height: 85vh; overflow: auto; color: var(--ink); background: var(--paper); }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog.modal h2 { margin-top: 0; }
dialog.modal .verdict, dialog.modal .rubric { max-width: none; }

/* Command blocks: the copy button sits in the top right corner, grey on
   hover, with a "Copy" tooltip that appears after a short pause; after a
   click the icon is a checkmark for a moment. */
.code { position: relative; }
.code pre { padding-right: 48px; }
.copy {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--ink-soft); border: 0; border-radius: 6px; cursor: pointer;
}
.copy:hover { background: var(--hover); color: var(--ink); }
.copy.done { color: var(--good); }
.copy .tip {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-size: 0.78rem; line-height: 1; padding: 6px 8px; border-radius: 4px;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.15s ease 0.6s;
}
.copy:hover .tip, .copy.done .tip { opacity: 1; }
.copy.done .tip { transition-delay: 0s; }

/* The task page: the counted score under the header, the links at the end. */
.counted { max-width: 820px; }
.task-nav { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--rule); }

/* Inside the PyCharm plugin only (html.in-ide): the hand-in button, content
   links that call the IDE, clickable file paths, the run button beside copy. */
.ide-only, a[href^="ide:"] { display: none; }
html.in-ide .ide-only { display: block; }
button.ide-link { display: inline-block; margin: 4px 0; }
html.in-ide code.path { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
html.in-ide code.path:hover { color: var(--tide); }
html.in-ide .code pre { padding-right: 84px; }
.run {
  position: absolute; top: 6px; right: 42px; width: 30px; height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--ink-soft); border: 0; border-radius: 6px; cursor: pointer;
}
.run:hover { background: var(--hover); color: var(--good); }
.run .tip {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-size: 0.78rem; line-height: 1; padding: 6px 8px; border-radius: 4px;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.15s ease 0.6s;
}
.run:hover .tip { opacity: 1; }

/* The appearance form on the account page: three radios in a row. */
.theme-form { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.theme-form .radio { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); }
.theme-form .radio input { width: auto; }

/* The gateway's meter on the account page: this month's tokens as a bar. */
.meter { height: 10px; max-width: var(--measure); background: var(--foam); border-radius: 5px; overflow: hidden; margin: 10px 0 4px; }
.meter span { display: block; height: 100%; background: var(--tide); }
