@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600&display=swap');

@media screen {
  html {
    background: #f5f1eb;
  }
  body {
    background: white;
    max-width: 42em;
    margin: 3em auto;
    padding: 2.5em 3em;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
    position: relative;
  }
}

/* download links */
.downloads {
  position: absolute;
  top: 1.8em;
  right: 2em;
  display: flex;
  gap: 1.2em;
}

.downloads a {
  font: 0.7em/1 'Crimson Text', serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: #aaa;
  transition: color 0.2s;
}

.downloads a:hover {
  color: #444;
}

body {
  font: 13pt/1.55 'Crimson Text', 'Georgia', serif;
  color: #1a1a1a;
  hyphens: auto;
}

h1 {
  font: 2.2em/1.1 'Crimson Text', serif;
  font-weight: 400;
  text-align: center;
  margin: 0 0 0.15em;
  letter-spacing: 0.02em;
}

.subtitle {
  text-align: center;
  font-style: italic;
  color: #666;
  margin: 0 0 2em;
  font-size: 0.95em;
}

/* TOC */
.toc {
  border-top: 0.5pt solid #1a1a1a;
  border-bottom: 0.5pt solid #1a1a1a;
  padding: 1em 0;
  margin-bottom: 2em;
}

.toc-label {
  font-variant: small-caps;
  letter-spacing: 0.1em;
  font-size: 0.85em;
  margin-bottom: 0.6em;
}

.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 2em;
  column-rule: 0.2pt solid #ccc;
}

.toc li {
  break-inside: avoid;
  padding: 0.1em 0;
}

.toc a {
  color: inherit;
  text-decoration: none;
  font-size: 0.95em;
}

.toc a:hover {
  text-decoration: underline;
}

.toc .num {
  display: inline-block;
  width: 1.8em;
  text-align: right;
  margin-right: 0.5em;
  color: #999;
  font-size: 0.85em;
}

/* phase headings */
.phase {
  font-variant: small-caps;
  letter-spacing: 0.14em;
  font-size: 1.25em;
  color: #555;
  text-align: center;
  margin: 3.5em 0 1.5em;
  border-bottom: 0.5pt solid #ccc;
  padding-bottom: 0.5em;
}

/* concept entries */
.entry {
  margin-bottom: 1.8em;
  scroll-margin-top: 1em;
}

.entry-head {
  font-weight: 700;
  font-size: 1.05em;
  margin-bottom: 0.2em;
}

.entry-num {
  color: #999;
  font-weight: 400;
  font-size: 0.8em;
  margin-right: 0.3em;
}

.entry p {
  margin: 0.5em 0 0;
  text-indent: 0;
}

/* term highlights */
.term {
  font-weight: 600;
}

.it {
  font-style: italic;
}

/* example blocks */
.ex {
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 0.82em;
  line-height: 1.6;
  background: #faf8f5;
  border-left: 2pt solid #ddd;
  padding: 0.8em 1em;
  margin: 0.6em 0;
  white-space: pre;
  overflow-x: auto;
}

/* definition pairs */
.defs {
  margin: 1.2em 0;
  padding: 0;
  display: grid;
  grid-template-columns: 10em 1fr;
  border-top: 0.5pt solid #e5e5e5;
  border-bottom: 0.5pt solid #e5e5e5;
}

.defs dt {
  font-weight: 600;
  padding: 0.3em 0.5em 0.3em 0;
  border-bottom: 0.3pt solid #eee;
}

.defs dd {
  margin: 0;
  padding: 0.3em 0 0.3em 0.5em;
  border-bottom: 0.3pt solid #eee;
}

.defs dt:nth-of-type(even),
.defs dd:nth-of-type(even) {
  background: #faf8f5;
}

.defs dt:last-of-type,
.defs dd:last-of-type {
  border-bottom: none;
}

/* wider defs for financials */
.defs-wide {
  grid-template-columns: 8em 1fr;
}

/* note */
.note {
  font-style: italic;
  color: #666;
  font-size: 0.92em;
  margin: 0.4em 0;
  text-indent: 0 !important;
}

/* inline citation links */
.entry a {
  color: #555;
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}

.entry a:hover {
  color: #1a1a1a;
  text-decoration-color: #666;
}

.defs a {
  color: #555;
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}

.defs a:hover {
  color: #1a1a1a;
  text-decoration-color: #666;
}

/* SVG chart containers */
.chart {
  display: block;
  margin: 1.5em auto;
  width: 90%;
  height: auto;
}

/* footer */
footer {
  border-top: 0.5pt solid #1a1a1a;
  margin-top: 3em;
  padding-top: 0.8em;
  text-align: center;
  font-size: 0.8em;
  color: #999;
}

footer a {
  color: #666;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* print */
@media print {
  html, body {
    background: white;
    margin: 0;
    padding: 0;
    box-shadow: none;
    font-size: 10pt;
    max-width: none;
  }
  body {
    padding: 0.5in;
  }
  .phase {
    margin-top: 1.5em;
    page-break-after: avoid;
  }
  .entry-head {
    break-after: avoid;
  }
  .toc {
    page-break-after: always;
  }
  .toc ol {
    columns: 2;
  }
  .sources a {
    color: #444;
    border-bottom: none;
  }
  .sources a::after {
    content: " (" attr(href) ")";
    font-size: 0.7em;
    color: #999;
    word-break: break-all;
    display: none; /* keep URLs hidden in print for cleanliness */
  }
  footer {
    page-break-before: always;
  }
  a {
    color: inherit;
    text-decoration: none;
  }
}

@media (max-width: 600px) {
  body { padding: 1.5em; font-size: 12pt; }
  .toc ol { columns: 1; }
  .defs { grid-template-columns: 1fr; }
  .defs dt { padding-bottom: 0; border-bottom: none; }
  .defs dd { padding-top: 0; }
}
