/* The Cold Hard Truth, The Path To Perfection - Wiki Stylesheet */

:root {
  /* Light mode */
  --color-bg: #ffffff;
  --color-bg-secondary: #f8f9fa;
  --color-text: #1a1a1a;
  --color-text-secondary: #666666;
  --color-border: #e0e0e0;
  --color-accent: #2c3e50;
  --color-accent-light: #ecf0f1;
  --color-accent-muted: #5a6c7d;
  --color-primary: #2c3e50;
  --color-success: #27ae60;
  --color-warning: #e67e22;
  --color-link: #0066cc;
  --color-link-visited: #663399;
  --color-highlight: #fff3cd;
  --color-code-bg: #f5f5f5;
  --color-code-text: #d63384;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-xl: 0 10px 30px rgba(0,0,0,0.15);
}

body.dark-mode {
  /* Dark mode */
  --color-bg: #1a1a1a;
  --color-bg-secondary: #252525;
  --color-text: #e0e0e0;
  --color-text-secondary: #999999;
  --color-border: #333333;
  --color-accent: #ecf0f1;
  --color-accent-light: #2c3e50;
  --color-accent-muted: #a0a8b0;
  --color-primary: #ecf0f1;
  --color-success: #2ecc71;
  --color-warning: #f39c12;
  --color-link: #66b3ff;
  --color-link-visited: #bb99ff;
  --color-highlight: #664d00;
  --color-code-bg: #2a2a2a;
  --color-code-text: #ff9dcc;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-xl: 0 10px 30px rgba(0,0,0,0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 1fr;
  gap: 0;
}

/* Sidebar */
.sidebar {
  background-color: var(--color-accent);
  color: white;
  padding: 2rem 1.5rem;
  overflow-y: auto;
  max-height: 100vh;
  position: sticky;
  top: 0;
  box-shadow: var(--shadow);
}

body.dark-mode .sidebar {
  background-color: #2c3e50;
}

.sidebar-header {
  margin-bottom: 1.5rem;
  border-bottom: 2px solid rgba(255,255,255,0.2);
  padding-bottom: 1rem;
}

.site-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  word-wrap: break-word;
  color: white;
}

.site-subtitle {
  font-size: 0.85rem;
  opacity: 0.95;
  line-height: 1.4;
  color: rgba(255,255,255,0.95);
}

/* Theme Toggle */
.theme-toggle {
  margin: 1rem 0;
  text-align: center;
}

.theme-btn {
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  width: 100%;
}

.theme-btn:hover {
  background: rgba(255,255,255,0.3);
  border-color: white;
}

/* Search */
.search-container {
  margin: 1.5rem 0;
}

.search-input {
  width: 100%;
  padding: 0.7rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.search-input::placeholder {
  color: rgba(255,255,255,0.6);
}

.search-input:focus {
  outline: none;
  background: rgba(255,255,255,0.15);
  border-color: white;
}

.search-results {
  list-style: none;
  margin-top: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.search-results li {
  padding: 0.5rem;
  margin: 0.3rem 0;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  border-left: 3px solid rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-results li:hover {
  background: rgba(255,255,255,0.2);
  border-left-color: white;
}

.search-results a {
  color: white;
  text-decoration: none;
  font-size: 0.9rem;
}

/* Navigation */
.unified-nav {
  display: block;
}

.sidebar-nav {
  margin: 1.5rem 0;
}

.nav-list {
  list-style: none;
}

.nav-section {
  margin: 1.5rem 0 0.5rem 0;
}

.nav-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 1;
  margin-bottom: 0.8rem;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid rgba(255,255,255,0.9);
  padding-left: 1rem;
  color: white;
  font-weight: 600;
  display: block;
}

.nav-section h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.5rem;
  border-left: 3px solid rgba(255,255,255,0.5);
  padding-left: 1rem;
}

.nav-sublist {
  list-style: none;
  margin-left: 0.5rem;
}

.nav-item {
  list-style: none;
}

.nav-link {
  display: block;
  padding: 0.6rem 0.8rem;
  color: rgba(255,255,255,0.95);
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  margin: 0.2rem 0;
  font-weight: 500;
}

.nav-link:hover {
  background: rgba(255,255,255,0.2);
  padding-left: 1.2rem;
  color: white;
}

.nav-link.active {
  background: rgba(255,255,255,0.3);
  font-weight: 700;
  border-left: 3px solid white;
  padding-left: 0.8rem;
  color: white;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 2px solid rgba(255,255,255,0.2);
  font-size: 0.8rem;
  opacity: 0.9;
  color: rgba(255,255,255,0.95);
}

.updated {
  margin: 0;
  font-weight: 500;
}

/* Main Content */
main.content {
  padding: 3rem 4rem;
  overflow-y: auto;
  max-height: 100vh;
  background-color: var(--color-bg);
}

.content-header {
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 1.5rem;
}

.page-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-accent);
  margin: 0;
}

body.dark-mode .page-title {
  color: var(--color-primary);
}

/* Table of Contents */
.table-of-contents {
  background: var(--color-accent-light);
  padding: 1.5rem;
  border-left: 4px solid var(--color-accent);
  border-radius: 4px;
  margin: 2rem 0;
  float: right;
  width: 280px;
  margin-left: 2rem;
}

.table-of-contents h3 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--color-accent);
}

.toc-list {
  list-style: none;
}

.toc-list li {
  margin: 0.5rem 0;
}

.toc-list a {
  color: var(--color-link);
  text-decoration: none;
  font-size: 0.9rem;
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.toc-list a:hover {
  background: rgba(0,0,0,0.05);
  padding-left: 1rem;
}

/* Sidebar Table of Contents */
.sidebar-toc {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.sidebar-toc h3 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Content Body */
.content-body {
  line-height: 1.8;
  font-size: 1.05rem;
  background: var(--color-bg);
  color: var(--color-text);
}

/* Special styling for homepage */
.content-body > h2:first-of-type {
  text-align: center;
  margin-top: 0;
}

/* Question/emphasis boxes */
.content-body strong {
  color: var(--color-accent);
  font-weight: 700;
}

body.dark-mode .content-body strong {
  color: var(--color-primary);
}

.content-body em {
  color: var(--color-accent-muted);
  font-style: italic;
}

body.dark-mode .content-body em {
  color: var(--color-accent-muted);
}

.content-body h2 {
  font-size: 2rem;
  margin: 3rem 0 1.2rem 0;
  color: var(--color-accent);
  border-bottom: 3px solid var(--color-accent);
  padding-bottom: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

body.dark-mode .content-body h2 {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.content-body h3 {
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem 0;
  color: var(--color-accent);
  font-weight: 600;
  letter-spacing: -0.3px;
}

body.dark-mode .content-body h3 {
  color: var(--color-primary);
}

.content-body h4 {
  font-size: 1.25rem;
  margin: 2rem 0 0.8rem 0;
  color: var(--color-text);
  font-weight: 600;
}

body.dark-mode .content-body h4 {
  color: var(--color-primary);
}

.content-body p {
  margin: 1.2rem 0;
  color: var(--color-text);
  line-height: 1.8;
}

.content-body a {
  color: var(--color-link);
  text-decoration: underline;
  transition: opacity 0.2s ease;
  font-weight: 500;
}

.content-body a:hover {
  opacity: 0.8;
}

.content-body a:visited {
  color: var(--color-link-visited);
}

/* Lists */
.content-body ul, .content-body ol {
  margin: 1rem 0 1rem 2rem;
}

.content-body li {
  margin: 0.5rem 0;
}

/* Code */
.content-body code {
  background: var(--color-code-bg);
  color: var(--color-code-text);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: 500;
}

body.dark-mode .content-body code {
  background: #2a2a2a;
  color: #ff9dcc;
}

.content-body pre {
  background: var(--color-code-bg);
  border-left: 4px solid var(--color-accent);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

body.dark-mode .content-body pre {
  background: #2a2a2a;
  border-left-color: var(--color-primary);
}

.content-body pre code {
  background: transparent;
  color: var(--color-text);
  padding: 0;
}

/* Blockquotes */
.content-body blockquote {
  border-left: 5px solid var(--color-accent);
  padding: 1.5rem 2rem;
  background: var(--color-bg-secondary);
  margin: 2rem 0;
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-style: italic;
  color: var(--color-text);
}

body.dark-mode .content-body blockquote {
  border-left-color: var(--color-primary);
  background: #2a2a2a;
}

.content-body blockquote p {
  margin: 0.5rem 0;
  color: inherit;
}

/* Tables */
.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  border-radius: 6px;
  overflow: hidden;
}

.content-body th, .content-body td {
  padding: 1.2rem 1.5rem;
  text-align: left;
  border: 1px solid var(--color-border);
}

.content-body th {
  background: var(--color-accent);
  color: white;
  font-weight: 700;
  letter-spacing: 0.5px;
}

body.dark-mode .content-body th {
  background: #2c3e50;
  color: white;
}

.content-body tr:nth-child(even) {
  background: var(--color-bg-secondary);
}

body.dark-mode .content-body tr:nth-child(even) {
  background: #2a2a2a;
}

.content-body tr:hover {
  background: var(--color-accent-light);
}

body.dark-mode .content-body tr:hover {
  background: #3a4a5a;
}

/* Math expressions (if using MathJax) */
.katex {
  color: var(--color-text);
}

/* Line breaks - equations */
.content-body .math {
  overflow-x: auto;
  margin: 1.5rem 0;
}

/* Content Footer */
.content-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--color-border);
}

.next-prev-nav {
  margin-bottom: 1.5rem;
}

.next-link, .prev-link {
  display: inline-block;
  padding: 0.8rem 1.2rem;
  background: var(--color-accent);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.3s ease;
  margin-right: 1rem;
}

.next-link:hover, .prev-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.print-note {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 1200px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }

  main.content {
    padding: 2rem;
  }

  .table-of-contents {
    float: none;
    width: 100%;
    margin: 1.5rem 0;
  }
}

@media (max-width: 768px) {
  main.content {
    padding: 1.5rem;
  }

  .page-title {
    font-size: 1.8rem;
  }

  .content-body {
    font-size: 1rem;
  }

  .content-body h2 {
    font-size: 1.5rem;
  }

  .content-body h3 {
    font-size: 1.2rem;
  }
}

/* Print Styles */
@media print {
  .sidebar, .theme-toggle, .search-container, .table-of-contents {
    display: none;
  }

  body {
    grid-template-columns: 1fr;
  }

  main.content {
    max-height: none;
    padding: 0;
  }

  .content-body a {
    color: #0066cc;
  }

  .content-body {
    font-size: 12pt;
    line-height: 1.6;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body.dark-mode .card {
  background: #2a2a2a;
  border-color: #444;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

body.dark-mode .card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.card-header {
  background: var(--color-accent);
  color: white;
  padding: 20px;
  position: relative;
}

body.dark-mode .card-header {
  background: #2c3e50;
}

.card-header h3 {
  margin: 0;
  font-size: 1.4em;
  font-weight: 600;
  color: white;
}

.card-tier {
  position: absolute;
  top: 15px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 600;
}

.card-body {
  padding: 20px;
  color: var(--color-text);
}

body.dark-mode .card-body {
  color: #e0e0e0;
}

.card-body p {
  margin: 12px 0;
  line-height: 1.6;
  color: inherit;
}

.card-body strong {
  color: var(--color-accent);
  font-weight: 600;
}

body.dark-mode .card-body strong {
  color: var(--color-primary);
}

/* Diagram Styles */
.diagram {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.diagram img, .diagram svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

body.dark-mode .diagram img,
body.dark-mode .diagram svg {
  filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.1));
}

.diagram + .diagram {
  margin-top: 1rem;
}


/* Diagram Styles */
.diagram {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.diagram img, .diagram svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

body.dark-mode .diagram img,
body.dark-mode .diagram svg {
  filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.1));
}

.diagram + .diagram {
  margin-top: 1rem;
}
