/* ===========================================================
   PEDIANOTES OSCE - DYNAMIC GRID SPECIALTY CARDS
   Universal styling for Obsidian & Hugo Production Site
   Measures actual screen width using CSS Grid (repeat auto-fill)
   =========================================================== */

/* 1. Portal Canvas Width Expansion in Obsidian */
.osce-portal .cm-sizer,
.osce-portal .markdown-preview-sizer,
.osce-portal .markdown-source-view.mod-cm6 .cm-content,
.osce-portal .markdown-preview-section {
  max-width: 1200px !important;
  width: 100% !important;
  margin: 0 auto !important;
}

/* 2. Header Centering */
.osce-portal h1,
.osce-portal .inline-title,
.osce-portal .cm-line.HyperMD-header,
.home-container h1 {
  width: 100% !important;
  text-align: center !important;
  font-size: 2.5rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.025em !important;
  margin: 1.5rem 0 2rem 0 !important;
  color: var(--text-normal, var(--text-primary, #f8fafc)) !important;
}

/* 3. DYNAMIC MULTI-COLUMN GRID: Measures Screen Width */
.osce-card-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
  gap: 1.65rem !important;
  justify-content: center !important;
  max-width: 1140px !important;
  width: 100% !important;
  margin: 1.5rem auto 3.5rem auto !important;
  padding: 0 0.5rem !important;
  box-sizing: border-box !important;
}

/* Hide TOC on portal / home pages */
.osce-portal .toc-wrapper,
.home-container .toc-wrapper {
  display: none !important;
}

/* Footer full width */
.osce-portal footer,
.osce-portal .site-footer,
.home-container footer,
.home-container .site-footer {
  width: 100% !important;
  margin-top: 3.5rem !important;
}

/* 4. Strip Codeblock Wrapper in Obsidian */
.block-language-card,
.osce-card-block-container,
.cm-embed-block:has(.block-language-card),
.cm-embed-block:has(.osce-card-block-container) {
  display: block !important;
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 auto !important;
  overflow: visible !important;
}

.edit-block-button {
  opacity: 0.15 !important;
  transition: opacity 0.2s ease !important;
}
.edit-block-button:hover {
  opacity: 1 !important;
}

/* 5. Each Specialty Card Box */
.osce-card {
  width: 100% !important;
  min-height: 205px !important;
  aspect-ratio: 1 / 0.92 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  text-decoration: none !important;
  margin: 0 !important;
  padding: 1.65rem 1.25rem !important;
  border-radius: 22px !important;
  border: 3.5px solid var(--card-color, #38bdf8) !important;
  background-color: var(--card-bg, rgba(56, 189, 248, 0.05)) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, border-color 0.22s ease !important;
  position: relative !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  color: inherit !important;
}

/* Hover Lift & Glow */
.osce-card:hover {
  transform: translateY(-6px) scale(1.02) !important;
  box-shadow: 0 16px 36px -4px var(--card-glow, rgba(0, 0, 0, 0.2)) !important;
}

/* 6. Card Icon (Centered 52px Lucide) */
.osce-card .osce-card-icon {
  width: 56px !important;
  height: 56px !important;
  margin-bottom: 1.15rem !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--card-color, currentColor) !important;
  transition: transform 0.22s ease !important;
  flex-shrink: 0 !important;
}

.osce-card:hover .osce-card-icon {
  transform: scale(1.12) !important;
}

.osce-card .osce-card-icon svg,
.osce-card .osce-card-icon i {
  width: 52px !important;
  height: 52px !important;
  stroke-width: 2.2 !important;
  stroke: var(--card-color, currentColor) !important;
  color: var(--card-color, currentColor) !important;
}

/* 7. Card Title */
.osce-card .osce-card-title {
  font-size: 1.18rem !important;
  font-weight: 750 !important;
  line-height: 1.35 !important;
  letter-spacing: -0.01em !important;
  color: var(--text-normal, var(--text-primary, #f8fafc)) !important;
  width: 100% !important;
  transition: color 0.15s ease !important;
}

.osce-card:hover .osce-card-title {
  color: var(--card-color) !important;
}

/* 8. Palette Rules for All Colors */
[data-color="orange"] { --card-color: #f97316 !important; --card-bg: rgba(249, 115, 22, 0.06) !important; --card-glow: rgba(249, 115, 22, 0.35) !important; border-color: #f97316 !important; }
[data-color="green"]  { --card-color: #10b981 !important; --card-bg: rgba(16, 185, 129, 0.06) !important; --card-glow: rgba(16, 185, 129, 0.35) !important; border-color: #10b981 !important; }
[data-color="purple"] { --card-color: #8b5cf6 !important; --card-bg: rgba(139, 92, 246, 0.06) !important; --card-glow: rgba(139, 92, 246, 0.35) !important; border-color: #8b5cf6 !important; }
[data-color="blue"]   { --card-color: #2563eb !important; --card-bg: rgba(37, 99, 235, 0.06) !important; --card-glow: rgba(37, 99, 235, 0.35) !important; border-color: #2563eb !important; }
[data-color="pink"]   { --card-color: #ec4899 !important; --card-bg: rgba(236, 72, 153, 0.06) !important; --card-glow: rgba(236, 72, 153, 0.35) !important; border-color: #ec4899 !important; }
[data-color="red"]    { --card-color: #ef4444 !important; --card-bg: rgba(239, 68, 68, 0.06) !important; --card-glow: rgba(239, 68, 68, 0.35) !important; border-color: #ef4444 !important; }
[data-color="teal"]   { --card-color: #0d9488 !important; --card-bg: rgba(13, 148, 136, 0.06) !important; --card-glow: rgba(13, 148, 136, 0.35) !important; border-color: #0d9488 !important; }
[data-color="amber"]  { --card-color: #f59e0b !important; --card-bg: rgba(245, 158, 11, 0.06) !important; --card-glow: rgba(245, 158, 11, 0.35) !important; border-color: #f59e0b !important; }
[data-color="violet"] { --card-color: #7c3aed !important; --card-bg: rgba(124, 58, 237, 0.06) !important; --card-glow: rgba(124, 58, 237, 0.35) !important; border-color: #7c3aed !important; }
[data-color="fuchsia"]{ --card-color: #d946ef !important; --card-bg: rgba(217, 70, 239, 0.06) !important; --card-glow: rgba(217, 70, 239, 0.35) !important; border-color: #d946ef !important; }
[data-color="rose"]   { --card-color: #f43f5e !important; --card-bg: rgba(244, 63, 94, 0.06) !important; --card-glow: rgba(244, 63, 94, 0.35) !important; border-color: #f43f5e !important; }
[data-color="sky"]    { --card-color: #0ea5e9 !important; --card-bg: rgba(14, 165, 233, 0.06) !important; --card-glow: rgba(14, 165, 233, 0.35) !important; border-color: #0ea5e9 !important; }
[data-color="yellow"] { --card-color: #eab308 !important; --card-bg: rgba(234, 179, 8, 0.06) !important; --card-glow: rgba(234, 179, 8, 0.35) !important; border-color: #eab308 !important; }
[data-color="cyan"]   { --card-color: #06b6d4 !important; --card-bg: rgba(6, 182, 212, 0.06) !important; --card-glow: rgba(6, 182, 212, 0.35) !important; border-color: #06b6d4 !important; }
[data-color="slate"]  { --card-color: #64748b !important; --card-bg: rgba(100, 116, 139, 0.06) !important; --card-glow: rgba(100, 116, 139, 0.35) !important; border-color: #64748b !important; }
[data-color="ruby"]   { --card-color: #be123c !important; --card-bg: rgba(190, 18, 60, 0.06) !important; --card-glow: rgba(190, 18, 60, 0.35) !important; border-color: #be123c !important; }
[data-color="lime"]   { --card-color: #84cc16 !important; --card-bg: rgba(132, 204, 22, 0.06) !important; --card-glow: rgba(132, 204, 22, 0.35) !important; border-color: #84cc16 !important; }
[data-color="indigo"] { --card-color: #6366f1 !important; --card-bg: rgba(99, 102, 241, 0.06) !important; --card-glow: rgba(99, 102, 241, 0.35) !important; border-color: #6366f1 !important; }

/* 9. Responsive Breakpoints */
@media (max-width: 580px) {
  .osce-card-grid {
    grid-template-columns: 1fr !important;
  }
  .osce-portal h1,
  .osce-portal .inline-title,
  .home-container h1 {
    font-size: 1.85rem !important;
  }
}
