/*
 * Berta Chapters - Intentional 1990s Web Style
 * Sober, functional, retro. Content over chrome.
 * HIGH CONTRAST: black text on white backgrounds throughout.
 */

/* Override Material theme color variables for guaranteed contrast */
:root,
[data-md-color-scheme="default"] {
  --md-default-fg-color: #000000;
  --md-default-fg-color--light: #333333;
  --md-default-fg-color--lighter: #555555;
  --md-default-fg-color--lightest: #808080;
  --md-default-bg-color: #ffffff;
  --md-default-bg-color--light: #f5f5f5;
  --md-default-bg-color--lighter: #eeeeee;
  --md-default-bg-color--lightest: #e0e0e0;
  --md-primary-fg-color: #003366;
  --md-primary-fg-color--light: #004488;
  --md-primary-fg-color--dark: #002244;
  --md-primary-bg-color: #ffffff;
  --md-accent-fg-color: #008080;
  --md-typeset-color: #000000;
  --md-typeset-a-color: #0000ee;
  --md-code-bg-color: #f5f5dc;
  --md-code-fg-color: #333333;
  --md-code-hl-color: #ffffcc;
  --md-footer-bg-color: #003366;
  --md-footer-fg-color: #ffffff;
  --md-footer-fg-color--light: #cccccc;
  --md-footer-fg-color--lighter: #aaaaaa;
}

/* Dark mode: cream text on dark backgrounds */

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

body,
.md-typeset,
.md-typeset p,
.md-typeset li,
.md-typeset td,
.md-typeset th {
  font-family: "Times New Roman", Times, Georgia, serif !important;
  font-size: 16px !important;
  line-height: 1.6 !important;
}

code, pre,
.md-typeset code,
.md-typeset pre,
.md-typeset pre code {
  font-family: "Courier New", Courier, monospace !important;
  font-size: 14px !important;
}

/* ============ MAIN LAYOUT ============ */

.md-main {
  background: #d4d0c8 !important;
}

.md-content {
  background: #ffffff !important;
  color: #000000 !important;
  border: 2px solid #808080 !important;
  padding: 20px !important;
  margin: 10px !important;
}

/* Force text color on all content elements */
.md-typeset {
  color: #000000 !important;
}

/* ============ HEADER ============ */

.md-header {
  background: #003366 !important;
  box-shadow: none !important;
  border-bottom: 3px solid #001a33 !important;
  backdrop-filter: none !important;
  color: #ffffff !important;
}

.md-header__title,
.md-header__topic,
.md-header .md-ellipsis {
  font-family: "Times New Roman", Times, serif !important;
  font-weight: bold !important;
  font-size: 20px !important;
  color: #ffffff !important;
}

.md-header__button {
  color: #ffffff !important;
}

/* ============ NAVIGATION TABS (top bar) ============ */

.md-tabs {
  background: #002244 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.md-tabs__link {
  color: #cccccc !important;
  font-family: "Times New Roman", Times, serif !important;
  font-weight: bold !important;
  opacity: 1 !important;
}

.md-tabs__link:hover,
.md-tabs__link--active {
  color: #ffffff !important;
}

/* ============ SIDEBAR ============ */

.md-sidebar {
  background: #c0c0c0 !important;
  border-right: 2px solid #808080 !important;
}

.md-nav__link {
  font-family: "Times New Roman", Times, serif !important;
  color: #0000ee !important;
  text-decoration: underline !important;
}

.md-nav__link:hover {
  color: #cc0000 !important;
}

.md-nav__link--active,
.md-nav__item--active > .md-nav__link {
  font-weight: bold !important;
  color: #000000 !important;
}

.md-nav__item--nested > .md-nav__link,
.md-nav__item--section > .md-nav__link {
  color: #333333 !important;
  font-weight: bold !important;
}

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

.md-typeset a,
.md-typeset a:link {
  color: #0000ee !important;
  text-decoration: underline !important;
}

.md-typeset a:visited {
  color: #551a8b !important;
}

.md-typeset a:hover {
  color: #cc0000 !important;
}

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

.md-typeset h1 {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 28px !important;
  font-weight: bold !important;
  border-bottom: 3px double #808080 !important;
  padding-bottom: 8px !important;
  color: #003366 !important;
}

.md-typeset h2 {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 22px !important;
  font-weight: bold !important;
  border-bottom: 1px solid #808080 !important;
  padding-bottom: 4px !important;
  color: #006666 !important;
}

.md-typeset h3 {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 18px !important;
  font-weight: bold !important;
  color: #333333 !important;
}

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

.md-typeset table {
  border-collapse: collapse !important;
  border: 2px solid #000000 !important;
  width: 100% !important;
  font-size: 14px !important;
}

.md-typeset table th {
  background: #003366 !important;
  color: #ffffff !important;
  border: 1px solid #000000 !important;
  padding: 6px 10px !important;
  font-weight: bold !important;
  text-align: left !important;
}

.md-typeset table td {
  border: 1px solid #808080 !important;
  padding: 6px 10px !important;
  background: #ffffff !important;
  color: #000000 !important;
}

.md-typeset table tr:nth-child(even) td {
  background: #f0f0f0 !important;
}

/* ============ CODE BLOCKS ============ */

.md-typeset pre {
  background: #f5f5dc !important;
  border: 2px inset #808080 !important;
  border-radius: 0 !important;
  padding: 12px !important;
  color: #333333 !important;
}

.md-typeset code {
  background: #f5f5dc !important;
  border: 1px solid #cccccc !important;
  border-radius: 0 !important;
  padding: 1px 4px !important;
  color: #333333 !important;
}

/* ============ ADMONITIONS ============ */

.md-typeset .admonition,
.md-typeset details {
  border-radius: 0 !important;
  border: 2px solid #808080 !important;
  box-shadow: none !important;
  color: #000000 !important;
  background: #ffffff !important;
}

.md-typeset .admonition p,
.md-typeset details p {
  color: #000000 !important;
}

.md-typeset .admonition-title,
.md-typeset summary {
  border-radius: 0 !important;
  font-family: "Times New Roman", Times, serif !important;
  font-weight: bold !important;
  color: #000000 !important;
}

/* ============ BUTTONS ============ */

.md-typeset .md-button,
.md-search__form,
.md-search__input {
  border-radius: 0 !important;
}

.md-typeset .md-button {
  border: 2px outset #808080 !important;
  background: #c0c0c0 !important;
  color: #000000 !important;
  font-family: "Times New Roman", Times, serif !important;
  font-weight: bold !important;
  text-decoration: none !important;
  padding: 6px 16px !important;
  box-shadow: none !important;
}

.md-typeset .md-button:hover {
  background: #d4d0c8 !important;
  border-style: inset !important;
  color: #000000 !important;
}

.md-typeset .md-button--primary {
  background: #008080 !important;
  color: #ffffff !important;
  border-color: #006666 !important;
}

.md-typeset .md-button--primary:hover {
  background: #006666 !important;
  color: #ffffff !important;
}

/* ============ FOOTER ============ */

.md-footer {
  background: #003366 !important;
  border-top: 3px solid #001a33 !important;
  color: #ffffff !important;
}

.md-footer a,
.md-footer-meta a {
  color: #aaccff !important;
}

.md-footer__link,
.md-footer__title {
  color: #ffffff !important;
}

.md-copyright {
  color: #cccccc !important;
}

.md-copyright a {
  color: #aaccff !important;
}

/* ============ SEARCH ============ */

.md-search__form {
  border: 2px inset #808080 !important;
  background: #ffffff !important;
}

.md-search__input {
  color: #000000 !important;
  font-family: "Times New Roman", Times, serif !important;
}

.md-search__input::placeholder {
  color: #808080 !important;
}

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

.md-typeset hr {
  border: none !important;
  border-top: 2px solid #808080 !important;
  margin: 20px 0 !important;
}

/* ============ TABS ============ */

.md-typeset .tabbed-labels > label {
  border-radius: 0 !important;
  font-family: "Times New Roman", Times, serif !important;
  color: #333333 !important;
}

.md-typeset .tabbed-labels > label:hover {
  color: #000000 !important;
}

/* ============ MISC MATERIAL OVERRIDES ============ */

.md-typeset .highlight code,
.md-typeset .highlighttable {
  border-radius: 0 !important;
  box-shadow: none !important;
}

.md-typeset .headerlink {
  color: #808080 !important;
}

.md-typeset .md-typeset__scrollwrap {
  overflow-x: auto;
}

/* TOC right sidebar */
.md-sidebar--secondary .md-nav__link {
  color: #333333 !important;
  font-size: 13px !important;
}

/* ============ RETRO CUSTOM COMPONENTS ============ */

.hero {
  text-align: center;
  padding: 20px 10px;
  background: #ffffcc !important;
  border: 2px solid #808080;
  margin-bottom: 20px;
  color: #000000 !important;
}

.hero h1 {
  font-size: 32px !important;
  color: #003366 !important;
  border-bottom: none !important;
  margin-bottom: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0;
  margin: 20px 0;
  border: 2px solid #000000;
}

.stat-card {
  text-align: center;
  padding: 12px 8px;
  border: 1px solid #808080;
  background: #ffffff !important;
  color: #000000 !important;
}

.stat-card .number {
  font-size: 28px;
  font-weight: bold;
  color: #008080 !important;
  font-family: "Courier New", Courier, monospace;
}

.stat-card .label {
  font-size: 12px;
  color: #333333 !important;
  margin-top: 2px;
}

.chapter-card {
  padding: 10px;
  border: 2px solid #808080;
  border-left: 6px solid #008080;
  background: #ffffff !important;
  margin-bottom: 10px;
  color: #000000 !important;
}

.chapter-card:hover {
  background: #ffffcc !important;
}

.track-badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid #000000;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: "Courier New", Courier, monospace;
  color: #000000 !important;
}

.track-badge.foundation { background: #ccddff; }
.track-badge.practitioner { background: #eeccff; }
.track-badge.advanced { background: #ccffcc; }

.cta-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 20px 0;
}

/* Newsletter form */
.newsletter-form {
  background: #ffffff !important;
  border: 2px inset #808080;
  padding: 20px;
  max-width: 500px;
  margin: 20px auto;
  color: #000000 !important;
}

/* Playground */
.playground-container {
  border: 2px solid #000000;
  background: #ffffff;
  margin: 20px 0;
}

.playground-header {
  background: #003366;
  color: #ffffff !important;
  padding: 6px 12px;
  font-weight: bold;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  border-bottom: 2px solid #000000;
}

.playground-editor {
  width: 100%;
  min-height: 200px;
  font-family: "Courier New", Courier, monospace !important;
  font-size: 14px;
  padding: 10px;
  border: none;
  border-bottom: 2px solid #808080;
  background: #f5f5dc !important;
  color: #333333 !important;
  resize: vertical;
  box-sizing: border-box;
  tab-size: 4;
}

.playground-toolbar {
  padding: 6px 10px;
  background: #c0c0c0;
  border-bottom: 2px solid #808080;
}

.playground-toolbar button {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  font-weight: bold;
  padding: 4px 14px;
  margin-right: 6px;
  border: 2px outset #808080;
  cursor: pointer;
  border-radius: 0;
}

.playground-toolbar .run-btn {
  background: #006600;
  color: #ffffff !important;
  border-color: #004400;
}

.playground-toolbar .clear-btn {
  background: #c0c0c0;
  color: #000000 !important;
}

.playground-toolbar .run-btn:hover,
.playground-toolbar .clear-btn:hover {
  border-style: inset;
}

.playground-output {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  padding: 10px;
  min-height: 80px;
  background: #000000 !important;
  color: #00ff00 !important;
  white-space: pre-wrap;
  overflow-x: auto;
}

.playground-output .error {
  color: #ff4444 !important;
}

.playground-output .error-explain {
  color: #ffcc00 !important;
  font-style: italic;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #444444;
}

.playground-status {
  padding: 4px 10px;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  background: #c0c0c0;
  border-top: 1px solid #808080;
  color: #333333 !important;
}

.exercise-select {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  padding: 3px 8px;
  border: 2px inset #808080;
  background: #ffffff;
  color: #000000 !important;
  border-radius: 0;
}

.visitor-counter {
  text-align: center;
  margin: 20px 0;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  color: #666666 !important;
}

.retro-banner {
  background: #ffffcc !important;
  border: 2px dashed #996600;
  padding: 8px 16px;
  text-align: center;
  font-weight: bold;
  margin: 10px 0;
  color: #333333 !important;
}
