/* ============================================
   GLOBAL COLORS — LIGHT MODE
============================================ */

:root {
  --bg: #f3f4f6;          /* Soft grey page background */
  --text: #111827;
  --muted: #6b7280;

  --accent: #4FD1C5;
  --accent-soft: #ecfeff;

  --border: #e5e7eb;

  --card-bg: #ffffff;     /* PURE WHITE cards */
  --note-bg: #fef9c3;
  --tip-bg: #e0f2fe;

  --code-bg: #111827;
  --code-text: #f9fafb;
  
}

/* ============================================
   GLOBAL COLORS — DARK MODE
============================================ */

.dark {
  --bg: #020617;          /* Deep navy background */
  --text: #e5e7eb;
  --muted: #9ca3af;

  --accent: #4FD1C5;
  --accent-soft: #022c22;

  --border: #1f2933;

  --card-bg: #0f172a;     /* Slightly lighter dark card */
  --note-bg: #3a351f;
  --tip-bg: #1e293b;

  --code-bg: #020617;
  --code-text: #e5e7eb;
}

/* ============================================
   PAGE BASE
============================================ */

html, body {
  background: var(--bg) !important;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: system-ui, sans-serif;
  line-height: 1.7;
  margin: 0;
  padding: 0;
}

.function-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}

/* ============================================
   BREADCRUMBS
============================================ */

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs-current {
  font-weight: 500;
}

/* ============================================
   FUNCTION HEADER
============================================ */

.function-title {
  font-size: 2.1rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.function-description {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 52rem;
}

/* ============================================
   INTRO BLOCK
============================================ */

.function-content .intro {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

/* ============================================
   GENERIC CARD
============================================ */

.card {
  background: var(--card-bg) !important;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* ============================================
   SECTION HEADINGS (GENERIC ICON)
============================================ */

.function-content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
}

.function-content h2::before {
  content: "●";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 900;
}

/* ============================================
   COLLAPSIBLE SECTIONS
============================================ */

.section-toggle {
  margin-left: auto;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.section-toggle:hover {
  opacity: 1;
}

.section-body {
  margin-top: 1rem;
  transition: max-height 0.25s ease, opacity 0.25s ease;
  overflow: hidden;
}

.section-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
}

/* ============================================
   SUBHEADINGS
============================================ */

.function-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

.function-content h3::before {
  content: "ⓘ";
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  width: 1.3rem;
  height: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

/* ============================================
   PARAGRAPHS & LISTS
============================================ */

.function-content p {
  margin: 0.4rem 0 0.8rem;
  color: var(--text);
}

.function-content ul {
  margin: 0.25rem 0 0.75rem 1.25rem;
}

.function-content li {
  margin-bottom: 0.25rem;
}

/* ============================================
   CODE BLOCKS
============================================ */

.function-content pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  overflow-x: auto;
  margin: 0.4rem 0 0.9rem;
}

.function-content code {
  font-family: inherit;
}

.function-content p code,
.function-content li code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ============================================
   NOTES & TIPS
============================================ */

.note,
.tip {
  border-radius: 8px;
  padding: 0.75rem 0.9rem 0.75rem 2.4rem;
  margin: 0.9rem 0;
  font-size: 0.95rem;
  position: relative;
  color: var(--text);
}

.note {
  background: var(--note-bg);
}

.tip {
  background: var(--tip-bg);
}

.note::before,
.tip::before {
  position: absolute;
  left: 0.8rem;
  top: 0.8rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.note::before {
  content: "⚠";
  background: #facc15;
  color: #1f2937;
}

.tip::before {
  content: "💡";
  background: #3b82f6;
  color: #eff6ff;
}

/* ============================================
   LINKS
============================================ */

.function-content a {
  color: var(--accent);
  text-decoration: none;
}

.function-content a:hover {
  text-decoration: underline;
}

/* ============================================
   COMMON ERRORS BLOCK
============================================ */

.common-error-group {
  padding: 0.4rem 0 0.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.6rem;
}

.common-error-group:last-child {
  border-bottom: none;
}

.function-content ul {
  margin: 0.25rem 0 0.5rem 1.25rem;
  padding-left: 1.1rem;
  list-style-type: disc;
}

.function-content li {
  margin-bottom: 0.15rem;
}

.common-errors h3 {
  margin-top: 0.75rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.common-errors p {
  margin: 0.2rem 0 0.4rem;
}

.common-errors ul {
  margin: 0.1rem 0 0.4rem 1.25rem;
}

/* ============================================
   HEADER CARD
============================================ */

.header-card {
  margin-bottom: 2rem;
  padding: 1.75rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.header-card .function-title {
  margin-top: 0;
}

.header-card .function-description {
  margin-top: 0.5rem;
  color: var(--text-muted);
}

/* ============================================
   METADATA BADGES
============================================ */

.function-meta {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
  flex-wrap: wrap;
}

.meta-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}

/* Category-specific colors */
.meta-category {
  background: #e0f2fe;
  color: #0369a1;
}

/* Difficulty */
.meta-difficulty {
  background: #fef3c7;
  color: #b45309;
}

/* Software */
.meta-software {
  background: #ede9fe;
  color: #5b21b6;
}

/* Version */
.meta-version {
  background: #d1fae5;
  color: #065f46;
}

/* Tags */
.function-tags {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tag-badge {
  background: var(--border);
  color: var(--text);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
}

/* ============================================
   COMPATIBILITY TABLE
============================================ */

.compatibility-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.compatibility-body {
  transition: max-height 0.25s ease, opacity 0.25s ease;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
}

.compatibility-body:not(.collapsed) {
  max-height: 500px;
  opacity: 1;
}

.compatibility-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.compatibility-table td {
  padding: 0.25rem 0.2rem;
  border-bottom: 1px solid var(--border);
}

.engine-name {
  font-weight: 500;
}

.support-yes {
  color: #059669;
  font-weight: 700;
}

.support-no {
  color: #dc2626;
  font-weight: 700;
}

.compatibility-card .section-toggle {
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.compatibility-card .section-toggle:hover {
  opacity: 1;
}