/* =====================================================================
   Data Science Major 2025 - Study Material
   Shared Stylesheet

   Adopted verbatim from nrstatlab/Statistics-Major so both sites read as
   one family. Everything above the "ADDITIONS" rule at the foot of this
   file is unchanged from that repository; keep it that way so the two
   stylesheets stay diffable.
   ===================================================================== */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: #1f2937;
  margin: 0;
  background: #f5f7fb;
}

/* ---------- Layout ---------- */
.wrapper {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 22px 80px;
}

/* ---------- Header banner ---------- */
.banner {
  background: linear-gradient(135deg, #0f4c81 0%, #1e7fbf 100%);
  color: #fff;
  padding: 30px 22px;
  border-radius: 14px;
  margin-bottom: 28px;
  box-shadow: 0 6px 20px rgba(15,76,129,0.18);
}
.banner h1 {
  margin: 0 0 6px;
  font-size: 1.9rem;
  letter-spacing: 0.3px;
}
.banner p {
  margin: 0;
  opacity: 0.95;
  font-size: 1rem;
}
.banner .crumbs {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-bottom: 8px;
}
.banner .crumbs a { color: #ffe49a; text-decoration: none; }
.banner .crumbs a:hover { text-decoration: underline; }

/* ---------- Navigation grid (index page) ---------- */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin: 24px 0;
}
.unit-card {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  border-top: 4px solid #1e7fbf;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.unit-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}
.unit-card h3 {
  margin: 0 0 8px;
  color: #0f4c81;
  font-size: 1.15rem;
}
.unit-card p { margin: 0; color: #4b5563; font-size: 0.95rem; }
.unit-card .tag {
  display: inline-block;
  font-size: 0.75rem;
  background: #e6f1fb;
  color: #0f4c81;
  padding: 2px 10px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-weight: 600;
}

/* ---------- Section headings ---------- */
h2 {
  color: #0f4c81;
  border-bottom: 3px solid #1e7fbf;
  padding-bottom: 6px;
  margin-top: 42px;
  font-size: 1.55rem;
}
h3 {
  color: #1e7fbf;
  margin-top: 28px;
  font-size: 1.2rem;
}
h4 {
  color: #0f4c81;
  margin-top: 22px;
  font-size: 1.05rem;
}

/* ---------- Concept / definition box ---------- */
.concept {
  background: #fff;
  border-left: 5px solid #1e7fbf;
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.concept .label {
  display: inline-block;
  background: #1e7fbf;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

/* ---------- Formula box ---------- */
.formula {
  background: #fff8e1;
  border: 1px solid #ffd966;
  border-left: 5px solid #f59e0b;
  padding: 12px 18px;
  margin: 14px 0;
  border-radius: 6px;
  font-size: 1.05rem;
}
.formula .label {
  display: inline-block;
  background: #f59e0b;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  margin-bottom: 4px;
}

/* ---------- Example box ---------- */
.example {
  background: #ecfdf5;
  border-left: 5px solid #059669;
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: 6px;
}
.example .label {
  display: inline-block;
  background: #059669;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.example h4 {
  margin: 4px 0 8px;
  color: #065f46;
}

/* ---------- Tip / Note box ---------- */
.tip {
  background: #eef2ff;
  border-left: 5px solid #6366f1;
  padding: 10px 16px;
  margin: 14px 0;
  border-radius: 6px;
  font-size: 0.96rem;
}
.tip strong { color: #4338ca; }

/* ---------- Tables ---------- */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 14px 0;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
th, td {
  border: 1px solid #d1d5db;
  padding: 8px 12px;
  text-align: center;
  font-size: 0.96rem;
}
th {
  background: #0f4c81;
  color: #fff;
  font-weight: 600;
}
tbody tr:nth-child(even) { background: #f3f4f6; }
table.left td, table.left th { text-align: left; }

/* ---------- Lists ---------- */
ul, ol { padding-left: 22px; }
ul li, ol li { margin: 4px 0; }

/* ---------- Footer / page navigation ---------- */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin: 50px 0 0;
  padding-top: 20px;
  border-top: 2px solid #d1d5db;
  flex-wrap: wrap;
  gap: 10px;
}
.page-nav a {
  color: #0f4c81;
  text-decoration: none;
  background: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-weight: 500;
}
.page-nav a:hover { background: #1e7fbf; color: #fff; }

footer {
  text-align: center;
  margin-top: 40px;
  font-size: 0.85rem;
  color: #6b7280;
}

/* ---------- Topic chip list ---------- */
.chips { margin: 12px 0 24px; }
.chip {
  display: inline-block;
  background: #e6f1fb;
  color: #0f4c81;
  padding: 4px 12px;
  border-radius: 14px;
  margin: 4px 4px 4px 0;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ---------- Two-column on wide screens ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 700px) {
  /* A wide table must scroll inside itself rather than widen the page.
     Without this the table pushes the whole document sideways on a phone and
     the code chips in its cells are cut off at the screen edge. */
  table { display: block; max-width: 100%; overflow-x: auto; }
  /* A long file path or command in running text is one unbreakable word; it
     drags the paragraph, and the page with it, past the screen edge. break-word
     (not anywhere) lets it wrap without shrinking a table's columns. */
  code { overflow-wrap: break-word; }
  pre code { overflow-wrap: normal; }
  /* Same for prose: a run of dot leaders, or a sum written out term by term,
     is one word as far as the line-breaker is concerned. This only affects a
     word that cannot fit; ordinary text wraps exactly as before. */
  p, li, td, th, h1, h2, h3, h4 { overflow-wrap: break-word; }
  /* Display math is typeset at its natural width, so it scrolls in its own box
     rather than widening the page. */
  mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
  .two-col { grid-template-columns: 1fr; }
  body { font-size: 16px; }
  .banner h1 { font-size: 1.5rem; }
}

/* ---------- Print friendly ---------- */
@media print {
  body { background: #fff; }
  .banner, .unit-card { box-shadow: none; }
  .page-nav { display: none; }
}

/* ---------- Inline code: high-contrast, distinct from body text ---------- */
code {
  background: #fff4e5;             /* soft cream */
  color: #b91c1c;                  /* deep red — very readable */
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid #fcd9b6;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.92em;
  font-weight: 600;
}

/* ---------- Code block (multi-line snippets) ---------- */
pre {
  background: #0f172a;             /* deep navy */
  color: #f1f5f9;                  /* near-white text */
  padding: 14px 18px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.93rem;
  line-height: 1.55;
  margin: 14px 0;
  font-family: "Consolas", "Courier New", monospace;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Inline code INSIDE pre block inherits pre styling — no double background */
pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: 0;
  font-weight: normal;
  font-size: inherit;
}

/* Console-style output box used in some R / Excel units */
.out {
  background: #f8fafc;
  color: #1f2937;
  border-left: 4px solid #475569;
  padding: 10px 14px;
  margin: 8px 0 14px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  border-radius: 4px;
}

/* ---------- Figure / SVG diagrams ---------- */
.figure {
  margin: 18px auto;
  text-align: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 12px 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  max-width: 620px;
}
.figure svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.figure figcaption {
  margin-top: 8px;
  font-size: 0.88rem;
  color: #4b5563;
  font-style: italic;
}
.figure-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.figure-row .figure { margin: 0; max-width: none; }
@media (max-width: 700px) {
  .figure-row { grid-template-columns: 1fr; }
}


/* =====================================================================
   ADDITIONS for Data Science Major (not present in Statistics-Major)
   ===================================================================== */

/* ---------- Off-syllabus warning ----------
   Two topics (Bayes' theorem, database triggers) are examined but appear
   in no syllabus unit. Those callouts must not read as ordinary notes. */
.warn {
  background: #fef2f2;
  border-left: 5px solid #dc2626;
  padding: 14px 18px;
  margin: 18px 0;
  border-radius: 6px;
}
.warn .label {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.warn strong { color: #991b1b; }

/* ---------- Review finding reference ---------- */
.finding {
  display: inline-block;
  background: #fde68a;
  color: #78350f;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 8px;
}

/* ---------- Mermaid diagrams ----------
   Statistics-Major draws its figures as hand-written inline SVG. This repo
   has two Mermaid diagrams (a flowchart and an ER diagram) which render
   natively on github.com, so they are kept as Mermaid and drawn client-side
   here inside the same .figure frame. */
pre.mermaid {
  background: none;
  color: inherit;
  box-shadow: none;
  padding: 0;
  margin: 0;
  text-align: center;
  overflow-x: auto;
}

/* ---------- Left-aligned tables ----------
   The house table style centres every cell, which suits numeric tables.
   Syllabus and comparison tables read better left-aligned. */
table.left td, table.left th { text-align: left; }
.main-table td:first-child, .main-table th:first-child { text-align: left; }

/* ---------- Status pills on the course hub ---------- */
.ready   { border-left: 4px solid #059669; }
.pending { border-left: 4px solid #9ca3af; opacity: .75; }
.status  { font-size: .75rem; font-weight: 600; float: right; }
.ready .status   { color: #059669; }
.pending .status { color: #6b7280; }

/* ---------- Verification badge ---------- */
.verified {
  display: inline-block;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
}

/* ---------------------------------------------------------------------------
   Collapsible answers on the practice pages.

   A practice question whose answer sits open beneath it is not practice: the
   eye reaches the answer before the student has attempted anything. Every
   answer is folded behind this control, so the page reads as a question set
   first and a solution set second.
   --------------------------------------------------------------------------- */
details {
  margin: 10px 0 22px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fbfcfe;
  overflow: hidden;
}

details > summary {
  cursor: pointer;
  padding: 9px 14px 9px 34px;
  position: relative;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: .02em;
  color: #0f4c81;
  background: #eef4fb;
  list-style: none;               /* hide the default triangle ... */
  user-select: none;
}
details > summary::-webkit-details-marker { display: none; }   /* ... in WebKit */

/* our own marker, so it can rotate */
details > summary::before {
  content: "▸";
  position: absolute;
  left: 14px;
  transition: transform .15s ease;
  display: inline-block;
}
details[open] > summary::before { transform: rotate(90deg); }

details > summary:hover { background: #e3edf9; }
details > summary:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: -3px;
}

details[open] > summary {
  border-bottom: 1px solid #dbe3ee;
}

/* the answer itself */
details > *:not(summary) { margin-left: 14px; margin-right: 14px; }
details > *:nth-child(2) { margin-top: 12px; }
details > *:last-child  { margin-bottom: 12px; }

/* a folded answer must still print, or the page is useless on paper */
@media print {
  details { border: none; background: none; }
  details > summary { display: none; }
  /* the browser hides a closed details' children; override so a printed
     revision copy carries the answers even when they were never expanded */
  details:not([open]) > *:not(summary) { display: block !important; }
  details > *:not(summary) { margin-left: 0; margin-right: 0; }
}

/* ---------------------------------------------------------------------------
   'On this page' contents.

   A unit page runs to two and a half thousand words across a dozen sections.
   Closed by default so it costs one line on a phone; open it and the whole
   shape of the page is visible, and every heading is linkable.
   --------------------------------------------------------------------------- */
details.toc {
  margin: 0 0 24px;
  background: #f7f9fc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0f4c81;
}
details.toc > summary {
  background: transparent;
  color: #0f4c81;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
details.toc > summary:hover { background: #eef4fb; }
/* No marker: over half the headings on this site number themselves ("3. t-test
   for Difference of Two Means"), so an ordered list rendered them as "3. 3.
   t-test for...". The heading's own number is the one a student refers to. */
details.toc ol {
  margin: 4px 0 12px;
  padding-left: 4px;
  list-style: none;
  columns: 2;
  column-gap: 28px;
}
details.toc li { margin: 3px 0; break-inside: avoid; font-size: .93rem; }
details.toc a { color: #24405c; text-decoration: none; }
details.toc a:hover { color: #0f4c81; text-decoration: underline; }

/* a jumped-to heading should not hide under anything, and should be obvious */
h2[id], h3[id] { scroll-margin-top: 12px; }
h2[id]:target, h3[id]:target {
  background: #fff8e1;
  box-shadow: -6px 0 0 #f59e0b;
  padding-left: 6px;
}

@media (max-width: 700px) {
  details.toc ol { columns: 1; padding-left: 30px; }
}
@media print { details.toc { display: none; } }

/* ---- syntax highlighting (generated by build_site.py) ---- */
/* Generated -- do not hand-edit. Rerun tools/build_site.py to refresh.
   Colours are github-dark, chosen because its background (#0d1117) is the
   nearest of the bundled themes to the deep navy this site already gives
   <pre>, so the tokens are contrast-tuned for the ground they sit on. Only
   token colours are kept; Pygments' own pre/line-number rules are dropped so
   they cannot fight the layout above. */
pre code .hll { background-color: #6e7681 }
pre code .c { color: #8B949E; font-style: italic } /* Comment */
pre code .err { color: #F85149 } /* Error */
pre code .esc { color: #E6EDF3 } /* Escape */
pre code .g { color: #E6EDF3 } /* Generic */
pre code .k { color: #FF7B72 } /* Keyword */
pre code .l { color: #A5D6FF } /* Literal */
pre code .n { color: #E6EDF3 } /* Name */
pre code .o { color: #FF7B72; font-weight: bold } /* Operator */
pre code .x { color: #E6EDF3 } /* Other */
pre code .p { color: #E6EDF3 } /* Punctuation */
pre code .ch { color: #8B949E; font-style: italic } /* Comment.Hashbang */
pre code .cm { color: #8B949E; font-style: italic } /* Comment.Multiline */
pre code .cp { color: #8B949E; font-weight: bold; font-style: italic } /* Comment.Preproc */
pre code .cpf { color: #8B949E; font-style: italic } /* Comment.PreprocFile */
pre code .c1 { color: #8B949E; font-style: italic } /* Comment.Single */
pre code .cs { color: #8B949E; font-weight: bold; font-style: italic } /* Comment.Special */
pre code .gd { color: #FFA198; background-color: #490202 } /* Generic.Deleted */
pre code .ge { color: #E6EDF3; font-style: italic } /* Generic.Emph */
pre code .ges { color: #E6EDF3; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
pre code .gr { color: #FFA198 } /* Generic.Error */
pre code .gh { color: #79C0FF; font-weight: bold } /* Generic.Heading */
pre code .gi { color: #56D364; background-color: #0F5323 } /* Generic.Inserted */
pre code .go { color: #8B949E } /* Generic.Output */
pre code .gp { color: #8B949E } /* Generic.Prompt */
pre code .gs { color: #E6EDF3; font-weight: bold } /* Generic.Strong */
pre code .gu { color: #79C0FF } /* Generic.Subheading */
pre code .gt { color: #FF7B72 } /* Generic.Traceback */
pre code .g-Underline { color: #E6EDF3; text-decoration: underline } /* Generic.Underline */
pre code .kc { color: #79C0FF } /* Keyword.Constant */
pre code .kd { color: #FF7B72 } /* Keyword.Declaration */
pre code .kn { color: #FF7B72 } /* Keyword.Namespace */
pre code .kp { color: #79C0FF } /* Keyword.Pseudo */
pre code .kr { color: #FF7B72 } /* Keyword.Reserved */
pre code .kt { color: #FF7B72 } /* Keyword.Type */
pre code .ld { color: #79C0FF } /* Literal.Date */
pre code .m { color: #A5D6FF } /* Literal.Number */
pre code .s { color: #A5D6FF } /* Literal.String */
pre code .na { color: #E6EDF3 } /* Name.Attribute */
pre code .nb { color: #E6EDF3 } /* Name.Builtin */
pre code .nc { color: #F0883E; font-weight: bold } /* Name.Class */
pre code .no { color: #79C0FF; font-weight: bold } /* Name.Constant */
pre code .nd { color: #D2A8FF; font-weight: bold } /* Name.Decorator */
pre code .ni { color: #FFA657 } /* Name.Entity */
pre code .ne { color: #F0883E; font-weight: bold } /* Name.Exception */
pre code .nf { color: #D2A8FF; font-weight: bold } /* Name.Function */
pre code .nl { color: #79C0FF; font-weight: bold } /* Name.Label */
pre code .nn { color: #FF7B72 } /* Name.Namespace */
pre code .nx { color: #E6EDF3 } /* Name.Other */
pre code .py { color: #79C0FF } /* Name.Property */
pre code .nt { color: #7EE787 } /* Name.Tag */
pre code .nv { color: #79C0FF } /* Name.Variable */
pre code .ow { color: #FF7B72; font-weight: bold } /* Operator.Word */
pre code .pm { color: #E6EDF3 } /* Punctuation.Marker */
pre code .w { color: #6E7681 } /* Text.Whitespace */
pre code .mb { color: #A5D6FF } /* Literal.Number.Bin */
pre code .mf { color: #A5D6FF } /* Literal.Number.Float */
pre code .mh { color: #A5D6FF } /* Literal.Number.Hex */
pre code .mi { color: #A5D6FF } /* Literal.Number.Integer */
pre code .mo { color: #A5D6FF } /* Literal.Number.Oct */
pre code .sa { color: #79C0FF } /* Literal.String.Affix */
pre code .sb { color: #A5D6FF } /* Literal.String.Backtick */
pre code .sc { color: #A5D6FF } /* Literal.String.Char */
pre code .dl { color: #79C0FF } /* Literal.String.Delimiter */
pre code .sd { color: #A5D6FF } /* Literal.String.Doc */
pre code .s2 { color: #A5D6FF } /* Literal.String.Double */
pre code .se { color: #79C0FF } /* Literal.String.Escape */
pre code .sh { color: #79C0FF } /* Literal.String.Heredoc */
pre code .si { color: #A5D6FF } /* Literal.String.Interpol */
pre code .sx { color: #A5D6FF } /* Literal.String.Other */
pre code .sr { color: #79C0FF } /* Literal.String.Regex */
pre code .s1 { color: #A5D6FF } /* Literal.String.Single */
pre code .ss { color: #A5D6FF } /* Literal.String.Symbol */
pre code .bp { color: #E6EDF3 } /* Name.Builtin.Pseudo */
pre code .fm { color: #D2A8FF; font-weight: bold } /* Name.Function.Magic */
pre code .vc { color: #79C0FF } /* Name.Variable.Class */
pre code .vg { color: #79C0FF } /* Name.Variable.Global */
pre code .vi { color: #79C0FF } /* Name.Variable.Instance */
pre code .vm { color: #79C0FF } /* Name.Variable.Magic */
pre code .il { color: #A5D6FF } /* Literal.Number.Integer.Long */
