/* ==========================================================
   Biostatistics-CDFD-2026
   Course website stylesheet
   Blue is reserved for hyperlinks only
   ========================================================== */

:root {
    --bg: #ffffff;
    --bg-soft: #f6f8fb;

    --text: #20242a;
    --muted: #5f6b76;

    --link: #174a7e;
    --link-hover: #2f80c9;

    --border: #dfe5eb;
    --code-bg: #f3f5f7;

    --max-width: 980px;
}


/* ----------------------------------------------------------
   Page
   ---------------------------------------------------------- */

html {
    scroll-behavior: smooth;
}

body {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 50px 32px 80px;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    font-size: 17px;
    line-height: 1.7;

    color: var(--text);
    background: var(--bg);
}


/* ----------------------------------------------------------
   Main title
   ---------------------------------------------------------- */

h1 {
    margin-top: 0;
    margin-bottom: 12px;

    font-size: clamp(2.2rem, 5vw, 3.6rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;

    color: var(--text);

    border-bottom: 2px solid var(--border);
    padding-bottom: 20px;
}


/* Introductory paragraph immediately below title */

h1 + p {
    margin-top: 22px;
    margin-bottom: 38px;

    font-size: 1.18rem;
    line-height: 1.65;

    color: var(--muted);
}


/* ----------------------------------------------------------
   Headings
   ---------------------------------------------------------- */

h2 {
    margin-top: 60px;
    margin-bottom: 22px;

    font-size: 1.75rem;
    font-weight: 650;
    letter-spacing: -0.02em;

    color: var(--text);

    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

h3 {
    margin-top: 36px;
    margin-bottom: 14px;

    font-size: 1.3rem;
    font-weight: 650;

    color: var(--text);
}

h4 {
    margin-top: 28px;
    margin-bottom: 12px;

    color: var(--text);
}


/* ----------------------------------------------------------
   Paragraphs
   ---------------------------------------------------------- */

p {
    margin: 0 0 1.15em;
}


/* ----------------------------------------------------------
   Hyperlinks
   ---------------------------------------------------------- */

a {
    color: var(--link);
    text-decoration: none;
    font-weight: 500;

    text-underline-offset: 3px;
}

a:visited {
    color: var(--link);
}

a:hover,
a:focus {
    color: var(--link-hover);
    text-decoration: underline;
}


/* ----------------------------------------------------------
   Lecture links
   ---------------------------------------------------------- */

/*
   Links immediately following Lecture headings remain
   simple text links rather than buttons.
*/

h3 + p a {
    color: var(--link);

    padding: 0;
    margin: 0;

    font-weight: 600;
    text-decoration: none;
}

h3 + p a:visited {
    color: var(--link);
}

h3 + p a:hover,
h3 + p a:focus {
    color: var(--link-hover);
    text-decoration: underline;
}


/* ----------------------------------------------------------
   Lists
   ---------------------------------------------------------- */

ul,
ol {
    padding-left: 1.6em;
    margin-bottom: 1.6em;
}

li {
    margin: 0.45em 0;
}

li::marker {
    color: var(--text);
}


/* ----------------------------------------------------------
   Strong and emphasized text
   ---------------------------------------------------------- */

strong {
    font-weight: 650;
}

em {
    color: inherit;
}


/* ----------------------------------------------------------
   Inline code
   ---------------------------------------------------------- */

code {
    padding: 0.15em 0.35em;

    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        Menlo,
        monospace;

    font-size: 0.9em;

    color: var(--text);
    background: var(--code-bg);

    border: 1px solid var(--border);
    border-radius: 4px;
}


/* ----------------------------------------------------------
   Code blocks
   ---------------------------------------------------------- */

pre {
    margin: 24px 0;
    padding: 20px 22px;

    overflow-x: auto;

    color: var(--text);
    background: var(--code-bg);

    border: 1px solid var(--border);
    border-left: 4px solid var(--border);

    border-radius: 8px;

    line-height: 1.5;
}

pre code {
    padding: 0;

    color: inherit;
    background: transparent;

    border: none;
}


/* ----------------------------------------------------------
   Block quotes
   ---------------------------------------------------------- */

blockquote {
    margin: 28px 0;
    padding: 15px 22px;

    color: var(--muted);
    background: var(--bg-soft);

    border-left: 4px solid var(--border);

    border-radius: 0 7px 7px 0;
}

blockquote p:last-child {
    margin-bottom: 0;
}


/* ----------------------------------------------------------
   Tables
   ---------------------------------------------------------- */

table {
    width: 100%;
    margin: 28px 0;

    border-collapse: separate;
    border-spacing: 0;

    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: 8px;
}

th,
td {
    padding: 11px 14px;

    text-align: left;

    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text);
    background: var(--bg-soft);

    font-weight: 650;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-soft);
}


/* ----------------------------------------------------------
   Horizontal rule
   ---------------------------------------------------------- */

hr {
    margin: 50px 0;

    border: 0;
    border-top: 1px solid var(--border);
}


/* ----------------------------------------------------------
   Images
   ---------------------------------------------------------- */

img {
    display: block;

    max-width: 100%;
    height: auto;

    margin: 28px auto;

    border-radius: 8px;
}


/* ----------------------------------------------------------
   Figures and captions
   ---------------------------------------------------------- */

figure {
    margin: 32px 0;
}

figcaption {
    margin-top: 10px;

    color: var(--muted);

    font-size: 0.92rem;
    text-align: center;
}


/* ----------------------------------------------------------
   Contact section
   ---------------------------------------------------------- */

h2:last-of-type {
    margin-top: 60px;
}


/* ----------------------------------------------------------
   Selection
   ---------------------------------------------------------- */

::selection {
    color: var(--text);
    background: #e5e8eb;
}


/* ----------------------------------------------------------
   Responsive layout
   ---------------------------------------------------------- */

@media (max-width: 700px) {

    body {
        padding: 30px 20px 60px;

        font-size: 16px;
    }

    h1 {
        font-size: 2.25rem;
    }

    h2 {
        margin-top: 45px;
        font-size: 1.55rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    pre {
        padding: 16px;
    }

    table {
        display: block;
        overflow-x: auto;
    }
}


/* ----------------------------------------------------------
   Automatic dark mode
   ---------------------------------------------------------- */

@media (prefers-color-scheme: dark) {

    :root {
        --bg: #11161c;
        --bg-soft: #182029;

        --text: #dce3ea;
        --muted: #aab5c0;

        --link: #76b7eb;
        --link-hover: #a7d4f5;

        --border: #303b46;
        --code-bg: #161d24;
    }

    ::selection {
        color: var(--text);
        background: #303b46;
    }
}
