/* =========================================================================
   Dorat Cloud Foundations — course stylesheet
   Light-only, warm & friendly, brand-aligned (deep teal + restrained orange on
   warm off-white). Accessible: visible focus rings, AA contrast, motion-light.
   ========================================================================= */

:root {
  --bg:         #FBF7F0;   /* warm off-white */
  --bg-2:       #F4EEE3;
  --surface:    #FFFFFF;
  --ink:        #21303A;
  --muted:      #5C6B73;
  --teal:       #0E5E63;   /* trust anchor */
  --teal-700:   #0B4A4E;
  --teal-900:   #073538;
  --teal-050:   #E6F0F0;
  --teal-100:   #D2E6E6;
  --orange:     #E8743B;   /* restrained accent */
  --orange-700: #B9551F;
  --orange-050: #FCEDE3;
  --green:      #2E7D5B;
  --green-050:  #E6F2EC;
  --red:        #B4452F;
  --red-050:    #FBEAE6;
  --amber:      #9A7B11;
  --amber-050:  #FBF1D9;
  --line:       #E7DFD3;
  --line-2:     #D8CDBB;
  --code-bg:    #0F2E33;
  --code-ink:   #E9F3F2;
  --code-dim:   #84B3B3;
  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 2px 4px rgba(33,48,58,.05), 0 8px 24px rgba(33,48,58,.06);
  --shadow-lg:  0 12px 40px rgba(33,48,58,.14);
  --header-h:   60px;
  --sidebar-w:  300px;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-underline-offset: 2px; }
a:hover { color: var(--teal-900); }

/* visible focus for keyboard users */
:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
  border-radius: 4px;
  /* teal companion guarantees >=3:1 focus contrast on the warm backgrounds too */
  box-shadow: 0 0 0 1px var(--teal-900);
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--teal); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ============================ TOP BAR ============================ */
.site-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 18px;
  background: var(--teal);
  color: #EAF5F5;
  box-shadow: 0 2px 10px rgba(7,53,56,.25);
}
.nav-toggle {
  display: none;
  background: rgba(255,255,255,.12); color: #fff; border: none;
  width: 38px; height: 38px; border-radius: 9px; font-size: 18px; cursor: pointer;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-mark { font-weight: 800; font-size: 18px; letter-spacing: .3px; color: #fff; }
.brand-sub { font-size: 11px; color: #9FCBCB; letter-spacing: .14em; text-transform: uppercase; }

.header-search { margin-left: auto; }
.header-search input {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16);
  color: #fff; padding: 8px 13px; border-radius: 99px; width: 220px; font-size: 13.5px;
}
.header-search input::placeholder { color: #B6D6D6; }
.header-search input:focus { background: rgba(255,255,255,.2); }

.header-progress { display: flex; align-items: center; gap: 9px; min-width: 140px; }
.header-progress .bar { width: 110px; height: 8px; background: rgba(255,255,255,.18); border-radius: 99px; overflow: hidden; }
.header-progress .bar > span { display: block; height: 100%; width: 0; background: var(--orange); transition: width .35s ease; }
.progress-label { font-size: 12.5px; color: #DCEFEF; font-variant-numeric: tabular-nums; min-width: 30px; }

/* ============================ LAYOUT ============================ */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; align-items: start; }

.sidebar {
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.toc { padding: 14px 10px; flex: 1; }
.toc .module { margin-bottom: 6px; }
.toc .module-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: none; cursor: pointer; text-align: left;
  padding: 9px 10px; border-radius: var(--radius-sm); color: var(--teal-700);
  font-weight: 700; font-size: 13.5px; font-family: inherit;
}
.toc .module-head:hover { background: var(--teal-050); }
.toc .module-head .ico { font-size: 15px; }
.toc .module-head .m-title { flex: 1; }
.toc .module-head .m-prog { font-size: 11px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.toc .module-head .chev { color: var(--muted); transition: transform .18s; font-size: 11px; }
.toc .module.collapsed .lessons { display: none; }
.toc .module.collapsed .chev { transform: rotate(-90deg); }

.toc .lessons { list-style: none; margin: 2px 0 8px; padding: 0 0 0 6px; }
.toc .lessons li { margin: 1px 0; }
.toc .lessons a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 8px; border-radius: 8px; text-decoration: none;
  color: var(--ink); font-size: 13px; border-left: 2px solid transparent;
}
.toc .lessons a:hover { background: var(--teal-050); }
.toc .lessons a.active { background: var(--teal); color: #fff; font-weight: 600; }
.toc .lessons a.active .tick { color: #fff; }
.toc .lessons a .tick {
  flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--line-2); display: grid; place-items: center;
  font-size: 10px; color: transparent;
}
.toc .lessons a.done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.toc .lessons a .lt { flex: 1; }
.toc .lessons li.hidden, .toc .module.search-hidden { display: none; }

.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.ghost-btn {
  background: transparent; border: 1px solid var(--line-2); color: var(--muted);
  padding: 7px 12px; border-radius: 8px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.ghost-btn:hover { background: var(--teal-050); color: var(--teal-700); }
.sidebar-note { font-size: 11px; color: var(--muted); margin: 8px 0 0; }

.backdrop { position: fixed; inset: var(--header-h) 0 0 0; background: rgba(15,46,51,.4); z-index: 30; }

/* ============================ CONTENT ============================ */
.content { padding: 36px clamp(20px, 5vw, 60px) 60px; max-width: 920px; margin: 0; }
.content:focus { outline: none; }

.lesson .crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; letter-spacing: .02em; }
.lesson .crumbs .sep { margin: 0 7px; color: var(--line-2); }
.lesson h1.l-title { font-size: clamp(24px, 3.6vw, 33px); color: var(--teal-900); margin: 2px 0 6px; line-height: 1.15; }
.lesson .l-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.lesson .l-summary { font-size: 17px; color: var(--muted); margin: 0 0 18px; max-width: 70ch; }

.chip {
  background: var(--teal-050); color: var(--teal-700); border: 1px solid var(--teal-100);
  border-radius: 99px; padding: 3px 11px; font-size: 12px; font-weight: 600;
}
.chip.accent { background: var(--orange-050); color: var(--orange-700); border-color: #F2D2BF; }
.chip.time::before { content: "\23F1\FE0F  "; }

/* prose */
.lesson h2 { font-size: 21px; color: var(--teal-700); margin: 30px 0 8px; }
.lesson h3 { font-size: 16.5px; color: var(--teal-700); margin: 22px 0 6px; }
.lesson h4 { font-size: 13px; color: var(--ink); margin: 16px 0 4px; text-transform: uppercase; letter-spacing: .05em; }
.lesson p { margin: 10px 0; }
.lesson ul, .lesson ol { margin: 10px 0; padding-left: 22px; }
.lesson li { margin: 5px 0; }
.lesson strong { color: var(--teal-900); }
.lesson em { color: var(--ink); }
.lesson hr { border: none; border-top: 1px solid var(--line); margin: 24px 0; }

code, .inl {
  font-family: var(--mono); font-size: .88em;
  background: var(--teal-050); color: var(--teal-700);
  padding: 1px 6px; border-radius: 6px; word-break: break-word;
}

/* analogy / definition boxes */
.def {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--orange);
  border-radius: var(--radius-sm); padding: 12px 16px; margin: 14px 0; box-shadow: var(--shadow);
}
.def .term { font-weight: 800; color: var(--orange-700); }

/* callouts */
.callout { border-radius: var(--radius-sm); padding: 13px 16px; margin: 14px 0; border: 1px solid; font-size: 14.5px; }
.callout .ttl { font-weight: 700; display: block; margin-bottom: 3px; }
.callout.info  { background: var(--teal-050);  border-color: var(--teal-100); color: var(--teal-700); }
.callout.warn  { background: var(--amber-050); border-color: #EAD9A6; color: #6f5300; }
.callout.ok    { background: var(--green-050); border-color: #CDE6D9; color: #246A4B; }
.callout.back  { background: var(--orange-050);border-color: #F2D2BF; color: var(--orange-700); }
.callout.dorat { background: #FFF; border-color: var(--teal-100); border-left: 4px solid var(--teal); color: var(--ink); box-shadow: var(--shadow); }
.callout.dorat .ttl { color: var(--teal-700); }
.callout.dorat .ttl::before { content: "\1F9F8  "; }

/* command blocks */
.cmd-tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 6px; margin: 6px 0 -4px; }
.cmd-tag.ro  { background: var(--green-050); color: var(--green); }
.cmd-tag.mut { background: var(--red-050); color: var(--red); }
.cmd {
  position: relative; background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius-sm);
  padding: 14px 46px 14px 16px; margin: 10px 0; overflow-x: auto; font-size: 13px; line-height: 1.6;
  font-family: var(--mono); white-space: pre;
}
.cmd .copy {
  position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.12); border: none; color: #cfe6e6;
  border-radius: 7px; padding: 5px 9px; font-size: 11px; cursor: pointer; font-family: inherit;
}
.cmd .copy:hover { background: rgba(255,255,255,.24); }
.cmd.readonly { border-left: 4px solid var(--green); }
.cmd.mutating { border-left: 4px solid var(--red); }
.cmd .cm  { color: var(--code-dim); }   /* comment */

/* tables */
table.grid { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
table.grid th, table.grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { color: var(--teal-700); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tr.hl td { background: var(--orange-050); font-weight: 600; }
table.grid tfoot td { font-weight: 700; border-top: 2px solid var(--teal); }

/* fact / stat cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.card .big { font-size: 25px; font-weight: 800; color: var(--green); line-height: 1.1; }
.card .lbl { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.card.teal .big { color: var(--teal); }
.card.orange .big { color: var(--orange-700); }

/* diagram blocks (ascii / svg) */
.diagram { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px; margin: 14px 0; overflow-x: auto; box-shadow: var(--shadow); }
.diagram pre { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; color: var(--teal-900); white-space: pre; }
.diagram figcaption { font-size: 12.5px; color: var(--muted); margin-top: 8px; text-align: center; }

/* source citations */
.sources { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.sources b { color: var(--ink); }

/* ============================ QUIZ ============================ */
.quiz { margin: 26px 0 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.quiz > h3 { margin-top: 0; color: var(--teal-700); display: flex; align-items: center; gap: 8px; }
.quiz > h3::before { content: "\2705"; }
.q { margin: 16px 0; }
.q .q-text { font-weight: 600; margin-bottom: 8px; }
.q .opt { display: flex; align-items: flex-start; gap: 9px; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: 9px; margin: 6px 0; cursor: pointer; transition: background .12s, border-color .12s; }
.q .opt:hover { background: var(--teal-050); }
.q .opt input { margin-top: 3px; accent-color: var(--teal); }
.q.answered .opt { cursor: default; }
.q.answered .opt.correct { background: var(--green-050); border-color: #BFE0CD; }
.q.answered .opt.wrong   { background: var(--red-050); border-color: #EEC4BB; }
.q .explain { display: none; font-size: 13.5px; color: var(--muted); margin: 8px 2px 0;
  padding-left: 12px; border-left: 3px solid var(--teal-100); }
.q.answered .explain { display: block; }
.quiz .check-btn { margin-top: 8px; background: var(--teal); color: #fff; border: none;
  padding: 9px 18px; border-radius: 9px; font-size: 14px; cursor: pointer; font-family: inherit; font-weight: 600; }
.quiz .check-btn:hover { background: var(--teal-700); }
.quiz .quiz-result { margin-top: 12px; font-weight: 700; }
.quiz .quiz-result.pass { color: var(--green); }
.quiz .quiz-result.part { color: var(--amber); }

/* ============================ PAGER ============================ */
.pager { display: flex; gap: 10px; align-items: center; margin: 34px 0 10px; flex-wrap: wrap; }
.pager-btn { background: var(--surface); border: 1px solid var(--line-2); color: var(--ink);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; cursor: pointer; font-family: inherit; }
.pager-btn:hover:not(:disabled) { background: var(--teal-050); border-color: var(--teal-100); }
.pager-btn:disabled { opacity: .4; cursor: not-allowed; }
.pager-btn.primary { background: var(--orange); color: #fff; border-color: var(--orange); margin-left: auto; font-weight: 600; }
.pager-btn.primary:hover { background: var(--orange-700); }
.pager-btn.primary.is-done { background: var(--green); border-color: var(--green); }
#nextBtn { margin-left: 0; }

.page-foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); }
.page-foot code { font-size: 11.5px; }

/* module overview (rendered when a module head is opened as a page) */
.mod-hero { background: linear-gradient(135deg, var(--teal), var(--teal-900)); color: #EAF5F5;
  border-radius: var(--radius); padding: 26px 28px; margin-bottom: 20px; box-shadow: var(--shadow-lg); }
.mod-hero .eyebrow { color: #9FCBCB; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.mod-hero h1 { margin: 6px 0 8px; color: #fff; font-size: 30px; }
.mod-hero p { margin: 0; color: #CDE6E6; max-width: 66ch; }
.lesson-list { list-style: none; padding: 0; margin: 8px 0; }
.lesson-list li a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 11px; margin: 9px 0; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.lesson-list li a:hover { border-color: var(--teal-100); background: var(--teal-050); }
.lesson-list .n { width: 30px; height: 30px; border-radius: 8px; background: var(--teal-050); color: var(--teal-700);
  display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.lesson-list .meta { flex: 1; }
.lesson-list .meta .t { font-weight: 600; }
.lesson-list .meta .s { font-size: 13px; color: var(--muted); }
.lesson-list .done-badge { color: var(--green); font-size: 18px; }

/* ============================ DUAL-PATH (console / CLI) ============================ */
/* A learner picks Console or CLI once; the choice applies to every block in the
   course (persisted). Authors write one .paths block with two .path-pane panes. */
.paths { margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.path-tabs { display: flex; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.path-tab { flex: 0 0 auto; background: transparent; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 9px 16px; }
.path-tab:hover { background: var(--teal-050); color: var(--teal-700); }
/* Active tab: darker, thicker underline (>=3:1 non-text contrast) + bold, so the
   selected state never rests on colour alone (WCAG 1.4.11 / 1.4.1). */
.path-tab.active { color: var(--teal-900); border-bottom: 3px solid var(--orange-700); background: var(--surface); font-weight: 700; }
.path-pane { display: none; padding: 6px 14px 12px; }
.path-pane.active { display: block; }
.path-hint { display: block; font-size: 13px; color: var(--muted); margin-top: 6px; }
.t-body .path-hint { margin-top: 4px; }
.path-pane > .cmd:first-child, .path-pane > .cmd-tag:first-child { margin-top: 8px; }

/* the console click-path: a numbered list of where to click */
ol.console-steps { counter-reset: cstep; list-style: none; padding-left: 0; margin: 10px 0; }
ol.console-steps > li { counter-increment: cstep; position: relative; padding: 3px 0 3px 32px; margin: 7px 0; }
ol.console-steps > li::before { content: counter(cstep); position: absolute; left: 0; top: 1px; width: 21px; height: 21px;
  border-radius: 50%; background: var(--teal-050); color: var(--teal-700); font-size: 11px; font-weight: 700;
  display: grid; place-items: center; }
.console-steps .nav { color: var(--teal-700); font-weight: 600; }
.console-steps kbd, .lesson kbd { font-family: var(--mono); font-size: .82em; background: var(--bg-2);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--ink); white-space: nowrap; }

/* ============================ TASK CHECKLISTS ============================ */
/* Persisted, per-step checkboxes. Ticking every task in a lesson auto-completes it. */
ol.tasks { list-style: none; counter-reset: tsk; padding-left: 0; margin: 14px 0; }
ol.tasks > li { counter-increment: tsk; display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0;
  background: var(--surface); box-shadow: var(--shadow); transition: background .15s, border-color .15s; }
ol.tasks > li::before { content: counter(tsk); flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  background: var(--teal-050); color: var(--teal-700); font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
ol.tasks > li > input[type=checkbox] { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 3px; accent-color: var(--green); cursor: pointer; }
ol.tasks > li .t-body { flex: 1; min-width: 0; }
ol.tasks > li .t-title { font-weight: 600; color: var(--teal-900); }
ol.tasks > li.done { background: var(--green-050); border-color: #CDE6D9; }
ol.tasks > li.done .t-title { text-decoration: line-through; color: var(--muted); }
.t-why { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.t-why::before { content: "\21B3  "; color: var(--teal); font-weight: 700; }

/* progress banner injected at the top of any lesson that contains tasks */
.task-prog { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; padding: 10px 14px;
  background: var(--teal-050); border: 1px solid var(--teal-100); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--teal-700); font-weight: 700; }
.task-prog .bar { flex: 1; max-width: 240px; height: 8px; background: #fff; border-radius: 99px; overflow: hidden; border: 1px solid var(--teal-100); }
.task-prog .bar > span { display: block; height: 100%; width: 0; background: var(--green); transition: width .3s ease; }

/* ============================ RESOURCE EXPLAINER CARDS ============================ */
/* Per-AWS-resource recap: what / why / how + a plain-terms line. */
.resource { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--teal);
  border-radius: var(--radius-sm); padding: 14px 16px 16px; margin: 16px 0; box-shadow: var(--shadow); }
.resource .r-head { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; flex-wrap: wrap; }
.resource .r-ico { font-size: 20px; }
.resource .r-name { font-weight: 800; color: var(--teal-900); font-size: 16px; }
.resource .r-tag { margin-left: auto; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--teal-700); background: var(--teal-050); border: 1px solid var(--teal-100); border-radius: 99px; padding: 2px 9px; }
.resource .r-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 18px; margin: 10px 0 4px; }
.resource .r-grid b { color: var(--orange-700); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.resource .r-grid p { margin: 2px 0 0; font-size: 13.5px; }
.resource .r-layman { margin-top: 10px; padding: 9px 12px; background: var(--bg-2); border-radius: 8px; font-size: 13.5px; }
.resource .r-layman::before { content: "\1F9E0  In plain terms \2014 "; font-weight: 700; color: var(--teal-700); }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .header-search input { width: 140px; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; width: 86%; max-width: 320px;
    z-index: 35; transform: translateX(-104%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
}
@media (max-width: 560px) {
  .header-search { display: none; }
  .content { padding: 24px 18px 50px; }
}

/* ============================ PRINT ============================ */
@media print {
  .site-header, .sidebar, .pager, .backdrop, .nav-toggle, .quiz .check-btn { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .cmd { white-space: pre-wrap; border: 1px solid #ccc; color: #111; background: #f6f6f6; }
  .q.answered .explain, .q .explain { display: block; }
  a { color: #000; text-decoration: underline; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
