/* Peak Brain Client Resources - Custom Styles */
/* Modern, clean, welcoming design with excellent readability */

:root {
  /* Peak Brain brand colors - warmer for clients */
  --pb-primary: #2563eb;           /* Bright blue */
  --pb-primary-light: #3b82f6;     /* Lighter blue */
  --pb-accent: #f59e0b;            /* Warm amber */
  --pb-accent-dark: #d97706;       /* Deep amber */
  --pb-surface: #f8fafc;           /* Light surface */
  --pb-text: #1e293b;              /* Dark text */
  --pb-muted: #64748b;             /* Muted gray */
  
  /* Light mode overrides */
  --md-primary-fg-color: var(--pb-primary);
  --md-primary-fg-color--light: var(--pb-primary-light);
  --md-primary-fg-color--dark: #1d4ed8;
  --md-accent-fg-color: var(--pb-accent-dark);
  --md-typeset-a-color: var(--pb-primary-light);
}

/* Dark mode (slate) overrides */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: #0f172a;
  --md-default-fg-color: #e2e8f0;
  --md-primary-fg-color: #60a5fa;
  --md-primary-fg-color--light: #93c5fd;
  --md-accent-fg-color: var(--pb-accent);
  --md-typeset-a-color: #60a5fa;
  --md-code-bg-color: #1e293b;
  --md-footer-bg-color: #0f172a;
  --md-footer-bg-color--dark: #020617;
}

/* Typography improvements - clean and readable */
.md-typeset {
  font-size: 1rem;
  line-height: 1.7;
  letter-spacing: -0.01em;
}

/* Base font size */
:root {
  --md-typeset-font-size: 1rem;
}

.md-typeset h1 {
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  color: var(--md-primary-fg-color);
  font-size: 2.2rem;
}

.md-typeset h2 {
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--md-primary-fg-color--light);
  font-size: 1.6rem;
}

.md-typeset h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2rem;
  color: var(--pb-primary-light);
  font-size: 1.25rem;
}

[data-md-color-scheme="slate"] .md-typeset h3 {
  color: #93c5fd;
}

/* Content width and spacing */
.md-content__inner {
  max-width: 65rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* Narrower sidebars for more content space */
@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
    width: 10rem;
  }
  .md-sidebar--secondary {
    width: 11rem;
  }
  .md-sidebar--primary .md-sidebar__scrollwrap {
    width: 10rem;
  }
  .md-sidebar--secondary .md-sidebar__scrollwrap {
    width: 11rem;
  }
}

/* Card-like sections for better visual hierarchy */
.md-typeset .admonition,
.md-typeset details {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  margin: 1.5rem 0;
  overflow: hidden;
}

.md-typeset .admonition-title,
.md-typeset summary {
  font-weight: 600;
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

/* Beautiful tables */
.md-typeset table:not([class]) {
  border: none;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin: 1.5rem 0;
}

.md-typeset table:not([class]) th {
  background: var(--pb-primary);
  color: white;
  font-weight: 600;
  padding: 0.875rem 1.1rem;
  text-align: left;
  font-size: 0.95rem;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  background: #1e40af;
}

.md-typeset table:not([class]) td {
  padding: 0.875rem 1.1rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* First column wider to prevent wrapping */
.md-typeset table:not([class]) td:first-child,
.md-typeset table:not([class]) th:first-child {
  min-width: 12rem;
  white-space: nowrap;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) td {
  border-bottom-color: #334155;
}

.md-typeset table:not([class]) tr:last-child td {
  border-bottom: none;
}

.md-typeset table:not([class]) tr:hover td {
  background: rgba(37, 99, 235, 0.05);
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) tr:hover td {
  background: rgba(96, 165, 250, 0.08);
}

/* Code blocks */
.md-typeset pre {
  border-radius: 8px;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}

.md-typeset code {
  border-radius: 4px;
  padding: 0.2em 0.45em;
  font-size: 0.9em;
}

/* Lists with better spacing */
.md-typeset ul,
.md-typeset ol {
  margin-left: 0.5rem;
}

.md-typeset li {
  margin-bottom: 0.6rem;
  line-height: 1.8;
}

.md-typeset li > p {
  margin: 0.25rem 0;
}

/* Task lists - checkboxes */
.md-typeset .task-list-item {
  list-style: none;
}

.md-typeset .task-list-item input[type="checkbox"] {
  margin-right: 0.6rem;
  transform: scale(1.2);
}

/* Navigation styling */
.md-nav__link {
  font-size: 0.85rem;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.md-nav__link:hover {
  background: rgba(37, 99, 235, 0.08);
}

[data-md-color-scheme="slate"] .md-nav__link:hover {
  background: rgba(96, 165, 250, 0.1);
}

.md-nav__link--active {
  font-weight: 600;
  background: rgba(37, 99, 235, 0.1);
}

/* Header */
.md-header {
  background: var(--pb-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

[data-md-color-scheme="slate"] .md-header {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
}

.md-header__title {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Search */
.md-search__input {
  border-radius: 8px;
  font-size: 0.95rem;
}

.md-search__input::placeholder {
  opacity: 0.7;
}

/* Footer */
.md-footer {
  margin-top: 3rem;
  background: var(--pb-primary);
}

[data-md-color-scheme="slate"] .md-footer {
  background: #0f172a;
  border-top: 1px solid #1e293b;
}

.md-footer__inner {
  padding: 1.5rem;
}

/* Smooth transitions */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Tabs navigation */
.md-tabs {
  background: var(--pb-primary);
}

[data-md-color-scheme="slate"] .md-tabs {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
}

.md-tabs__link {
  font-weight: 500;
  opacity: 0.85;
  font-size: 0.9rem;
}

.md-tabs__link--active,
.md-tabs__link:hover {
  opacity: 1;
}

/* TOC styling - right sidebar */
.md-nav--secondary .md-nav__link {
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
}

/* TOC header */
.md-nav--secondary > .md-nav__title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  font-weight: 600;
}

/* Left sidebar navigation */
.md-sidebar--primary .md-nav__link {
  font-size: 0.85rem;
}

/* Sidebar section titles */
.md-nav__item--nested > .md-nav__link {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Horizontal rule - gradient for visual appeal */
.md-typeset hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, var(--pb-primary-light), transparent);
  margin: 2.5rem 0;
}

[data-md-color-scheme="slate"] .md-typeset hr {
  background: linear-gradient(to right, #3b82f6, transparent);
}

/* Grid cards on homepage */
.md-typeset .grid.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.md-typeset .grid.cards > ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: contents;
}

.md-typeset .grid.cards > ul > li {
  background: var(--pb-surface);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(37, 99, 235, 0.1);
}

[data-md-color-scheme="slate"] .md-typeset .grid.cards > ul > li {
  background: #1e293b;
  border-color: #334155;
}

.md-typeset .grid.cards > ul > li:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.12);
  border-color: var(--pb-primary);
}

/* Warning/tip/note styling */
.md-typeset .admonition.warning,
.md-typeset details.warning {
  border-left: 4px solid #f59e0b;
}

.md-typeset .admonition.tip,
.md-typeset details.tip {
  border-left: 4px solid #10b981;
}

.md-typeset .admonition.note,
.md-typeset details.note {
  border-left: 4px solid #3b82f6;
}

.md-typeset .admonition.danger,
.md-typeset details.danger {
  border-left: 4px solid #ef4444;
}

/* Better blockquotes */
.md-typeset blockquote {
  border-left: 4px solid var(--pb-accent);
  background: rgba(245, 158, 11, 0.08);
  padding: 1.25rem 1.5rem;
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
  font-style: italic;
}

[data-md-color-scheme="slate"] .md-typeset blockquote {
  background: rgba(245, 158, 11, 0.06);
}

/* Emoji sizing */
.md-typeset img.twemoji {
  height: 1.3em;
  vertical-align: text-bottom;
}

/* Better spacing for readability */
.md-typeset p {
  margin-bottom: 1.2rem;
}

.md-typeset > *:first-child {
  margin-top: 0;
}

/* Styled sections with emoji headers */
.md-typeset h2[id*="overview"],
.md-typeset h2[id*="quick"],
.md-typeset h2[id*="important"] {
  padding: 0.75rem 0;
}

/* Print styles */
@media print {
  .md-sidebar,
  .md-header,
  .md-footer,
  .md-tabs {
    display: none;
  }
  
  .md-content {
    margin: 0;
    max-width: 100%;
  }
  
  .md-typeset {
    font-size: 11pt;
  }
  
  .md-typeset h1 {
    page-break-before: always;
  }
  
  .md-typeset h1:first-of-type {
    page-break-before: avoid;
  }
}

/* Better button styling for download links */
.md-typeset a[href$=".pdf"] {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--pb-primary);
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.1s ease;
  margin: 0.25rem 0.25rem 0.25rem 0;
}

.md-typeset a[href$=".pdf"]:hover {
  background: var(--pb-primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.md-typeset a[href$=".pdf"]::before {
  content: "📄 ";
  margin-right: 0.35rem;
}

/* Improved footer styling */
.md-footer-meta {
  background: var(--md-footer-bg-color--dark);
}

.md-footer-copyright {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Better social icons */
.md-footer-social {
  padding-top: 0.5rem;
}

.md-footer-social__link {
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.md-footer-social__link:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Responsive improvements for mobile */
@media screen and (max-width: 76.1875em) {
  .md-typeset {
    font-size: 0.95rem;
  }
  
  .md-typeset h1 {
    font-size: 1.8rem;
  }
  
  .md-typeset h2 {
    font-size: 1.4rem;
  }
  
  .md-typeset h3 {
    font-size: 1.15rem;
  }
  
  .md-content__inner {
    padding: 1.5rem 1rem;
  }
}

/* Emoji in headers - make them consistent */
.md-typeset h2:first-child {
  margin-top: 0;
}

/* Better focus states for accessibility */
.md-nav__link:focus,
.md-search__input:focus {
  outline: 2px solid var(--pb-accent);
  outline-offset: 2px;
}

/* Announcement bar if needed */
.md-banner {
  background: linear-gradient(90deg, var(--pb-primary) 0%, var(--pb-primary-light) 100%);
  color: white;
}

/* Improve spacing in navigation */
.md-nav--primary > .md-nav__list > .md-nav__item {
  margin-bottom: 0.25rem;
}

/* Make the 10-20 Electrode Guide stand out in nav */
.md-nav__link[href*="electrode-placement"] {
  background: rgba(37, 99, 235, 0.08);
  font-weight: 600;
}

[data-md-color-scheme="slate"] .md-nav__link[href*="electrode-placement"] {
  background: rgba(96, 165, 250, 0.12);
}

/* Image styling - much larger by default with click-to-zoom */
.md-typeset img {
  max-width: 100%;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin: 2rem auto;
  display: block;
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.md-typeset img:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

[data-md-color-scheme="slate"] .md-typeset img {
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

[data-md-color-scheme="slate"] .md-typeset img:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

/* Logo images should remain small */
.md-typeset .md-header__button.md-logo img,
.md-logo img {
  max-width: none;
  box-shadow: none;
  cursor: default;
  margin: 0;
  border-radius: 0;
}

.md-typeset .md-header__button.md-logo img:hover,
.md-logo img:hover {
  transform: none;
  box-shadow: none;
}

/* Twemoji (emoji) images should remain small */
.md-typeset img.twemoji {
  max-width: none;
  box-shadow: none;
  cursor: default;
  margin: 0;
  border-radius: 0;
  display: inline-block;
}

.md-typeset img.twemoji:hover {
  transform: none;
  box-shadow: none;
}

/* Lightbox overlay */
.image-lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
  overflow: auto;
}

.image-lightbox.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.image-lightbox img {
  /* Display at actual image size - no scaling */
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  cursor: zoom-out;
  animation: zoomIn 0.25s ease;
}

.image-lightbox img:hover {
  transform: none;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  color: white;
  font-size: 2.5rem;
  font-weight: 300;
  cursor: pointer;
  z-index: 10000;
  opacity: 0.8;
  transition: opacity 0.2s ease;
  line-height: 1;
  user-select: none;
}

.lightbox-close:hover {
  opacity: 1;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoomIn {
  from { 
    opacity: 0;
    transform: scale(0.9);
  }
  to { 
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive image sizing for mobile */
@media screen and (max-width: 76.1875em) {
  .md-typeset img:not(.twemoji) {
    max-width: 95%;
  }
  
  .lightbox-close {
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
  }
}

/* Copy link icons for headers */
.copy-link-icon {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.6em;
  opacity: 0.3;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.1s ease;
  vertical-align: middle;
  line-height: 1;
}

.copy-link-icon:hover {
  opacity: 1;
  background: rgba(37, 99, 235, 0.1);
  transform: scale(1.1);
}

.copy-link-icon:active {
  transform: scale(0.95);
}

[data-md-color-scheme="slate"] .copy-link-icon:hover {
  background: rgba(96, 165, 250, 0.15);
}

/* Hide copy icon in print */
@media print {
  .copy-link-icon {
    display: none;
  }
}

