/* ==========================================================================
   shrtnotes - Modern, Clean & High-Yield Design System
   Features:
   - Light & Dark mode via CSS variables
   - Zero emojis - 100% SVG vector iconography
   - Zero-CLS (Cumulative Layout Shift) Ad Containers
   - Fluid typography & responsive grid
   ========================================================================== */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --accent-border: #bfdbfe;
  
  --code-bg: #0f172a;
  --code-text: #f8fafc;
  
  --ad-bg: #f8fafc;
  --ad-border: #cbd5e1;
  --ad-label-color: #94a3b8;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  
  --max-width: 1240px;
  --sidebar-width: 280px;
}

[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --border-color: #1e293b;
  --border-subtle: #141d2e;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: #1e293b;
  --accent-border: #2563eb;
  
  --code-bg: #020617;
  --code-text: #f8fafc;
  
  --ad-bg: #0f172a;
  --ad-border: #1e293b;
  --ad-label-color: #64748b;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  scroll-behavior: smooth;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* Top Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .navbar {
  background-color: rgba(9, 13, 22, 0.9);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.brand-logo svg {
  width: 24px;
  height: 24px;
  stroke: var(--accent);
  stroke-width: 2.2;
}

.brand-dot {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
}

.nav-link {
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle-btn, .mobile-menu-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover, .mobile-menu-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.mobile-menu-btn {
  display: none;
}

/* Search Box */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.45rem 0.85rem 0.45rem 2.2rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  outline: none;
  width: 220px;
  transition: all 0.2s ease;
}

.search-input:focus {
  width: 280px;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Layout Wrappers */
.main-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  flex: 1;
  width: 100%;
}

.docs-grid {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.content-sidebar {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding-right: 0.75rem;
}

.content-sidebar::-webkit-scrollbar {
  width: 4px;
}

.content-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.sidebar-section {
  margin-bottom: 1.75rem;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sidebar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-item a {
  display: block;
  font-size: 0.885rem;
  color: var(--text-secondary);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  line-height: 1.4;
}

.sidebar-item a:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-item.active a {
  background-color: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* Main Content Area */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumbs a {
  color: var(--text-muted);
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumb-separator {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.article-title {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-item svg {
  width: 15px;
  height: 15px;
}

/* Typography Inside Content */
.prose {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  scroll-margin-top: 5rem;
}

.prose h2 {
  font-size: 1.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.prose h3 {
  font-size: 1.25rem;
}

.prose p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

.prose ul, .prose ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.5rem;
  font-style: italic;
  color: var(--text-secondary);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.prose th, .prose td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  text-align: left;
}

.prose th {
  background-color: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

.prose td {
  background-color: var(--bg-primary);
  color: var(--text-secondary);
}

.prose pre {
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.prose code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--bg-tertiary);
  color: var(--accent);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

/* Callout Box for Formulas / High Yield Notes */
.callout {
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}

.callout-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--accent);
  margin-top: 0.15rem;
}

.callout-content {
  flex: 1;
}

.callout-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.callout-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Zero-CLS Non-Intrusive AdSense Containers
   Guarantees:
   - Reserved min-height (prevents Cumulative Layout Shift)
   - Subtle 'ADVERTISEMENT' micro-tag (AdSense policy compliant)
   - Isolated flow: will NEVER cover text or overlap navigation
   ========================================================================== */
.ad-slot-wrapper {
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  clear: both;
}

.ad-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ad-label-color);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.ad-container {
  width: 100%;
  background-color: var(--ad-bg);
  border: 1px dashed var(--ad-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all 0.2s ease;
}

/* Standard dimensions with minimum reserved space */
.ad-banner {
  min-height: 100px;
  max-width: 728px;
}

.ad-in-article {
  min-height: 280px;
  max-width: 650px;
}

.ad-sidebar {
  min-height: 250px;
  max-width: 100%;
}

.ad-placeholder-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem;
}

/* Article Navigation (Previous / Next Note) */
.article-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-color);
}

.nav-card {
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  transition: all 0.15s ease;
}

.nav-card:hover {
  border-color: var(--accent);
  background-color: var(--bg-tertiary);
  transform: translateY(-2px);
}

.nav-card.next {
  text-align: right;
  align-items: flex-end;
}

.nav-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Home Page Hero & Subjects Grid */
.hero-section {
  text-align: center;
  padding: 3.5rem 1rem 2.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--accent-light);
  color: var(--accent);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  border: 1px solid var(--accent-border);
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero-title span {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0 3.5rem;
}

.subject-card {
  padding: 1.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background-color: var(--bg-secondary);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.subject-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.subject-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background-color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.subject-icon-box svg {
  width: 24px;
  height: 24px;
}

.subject-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.subject-desc {
  font-size: 0.885rem;
  color: var(--text-secondary);
  flex: 1;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.subject-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Recent Notes Feed */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.note-row {
  padding: 1.15rem 1.35rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
  gap: 1rem;
}

.note-row:hover {
  border-color: var(--accent);
  background-color: var(--bg-tertiary);
  transform: translateX(4px);
}

.note-row-main {
  flex: 1;
}

.note-row-tag {
  display: inline-block;
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.35rem;
}

.note-row-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.note-row-excerpt {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Footer & AdSense Compliance Section */
.site-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 1.25rem 2rem;
  margin-top: auto;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-brand {
  max-width: 360px;
}

.footer-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  line-height: 1.5;
}

.footer-col-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 0.85rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.825rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 1rem;
}

/* ==========================================================================
   Mobile Navigation Drawer & Responsive Controls
   ========================================================================== */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: min(320px, 85vw);
  height: 100vh;
  background-color: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.mobile-nav-drawer.open {
  right: 0;
}

.mobile-nav-header {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-nav-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.mobile-nav-section-title {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}

.mobile-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.925rem;
  font-weight: 500;
  transition: background 0.15s ease;
}

.mobile-nav-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--accent);
}

.mobile-nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.mobile-nav-icon svg {
  width: 18px;
  height: 18px;
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 90;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mobile-backdrop.open {
  display: block;
  opacity: 1;
}

/* Mobile Chapter Toggle Pill for Note reading */
.mobile-chapter-pill-wrapper {
  display: none;
  margin-bottom: 1.25rem;
}

.mobile-chapter-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mobile-chapter-btn:hover {
  border-color: var(--accent);
  background-color: var(--bg-tertiary);
}

.sidebar-header-mobile {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

/* Mobile Responsive Adjustments */
@media (max-width: 900px) {
  .docs-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .mobile-chapter-pill-wrapper {
    display: block;
  }
  
  .content-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 95;
    padding: 1.25rem;
    max-height: 100vh;
    overflow-y: auto;
  }
  
  .content-sidebar.mobile-open {
    display: block;
  }

  .sidebar-header-mobile {
    display: flex;
  }

  .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero-title {
    font-size: 2.15rem;
  }

  .article-title {
    font-size: 1.7rem;
  }
  
  .article-navigation {
    grid-template-columns: 1fr;
  }
  
  .search-wrapper {
    display: none; /* Mobile search available in full drawer or header */
  }
}

