/* 
  ==============================================================
  Stitch-inspired Google Design Theme for femlabpy Documentation
  ==============================================================
*/

/* Base Theme Variables (Light Mode) */
html[data-theme="light"], :root {
  /* Typography */
  --pst-font-family-base: "Google Sans Text", "Google Sans", "Product Sans", "Aptos", "Segoe UI", "Roboto", sans-serif;
  --pst-font-family-heading: "Google Sans Display", "Google Sans", "Product Sans", "Aptos", "Segoe UI", "Roboto", sans-serif;
  --pst-font-family-monospace: "Google Sans Mono", "JetBrains Mono", "Fira Code", "Roboto Mono", monospace;
  
  /* Primary Colors */
  --pst-color-primary: #1a73e8; /* Google Blue */
  --pst-color-link: #1a73e8;
  --pst-color-link-hover: #174ea6;
  --pst-color-secondary: #ea4335; /* Google Red */
  --pst-color-text-base: #202124; /* Google Gray 900 */
  --pst-color-text-muted: #5f6368; /* Google Gray 700 */

  /* Surfaces & Backgrounds */
  --pst-color-background: #ffffff;
  --pst-color-surface: #f1f3f4; /* Google Gray 100 */
  --pst-color-border: #dadce0; /* Google Gray 300 */
  
  /* Custom Variables for Components */
  --fp-ink: #202124;
  --fp-muted: #5f6368;
  --fp-surface: #f1f3f4; 
  --fp-accent: #1a73e8;
  --fp-accent-soft: #e8f0fe; /* Google Blue 50 */
  --fp-accent-text: #1a73e8;
  
  /* Stitch Card Design Variables */
  --fp-card-bg: #f8f9fa; /* Google Gray 50 */
  --fp-card-hover-bg: #ffffff; 
  --fp-card-border: transparent; 
  --fp-card-border-hover: #dadce0; 
  
  /* Shadows */
  --fp-shadow: none; 
  --fp-shadow-hover: 0 4px 12px rgba(60,64,67,0.1), 0 1px 3px rgba(60,64,67,0.15); 
  
  --fp-header-bg: rgba(255, 255, 255, 0.95);
  
  /* Code & Math Blocks */
  --fp-code-bg: #f8f9fa;
  --fp-code-border: #dadce0;
  --fp-math-bg: #ffffff;
  --fp-math-border: #e8eaed;
  
  /* Admonition Colors */
  --fp-adm-note-bg: #e8f0fe; /* Blue */
  --fp-adm-note-border: #1a73e8;
  --fp-adm-note-text: #1967d2;
  
  --fp-adm-warning-bg: #fef7e0; /* Yellow/Amber */
  --fp-adm-warning-border: #f9ab00;
  --fp-adm-warning-text: #ea8600;
  
  --fp-adm-tip-bg: #e6f4ea; /* Green */
  --fp-adm-tip-border: #1e8e3e;
  --fp-adm-tip-text: #137333;
  
  --fp-adm-danger-bg: #fce8e6; /* Red */
  --fp-adm-danger-border: #d93025;
  --fp-adm-danger-text: #c5221f;
}

/* Dark Mode Variables */
html[data-theme="dark"] {
  /* Primary Colors */
  --pst-color-primary: #8ab4f8; /* Google Blue 300 */
  --pst-color-link: #8ab4f8;
  --pst-color-link-hover: #aecbfa;
  --pst-color-secondary: #f28b82; /* Google Red 300 */
  --pst-color-text-base: #e8eaed; /* Google Gray 200 */
  --pst-color-text-muted: #9aa0a6; /* Google Gray 400 */

  /* Surfaces & Backgrounds */
  --pst-color-background: #202124;
  --pst-color-surface: #303134;
  --pst-color-border: #5f6368;
  
  /* Custom Variables for Components */
  --fp-ink: #e8eaed;
  --fp-muted: #9aa0a6;
  --fp-surface: #303134;
  --fp-accent: #8ab4f8;
  --fp-accent-soft: rgba(138, 180, 248, 0.12);
  --fp-accent-text: #8ab4f8;
  
  /* Stitch Card Design Variables */
  --fp-card-bg: #28292c; 
  --fp-card-hover-bg: #303134; 
  --fp-card-border: transparent;
  --fp-card-border-hover: #5f6368;
  
  /* Shadows */
  --fp-shadow: none;
  --fp-shadow-hover: 0 4px 12px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.3);
  
  --fp-header-bg: rgba(32, 33, 36, 0.95);
  
  /* Code & Math Blocks */
  --fp-code-bg: #28292c;
  --fp-code-border: #3c4043;
  --fp-math-bg: #202124;
  --fp-math-border: #3c4043;
  
  /* Admonition Colors */
  --fp-adm-note-bg: rgba(138, 180, 248, 0.1); 
  --fp-adm-note-border: #8ab4f8;
  --fp-adm-note-text: #aecbfa;
  
  --fp-adm-warning-bg: rgba(253, 214, 99, 0.1);
  --fp-adm-warning-border: #fdd663;
  --fp-adm-warning-text: #fde293;
  
  --fp-adm-tip-bg: rgba(129, 201, 149, 0.1);
  --fp-adm-tip-border: #81c995;
  --fp-adm-tip-text: #a8dab5;
  
  --fp-adm-danger-bg: rgba(242, 139, 130, 0.1);
  --fp-adm-danger-border: #f28b82;
  --fp-adm-danger-text: #f6aea9;
}

/* Global Typography & Body */
body {
  color: var(--fp-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header & Navigation */
.bd-header {
  backdrop-filter: blur(12px);
  background: var(--fp-header-bg);
  border-bottom: 1px solid var(--pst-color-border);
  box-shadow: none; 
}

.navbar-nav > .nav-item > .nav-link {
  font-size: 0.96rem;
  font-weight: 500; 
  color: var(--fp-muted);
}

.navbar-nav > .nav-item > .nav-link:hover,
.navbar-nav > .nav-item > .nav-link.active {
  color: var(--fp-accent);
}

/* Content Container */
.bd-main .bd-content .bd-article-container {
  max-width: 980px; 
}

.bd-content .bd-article-container .bd-article {
  padding-top: 2rem;
}

/* Headings */
.bd-content h1, .bd-content h2, .bd-content h3, .bd-content h4, .bd-content h5 {
  font-family: var(--pst-font-family-heading);
  color: var(--fp-ink);
}

.bd-content h1 {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.bd-content h2 {
  margin-top: 3.5rem;
  letter-spacing: -0.01em;
  font-weight: 500;
}

/* -----------------------------------------
   Hero Section & Call-To-Action (NEW) 
----------------------------------------- */
.fp-hero {
  position: relative;
  text-align: center;
  padding: 5rem 1.5rem;
  margin: 1rem 0 4rem;
  border-radius: 32px;
  background-color: var(--fp-surface);
  background-image: 
    linear-gradient(to right, var(--pst-color-border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--pst-color-border) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center top;
  box-shadow: inset 0 0 80px 60px var(--pst-color-background);
  overflow: hidden;
}

.fp-hero > * {
  position: relative;
  z-index: 1;
}

.fp-hero--compact {
  padding: 3rem 1.5rem;
  margin-bottom: 3rem;
  border-radius: 24px;
}

.fp-hero-title {
  font-family: var(--pst-font-family-heading);
  font-size: clamp(2.5rem, 4vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fp-ink);
  margin-bottom: 1rem;
}

.fp-card--compact {
  padding: 1.5rem;
}
.fp-card--compact h3 {
  margin-bottom: 0.5rem;
}
.fp-card--compact h3 a {
  text-decoration: none;
  color: var(--fp-ink);
}
.fp-card--compact h3 a:hover {
  color: var(--fp-accent);
}
.fp-card--compact p {
  font-size: 0.95rem;
}

/* -----------------------------------------
   Navbar Gradient Logo
----------------------------------------- */
.navbar-brand p.title,
.navbar-brand .logo__title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--pst-color-primary), var(--pst-color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  margin: 0;
  padding-top: 0.15rem;
}

/* Badge (used in hero sidebar and tutorials) */
.fp-badge-bar {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.fp-badge {
  display: inline-block;
  font-family: var(--pst-font-family-monospace);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--pst-color-border);
  color: var(--fp-muted);
  background: var(--pst-color-background);
}

/* Hero Meta Badges (above subtitle) */
.fp-hero-meta {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.fp-meta-badge {
  display: inline-block;
  font-family: var(--pst-font-family-monospace);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  color: var(--fp-muted);
  background: var(--fp-surface);
  border: 1px solid var(--pst-color-border);
  text-transform: uppercase;
}

.fp-hero-subtitle {
  font-size: clamp(1.3rem, 2.2vw, 1.65rem);
  color: var(--fp-muted);
  max-width: 52rem;
  margin: 0 auto 1.5rem;
  line-height: 1.5;
  font-weight: 400;
}

/* Hero Sidebar (badges next to animation) */
.fp-hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-self: center;
  padding-left: 1rem;
}

@media (max-width: 820px) {
  .fp-hero-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding-left: 0;
    margin-top: 0.5rem;
  }
}

/* Command Rows (pip install, pydoc) */
.fp-hero-commands {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.fp-cmd-row {
  display: inline-flex;
  align-items: center;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
}

.fp-cmd-text {
  display: inline-block;
  font-family: var(--pst-font-family-monospace) !important;
  font-size: 0.9rem !important;
  font-weight: 600;
  padding: 0.5rem 1rem !important;
  background: transparent !important;
  color: #e8eaed !important;
  border: none !important;
  border-radius: 0 !important;
  letter-spacing: 0.01em;
  user-select: all;
  cursor: text;
  white-space: nowrap;
}

.fp-cmd-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 100%;
  background: transparent;
  border: none;
  border-left: 1px solid #333;
  color: #9aa0a6;
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s, background 0.2s;
}
.fp-cmd-copy:hover {
  background: rgba(255,255,255,0.08);
  color: #e8eaed;
}
.fp-cmd-copy.copied {
  color: #34a853;
}

.fp-hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.fp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 2.25rem;
  border-radius: 999px;
  font-family: var(--pst-font-family-base);
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.fp-btn:hover {
  text-decoration: none;
}

.fp-btn-primary {
  background: var(--pst-color-primary);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
  border: 1px solid transparent;
}

.fp-btn-primary:hover {
  background: var(--pst-color-link-hover);
  box-shadow: 0 6px 16px rgba(26, 115, 232, 0.4);
  transform: translateY(-2px);
}

.fp-btn-secondary {
  background: var(--pst-color-background);
  color: var(--fp-ink) !important;
  border: 1px solid var(--pst-color-border);
}

.fp-btn-secondary:hover {
  background: var(--fp-surface);
  border-color: var(--fp-muted);
  transform: translateY(-2px);
}

.fp-btn-ghost {
  background: transparent;
  color: var(--fp-muted) !important;
  border: 1px solid var(--pst-color-border);
  font-size: 1rem;
  padding: 0.8rem 1.75rem;
}
.fp-btn-ghost:hover {
  background: var(--fp-surface);
  color: var(--fp-ink) !important;
  transform: translateY(-2px);
}

/* Hide default H1 on the hero page */
h1:has(+ .fp-hide-title),
.fp-hide-title,
section#femlabpy > h1:first-child,
.bd-article h1:first-of-type {
  display: none !important;
}

/* -----------------------------------------
   Hero Naming Animation
----------------------------------------- */
.fp-hero-interactive {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 1.5rem;
  margin: 3rem auto 4rem;
  max-width: 920px;
  padding: 0 1rem;
}

.fp-naming-anim-container {
  --fp-surface: #2a2a2a;
  --fp-ink: #e8eaed;
  --fp-muted: #9aa0a6;

  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 520px;
  box-sizing: border-box;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 3rem 1.75rem 1.75rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1);
  text-align: left;
  min-height: 360px;
}

@keyframes fp-container-cycle {
  0% { opacity: 0; transform: scale(0.98); }
  5% { opacity: 1; transform: scale(1); }
  95% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.98); }
}

/* macOS Window Buttons */
.fp-naming-anim-container::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 16px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f56;
  box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
}

.fp-code-window {
  font-family: var(--pst-font-family-monospace);
  font-size: clamp(1.3rem, 4.5vw, 1.75rem);
  font-weight: 600;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--fp-ink);
  letter-spacing: 0.02em;
  background: #121212;
  padding: 1.25rem 1rem;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
  white-space: nowrap;
  overflow-x: auto;
}

.fp-token {
  display: inline-block;
  padding: 0.15rem 0.08rem;
  border-radius: 6px;
}

@keyframes fp-token-pop {
  0% { background: transparent; color: var(--fp-ink); transform: scale(1); }
  30% { background: var(--anim-color); color: #fff; transform: scale(1.1); box-shadow: 0 0 15px var(--anim-color); }
  100% { background: transparent; color: var(--anim-color); transform: scale(1); }
}
.fp-anim-token {
  animation: fp-token-pop 1.5s ease forwards;
}

@keyframes fp-args-pop {
  0% { background: transparent; }
  30% { background: rgba(251, 188, 4, 0.25); box-shadow: 0 0 15px rgba(251, 188, 4, 0.2); }
  100% { background: transparent; }
}
.fp-anim-args {
  display: inline-block;
  animation: fp-args-pop 1.5s ease forwards;
  border-radius: 6px;
  padding: 0 0.2rem;
}

/* ---- Right Panel: Argument Cards ---- */
.fp-arg-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
  width: 240px;
  flex-shrink: 0;
  padding: 0.5rem 0 0.5rem 1.25rem;
  border-left: 2px solid rgba(251, 188, 4, 0.25);
}

.fp-arg-header {
  font-family: var(--pst-font-family-monospace);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fbbc04;
  padding: 0 0.25rem 0.4rem;
  border-bottom: 1px solid rgba(251, 188, 4, 0.2);
  margin-bottom: 0.2rem;
}

.fp-arg-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: var(--fp-card-bg);
  border: 1px solid var(--pst-color-border);
  border-radius: 8px;
  transition: border-color 0.25s ease;
}
.fp-arg-card:hover {
  border-color: rgba(251, 188, 4, 0.5);
}

.fp-arg-badge {
  font-family: var(--pst-font-family-monospace);
  font-weight: 800;
  color: #fbbc04;
  font-size: 1rem;
  min-width: 1.6rem;
  text-align: center;
  flex-shrink: 0;
}

.fp-arg-text {
  font-family: var(--pst-font-family-monospace);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--fp-muted);
  letter-spacing: 0.01em;
}

/* Responsive: stack on small screens */
@media (max-width: 820px) {
  .fp-hero-interactive {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  .fp-naming-anim-container {
    max-width: 100%;
    width: 100%;
  }
  .fp-arg-panel {
    width: 100%;
    max-width: 520px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .fp-arg-header {
    width: 100%;
  }
  .fp-arg-card {
    flex: 1 1 auto;
    min-width: 140px;
  }
}

/* Professional Math Legend */
.fp-math-defs {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  font-family: "Latin Modern Roman", "Computer Modern Roman", "Times New Roman", Times, serif;
  font-size: 1.15rem;
}

.fp-math-def {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  color: var(--fp-muted);
}

.fp-math-symbol {
  font-family: var(--pst-font-family-monospace);
  font-weight: 700;
  font-size: 1.25rem;
  min-width: 3.5rem;
  text-align: right;
}

.fp-math-arrow {
  color: #555;
  font-size: 1.2rem;
  font-family: Arial, sans-serif; /* For better arrow rendering */
}

.fp-math-desc {
  color: var(--fp-ink);
  flex: 1;
  line-height: 1.4;
}
.fp-math-desc i {
  color: var(--fp-muted);
  font-style: italic;
  font-size: 0.95em;
}

@keyframes fp-row-fade-in {
  0% { opacity: 0; transform: translateX(-15px); }
  100% { opacity: 1; transform: translateX(0); }
}
.fp-anim-row {
  opacity: 0;
  animation: fp-row-fade-in 0.6s cubic-bezier(0.2, 0, 0, 1) forwards;
}

/* -----------------------------------------
   Icons & Badges
----------------------------------------- */
.fp-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--fp-accent-soft);
  color: var(--fp-accent);
  margin-bottom: 1rem;
}

.fp-icon svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.fp-num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--fp-accent-soft);
  color: var(--fp-accent);
  font-size: 1.15rem;
  font-weight: 700;
  margin-right: 0.75rem;
}

/* -----------------------------------------
   Grids & Cards
----------------------------------------- */
.fp-card-grid {
  display: grid;
  gap: 1.5rem;
  margin: 2.5rem 0;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.fp-card-grid--primary {
  grid-template-columns: repeat(3, 1fr);
}
.fp-card-grid--secondary {
  grid-template-columns: repeat(2, 1fr);
  margin-top: 0;
}
@media (max-width: 820px) {
  .fp-card-grid--primary,
  .fp-card-grid--secondary {
    grid-template-columns: 1fr;
  }
}

.fp-stat-grid {
  display: grid;
  gap: 1.5rem;
  margin: 2rem 0 3rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.fp-card {
  height: 100%;
  padding: 2rem;
  border: 1px solid var(--fp-card-border);
  border-radius: 24px;
  background: var(--fp-card-bg);
  box-shadow: var(--fp-shadow);
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  display: flex;
  flex-direction: column;
}

.fp-card:hover {
  background: var(--fp-card-hover-bg);
  border-color: var(--fp-card-border-hover);
  box-shadow: var(--fp-shadow-hover);
  transform: translateY(-4px);
}

/* Card accent top stripe */
.fp-card--accent-blue  { border-top: 3px solid #1a73e8; }
.fp-card--accent-red   { border-top: 3px solid #ea4335; }
.fp-card--accent-green { border-top: 3px solid #34a853; }

/* Chip tag */
.fp-chip {
  display: inline-block;
  font-family: var(--pst-font-family-monospace);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--fp-accent-soft);
  color: var(--fp-accent);
  margin-bottom: 0.75rem;
}

.fp-card h2, .fp-card h3, .fp-card h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.35rem;
  font-weight: 500;
}

.fp-card p {
  color: var(--fp-muted);
  flex-grow: 1;
  line-height: 1.6;
  font-size: 1.05rem;
}

.fp-card p:last-child, .fp-card ul:last-child {
  margin-bottom: 0;
}

.fp-card a {
  font-weight: 600;
  color: var(--fp-accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  margin-top: 1.5rem;
  font-size: 1rem;
}

.fp-card a:hover {
  text-decoration: underline;
}

/* Stats */
.fp-stat {
  padding: 1.75rem;
  background: var(--fp-surface);
  border-radius: 16px;
  box-shadow: none;
  border: none;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.fp-stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--pst-color-primary), var(--pst-color-secondary));
}

.fp-stat-number {
  display: block;
  font-family: var(--pst-font-family-heading);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, var(--pst-color-primary), var(--pst-color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.fp-stat strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fp-ink);
}

.fp-stat p {
  margin: 0;
  color: var(--fp-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Steps / Reading Order (Timeline) */
.fp-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 2rem 0 3rem;
  position: relative;
  padding-left: 22px;
}

/* Vertical timeline line */
.fp-steps::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--pst-color-border);
  z-index: 0;
}

.fp-step {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: transparent;
  border-radius: 0;
  transition: background 0.2s ease;
  border: none;
  position: relative;
  z-index: 1;
}

.fp-step:hover {
  background: var(--fp-surface);
  border-radius: 12px;
}

.fp-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--fp-accent-soft);
  color: var(--fp-accent);
  font-family: var(--pst-font-family-heading);
  font-size: 1.15rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--pst-color-background);
  z-index: 2;
}

.fp-step-content h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--fp-ink);
}

.fp-step-content p {
  margin: 0;
  color: var(--fp-muted);
  line-height: 1.55;
  font-size: 1rem;
}

.fp-step-content a {
  color: var(--fp-accent);
  font-weight: 600;
}

/* Admonitions (Material 3 Style) */
.bd-content .admonition {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem !important;
  border-radius: 12px;
  border: none !important;
  box-shadow: none !important;
  position: relative;
  overflow: hidden;
  background: var(--fp-adm-note-bg); /* Default fallback */
}

/* Add colored left bar */
.bd-content .admonition::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--fp-adm-note-border);
}

.bd-content .admonition > .admonition-title {
  font-family: var(--pst-font-family-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0 !important;
  padding: 0 !important;
  color: var(--fp-adm-note-text);
  background: transparent !important;
  border: none !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bd-content .admonition > .admonition-title::before {
  margin: 0 !important; /* Use flex gap instead */
}

.bd-content .admonition > .admonition-title::after {
  display: none !important; /* Hide any extra icons PyData might add */
}

.bd-content .admonition p {
  margin-bottom: 0.5rem;
  color: var(--fp-ink);
}

.bd-content .admonition p:last-child {
  margin-bottom: 0;
}

/* Specific Admonition Types */
.bd-content .admonition.note, .bd-content .admonition.seealso {
  background: var(--fp-adm-note-bg);
}
.bd-content .admonition.note::before, .bd-content .admonition.seealso::before {
  background: var(--fp-adm-note-border);
}
.bd-content .admonition.note > .admonition-title, .bd-content .admonition.seealso > .admonition-title {
  color: var(--fp-adm-note-text);
}

.bd-content .admonition.warning, .bd-content .admonition.attention {
  background: var(--fp-adm-warning-bg);
}
.bd-content .admonition.warning::before, .bd-content .admonition.attention::before {
  background: var(--fp-adm-warning-border);
}
.bd-content .admonition.warning > .admonition-title, .bd-content .admonition.attention > .admonition-title {
  color: var(--fp-adm-warning-text);
}

.bd-content .admonition.tip, .bd-content .admonition.hint {
  background: var(--fp-adm-tip-bg);
}
.bd-content .admonition.tip::before, .bd-content .admonition.hint::before {
  background: var(--fp-adm-tip-border);
}
.bd-content .admonition.tip > .admonition-title, .bd-content .admonition.hint > .admonition-title {
  color: var(--fp-adm-tip-text);
}

.bd-content .admonition.danger, .bd-content .admonition.important, .bd-content .admonition.error {
  background: var(--fp-adm-danger-bg);
}
.bd-content .admonition.danger::before, .bd-content .admonition.important::before, .bd-content .admonition.error::before {
  background: var(--fp-adm-danger-border);
}
.bd-content .admonition.danger > .admonition-title, .bd-content .admonition.important > .admonition-title, .bd-content .admonition.error > .admonition-title {
  color: var(--fp-adm-danger-text);
}

/* Table styling */
.bd-content table.docutils {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--pst-color-border);
  margin: 2rem 0;
  width: 100%;
}

.bd-content table.docutils th {
  background-color: var(--fp-surface);
  font-weight: 600;
  text-align: left;
}

.bd-content table.docutils td, .bd-content table.docutils th {
  border-color: var(--pst-color-border);
  padding: 1rem;
}

/* Math blocks (LaTeX) */
div.math {
  background: var(--fp-math-bg);
  border: 1px solid var(--fp-math-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}

/* Code blocks (Pygments/Highlight) */
div.highlight {
  background: var(--fp-code-bg);
  border: 1px solid var(--fp-code-border);
  border-radius: 12px;
  padding: 1rem;
  margin: 1.5rem 0;
}

div.highlight pre {
  margin: 0;
  background: transparent;
  border: none;
  font-family: var(--pst-font-family-monospace);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Inline code styling */
code {
  font-family: var(--pst-font-family-monospace);
  background: var(--fp-surface);
  color: var(--fp-ink);
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  font-size: 0.85em;
}

/* Details/Summary */
.bd-content details {
  border-radius: 12px;
  border: 1px solid var(--pst-color-border);
  background: transparent;
  box-shadow: none;
  margin-bottom: 1rem;
}

.bd-content details summary {
  padding: 1rem 1.25rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--fp-surface);
  border-radius: 12px;
}

.bd-content details[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: 1px solid var(--pst-color-border);
}

/* Animations Classes (Controlled by custom.js) */
.fp-animate-hidden {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.2, 0, 0, 1), transform 0.6s cubic-bezier(0.2, 0, 0, 1);
  will-change: opacity, transform;
}

.fp-animate-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .bd-header .navbar-nav {
    gap: 0.25rem;
  }

  .bd-content h1 {
    font-size: 2.25rem;
  }

  .fp-hero-title {
    font-size: 2.5rem;
  }

  .fp-lead {
    font-size: 1.15rem;
  }
}

/* Callout Grid (replaces admonitions on index/manual/theory) */
.fp-callout-grid {
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.fp-callout {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--pst-color-border);
  background: var(--fp-card-bg);
}

.fp-callout--blue {
  border-left: 4px solid var(--pst-color-primary);
}
.fp-callout--amber {
  border-left: 4px solid #f9ab00;
}

.fp-callout-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--fp-accent);
}
.fp-callout--amber .fp-callout-icon {
  color: #f9ab00;
}

.fp-callout-body strong {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
  color: var(--fp-ink);
}

.fp-callout-body p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--fp-muted);
}

.fp-callout-body a {
  color: var(--fp-accent);
  font-weight: 600;
}

.fp-callout-body code {
  font-size: 0.82em;
}

/* Chapter list (used in manual/theory cards) */
.fp-chapter-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.fp-chapter-list li {
  margin-bottom: 0.4rem;
}

.fp-chapter-list li a {
  color: var(--fp-accent);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
}

.fp-chapter-list li a:hover {
  text-decoration: underline;
}

/* Scroll-to-top button */
.fp-scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--fp-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  z-index: 100;
  font-size: 1.25rem;
  line-height: 1;
}
.fp-scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.fp-scroll-top:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  transform: translateY(-2px);
}

/* ==============================================================
   FEM Figure System — TikZ-style Academic Diagrams (Pure CSS)
   ============================================================== */

/* Figure Container */
.fem-figure {
  position: relative;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--pst-color-background);
  border: 1px solid var(--pst-color-border);
  border-radius: 8px;
  overflow: visible;
}

.fem-figure-caption {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--fp-muted);
  font-style: italic;
}

.fem-figure-caption strong {
  color: var(--fp-ink);
  font-style: normal;
}

/* Canvas for drawing elements */
.fem-canvas {
  position: relative;
  margin: 0 auto;
  /* Size set inline per figure */
}

/* ==================== NODES ==================== */
.fem-node {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #202124;
  transform: translate(-50%, -50%);
  z-index: 10;
  box-sizing: border-box;
}

html[data-theme="dark"] .fem-node {
  background: #303134;
  border-color: #e8eaed;
}

.fem-node--filled {
  background: #202124;
}

html[data-theme="dark"] .fem-node--filled {
  background: #e8eaed;
}

.fem-node--large {
  width: 16px;
  height: 16px;
  border-width: 2.5px;
}

.fem-node--accent {
  border-color: var(--pst-color-primary);
}

.fem-node--accent.fem-node--filled {
  background: var(--pst-color-primary);
}

/* Node Labels */
.fem-node-label {
  position: absolute;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fp-ink);
  white-space: nowrap;
  transform: translate(-50%, -50%);
  z-index: 15;
  font-family: var(--pst-font-family-monospace);
}

.fem-node-label--math {
  font-style: italic;
  font-family: "Times New Roman", "STIX Two Math", serif;
}

.fem-node-label sub {
  font-size: 0.65em;
  vertical-align: baseline;
  position: relative;
  top: 0.3em;
}

/* ==================== EDGES / LINES ==================== */
.fem-edge {
  position: absolute;
  background: #202124;
  height: 2px;
  transform-origin: left center;
  z-index: 5;
}

html[data-theme="dark"] .fem-edge {
  background: #e8eaed;
}

.fem-edge--dashed {
  background: transparent;
  border-top: 2px dashed #202124;
  height: 0;
}

html[data-theme="dark"] .fem-edge--dashed {
  border-top-color: #e8eaed;
}

.fem-edge--thin {
  height: 1px;
}

.fem-edge--thick {
  height: 3px;
}

.fem-edge--accent {
  background: var(--pst-color-primary);
}

/* ==================== ARROWS ==================== */
.fem-arrow {
  position: absolute;
  z-index: 8;
}

.fem-arrow::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
}

.fem-arrow--right::after {
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #202124;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
}

html[data-theme="dark"] .fem-arrow--right::after {
  border-color: transparent transparent transparent #e8eaed;
}

.fem-arrow--up::after {
  border-width: 0 5px 8px 5px;
  border-color: transparent transparent #202124 transparent;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
}

html[data-theme="dark"] .fem-arrow--up::after {
  border-color: transparent transparent #e8eaed transparent;
}

.fem-arrow--down::after {
  border-width: 8px 5px 0 5px;
  border-color: #202124 transparent transparent transparent;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
}

html[data-theme="dark"] .fem-arrow--down::after {
  border-color: #e8eaed transparent transparent transparent;
}

/* Axis arrows with lines */
.fem-axis {
  position: absolute;
  display: flex;
  align-items: center;
  z-index: 6;
}

.fem-axis-line {
  background: #202124;
  height: 1.5px;
}

html[data-theme="dark"] .fem-axis-line {
  background: #e8eaed;
}

.fem-axis-arrow {
  width: 0;
  height: 0;
  border-style: solid;
}

.fem-axis--horizontal .fem-axis-arrow {
  border-width: 4px 0 4px 7px;
  border-color: transparent transparent transparent #202124;
}

html[data-theme="dark"] .fem-axis--horizontal .fem-axis-arrow {
  border-color: transparent transparent transparent #e8eaed;
}

.fem-axis--vertical {
  flex-direction: column;
}

.fem-axis--vertical .fem-axis-line {
  width: 1.5px;
  height: auto;
}

.fem-axis--vertical .fem-axis-arrow {
  border-width: 0 4px 7px 4px;
  border-color: transparent transparent #202124 transparent;
  order: -1;
}

html[data-theme="dark"] .fem-axis--vertical .fem-axis-arrow {
  border-color: transparent transparent #e8eaed transparent;
}

.fem-axis-label {
  position: absolute;
  font-size: 0.8rem;
  font-style: italic;
  font-family: "Times New Roman", "STIX Two Math", serif;
  color: var(--fp-ink);
}

/* ==================== SHAPES ==================== */

/* Triangle element */
.fem-triangle {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 3;
}

.fem-triangle-fill {
  position: absolute;
  clip-path: polygon(var(--p1), var(--p2), var(--p3));
  background: var(--fp-accent-soft);
  opacity: 0.5;
}

/* Quadrilateral element */
.fem-quad {
  position: absolute;
  clip-path: polygon(var(--p1), var(--p2), var(--p3), var(--p4));
  background: var(--fp-accent-soft);
  opacity: 0.5;
  z-index: 3;
}

/* Rectangle (for bar elements) */
.fem-rect {
  position: absolute;
  background: var(--fp-accent-soft);
  border: 1.5px solid var(--fp-ink);
  opacity: 0.6;
  z-index: 3;
}

html[data-theme="dark"] .fem-rect {
  border-color: #e8eaed;
}

/* ==================== DIMENSIONS & ANNOTATIONS ==================== */
.fem-dim {
  position: absolute;
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--fp-muted);
  z-index: 12;
}

.fem-dim-line {
  flex: 1;
  height: 1px;
  background: var(--fp-muted);
}

.fem-dim-tick {
  width: 1px;
  height: 8px;
  background: var(--fp-muted);
}

.fem-dim-label {
  padding: 0 0.4rem;
  font-style: italic;
  font-family: "Times New Roman", "STIX Two Math", serif;
  white-space: nowrap;
}

/* Brackets for natural coordinates */
.fem-bracket {
  position: absolute;
  border: 1.5px solid var(--fp-muted);
  border-radius: 2px;
  z-index: 4;
}

.fem-bracket--left {
  border-right: none;
  border-radius: 2px 0 0 2px;
}

.fem-bracket--right {
  border-left: none;
  border-radius: 0 2px 2px 0;
}

.fem-bracket--top {
  border-bottom: none;
  border-radius: 2px 2px 0 0;
}

.fem-bracket--bottom {
  border-top: none;
  border-radius: 0 0 2px 2px;
}

/* ==================== COORDINATE SYSTEMS ==================== */
.fem-coords {
  position: absolute;
  z-index: 20;
}

.fem-coords-origin {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--fp-ink);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* ==================== NATURAL COORDINATE MARKERS ==================== */
.fem-nat-marker {
  position: absolute;
  font-size: 0.7rem;
  font-family: "Times New Roman", "STIX Two Math", serif;
  color: var(--pst-color-primary);
  font-weight: 500;
  z-index: 15;
  white-space: nowrap;
}

.fem-nat-marker--corner {
  padding: 2px 4px;
  background: var(--fp-accent-soft);
  border-radius: 3px;
}

/* ==================== GAUSS POINTS ==================== */
.fem-gauss {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--pst-color-secondary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
}

.fem-gauss::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px dashed var(--pst-color-secondary);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.5;
}

/* ==================== FORCE VECTORS ==================== */
.fem-force {
  position: absolute;
  display: flex;
  align-items: center;
  z-index: 15;
}

.fem-force-shaft {
  height: 3px;
  background: #d93025;
  border-radius: 1px;
}

.fem-force-head {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #d93025;
}

.fem-force--down {
  flex-direction: column;
}

.fem-force--down .fem-force-shaft {
  width: 3px;
  height: auto;
}

.fem-force--down .fem-force-head {
  border-width: 10px 6px 0 6px;
  border-color: #d93025 transparent transparent transparent;
}

.fem-force-label {
  position: absolute;
  font-size: 0.8rem;
  font-style: italic;
  font-family: "Times New Roman", "STIX Two Math", serif;
  color: #d93025;
  font-weight: 500;
}

/* ==================== SUPPORTS ==================== */
.fem-support {
  position: absolute;
  z-index: 8;
}

/* Pin support (triangle) */
.fem-support--pin {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 14px solid var(--fp-ink);
  transform: translateX(-50%);
}

html[data-theme="dark"] .fem-support--pin {
  border-bottom-color: #e8eaed;
}

/* Roller support */
.fem-support--roller {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
}

.fem-support--roller::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 12px solid var(--fp-ink);
}

.fem-support--roller::after {
  content: '';
  width: 10px;
  height: 10px;
  border: 2px solid var(--fp-ink);
  border-radius: 50%;
  margin-top: 2px;
  background: var(--pst-color-background);
}

html[data-theme="dark"] .fem-support--roller::before {
  border-bottom-color: #e8eaed;
}

html[data-theme="dark"] .fem-support--roller::after {
  border-color: #e8eaed;
}

/* Fixed support (hatched ground) */
.fem-support--fixed {
  width: 30px;
  height: 12px;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 2px,
    var(--fp-ink) 2px,
    var(--fp-ink) 4px
  );
  border-top: 2px solid var(--fp-ink);
  transform: translateX(-50%);
}

html[data-theme="dark"] .fem-support--fixed {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 2px,
    #e8eaed 2px,
    #e8eaed 4px
  );
  border-top-color: #e8eaed;
}

/* ==================== ELEMENT TYPE BADGES ==================== */
.fem-badge {
  position: absolute;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--pst-font-family-monospace);
  background: var(--fp-surface);
  border: 1px solid var(--pst-color-border);
  border-radius: 4px;
  color: var(--fp-ink);
  z-index: 20;
}

.fem-badge--primary {
  background: var(--pst-color-primary);
  border-color: var(--pst-color-primary);
  color: #fff;
}

/* ==================== DOF INDICATORS ==================== */
.fem-dof {
  position: absolute;
  display: flex;
  gap: 3px;
  z-index: 12;
}

.fem-dof-arrow {
  width: 16px;
  height: 2px;
  background: #1e8e3e;
  position: relative;
}

.fem-dof-arrow::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 3px 0 3px 5px;
  border-color: transparent transparent transparent #1e8e3e;
}

.fem-dof-arrow--vertical {
  width: 2px;
  height: 16px;
}

.fem-dof-arrow--vertical::after {
  right: auto;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 3px 5px 3px;
  border-color: transparent transparent #1e8e3e transparent;
}

/* ==================== STRESS/STRAIN INDICATORS ==================== */
.fem-stress {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--fp-muted);
  z-index: 12;
}

.fem-stress-arrow {
  width: 20px;
  height: 0;
  border-top: 1px solid currentColor;
  position: relative;
}

.fem-stress-arrow::before,
.fem-stress-arrow::after {
  content: '';
  position: absolute;
  top: -3px;
  border-style: solid;
}

.fem-stress-arrow::before {
  left: 0;
  border-width: 3px 4px 3px 0;
  border-color: transparent currentColor transparent transparent;
}

.fem-stress-arrow::after {
  right: 0;
  border-width: 3px 0 3px 4px;
  border-color: transparent transparent transparent currentColor;
}

/* ==================== INFO BOX ==================== */
.fem-info {
  position: absolute;
  padding: 8px 12px;
  background: var(--fp-card-bg);
  border: 1px solid var(--pst-color-border);
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.5;
  z-index: 25;
  max-width: 200px;
}

.fem-info-title {
  font-weight: 600;
  color: var(--fp-ink);
  margin-bottom: 4px;
}

.fem-info-item {
  color: var(--fp-muted);
}

.fem-info-item code {
  font-size: 0.85em;
  background: var(--fp-surface);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ==================== SHAPE FUNCTION PLOTS ==================== */
.fem-shape-fn {
  position: absolute;
  z-index: 6;
}

.fem-shape-fn-curve {
  fill: none;
  stroke: var(--pst-color-primary);
  stroke-width: 2;
}

.fem-shape-fn-fill {
  fill: var(--fp-accent-soft);
  opacity: 0.3;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .fem-figure {
    padding: 1rem;
    margin: 1.5rem 0;
  }
  
  .fem-node-label,
  .fem-nat-marker {
    font-size: 0.65rem;
  }
  
  .fem-dim-label,
  .fem-axis-label {
    font-size: 0.7rem;
  }
}
