/* ==========================================================================
   Asymptotica — shared stylesheet
   Design tokens/footer mirror mikevotary.com so the two sites feel like one
   family. Note-specific pieces (#box, chart controls, tables, sidebar)
   carried over/added for the multi-page note structure.
   ========================================================================== */

:root {
    --bg: #f7f6f3;
    --ink: #1c1f26;
    --muted: #6c7079;
    --faint: #9a9ea6;
    --line: #e6e4de;
    --accent: #2f4a6b;
    --accent-weak: #eef1f5;
    --box-bg: #dde3ea;
    --font: "Charter", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    font-family: var(--font);
    color: var(--ink);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); }

/* ---------- Layout (index page) ---------- */
.wrap { max-width: 800px; margin: 0 auto; padding: 0 40px 2rem; }
section { padding: 40px 0; }
.section-head { font-size: 28px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 28px; }

/* ---------- Hero / intro ---------- */
.hero { padding-top: 60px; }
.hero h1 { font-size: 38px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; margin-bottom: 16px; }
.bio, .prose { font-size: 17.5px; color: #3a3d44; line-height: 1.7; margin-bottom: 18px; }
.bio:last-of-type, .prose:last-of-type { margin-bottom: 0; }
.prose strong { font-weight: 600; color: var(--ink); }

/* ---------- Notes list (index) ---------- */
.subhead {
    font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--accent); margin: 44px 0 22px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.subhead:first-of-type { margin-top: 0; }

.note-entry {
    position: relative; padding: 14px 0 14px 22px;
    border-bottom: 1px solid var(--line);
}
.note-entry:last-child { border-bottom: none; }
.note-entry::before {
    content: ""; position: absolute; left: 0; top: 22px;
    width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.note-title {
    display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
    text-decoration: none; color: var(--ink);
}
.note-title:hover { color: var(--accent); }

/* ---------- Note page: two-column layout (sidebar + content) ---------- */
.note-layout {
    max-width: 1100px; margin: 0 auto;
    padding: 50px 40px 2rem;
    display: flex; align-items: flex-start; gap: 50px;
}
.note-sidebar {
    flex: 0 0 220px;
    position: sticky; top: 40px;
}
.sidebar-brand {
    display: block; font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
    color: var(--ink); text-decoration: none; margin-bottom: 18px;
}
.sidebar-brand:hover { color: var(--accent); }
.sidebar-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--muted); margin-bottom: 12px;
}
.sidebar-list { list-style: none; }
.sidebar-list li { margin-bottom: 4px; }
.sidebar-list a {
    display: block; font-size: 14.5px; line-height: 1.5; padding: 5px 10px;
    border-radius: 6px; text-decoration: none; color: var(--muted);
}
.sidebar-list a:hover { background: var(--accent-weak); color: var(--accent); }
.sidebar-list a.active { color: var(--accent); font-weight: 700; background: var(--accent-weak); }

.note-content { flex: 1; min-width: 0; max-width: 780px; }

/* ---------- Note page header ---------- */
.note-header { margin-bottom: 10px; }
.note-kicker {
    font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--accent); margin-bottom: 10px;
}
.note-header h1 { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }

/* ---------- Citation line for book/paper study notes ---------- */
.note-content p.note-source {
    font-size: 15px; color: var(--muted); font-style: italic;
    margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--line);
}

/* body copy inside notes (mirrors original site's <p>, <ul>, <li>) */
.note-content p, .note-content li { font-size: 17.5px; line-height: 1.7; color: #2a2d33; }
.note-content p { margin: 0 0 1.1em; }

/* markdown-generated tables (from notes-src/*.md) get styled generically here,
   so authors don't need to hand-write inline styles per cell */
.note-content table {
    width: 100%; border-collapse: collapse; margin: 0 0 20px; text-align: left;
}
.note-content th, .note-content td {
    border: 1px solid var(--line); padding: 10px; vertical-align: top;
}
.note-content th { background: var(--accent-weak); font-weight: 700; }
.note-content ul, .note-content ol { margin: 0 0 1.1em 1.4em; }
.note-content li { margin-bottom: 0.4em; }
.note-content h2 { font-size: 26px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 20px; }
.note-content h3 { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; margin: 32px 0 14px; }
.note-content h4 { font-size: 18px; font-weight: 600; margin: 24px 0 10px; }
.note-content strong { font-weight: 700; color: var(--ink); }
.note-content em, .note-content i { font-style: italic; }
.note-content table { font-family: var(--font); }
.note-content section { padding: 8px 0; }

/* ---------- Callout box ---------- */
#box, .box {
    background-color: var(--box-bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
    margin: 20px 0;
}
#box > *:last-child, .box > *:last-child { margin-bottom: 0; }

/* ---------- Interactive controls (CLT chart, etc.) ---------- */
.controls {
    display: flex; flex-direction: column; gap: 15px; margin-bottom: 25px;
}
.control-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#nSlider { width: 250px; cursor: pointer; }
#nValue { font-weight: bold; min-width: 30px; display: inline-block; }
.chart-container { position: relative; height: 400px; width: 100%; }

/* ---------- Note pager (prev/next) ---------- */
.note-pager {
    display: flex; justify-content: space-between; align-items: center; gap: 20px;
    margin-top: 50px; padding-top: 24px; border-top: 1px solid var(--line);
    font-size: 15px;
}
.note-pager a { text-decoration: none; }
.note-pager a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Footer ---------- */
footer {
    text-align: center; padding: 40px 20px 56px; font-size: 13px; color: var(--faint); line-height: 1.8;
}
footer a { color: var(--faint); text-decoration: underline; text-underline-offset: 2px; }
footer a:hover { color: var(--accent); }

/* ---------- a11y / motion ---------- */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
.reveal { opacity: 0; transform: translateY(10px); animation: rise 0.7s ease forwards; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
    .note-layout { flex-direction: column; gap: 26px; padding: 34px 24px 2rem; }
    .note-sidebar { position: static; width: 100%; }
    .sidebar-list { display: flex; flex-wrap: wrap; gap: 6px; }
    .sidebar-list li { margin-bottom: 0; }
    .note-content { max-width: 100%; }
}

@media (max-width: 640px) {
    .wrap { padding: 0 22px 2rem; }
    section { padding: 30px 0; }
    .section-head { font-size: 25px; }
    .hero { padding-top: 40px; }
    .hero h1 { font-size: 29px; }
    .note-header h1 { font-size: 26px; }
    .note-content h2 { font-size: 22px; }
    .note-content h3 { font-size: 19px; }
}
