/* Shared styles for the Macroeconomics site.
   Background: graph paper, with a Keynesian cross diagram in the page header. */

:root {
    --iron: #1f2a37;
    --ember: #e0893a;
    --ember-deep: #a9521c;
    --blue: #1d4e89;
    --paper: #fbf9f4;
    --card: #ffffff;
    --ink: #26221e;
    --muted: #675e55;
    --rule: #e5ddcf;
    --grid: rgba(29, 78, 137, 0.07);
    --grid-major: rgba(29, 78, 137, 0.13);
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
    --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 4.5rem; }

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: var(--serif);
    font-size: 1.075rem;
    line-height: 1.6;
    color: var(--ink);
    background-color: #f3efe6;
    /* Graph paper: fine grid every 24px, heavier line every 120px. */
    background-image:
        linear-gradient(var(--grid-major) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}

a { color: var(--ember-deep); text-underline-offset: 0.15em; }
a:hover { color: var(--ember); }

h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.2; color: var(--iron); }

/* ---------- Top navigation ---------- */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem clamp(1rem, 4vw, 2.5rem);
    font-family: var(--sans);
    background: rgba(31, 42, 55, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 3px solid var(--ember);
}
.site-nav a { color: #f1ece3; text-decoration: none; }
.site-nav a:hover { color: var(--ember); }
.site-nav .brand {
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.95rem;
}
.site-nav .links { display: flex; gap: clamp(0.8rem, 3vw, 1.8rem); font-size: 0.9rem; font-weight: 500; }

/* ---------- Hero band with the Keynesian cross ---------- */
.hero {
    position: relative;
    max-width: 60rem;
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 3.25rem) clamp(1rem, 4vw, 2.5rem) clamp(1.75rem, 4vw, 2.5rem);
}
.hero::after {
    content: "";
    position: absolute;
    top: 0.75rem;
    right: clamp(0rem, 2vw, 1.5rem);
    bottom: 0.25rem;
    width: min(42%, 22rem);
    background: url("images/keynesian-cross.svg") right center / contain no-repeat;
    opacity: 0.55;
    pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 36rem; }
.hero .kicker {
    margin: 0 0 0.5rem;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ember-deep);
}
.hero h1 {
    margin: 0;
    color: var(--iron);
    font-weight: 800;
    font-size: clamp(1.9rem, 5vw, 2.9rem);
    letter-spacing: -0.01em;
}
.hero .sub { margin: 0.6rem 0 0; font-size: 1.1rem; color: var(--muted); }

body.home .hero {
    min-height: min(58vh, 34rem);
    display: flex;
    align-items: center;
}
body.home .hero-inner { max-width: 29rem; }
body.home .hero::after {
    width: 34rem;
    top: 1.5rem;
    bottom: 1.5rem;
    opacity: 0.2;
}
/* Wide screens: the diagram has room beside the text, so show it in full,
   letting it extend past the right edge of the content column. */
@media (min-width: 78rem) {
    body.home .hero::after { right: -7rem; opacity: 1; }
}
body.home .hero h1 { font-size: clamp(2.4rem, 6vw, 3.4rem); }
body.home .hero .sub { font-size: clamp(1.1rem, 2.2vw, 1.35rem); }

/* ---------- Main panel ---------- */
main {
    max-width: 60rem;
    margin: 0 auto;
    padding: clamp(1.25rem, 4vw, 2.75rem);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 6px 30px rgba(31, 42, 55, 0.10);
}
@media (min-width: 62rem) {
    main { border-radius: var(--radius); margin-bottom: 3rem; }
}

main > section + section { margin-top: 3rem; }

main h2 {
    font-size: 1.5rem;
    margin: 0 0 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--ember);
    display: inline-block;
}
.lede { margin: -0.25rem 0 1.25rem; color: var(--muted); }

/* ---------- Index cards ---------- */
ul.cards {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
    gap: 1rem;
}
a.card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    height: 100%;
    padding: 1.1rem 1.2rem 1rem;
    background: var(--card);
    border: 1px solid var(--rule);
    border-top: 4px solid var(--ember-deep);
    border-radius: var(--radius);
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.card:hover {
    color: var(--ink);
    transform: translateY(-2px);
    border-top-color: var(--ember);
    box-shadow: 0 10px 24px rgba(41, 34, 28, 0.12);
}
.card .label, .quiz-group .title {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ember-deep);
}
.card .title { font-family: var(--sans); font-weight: 700; font-size: 1.12rem; line-height: 1.3; }
.card .desc { font-size: 0.95rem; color: var(--muted); }
.card .meta { margin-top: auto; padding-top: 0.4rem; font-family: var(--sans); font-size: 0.8rem; color: var(--muted); }

/* ---------- Quiz list ---------- */
ul.quiz-list { list-style: none; padding: 0; margin: 0; }
.quiz-group {
    display: grid;
    grid-template-columns: 8rem 1fr;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--rule);
}
.quiz-group .title { font-size: 0.8rem; color: var(--iron); }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips a {
    padding: 0.2rem 0.75rem;
    font-family: var(--sans);
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: 999px;
}
.chips a:hover { border-color: var(--ember); color: var(--ember-deep); }

/* ---------- Lecture pages ---------- */
nav.pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 0 0 1.5rem;
}
nav.pager:last-child { margin: 2rem 0 0; }
nav.pager a {
    display: flex;
    flex-direction: column;
    padding: 0.7rem 1rem;
    text-decoration: none;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    color: var(--ink);
}
nav.pager a:hover { border-color: var(--ember); }
nav.pager a.next { text-align: right; }
nav.pager .dir {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ember-deep);
}
nav.pager .t { font-family: var(--sans); font-weight: 600; }

details.contents {
    margin-bottom: 1.5rem;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 0.6rem 1.1rem;
}
details.contents summary {
    cursor: pointer;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--iron);
}
details.contents ol { columns: 2 16rem; margin: 0.75rem 0 0.25rem; padding-left: 1.4rem; font-size: 0.95rem; }
details.contents li { break-inside: avoid; margin: 0.15rem 0; }
details.contents a { color: var(--ink); text-decoration: none; }
details.contents a:hover { color: var(--ember-deep); text-decoration: underline; }

section.slide {
    position: relative;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 1.1rem clamp(1rem, 3vw, 2rem) 1.25rem;
    margin: 1.25rem 0;
    box-shadow: 0 1px 2px rgba(41, 34, 28, 0.05);
}
section.slide h2 {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0 0 0.5rem;
    padding: 0;
    border: none;
    font-size: 1.3rem;
}
section.slide .num {
    flex: none;
    min-width: 2rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    color: #fff;
    background: var(--ember-deep);
    border-radius: 6px;
}
section.slide ul { padding-left: 1.3rem; margin: 0.4rem 0; }
section.slide li { margin: 0.25rem 0; }
section.slide li::marker { color: var(--ember-deep); }
section.slide img {
    display: block;
    max-width: 100%;
    max-height: 30rem;
    margin: 1rem auto;
    border-radius: 6px;
}

aside.notes {
    margin-top: 1rem;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    color: var(--muted);
    background: var(--paper);
    border-left: 3px solid var(--ember);
    border-radius: 0 6px 6px 0;
}
aside.notes ul { margin: 0; }

table { border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; }
th, td { border: 1px solid var(--rule); padding: 0.35rem 0.7rem; text-align: left; }
th { background: var(--paper); font-family: var(--sans); font-weight: 600; }
caption { font-style: italic; padding-bottom: 0.3rem; }

/* Line charts drawn from slide chart data */
svg.chart { width: 100%; height: auto; margin: 1rem 0; font-size: 12px; font-family: var(--sans); }
svg.chart text { fill: var(--muted); }
svg.chart .grid { stroke: var(--rule); }
svg.chart .zero { stroke: #9a8f82; }
p.legend { font-family: var(--sans); font-size: 0.9rem; }
p.legend span { margin-right: 1rem; }

/* ---------- Quiz pages (pandoc output) ---------- */
article.paper {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: clamp(1rem, 4vw, 2.5rem);
}
article.paper img { max-width: 100%; }
article.paper > :first-child { margin-top: 0; }
article.paper ol, article.paper ul { padding-left: 1.6rem; }

/* ---------- Footer ---------- */
.site-footer {
    max-width: 60rem;
    margin: 0 auto;
    padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 2.5rem;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

/* ---------- Small screens ---------- */
@media (max-width: 40rem) {
    body { font-size: 1rem; }
    .site-nav .links { font-size: 0.82rem; }
    .site-nav .brand { font-size: 0.85rem; letter-spacing: 0.08em; }
    body.home .hero { min-height: 22rem; align-items: flex-end; }
    .hero::after, body.home .hero::after { width: 70%; opacity: 0.18; }
    .quiz-group { grid-template-columns: 1fr; gap: 0.4rem; }
    nav.pager { grid-template-columns: 1fr; }
    nav.pager a.next { text-align: left; }
}
