/* =========================================================================
   Discrete Event Systems @ ETH Zürich — course site styles
   Self-contained refresh on top of Bootstrap 4 (grid/utilities only).
   Theming via CSS custom properties; light + dark via prefers-color-scheme.
   ========================================================================= */

:root {
  /* ETH brand + neutrals */
  --eth-blue: #215CAF;
  --eth-blue-dark: #1A4A8C;
  --eth-petrol: #007894;
  --eth-bronze: #8E6713;
  --eth-green: #627313;
  --eth-purple: #8C0149;

  /* semantic */
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --bg-card: #ffffff;
  --border: #e3e8ef;
  --border-strong: #cdd5df;
  --text: #1c2733;
  --text-muted: #647084;
  --primary: var(--eth-blue);
  --primary-contrast: #ffffff;

  /* the three course parts each get an accent */
  --part1: var(--eth-blue);     /* Computability Models  */
  --part2: var(--eth-petrol);   /* Analysis Methods      */
  --part3: var(--eth-purple);   /* Formal Verification   */

  /* exercise accent — a classic green (lecture stays ETH blue) */
  --green: #2e7d32;
  --green-tint: rgba(46, 125, 50, .12);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, .06), 0 10px 28px rgba(16, 24, 40, .10);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --bg-soft: #151c25;
    --bg-card: #161e28;
    --border: #26303d;
    --border-strong: #33404f;
    --text: #e6edf5;
    --text-muted: #9aa7b8;
    --primary: #5a9bef;
    --part1: #5a9bef;
    --part2: #3fb6cf;
    --part3: #e0609b;
    --green: #5cc26a;
    --green-tint: rgba(92, 194, 106, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .45), 0 12px 30px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  font-size: 15px;
  /* always reserve room for the scrollbar so switching tabs (short Info tab vs.
     long Schedule tab) never shifts the page horizontally */
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: .95rem;
  line-height: 1.55;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--eth-blue-dark); text-decoration: underline; }
@media (prefers-color-scheme: dark) { a:hover { color: #8fbcf5; } }

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 700; letter-spacing: -.01em; }
h4 { font-size: 1.08rem; margin-top: 1.5rem; }
.mat-label { display: block; font-weight: 700; font-size: .82rem; text-transform: uppercase;
     letter-spacing: .04em; color: var(--text-muted); margin: .6rem 0 .25rem; }

code { font-family: var(--font-mono); font-size: .88em; color: var(--eth-purple);
       background: var(--bg-soft); padding: .1em .35em; border-radius: 4px; }
@media (prefers-color-scheme: dark) { code { color: #e0609b; } }

.text-muted { color: var(--text-muted) !important; }

/* ---- Header / hero ---------------------------------------------------- */
.site-header {
  background:
    radial-gradient(1200px 400px at 90% -10%, rgba(33, 92, 175, .10), transparent 60%),
    var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.site-header h1 { font-size: 2.75rem; margin: 0; line-height: 1.08; }
.site-header .subtitle { color: var(--text-muted); font-size: 1rem; margin-top: 1.05rem; }
/* keep the "— from …" clause together so it only drops to a new line when it
   genuinely doesn't fit (conditional break), instead of always breaking */

/* group logos sit on a clean white plate so the (light-background) NSG mark
   reads as intentional rather than clashing with the tinted header */
.brand-col { text-align: right; }
.brand-logos {
  display: inline-flex; align-items: center; gap: 30px;
  background: #fff; border: 1px solid var(--border-strong);
  border-radius: 16px; padding: 16px 26px; box-shadow: var(--shadow);
}
.brand-logos a { line-height: 0; display: inline-flex; }
.logo-nsg { height: 62px; width: auto; }
.logo-dynamo { height: 60px; width: auto; }
/* drop the logos entirely when there isn't room for them to look good */
@media (max-width: 991.98px) { .brand-col { display: none; } }

.term-badge {
  display: inline-block; vertical-align: middle; margin-left: .6rem;
  font-size: .92rem; font-weight: 600; color: var(--primary-contrast);
  background: var(--primary); padding: .28em .7em; border-radius: 999px;
  letter-spacing: .01em;
}

/* ---- Callouts (News / Progress) -------------------------------------- */
.bs-callout {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius); padding: 1.1rem 1.25rem; margin: 1.25rem 0;
  box-shadow: var(--shadow);
}
.bs-callout.no-margin-top { margin-top: 0; }
.bs-callout h4 { margin-top: 0; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.bs-callout-success   { border-left-color: var(--green); }
.bs-callout-info      { border-left-color: var(--eth-petrol); }
.bs-callout-primary   { border-left-color: var(--primary); }
.bs-callout-secondary { border-left-color: var(--border-strong); }

/* ---- Tabs ------------------------------------------------------------- */
.nav-tabs { border-bottom: 1px solid var(--border); }
.nav-tabs .nav-link {
  border: 0; border-bottom: 2px solid transparent; color: var(--text-muted);
  font-weight: 600; padding: .8rem 1rem; background: transparent;
}
.nav-tabs .nav-link:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--border-strong); }
.nav-tabs .nav-link.active {
  color: var(--primary); background: transparent; border-bottom-color: var(--primary);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- Schedule: part titles + week rows ------------------------------- */
.row-part-title {
  margin: 3.5rem 0 .9rem; padding: .25rem 0;
}
/* the first part follows the disclaimer, so it needs less of a gap above */
.disclaimer + .row-part-title { margin-top: 1rem; }
.row-part-title .col-index {
  font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--primary); padding-top: .35rem;
}
.row-part-title h5 { margin: 0; font-size: 1.6rem; }
.part-1 .col-index, .part-1 h5 { --primary: var(--part1); }
.part-2 .col-index, .part-2 h5 { --primary: var(--part2); }
.part-3 .col-index, .part-3 h5 { --primary: var(--part3); }
.part-1 .col-index { color: var(--part1); }
.part-2 .col-index { color: var(--part2); }
.part-3 .col-index { color: var(--part3); }

.row-week {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); box-shadow: var(--shadow);
  padding: 1rem .25rem; margin: 0 0 1rem; transition: box-shadow .2s ease, transform .2s ease;
}
.row-week:hover { box-shadow: var(--shadow-hover); }
.row-week.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%,100% { box-shadow: var(--shadow); } 25% { box-shadow: 0 0 0 3px var(--primary); } }
.row-week .col-index {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); padding-top: .25rem;
}
/* the lecture/exercise date, shown once per week under "Week N" as a small pill */
.week-date {
  display: block; width: fit-content; margin-top: .5rem; white-space: nowrap;
  font-weight: 600; font-size: .72rem; text-transform: none; letter-spacing: 0;
  color: var(--text-muted); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 6px; padding: .28em .55em;
}
.row-week h6 { font-size: 1rem; font-weight: 700; margin: .1rem 0 .5rem; line-height: 1.4; }
.row-week ol, .row-week ul { padding-left: 1.2rem; margin-bottom: .4rem; }
.row-week li { margin: .12rem 0; }

/* badges */
.badge { font-weight: 600; font-size: .72rem; padding: .35em .6em; border-radius: 6px; letter-spacing: .02em; }
.badge-secondary { background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--border); }
.badge-primary   { background: rgba(33,92,175,.12); color: var(--primary); }
.badge-success   { background: var(--green-tint); color: var(--green); }
.badge-danger    { background: rgba(140,1,73,.12); color: var(--eth-purple); }
.badge-info      { background: rgba(0,120,148,.14); color: var(--eth-petrol); }

/* "coming soon" pill for not-yet-posted materials */
.soon { color: var(--text-muted); font-style: italic; }
.soon i { opacity: .6; }

/* ---- Contact / info columns ------------------------------------------ */
.info-grid h4 { margin-top: 0; }
.info-grid ul { padding-left: 1.1rem; }
.info-grid p { margin-bottom: .5rem; }

/* ---- Disclaimer box --------------------------------------------------- */
.disclaimer {
  background: var(--bg-soft); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin: 1rem 0 1.5rem;
  font-size: .92rem; color: var(--text-muted);
}
.disclaimer .warn { color: #d6342c; }
@media (prefers-color-scheme: dark) { .disclaimer .warn { color: #ff6b61; } }

/* ---- Responsive niceties --------------------------------------------- */
@media (max-width: 767.98px) {
  .site-header h1 { font-size: 2.1rem; }
  .row-week .col-index { padding-bottom: .4rem; }
}
