
/* Charter font from CDN */
@import url('https://cdn.jsdelivr.net/npm/charter-webfont@latest/charter.css');

/* Concourse Index font for custom bullets */
@font-face {
  font-family: "concourse-index";
  src: url("fonts/concourse_index_regular.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
}

/* =============================================================================
   CSS CUSTOM PROPERTIES (Variables)
   ============================================================================= */

:root {
  /* 
   * FONT SIZE: 15-25 pixels on the web
   * Using 18px as a comfortable middle ground
   */
  --body-font-size: 22px;
  
  /* 
   * LINE SPACING: 120-145% of point size
   * Using 1.4 (140%) as a comfortable reading line-height
   */
  --body-line-height: 1.4;
  
  /* 
   * LINE LENGTH: 45-90 characters average
   * ~65ch is ideal (roughly 2-3 lowercase alphabets)
   */
  --max-line-length: 60ch;
  
  /* 
   * PARAGRAPH SPACING: 50-100% of body text size
   * Or use first-line indents instead (not both!)
   */
  --paragraph-spacing: 0.75em;
  
  /* 
   * FIRST-LINE INDENT: 1-4x the point size
   * Only use if NOT using paragraph spacing
   */
  --first-line-indent: 1.5em;
  
  /* 
   * COLORS: Dark gray instead of pure black for screen reading
   * Pure black (#000) has too much contrast on screens
   */
  --text-color: #333333;
  --text-color-secondary: #555555;
  --background-color: #ffffff;
  --link-color: #0066cc;
  --link-hover-color: #004499;
  
  /* 
   * LETTERSPACING: 5-12% extra for all caps and small caps
   * 0.05em to 0.12em
   */
  --caps-letter-spacing: 0.05em;
  
  /* 
   * HEADING SIZES: Use the smallest increment necessary
   */
  --h1-size: 1.75em;
  --h2-size: 1.4em;
  --h3-size: 1.2em;
  --h4-size: 1.1em;
  --h5-size: 1em;
  --h6-size: 1em;
  
  /* Spacing for headings: space above and below is the best way to emphasize */
  --heading-margin-top: 1.5em;
  --heading-margin-bottom: 0.5em;
  
  /* Block quotation indents: 0.5-1 inch, or 2-5em on web */
  --blockquote-indent: 2.5em;
}


/* =============================================================================
   BASE TYPOGRAPHY
   ============================================================================= */

html {
  /* Improve text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  
  /* Enable kerning*/
  font-kerning: normal;
  font-feature-settings: "kern" 1;
}

body {
  /* 
   * Using Charter as the primary font for body text
   */
  font-family: "Charter", serif;
  
  font-size: var(--body-font-size);
  line-height: var(--body-line-height);
  color: var(--text-color);
  background-color: var(--background-color);
  
  /* Enable ligatures for professional typography */
  font-variant-ligatures: common-ligatures;
  font-feature-settings: "liga" 1, "clig" 1;
}


/* =============================================================================
   MAIN CONTENT CONTAINER
   ============================================================================= */

/* 
 * LINE LENGTH: Average 45-90 characters
 */
main,
article,
.content,
.text-content {
  max-width: var(--max-line-length);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  margin-top: 6rem;
  margin-bottom: 6rem;
  overflow: visible;
}


/* =============================================================================
   PARAGRAPHS
   ============================================================================= */

p {
  /* 
   * SPACE BETWEEN PARAGRAPHS: Use EITHER spacing OR first-line indents
   * Don't use both - that's redundant
   * This stylesheet uses spacing by default
   */
  margin-top: 0;
  margin-bottom: var(--paragraph-spacing);
  
  /* Hyphenation: Optional for left-aligned text, helps even the rag */
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 6 3 2;
}

/* 
 * ALTERNATIVE: First-line indents instead of paragraph spacing
 * Uncomment this section and comment out the paragraph spacing above
 * to use indents instead
 */
/*
p {
  margin-top: 0;
  margin-bottom: 0;
  text-indent: var(--first-line-indent);
}

p:first-of-type,
h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p,
hr + p,
blockquote + p {
  text-indent: 0;
}
*/


/* =============================================================================
   HEADINGS
   ============================================================================= */

/* 
 * HEADINGS: 
 * - Use bold, not italic (bold is easier to read)
 * - Don't underline (never underline except for links)
 * - Don't center (use sparingly if at all)
 * - Space above and below is the best emphasis
 * - Size increases should be subtle
 */
h1, h2, h3, h4, h5, h6 {
  font-family: "Charter", serif;
  
  font-weight: bold;
  font-style: normal;
  text-decoration: none;
  
  /* Space above and below for emphasis */
  margin-top: var(--heading-margin-top);
  margin-bottom: var(--heading-margin-bottom);
  
  /* Slightly tighter line-height for headings */
  line-height: 1.2;
  
  /* Enable kerning */
  font-kerning: normal;
}

h1 {
  font-size: var(--h1-size);
  margin-top: 0; /* First heading typically doesn't need top margin */
}

h2 {
  font-size: var(--h2-size);
}

h3 {
  font-size: var(--h3-size);
}

h4 {
  font-size: var(--h4-size);
}

h5 {
  font-size: var(--h5-size);
  font-weight: bold;
}

h6 {
  font-size: var(--h6-size);
  font-weight: bold;
  font-style: italic;
}


/* =============================================================================
   LINKS
   ============================================================================= */

/* 
 * UNDERLINING: Never underline except for web links
 * Color remains the idiomatic way to denote clickability on the web
 */
a {
  color: #07a;
  text-decoration: none;
  /*text-underline-offset: 0.15em;*/
  transition: background-color 0.1s;
}

a:hover,
a:focus {
  /*color: var(--link-hover-color);*/
  background-color: #f2f8fa;
  border-radius: 4px;
}

/*a:visited {
  color: #663399;
}*/

/* =============================================================================
   EMPHASIS: BOLD AND ITALIC
   ============================================================================= */

/* 
 * BOLD OR ITALIC: Use as little as possible, and not together
 */
strong, b {
  font-weight: bold;
}

em, i {
  font-style: italic;
}

/* Never use both together */
strong em, em strong,
b i, i b {
  /* If you must, at least don't stack the emphasis */
  font-weight: bold;
  font-style: normal;
}


/* =============================================================================
   ALL CAPS AND SMALL CAPS
   ============================================================================= */

/* 
 * ALL CAPS: Fine for less than one line of text
 * Always add 5-12% letterspacing
 * Make sure kerning is on
 */
.all-caps,
.caps {
  text-transform: uppercase;
  letter-spacing: var(--caps-letter-spacing);
  font-kerning: normal;
}

/* 
 * SMALL CAPS: Use real small caps if available
 * font-variant: small-caps is now safe to use (accesses OpenType if available)
 * Always add letterspacing
 */
.small-caps {
  font-variant: small-caps;
  font-variant-caps: small-caps;
  letter-spacing: var(--caps-letter-spacing);
  font-kerning: normal;
}

/* For abbreviations and acronyms */
abbr {
  font-variant: small-caps;
  font-variant-caps: small-caps;
  letter-spacing: var(--caps-letter-spacing);
  text-decoration: none;
}


/* =============================================================================
   BLOCK QUOTATIONS
   ============================================================================= */

/* 
 * BLOCK QUOTATIONS:
 * - Reduce point size and line spacing slightly
 * - Indent 0.5-1 inch (2-5em on web)
 * - Don't put quotation marks at the ends (they're redundant)
 */
blockquote {
  font-size: 0.95em;
  line-height: 1.35;
  margin-top: var(--paragraph-spacing);
  margin-bottom: var(--paragraph-spacing);
  margin-left: var(--blockquote-indent);
  margin-right: var(--blockquote-indent);
  padding: 0;
  border: none;
  color: var(--text-color-secondary);
}

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


/* =============================================================================
   LISTS
   ============================================================================= */

/* 
 * BULLETED AND NUMBERED LISTS:
 * Proper spacing and alignment
 */
ul, ol {
  margin-top: var(--paragraph-spacing);
  margin-bottom: var(--paragraph-spacing);
  padding-left: 1.5em;
}

li {
  margin-bottom: 0.25em;
}

li:last-child {
  margin-bottom: 0;
}

/* Nested lists */
li ul, li ol {
  margin-top: 0.25em;
  margin-bottom: 0;
}

/* Important callout with arrow bullets */
.important ul {
  list-style: none;
  padding-left: 2.5rem;
}

.important li {
  position: relative;
}

.important li::before {
  font-family: "concourse-index";
  content: "•";
  position: absolute;
  left: -2.5rem;
  margin-top: 0.1rem;
}


/* =============================================================================
   CODE AND MONOSPACE
   ============================================================================= */

/* 
 * MONOSPACED FONTS: Avoid for body text
 * Only use for code, technical content, or tabular numbers
 */
code, kbd, samp, pre {
  font-family: "SF Mono", "Consolas", "Liberation Mono", "Menlo", monospace;
  font-size: 0.9em;
}

pre {
  margin-top: var(--paragraph-spacing);
  margin-bottom: var(--paragraph-spacing);
  padding: 1em;
  overflow-x: auto;
  background-color: #f5f5f5;
  border-radius: 3px;
  line-height: 1.4;
}

code {
  padding: 0.1em 0.3em;
  background-color: #f5f5f5;
  border-radius: 3px;
}

pre code {
  padding: 0;
  background: none;
}


/* =============================================================================
   TABLES
   ============================================================================= */

table {
  border-collapse: collapse;
  width: 100%;
  margin-top: var(--paragraph-spacing);
  margin-bottom: var(--paragraph-spacing);
  font-size: 0.95em;
}

th, td {
  padding: 0.5em 1em;
  text-align: center;
}

th {
  background-color: #f5f5f5;
  font-weight: bold;
  border-bottom: 1px solid #ddd;
  border-top: 1px solid #ddd;
}

tbody tr:last-child td {
  border-bottom: 1px solid #ddd;
}

/* Use tabular (lining) figures in tables for alignment */
td {
  font-variant-numeric: tabular-nums lining-nums;
}


/* =============================================================================
   SYLLABUS TABLES
   ============================================================================= */

/*
 * This code is for formating course syllabi tables, which have slightly different
 * formatting than standard tables.
*/ 

.syllabus table {
  width: 100%;
  border-collapse: collapse;
}

.syllabus th {
  background-color: #f5f5f5;
  text-align: left;
  font-weight: bold;
  border-bottom: 1px solid #ddd;
  border-top: 1px solid #ddd;
}

.syllabus td {
  text-align: left;
  border-bottom: 1px solid #eee;
}

/*.syllabus tbody tr:nth-child(even) {
  background-color: #fafafa;
}*/

/*.syllabus tbody tr:hover {
  background-color: #f0f0f0;
}*/


/* =============================================================================
   HORIZONTAL RULES
   ============================================================================= */

/* 
 * RULES & BORDERS: Use sparingly
 */
hr {
  border: none;
  border-top: 1px solid #ddd;
  margin-top: calc(var(--paragraph-spacing) * 2);
  margin-bottom: calc(var(--paragraph-spacing) * 2);
}


/* =============================================================================
   FIGURES AND CAPTIONS
   ============================================================================= */

figure {
  margin: var(--paragraph-spacing) 0;
  text-align: center;
}

figure img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

figcaption {
  font-size: 0.9em;
  color: var(--text-color-secondary);
  margin-top: 0.5em;
}


/* =============================================================================
   TABLE CAPTIONS
   ============================================================================= */

caption {
  font-size: 0.9em;
  color: var(--text-color-secondary);
  caption-side: top;
  text-align: center;
  margin-bottom: 0.5em;
}


/* =============================================================================
   JUSTIFIED TEXT (Optional)
   ============================================================================= */

/* 
 * JUSTIFIED TEXT: 
 * - Personal preference (left-aligned is also fine)
 * - If using justified text, hyphenation is MANDATORY
 * - Word processors/browsers have basic justification; left-align may look better
 */
.justified {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 6 3 2;
  
  /* Modern CSS for better justification */
  text-wrap: pretty;
}


/* =============================================================================
   CENTERED TEXT
   ============================================================================= */

/* 
 * CENTERED TEXT: Use sparingly
 * Acceptable for: short phrases, headings, titles
 * Never center long passages of text
 */
.centered {
  text-align: center;
}


/* =============================================================================
   SPECIAL CHARACTERS AND TYPOGRAPHY
   ============================================================================= */

/* 
 * Ensure proper rendering of special characters
 * Curly quotes, em dashes, etc. should be used in HTML content
 */

/* Prevent orphans and widows where supported */
p, li, blockquote {
  orphans: 2;
  widows: 2;
}

/* Keep headings with following content */
h1, h2, h3, h4, h5, h6 {
  break-after: avoid;
  page-break-after: avoid;
}


/* =============================================================================
   RESPONSIVE TYPOGRAPHY
   ============================================================================= */

/* 
 * RESPONSIVE WEB DESIGN:
 * Line length must be controlled at all screen sizes
 */


/* Smaller screens: slightly smaller text, maintained line length */
/*
@media (max-width: 600px) {
  :root {
    --body-font-size: 16px;
    --max-line-length: 90vw;
  }
  
  body {
    -webkit-hyphens: auto;
    hyphens: auto;
  }
}*/

/* Larger screens: ensure text doesn't stretch too wide */
/*@media (min-width: 1200px) {
  :root {
    --body-font-size: 19px;
  }
}*/
@media all and (min-width:1000px) { html { font-size: 24px; } }
@media all and (max-width:480px) { html{ font-size: 11px; } }



/* =============================================================================
   PRINT STYLES
   ============================================================================= */

@media print {
  :root {
    /* Print uses 10-12 point, roughly 13-16px */
    --body-font-size: 12pt;
    /* Print uses black text, not gray */
    --text-color: #000000;
  }
  
  body {
    background: white;
    color: black;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  /* Better print margins */
  @page {
    margin: 1in;
  }
}


/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */

/* For when you need to override */
.no-hyphenation {
  -webkit-hyphens: none;
  hyphens: none;
}

.hyphenate {
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* Prevent line breaks (for proper names, etc.) */
.nowrap {
  white-space: nowrap;
}

/* For text that should never be underlined */
.no-underline {
  text-decoration: none !important;
}

/* Wide elements that break out of the 60ch container
   This is for JS widgets so they can span a width greater than the text
   Use --wide-max-width inline to override the default, e.g.:
   <div class="wide" style="--wide-max-width: 70ch"></div>
*/

.wide {
  --wide-max-width: 90ch;
  width: 100vw;
  max-width: var(--wide-max-width);
  position: relative;
  left: 50%;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* =============================================================================
   SPACER
   ============================================================================= */

.spacer {
  display: block;
  height: var(--h, 1in);
}


/* =============================================================================
   TABLE OF CONTENTS
   ============================================================================= */

#TOC ul {
  list-style-type: none;
}


/* =============================================================================
   BREADCRUMB
   ============================================================================= */

.breadcrumb {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px dotted gray;
}

.pdf-link {
  margin-left: auto;
}


/* =============================================================================
   CODE DOWNLOAD BUTTON
   ============================================================================= */

div.sourceCode[data-filename] {
  position: relative;
}

.code-download-btn {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25em;
  opacity: 0;
  transition: opacity 0.2s;
  color: var(--text-color-secondary);
  border-radius: 3px;
}

div.sourceCode[data-filename]:hover .code-download-btn {
  opacity: 1;
}

.code-download-btn:hover {
  background-color: #e0e0e0;
}


/* =============================================================================
   IMAGE DOWNLOAD BUTTON
   ============================================================================= */

.downloadable-image {
  position: relative;
  display: block;
}

.image-download-btn {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  cursor: pointer;
  padding: 0.25em;
  opacity: 0;
  transition: opacity 0.2s;
  color: var(--text-color-secondary);
  border-radius: 3px;
  text-decoration: none;
  line-height: 1;
}

.downloadable-image:hover .image-download-btn {
  opacity: 1;
}

.image-download-btn:hover {
  background-color: #e0e0e0;
}


