/* Java Unit Lab: course-page design, light only.
   One column, serif text, blue links, plain bordered rows and buttons.
   System fonts only. */

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #5e5e5e;
  --rule: #d9d9d9;
  --border: #bdbdbd;
  --link: #1a4db3;
  --link-bg: #f3f6fc;
  --code-bg: #f4f4f2;
  --button: #f1f1ef;
  --button-hover: #e4e4e1;
  --button-border: #8c8c8c;
  --ok: #1b7a3a;
  --ok-bg: #eef7f0;
  --bad: #b3261e;
  --bad-bg: #fbefee;
  --k: #213f99;
  --s: #8a2b12;
  --c: #6e6e6e;
  --serif: Georgia, "Times New Roman", Times, serif;
  --mono: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 19px/1.65 var(--serif); }

.site-header, main { max-width: 48rem; margin: 0 auto; padding-inline: 1.25rem; }

/* ---------- header with tabs ---------- */
.site-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .25rem 2rem;
  padding-top: 1.75rem; border-bottom: 1px solid var(--rule);
}
.site-title { font-size: 1.6rem; font-weight: bold; color: var(--fg); text-decoration: none; padding-bottom: .7rem; line-height: 1.2; }
.tabs { display: flex; gap: 1.75rem; }
.tabs a {
  display: block; padding: .4rem 0 .7rem; margin-bottom: -1px;
  font-size: 1.05rem; color: var(--link); text-decoration: none; border-bottom: 3px solid transparent;
}
.tabs a:hover { text-decoration: underline; }
.tabs a[aria-current] { color: var(--fg); font-weight: bold; border-bottom-color: var(--fg); text-decoration: none; }

main { padding-block: 2.25rem 4rem; min-width: 0; }

/* ---------- text ---------- */
a { color: var(--link); }
h1 { font-size: 2.35rem; line-height: 1.15; margin: .15rem 0 1rem; }
h2 { font-size: 1.5rem; line-height: 1.25; margin: 2.5rem 0 .9rem; }
h3 { font-size: 1.2rem; margin: 2rem 0 .6rem; }
p, ul, ol { margin: 0 0 1.1rem; }
li { margin-bottom: .3rem; }
.kicker { color: var(--muted); font-size: .95rem; margin: 0; }
.intro { font-size: 1.08rem; margin-bottom: 1.75rem; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.loading { color: var(--muted); }

code { font-family: var(--mono); font-size: .84em; background: var(--code-bg); padding: .08em .32em; border-radius: 3px; }
pre {
  font: 15px/1.55 var(--mono); background: var(--code-bg); border: 1px solid var(--rule); border-radius: 4px;
  padding: .9rem 1.1rem; overflow-x: auto; margin: 0 0 1.4rem; tab-size: 4;
}
pre code { background: none; padding: 0; font-size: inherit; border-radius: 0; }
.k { color: var(--k); }
.s { color: var(--s); }
.c { color: var(--c); }

/* ---------- buttons ---------- */
button, .button-link {
  display: inline-block; font: inherit; font-size: 1rem; line-height: 1.3; color: var(--fg);
  background: var(--button); border: 1px solid var(--button-border); border-radius: 4px;
  padding: .5rem 1.15rem; cursor: pointer; text-decoration: none;
}
button:hover:not(:disabled), .button-link:hover { background: var(--button-hover); }
button:disabled { color: var(--muted); cursor: default; }
button.primary { font-weight: bold; }
button.linkish { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; font-size: inherit; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ---------- big clickable rows (Lessons, Quizzes) ---------- */
.rows { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: .8rem; }
.rows li { margin: 0; }
.row {
  display: block; padding: 1.05rem 1.35rem 1.15rem; border: 1px solid var(--border); border-radius: 4px;
  color: var(--fg); text-decoration: none; background: var(--bg);
}
.row:hover { border-color: var(--link); background: var(--link-bg); }
.row:hover .row-title { text-decoration: underline; }
.row-top { display: flex; justify-content: space-between; gap: 1rem; font-size: .92rem; color: var(--muted); }
.row-status .ok { color: var(--ok); }
.row-status .sep { color: var(--muted); }
.row-title { display: block; font-size: 1.45rem; font-weight: bold; line-height: 1.25; color: var(--link); margin: .2rem 0 .25rem; }
.row-desc { display: block; color: var(--muted); }
.progress { color: var(--muted); }

/* ---------- code runner ---------- */
.runner { margin: 1.25rem 0 1.75rem; }
.runner-file { font: 14px var(--mono); color: var(--muted); margin-bottom: .3rem; }
.runner textarea {
  display: block; width: 100%; font: 15px/1.55 var(--mono); color: var(--fg); background: var(--bg);
  border: 1px solid var(--button-border); border-radius: 4px; padding: .75rem .9rem; resize: vertical; tab-size: 4;
}
/* highlighted editor: a coloured <pre> under a textarea with transparent text.
   Both layers must share every metric below, or the caret drifts from the text. */
.code-wrap { position: relative; border: 1px solid var(--button-border); border-radius: 4px; background: var(--bg); }
.code-wrap:focus-within { outline: 2px solid var(--link); outline-offset: 2px; }
.code-wrap .code-hl,
.code-wrap textarea.code {
  margin: 0; border: 0; border-radius: 0; padding: .75rem .9rem;
  font: 15px/1.55 var(--mono); font-variant-ligatures: none; letter-spacing: normal; word-spacing: normal;
  text-indent: 0; text-transform: none; tab-size: 4; -moz-tab-size: 4; white-space: pre;
}
.code-wrap .code-hl {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  background: transparent; color: var(--fg);
}
.code-wrap textarea.code {
  position: relative; z-index: 1; display: block; width: 100%; overflow: auto; resize: vertical; outline: none;
  background: transparent; color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--fg);
}
.code-wrap textarea.code::selection { background: rgba(26, 77, 179, .22); -webkit-text-fill-color: transparent; }

.output-label { display: block; font-weight: bold; margin-bottom: .25rem; }
.hint { font-weight: normal; color: var(--muted); font-size: .88rem; }
.runner-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; margin: .9rem 0; }

/* console: program output, plus a text field at the end when the program asks for input */
.output { margin: 0; min-height: 3.6rem; max-height: 24rem; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.output:empty::before { content: "Press Run to see the output."; color: var(--muted); font-style: italic; font-family: var(--serif); }
.output .err { color: var(--bad); }
.output .meta { color: var(--muted); }
.output .in { color: var(--link); }           /* what the user typed, echoed like a terminal */
.console-input {
  font: inherit; color: var(--link); background: transparent; caret-color: var(--link);
  border: 0; border-bottom: 1px solid var(--link); border-radius: 0;
  margin: 0; padding: 0 .15em; max-width: 100%; outline: none; vertical-align: baseline;
}
.console-input:focus { background: var(--link-bg); }

/* ---------- debug challenge ---------- */
.goal { margin: 0 0 1.5rem; }
.goal-label { display: block; font-weight: bold; margin-bottom: .35rem; }
.goal pre { margin: 0; }
.passed-note { margin: .6rem 0 0; color: var(--ok); }
.challenge-result {
  margin: 1.25rem 0 0; padding: .9rem 1.2rem; border: 1px solid var(--border); border-radius: 4px;
}
.challenge-result.passed { border-color: var(--ok); background: var(--ok-bg); }
.challenge-result.passed strong { color: var(--ok); }
.challenge-result.not-yet { background: var(--code-bg); }

/* ---------- end of a lesson ---------- */
.lesson-end {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem;
  margin-top: 2.75rem; padding: 1.15rem 1.35rem; border: 1px solid var(--border); border-radius: 4px; background: var(--code-bg);
}
.finish { display: flex; align-items: center; gap: .65rem; cursor: pointer; font-size: 1.05rem; }
.finish input { width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--link); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1.25rem; }
.pager a {
  display: block; padding: .9rem 1.2rem 1rem; border: 1px solid var(--border); border-radius: 4px; text-decoration: none;
}
.pager a:hover { border-color: var(--link); background: var(--link-bg); }
.pager a:hover .pager-title { text-decoration: underline; }
.pager .next { grid-column: 2; text-align: right; }
.pager-label { display: block; font-size: .9rem; color: var(--muted); }
.pager-title { display: block; font-size: 1.15rem; font-weight: bold; color: var(--link); line-height: 1.3; }

/* ---------- quiz ---------- */
.best { color: var(--muted); }
.questions { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.1rem; }
.question { margin: 0; padding: 1.2rem 1.35rem 1.3rem; border: 1px solid var(--rule); border-radius: 4px; }
.qnum { display: block; font-size: .9rem; color: var(--muted); }
.stem { font-size: 1.12rem; font-weight: bold; margin: .15rem 0 .9rem; }
.choices { display: grid; gap: .5rem; }
.choice {
  display: flex; align-items: center; gap: .8rem; padding: .65rem .9rem;
  border: 1px solid var(--border); border-radius: 4px; background: var(--bg); cursor: pointer;
}
.choice:not(.locked):hover { border-color: var(--link); }
.choice:has(input:checked) { border-color: var(--link); background: var(--link-bg); }
.choice input { flex: none; width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--link); }
.choice code { background: none; padding: 0; }
.choice.locked { cursor: default; }
.questions .choice.right { border-color: var(--ok); background: var(--ok-bg); }
.questions .choice.wrong { border-color: var(--bad); background: var(--bad-bg); }
.questions .choice.wrong .choice-text { text-decoration: line-through; }
.verdict { margin: .8rem 0 0; font-style: italic; }
.verdict.ok { color: var(--ok); }
.verdict.no { color: var(--bad); }
.quiz-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 1.5rem; }
.score { margin: 0; font-size: 1.2rem; font-weight: bold; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  body { font-size: 17.5px; }
  .site-header { flex-direction: column; align-items: flex-start; padding-top: 1.25rem; }
  .site-title { font-size: 1.35rem; padding-bottom: .1rem; }
  .tabs { gap: 1.25rem; }
  main { padding-block: 1.5rem 3rem; }
  h1 { font-size: 1.85rem; }
  .row, .question { padding-inline: 1rem; }
  .row-title { font-size: 1.25rem; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  pre, .runner textarea { font-size: 14px; }
  .code-wrap .code-hl, .code-wrap textarea.code { font-size: 14px; }
  .console-input { font-size: 16px; } /* below 16px, iPhones zoom the page when the field is focused */
}
