/* ============================================
   MODERN 2025 THEME VARIABLES
===============================================*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* ----- Backgrounds ----- */
    --ec-bg-page: linear-gradient(135deg, #f5f7fa 0%, #e8edf3 100%);
    --ec-bg-surface: rgba(255, 255, 255, 0.85);
    --ec-bg-header: rgba(255, 255, 255, 0.75);
    --ec-bg-header-border: rgba(0, 0, 0, 0.08);

    /* ----- Typography ----- */
    --ec-text-main: #1a202c;
    --ec-text-muted: #718096;
    --ec-heading: #0f172a;

    /* ----- Links & Accents ----- */
    --ec-link: #3b82f6;
    --ec-link-hover: #2563eb;
    --ec-accent: #3b82f6;
    --ec-accent-soft: rgba(59, 130, 246, 0.1);
    --ec-accent-glow: rgba(59, 130, 246, 0.3);

    /* ----- Borders & Shadows ----- */
    --ec-border-subtle: rgba(0, 0, 0, 0.08);
    --ec-shadow-soft: 0 20px 40px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    --ec-shadow-hover: 0 30px 60px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);

    /* ----- Glass effect ----- */
    --glass-border: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2));

    /* ----- Radius ----- */
    --ec-radius-lg: 24px;
    --ec-radius-md: 16px;

    /* mmenu (light) */
    --mm-color-background: #f9fafb;
    --mm-color-border: rgba(0,0,0,0.1);
    --mm-color-icon: #3b82f6;
    --mm-color-text: #111827;
    --mm-color-text-dimmed: rgba(55,65,81,0.7);
    --mm-color-background-highlight: #e5e7eb;
    --mm-color-background-emphasis: #e5e7eb;
    --mm-color-focusring: #3b82f6;
}

/* =========================================================
   DARK THEME - ENHANCED 2025
============================================================*/
:root[data-theme="dark"] {
    --ec-bg-page: radial-gradient(ellipse at top, #1e293b 0%, #0f172a 50%, #020617 100%);
    --ec-bg-surface: rgba(15, 23, 42, 0.9);
    --ec-bg-header: rgba(15, 23, 42, 0.85);
    --ec-bg-header-border: rgba(148, 163, 184, 0.2);

    --ec-text-main: #e2e8f0;
    --ec-text-muted: #94a3b8;
    --ec-heading: #f1f5f9;

    --ec-link: #60a5fa;
    --ec-link-hover: #3b82f6;

    --ec-accent: #60a5fa;
    --ec-accent-soft: rgba(96, 165, 250, 0.15);
    --ec-accent-glow: rgba(96, 165, 250, 0.4);

    --ec-border-subtle: rgba(148, 163, 184, 0.15);
    --ec-shadow-soft: 0 20px 50px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
    --ec-shadow-hover: 0 30px 70px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);

    --glass-border: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));

    --mm-color-background: #020617;
    --mm-color-border: rgba(148,163,184,0.4);
    --mm-color-icon: #60a5fa;
    --mm-color-text: #e2e8f0;
    --mm-color-text-dimmed: rgba(148,163,184,0.8);
    --mm-color-background-highlight: #111827;
    --mm-color-background-emphasis: #111827;
    --mm-color-focusring: #60a5fa;
}

:root[data-theme="dark"] #header {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7);
}

/* ============================================
   RESET + BODY
===============================================*/

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: var(--ec-bg-page);
    background-attachment: fixed;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--ec-text-main);
    overflow-x: hidden;
    transition: background 0.5s ease;
}

/* Page fade-in animation */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

#page {
    min-height: 100vh;
    animation: fadeInUp 0.6s ease-out;
}

/* ============================================
   HEADER - Enhanced Glass Morphism
===============================================*/

#header {
    position: sticky;
    top: 0;
    z-index: 20;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 20px;
    background: var(--ec-bg-header);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);

    border-bottom: 1px solid var(--ec-bg-header-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);

    position: relative;
}

/* Glass border highlight */
#header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: var(--glass-border);
    opacity: 0.8;
}

/* PERFECT CENTERING OF TITLE + LOGO */
.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-content span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ec-heading);
    letter-spacing: -0.02em;
}

.header-content a.home-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ec-heading);
}

.header-content a.home-link:hover {
    opacity: 0.85;
}

.logo {
    height: 40px;
    width: auto;
    border-radius: 8px;
    object-fit: contain;
    background: none;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05) rotate(-2deg);
}

/* Menu Toggle with Ripple Effect */
.menu-toggle {
    border: 1px solid var(--ec-border-subtle);
    background: var(--ec-accent-soft);
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 50;
}

.menu-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--ec-accent-glow);
}

.menu-toggle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--ec-accent-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-toggle:active::before {
    opacity: 1;
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ec-text-main);
    border-radius: 999px;
    position: relative;
    transition: all 0.3s ease;
}

.menu-toggle span::before,
.menu-toggle span::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 2px;
    background: var(--ec-text-main);
    border-radius: 999px;
    transition: all 0.3s ease;
}

.menu-toggle span::before { top: -6px; }
.menu-toggle span::after  { top:  6px; }

/* Theme Toggle with Animation */
.theme-toggle {
    margin-left: auto;
    border: 1px solid var(--ec-border-subtle);
    background: var(--ec-accent-soft);
    color: var(--ec-text-main);
    border-radius: 999px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    transform: scale(1.05) rotate(15deg);
    box-shadow: 0 0 20px var(--ec-accent-glow);
    border-color: var(--ec-accent);
}

.theme-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.5s ease;
}

.theme-icon svg { display: block; }

/* ============================================
   ORIENTATION WARNING
===============================================*/

#orientation-warning {
    display: none;
    position: fixed;
    top: 0;
    width: 100%;
    background-color: #ffcc00;
    color: #000;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    z-index: 9999;
}

/* ============================================
   CONCEPT STRIP
===============================================*/

#concept-strip {
    max-width: 960px;
    margin: 6px auto 20px auto;
    padding: 8px 18px;
    background: var(--ec-bg-surface);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--ec-border-subtle);
    border-radius: 999px;
    font-size: 0.86rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--ec-shadow-soft);
}

#concept-strip a {
    color: var(--ec-link);
    text-decoration: none;
    font-weight: 500;
}

#concept-strip a:hover {
    color: var(--ec-link-hover);
}

#concept-strip .sep { color: var(--ec-text-muted); }

/* ============================================
   MAIN CONTENT CARD - Enhanced Glass
===============================================*/

#course-content {
    max-width: 960px;
    margin: 20px auto 60px auto;
    padding: 40px 32px;
    background: var(--ec-bg-surface);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--ec-border-subtle);
    border-radius: var(--ec-radius-lg);
    box-shadow: var(--ec-shadow-soft);
    position: relative;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

/* Glass border highlight */
#course-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: var(--glass-border);
    border-radius: var(--ec-radius-lg) var(--ec-radius-lg) 0 0;
}

/* ============================================
   TYPOGRAPHY - Fluid & Modern
===============================================*/

h1, h2, h3, h4, h5, h6 {
    color: var(--ec-heading);
    margin: 0 0 0.8em 0;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--ec-heading) 0%, var(--ec-link) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    color: var(--ec-link);
}

h3 { font-size: 1.15rem; }

p { margin: 0 0 1em 0; }

a {
    color: var(--ec-link);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

a:hover {
    color: var(--ec-link-hover);
    text-decoration: underline;
}

.section-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--ec-text-muted);
    font-weight: 600;
}

.lead {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--ec-text-main);
}

/* ============================================
   HERO LAYOUT - Staggered Animations
===============================================*/

.hero{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "nav  nav"
      "text media";
    gap: 32px;
    align-items: start;
  }
  
  .local-nav--full{
    grid-area: nav;
    width: 100%;
  }
  
  .hero-text{
    grid-area: text;
    min-width: 0;
  }
  
  .hero-media{
    grid-area: media;
    margin-top: 11rem; /* keep your placement */
  }
  

.hero-text > * {
    animation: fadeInUp 0.6s ease-out backwards;
}

.hero-text > *:nth-child(1) { animation-delay: 0.1s; }
.hero-text > *:nth-child(2) { animation-delay: 0.2s; }
.hero-text > *:nth-child(3) { animation-delay: 0.3s; }
.hero-text > *:nth-child(4) { animation-delay: 0.4s; }
.hero-text > *:nth-child(5) { animation-delay: 0.5s; }
.hero-text > *:nth-child(6) { animation-delay: 0.6s; }

.hero-media {
    display: flex;
    justify-content: center;
    margin-top: 11.0rem;
    animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

.hero-img {
    max-width: 280px;
    max-height: 360px;
    display: block;
    height: auto;
    object-fit: contain;
    border-radius: var(--ec-radius-md);
    border: 1px solid var(--ec-border-subtle);
    box-shadow: var(--ec-shadow-soft);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-img:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--ec-shadow-hover);
}

/* Desktop only: keep your exact hero image placement */
@media (min-width: 769px){
    .hero-media{
      margin-top: 11rem;
    }
  }
  
  /* Mobile: stack cleanly and remove the huge offset */
  @media (max-width: 768px){
    .hero{
      grid-template-columns: 1fr;
      grid-template-areas:
        "nav"
        "text"
        "media";
    }
  
    .hero-media{
      margin-top: 1rem;     /* or 0 */
      justify-content: flex-start; /* optional: aligns left */
    }
  
    .hero-text{
      flex: none;           /* harmless if still present */
      width: 100%;
    }
  }
  @media (max-width: 480px){
    .local-nav a{
      padding: 5px 12px;
      font-size: 0.9rem;
    }
  }


  
  /* Single calm container for theory properties */
.property-block{
    margin-top: 1.2rem;
    padding: 14px 16px;
  
    border-radius: var(--ec-radius-md);
    border: 1px solid var(--ec-border-subtle);
  
    background: var(--ec-accent-soft);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
  }
  
  .property-muted{
    margin: 0.35rem 0 0.75rem 0;
    font-size: 0.95rem;
    color: var(--ec-text-muted);
    line-height: 1.6;
  }
  
  .property-list{
    margin: 0;
    padding: 0;
    list-style: none;
  }
  
  .property-list li{
    position: relative;
    padding: 6px 0 6px 20px;
    line-height: 1.6;
  }
  
  /* subtle separator between items */
  .property-list li + li{
    border-top: 1px dashed var(--ec-border-subtle);
    margin-top: 6px;
    padding-top: 10px;
  }
  
  /* small accent dot */
  .property-list li::before{
    content: "•";
    position: absolute;
    left: 0;
    top: 6px;
    color: var(--ec-link);
    font-weight: 700;
  }
  
  
  

/* ============================================
   SKIPLINK
===============================================*/

.skip-link {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: var(--ec-bg-surface);
    color: var(--ec-text-main);
    border-radius: 999px;
    border: 1px solid var(--ec-border-subtle);
    font-size: 0.9rem;
    z-index: 2000;
    transition: top 0.3s ease;
    box-shadow: var(--ec-shadow-soft);
}

.skip-link:focus { top: 16px; }

/* ============================================
   HEADER ACTIONS
===============================================*/

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.course-home-btn {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid var(--ec-border-subtle);
    background: var(--ec-accent-soft);
    color: var(--ec-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.course-home-btn:hover {
    border-color: var(--ec-accent);
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--ec-accent-glow);
}

.course-home-btn svg { display: block; }

/* ============================================
   BLOCKQUOTE - Enhanced
===============================================*/

blockquote {
    padding: 20px 24px;
    background: var(--ec-accent-soft);
    border-left: 4px solid var(--ec-accent);
    border-radius: var(--ec-radius-md);
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

blockquote::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--ec-accent), transparent);
}

blockquote strong { color: var(--ec-heading); }

/* ============================================
   CARDS - Enhanced Hover Effects
===============================================*/

.cards-section {
    margin-top: 3rem;
    animation: fadeInUp 0.6s ease-out 0.8s backwards;
}

.section-heading {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--ec-heading);
}

.card-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.card {
    background: var(--ec-bg-surface);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--ec-border-subtle);
    box-shadow: var(--ec-shadow-soft);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

/* Stagger card animations */
.card:nth-child(1) { animation: fadeInUp 0.6s ease-out 0.9s backwards; }
.card:nth-child(2) { animation: fadeInUp 0.6s ease-out 1.0s backwards; }
.card:nth-child(3) { animation: fadeInUp 0.6s ease-out 1.1s backwards; }

/* Glass border on hover */
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: var(--glass-border);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before { opacity: 1; }

.card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: var(--ec-shadow-hover);
    border-color: var(--ec-accent);
}

/* Glow effect on hover */
.card::after {
    content: '';
    position: absolute;
    inset: -100%;
    background: radial-gradient(circle at center, var(--ec-accent-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.card:hover::after { opacity: 0.5; }

.card-img {
    width: 100%;
    height: auto;
    max-height: 280px;
    display: block;
    object-fit: contain;
    border-radius: 12px;
    margin: 0 auto 16px auto;
    transition: transform 0.4s ease;
}

.card:hover .card-img { transform: scale(1.05); }

.card h3 {
    margin-bottom: 0.6rem;
    font-size: 1.15rem;
}

.card p {
    color: var(--ec-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ============================================
   VIDEO CONTAINER
===============================================*/

.video-container {
    width: 100%;
    max-width: 960px;
    margin: 20px auto;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.video-container::before {
    content: "";
    display: block;
    padding-top: 56.25%;
}

.video-container iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ============================================
   TABLES
===============================================*/

.table-wrapper {
    margin: 1.2rem 0;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--ec-border-subtle);
    background: var(--ec-bg-surface);
}

th, td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--ec-border-subtle);
    font-size: 0.95rem;
    text-align: left;
}

thead th {
    background: #111827;
    color: #f9fafb;
    font-weight: 600;
}

tbody tr:nth-child(even) { background: #f9fafb; }
tbody tr:nth-child(odd)  { background: #ffffff; }

:root[data-theme="dark"] tbody tr:nth-child(even),
:root[data-theme="dark"] tbody tr:nth-child(odd) {
    background: #020617;
}

tbody tr {
    transition: background-color 0.18s ease, color 0.18s ease;
}

:root:not([data-theme="dark"]) tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.18);
    color: #111827;
}

:root[data-theme="dark"] tbody tr:hover {
    background-color: rgba(56, 189, 248, 0.20);
    color: #f1f5f9;
}

/* ============================================
   COURSE SWITCHER (HEADER)
===============================================*/

.course-switcher {
    margin-left: 8px;
    margin-right: 8px;
}

.course-switcher select {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--ec-border-subtle);
    background: var(--ec-bg-surface);
    color: var(--ec-text-main);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.course-switcher select:focus-visible {
    outline: 2px solid var(--ec-accent);
    outline-offset: 2px;
}

@media (max-width: 600px) {
    .course-switcher { display: none; }
}

/* ============================================
   BREADCRUMBS - Modernized
===============================================*/

.breadcrumbs {
    max-width: 960px;
    margin: 8px auto 0 auto;
    padding: 10px 20px;
    font-size: 0.875rem;
    color: var(--ec-text-muted);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

.breadcrumbs a {
    color: var(--ec-link);
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.breadcrumbs a:hover {
    background: var(--ec-accent-soft);
    transform: translateX(2px);
}

.breadcrumbs .crumb-sep { color: var(--ec-text-muted); }

/* ============================================
   LOCAL NAVIGATION - Modern Active States
===============================================*/

.local-nav {
    display: flex;
    flex-wrap: nowrap;          /* NEVER wrap */
    gap: 12px;

    overflow-x: auto;           /* allow horizontal scroll */
    overflow-y: hidden;
    white-space: nowrap;

    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;

    margin: 0.6rem 0 1.6rem 0;
    padding-bottom: 6px;        /* room for scrollbar */
}


.local-nav a {
    color: var(--ec-text-muted);
    text-decoration: none;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 999px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    flex: 0 0 auto;             /* prevents compression */

}

.local-nav a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--ec-accent-soft);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.local-nav a:hover::before { opacity: 1; }

.local-nav a:hover {
    color: var(--ec-link);
    transform: translateY(-2px);
}

.local-nav a[aria-current="page"] {
    color: var(--ec-link);
    font-weight: 600;
    background: var(--ec-accent-soft);
    box-shadow: 0 4px 12px var(--ec-accent-glow);
}

.local-nav a > * { position: relative; z-index: 1; }

/* ============================================
   HERO INTRO
===============================================*/

.hero-intro {
    margin-top: 1.4rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--ec-border-subtle);
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 2.5rem);
    margin: 0.2rem 0 0.4rem 0;
}

.hero h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 0.6rem 0;
}

/* === NAV FIX (when hero-media exists): keep nav in one row with horizontal scroll === */
.hero .hero-text .local-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;

    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;

    padding-bottom: 6px;
}

.hero .hero-text .local-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* optional fade edges to hint scroll */
.hero .hero-text .local-nav {
    mask-image: linear-gradient(to right,
        transparent 0,
        black 18px,
        black calc(100% - 18px),
        transparent 100%);
    -webkit-mask-image: linear-gradient(to right,
        transparent 0,
        black 18px,
        black calc(100% - 18px),
        transparent 100%);
}

.hero .hero-text .local-nav::-webkit-scrollbar { height: 6px; }
.hero .hero-text .local-nav::-webkit-scrollbar-thumb { border-radius: 999px; }

/* ============================================
   SECTION DIVIDER
===============================================*/

.section-divider {
    height: 2px;
    border: none;
    background: linear-gradient(90deg, var(--ec-accent) 0%, transparent 100%);
    margin: 1.5rem 0;
    opacity: 0.3;
}

/* ============================================
   CAUTION NOTE
===============================================*/

.caution-note {
    margin-top: 1.2rem;
    padding: 14px 16px;
    border-left: 4px solid #f97316;
    background: rgba(249, 115, 22, 0.10);
    border-radius: var(--ec-radius-md);
    font-size: 0.95rem;
    color: var(--ec-text-main);
}

.caution-note strong { font-weight: 700; }

.caution-note code {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.04);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

:root[data-theme="dark"] .caution-note {
    background: rgba(249, 115, 22, 0.12);
    border-left-color: #fdba74;
}

/* FORCE reading progress bar to sit ON TOP at the very top of the viewport */
.reading-progress-bar {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    z-index: 9999 !important;
    pointer-events: none;
    background: transparent;
}

.reading-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--ec-accent), #22c55e);
    transform-origin: left center;
    transition: width 0.05s linear;
}

/* ============================================
   MOBILE FIXES
===============================================*/

@media (max-width: 768px) {
    #header {
        padding: 10px 12px;
        justify-content: space-between;
    }

    .header-content {
        position: static;
        left: auto;
        transform: none;
        margin: 0 auto;
    }

    .header-content span { font-size: 1rem; }
    .logo { height: 32px; }

    .header-actions { gap: 4px; }

    .menu-toggle,
    .theme-toggle,
    .course-home-btn {
        width: 40px;
        height: 40px;
    }

    .menu-toggle span,
    .menu-toggle span::before,
    .menu-toggle span::after {
        width: 16px;
    }

    body { background-attachment: scroll; }

    #course-content {
        margin: 16px 12px 40px 12px;
        padding: 24px 18px;
    }
}

/* ============================================
   CARD GRID – RESPONSIVE LAYOUT
===============================================*/

/* Tablets / small laptops */
@media (max-width: 1024px) {
    .card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phones – single column & non-zoomed images */
@media (max-width: 700px) {
    .card-list { grid-template-columns: 1fr; }

    .card { padding: 18px 16px; }

    .card-list .card-img {
        width: 100%;
        height: auto;
        max-height: 220px;
        object-fit: contain;
        margin: 0 auto 12px auto;
        border-radius: 10px;
        background: none;
    }

    .card-list .card { border-radius: 18px; }

    .breadcrumbs {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .lead { font-size: 1rem; }
}

/* Light mode: normal */
.invert-dark { filter: none; }

/* Dark mode: invert image so it works on dark backgrounds */
:root[data-theme="dark"] .invert-dark {
    filter: invert(1) hue-rotate(180deg);
}

/* ============================================
   CLEAN HORIZONTAL "ON THIS PAGE" NAV
===============================================*/

.section-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    margin: 1.2rem 0 1.8rem 0;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
}

.section-nav > span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ec-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 6px;
}

.section-nav a {
    font-size: 0.95rem;
    color: var(--ec-link);
    text-decoration: none;
    font-weight: 500;
    padding: 0;
    border-radius: 0;
    transition: color 0.2s ease;
}

.section-nav a:hover {
    color: var(--ec-link-hover);
    text-decoration: underline;
}

@media (max-width: 600px) {
    .section-nav { gap: 12px; }
}

/* ============================================
   CHAPTER HEADER ROW
===============================================*/

.chapter-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--ec-border-subtle);
}

.chapter-header-row .section-label,
.chapter-prev-link,
.chapter-next-link {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--ec-text-muted);
    text-transform: uppercase;
}

.chapter-prev-link,
.chapter-next-link {
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.chapter-prev-link:hover,
.chapter-next-link:hover {
    background: var(--ec-accent-soft);
    color: var(--ec-link-hover);
}

/* ============================================
   BOTTOM PAGE NAVIGATION (Prev / Next)
===============================================*/

.page-nav {
    width: 100%;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--ec-border-subtle);

    display: flex;
    justify-content: center;
    align-items: center;
    gap: 32px;

    font-size: 0.95rem;
}

.page-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;

    border-radius: 999px;
    border: 1px solid transparent;

    font-weight: 500;
    text-decoration: none;
    color: var(--ec-link);
    background: transparent;

    transition: background 0.25s ease,
                color 0.25s ease,
                border-color 0.25s ease,
                transform 0.2s ease,
                box-shadow 0.25s ease;
}

.page-nav a:hover,
.page-nav a:focus-visible {
    background: var(--ec-accent-soft);
    border-color: var(--ec-accent);
    color: var(--ec-link-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--ec-accent-glow);
    outline: none;
}

.page-nav a.prev { color: var(--ec-text-muted); }

.page-nav a.prev:hover,
.page-nav a.prev:focus-visible { color: var(--ec-link-hover); }

@media (max-width: 700px) {
    .page-nav {
        margin-top: 2.5rem;
        padding-top: 1.2rem;
        gap: 16px;
        font-size: 0.9rem;
        flex-wrap: wrap;
    }

    .page-nav a { padding: 8px 14px; }
}

.page-nav-sep {
    font-size: 1rem;
    color: var(--ec-text-muted);
    opacity: 0.6;
    user-select: none;
}

/* ============================================
   EXAMPLE BOXES – STYLED CALLOUTS
===============================================*/

.example-box {
    margin: 1.6rem 0;
    padding: 1rem 1.2rem 1.1rem 1.2rem;
    border-radius: var(--ec-radius-md);
    border: 1px solid var(--ec-border-subtle);
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.10), transparent 55%);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    box-shadow: var(--ec-shadow-soft);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease,
                border-color 0.18s ease, background 0.18s ease;
    position: relative;
}

.example-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--ec-shadow-hover);
    border-color: var(--ec-accent);
}

.example-box::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--ec-accent), transparent);
    opacity: 0.9;
}

.example-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.example-header h3 {
    margin: 0;
    font-size: 1rem;
}

#prompt-message-units,
#prompt-message-grav {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ec-link);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

#prompt-message-units::after,
#prompt-message-grav::after {
    font-size: 0.85em;
}

.example-box p:last-child { margin-bottom: 0; }

:root[data-theme="dark"] .example-box {
    background: radial-gradient(circle at top left, rgba(96, 165, 250, 0.18), rgba(15, 23, 42, 0.96));
}

/* ============================================
   INFO NOTE - Calm informational callout
===============================================*/

.info-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;

    padding: 14px 16px;
    margin: 1.2rem 0;

    background: var(--ec-accent-soft);
    border-left: 4px solid var(--ec-link);
    border-radius: var(--ec-radius-md);

    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);

    box-shadow: var(--ec-shadow-soft);
}

.info-icon {
    font-size: 1.3rem;
    line-height: 1;
    color: var(--ec-link);
    flex-shrink: 0;
    margin-top: 2px;
}

.info-content {
    color: var(--ec-text-main);
    font-size: 0.95rem;
    line-height: 1.5;
}

:root[data-theme="dark"] .info-note {
    background: rgba(96, 165, 250, 0.15);
    border-left-color: var(--ec-accent);
}

:root[data-theme="dark"] .info-icon { color: var(--ec-accent); }

/* ============================================
   EXAMPLE CARD – (ec-example)
===============================================*/

.ec-example {
    margin: 1.8rem 0;
    padding: 18px 18px 20px 18px;
    border-radius: var(--ec-radius-lg);
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.12), transparent 55%),
        var(--ec-bg-surface);
    border: 1px solid var(--ec-border-subtle);
    box-shadow: var(--ec-shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* TOP BAR OF EXAMPLE */
.ec-example-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;

    margin: -6px -10px 6px -10px;
    padding: 8px 14px;
    border-radius: calc(var(--ec-radius-lg) - 4px) calc(var(--ec-radius-lg) - 4px) 10px 10px;

    background: linear-gradient(
        90deg,
        rgba(15, 23, 42, 0.12),
        rgba(37, 99, 235, 0.18),
        rgba(15, 23, 42, 0.12)
    );
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

/* DARK THEME — violet/indigo bar */
:root[data-theme="dark"] .ec-example-meta {
    background: linear-gradient(
        90deg,
        rgba(88, 73, 130, 0.45),
        rgba(72, 61, 115, 0.45),
        rgba(88, 73, 130, 0.45)
    );
    border-bottom: 1px solid rgba(200, 180, 255, 0.25);
}

/* Chips */
.ec-example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.chip-primary {
    background: var(--ec-accent-soft);
    color: var(--ec-link);
}

.chip-soft {
    background: rgba(148, 163, 184, 0.16);
    color: var(--ec-text-muted);
}

/* Toggle button */
.ec-example-toggle {
    border-radius: 999px;
    border: 1px solid var(--ec-border-subtle);
    background: var(--ec-bg-surface);
    padding: 6px 14px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    color: var(--ec-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease,
                transform 0.15s ease,
                color 0.2s ease;
}

.ec-example-toggle:hover {
    background: var(--ec-accent-soft);
    border-color: var(--ec-accent);
    color: var(--ec-link-hover);
    box-shadow: 0 0 14px var(--ec-accent-glow);
    transform: translateY(-1px);
}

.ec-example-toggle[aria-expanded="true"] {
    background: var(--ec-accent-soft);
    border-color: var(--ec-accent);
    color: var(--ec-link-hover);
}

/* Dark theme toggle harmony */
:root[data-theme="dark"] .ec-example-toggle {
    background: rgba(72, 61, 115, 0.55);
    border-color: rgba(200, 180, 255, 0.35);
    color: #cbd5e1;
}

:root[data-theme="dark"] .ec-example-toggle:hover {
    background: rgba(109, 95, 163, 0.65);
    border-color: rgba(220, 200, 255, 0.55);
    color: #f1f5f9;
    box-shadow: 0 0 14px rgba(140, 120, 200, 0.35);
}

:root[data-theme="dark"] .ec-example-toggle[aria-expanded="true"] {
    background: rgba(109, 95, 163, 0.35);
    border-color: rgba(220, 200, 255, 0.45);
    color: #f1f5f9;
}

/* Main layout: text + figure */
.ec-example-main {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr);
    gap: 18px;
    align-items: flex-start;
}

.ec-example-question h3 { margin-bottom: 0.4rem; }
.ec-example-problem { margin-bottom: 0.6rem; }
.ec-example-why { font-size: 0.9rem; color: var(--ec-text-muted); }

/* Figure */
.ec-example-figure {
    margin: 0;
    font-size: 0.8rem;
    color: var(--ec-text-muted);
}

.ec-example-figure-bg {
    display: flex;
    justify-content: center;
    border-radius: var(--ec-radius-md);
    padding: 10px;
    background: radial-gradient(circle at top, rgba(59, 130, 246, 0.18), transparent 60%);
    border: 1px solid var(--ec-border-subtle);
    box-shadow: var(--ec-shadow-soft);
}

.ec-example-figure img {
    display: block;
    width: 100%;
    height: auto;
}

/* Solution area */
.ec-example-solution {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px dashed var(--ec-border-subtle);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ec-example-solution[hidden] { display: none !important; }

/* Steps */
/* Remove card-in-card look for figures inside example steps */
.ec-example-step .ec-example-figure-bg {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
}

.ec-example-step .ec-example-figure {
    margin: 0.75rem 0;
}

.ec-example-step .ec-example-figure img {
    max-width: 70%;
    margin: 0 auto;
    display: block;
}

/* DARK THEME — Better example card background */
:root[data-theme="dark"] .ec-example {
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.08), transparent 55%),
        rgba(28, 31, 43, 0.95);
    border-color: rgba(148, 163, 184, 0.22);
}

/* Step badge */
.step-badge {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #f9fafb;
    background: linear-gradient(135deg, var(--ec-link), #22c55e);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.step-body { flex: 1; }

.step-title {
    margin: 0 0 0.35rem 0;
    font-weight: 600;
    font-size: 0.95rem;
}

.step-note {
    margin-top: 0.3rem;
    font-size: 0.9rem;
    color: var(--ec-text-muted);
}

/* Common mistake callout */
.ec-example-mistake {
    padding: 10px 12px;
    border-radius: var(--ec-radius-md);
    border-left: 3px solid #f97316;
    background: rgba(249, 115, 22, 0.10);
    font-size: 0.9rem;
}

:root[data-theme="dark"] .ec-example-mistake {
    background: rgba(249, 115, 22, 0.16);
    border-left-color: #fdba74;
}

/* Summary list */
.ec-example-summary {
    padding: 10px 12px;
    border-radius: var(--ec-radius-md);
    background: rgba(34, 197, 94, 0.08);
    border: 1px dashed rgba(34, 197, 94, 0.4);
    font-size: 0.9rem;
}

.ec-example-summary ul {
    margin: 0.4rem 0 0 1.1rem;
    padding: 0;
}

/* Video placeholder */
.ec-example-video-coming {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    font-size: 0.85rem;
    color: var(--ec-text-muted);
}

.ec-example-video-icon { font-size: 0.9rem; }

/* Responsive adjustments */
@media (max-width: 800px) {
    .ec-example-main { grid-template-columns: 1fr; }
}

/* ------------------------------------------
   MODERN 2025 MATH STYLING
------------------------------------------ */

mjx-container {
    color: var(--ec-text-main);
    margin: 0.35rem 0;
}

mjx-container[display="true"] {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
    -webkit-overflow-scrolling: touch;
    margin: 1.0rem 0 1.2rem 0;
}

:root[data-theme="dark"] mjx-container mjx-math {
    color: #e2e8f0;
}

/* On small screens, don't let the meta bar bleed outside the card */
@media (max-width: 800px) {
    .ec-example {
        margin-left: 0;
        margin-right: 0;
        padding: 16px 14px 18px 14px;
    }

    .ec-example-meta {
        margin: 0 0 6px 0;
        padding: 8px 10px;
        border-radius: calc(var(--ec-radius-lg) - 4px);
    }
}


/* ============================================
   EQBOX (Equation Box)
===============================================*/
.eqbox{
    margin: 1.2rem 0;
    padding: 14px 16px;
    border: 1px solid var(--ec-border-subtle);
    border-radius: var(--ec-radius-md);
    background: var(--ec-accent-soft);
    box-shadow: var(--ec-shadow-soft);
  }
  
  /* Key equation box: stronger border */
  .eqbox.eqbox-key{
    border: 2px solid var(--ec-accent);
  }

  .eqbox-label{
    display: inline-block;
    margin-bottom: 0.6rem;
    padding: 3px 10px;
    border-radius: 999px;
  
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  
    color: var(--ec-link);
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--ec-border-subtle);
  }
  
  :root[data-theme="dark"] .eqbox-label{
    background: rgba(15,23,42,0.55);
    border-color: rgba(148,163,184,0.25);
    color: var(--ec-accent);
  }

  
  /* Tight paragraph spacing for dense theory blocks */
p.tight {
    margin-bottom: 0.4rem;
  }
  
  /* Reduce vertical footprint of figures */
  .compact-figure {
    margin: 0.4rem 0 0.8rem 0;
  }
  
  /* Tighten MathJax spacing inside equation boxes */
  .eqbox mjx-container[display="true"] {
    margin: 0.4rem 0;
  }
  
  /* Slightly tighter padding for key equation boxes */
  .eqbox.eqbox-key {
    padding: 12px 14px;
  }
  
  /* Secondary equation box (vector form) */
  .eqbox-soft {
    background: transparent;
    border: 1px dashed var(--ec-border-subtle);
    box-shadow: none;
  }

  /* Reduce vertical footprint of supporting figures */
.compact-figure{
    margin: 0.4rem 0 0.9rem 0;
  }
  
  /* Tight paragraph spacing in dense theory sections */
  p.tight{
    margin-bottom: 0.4rem;
  }
  
  /* Side-by-side text + figure (desktop) */
  .ec-split{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    margin: 0.4rem 0 1.0rem 0;
  }
  
  .ec-split-figure{
    display: flex;
    justify-content: center;
  }
  
  /* Stack on mobile */
  @media (max-width: 768px){
    .ec-split{
      grid-template-columns: 1fr;
    }
    .ec-split-figure{
      justify-content: flex-start;
    }
  }
  
  /* Tighten MathJax spacing inside eqbox */
  .eqbox mjx-container[display="true"]{
    margin: 0.4rem 0;
  }

  .eqbox-secondary{
    background: transparent;
    border: 1px dashed var(--ec-border-subtle);
    box-shadow: none;
  }

  
  .inline-figure{
    margin: 0;
    padding: 0;
  }
  
  .unit-vector-img{
    width: 160px;   /* change this number */
    height: auto;
  }
  

  .figure-inline{
    margin: 0;
    padding: 0;
  }
  .figure-inline img{
    display: block;
    height: auto;
    width: 140px; /* default = medium */
  }
  
  .figure-inline.size-sm img{ width: 110px; }
  .figure-inline.size-md img{ width: 160px; }
  .figure-inline.size-lg img{ width: 200px; }
  

  /* --- EQBOX: side-by-side figure + equations (tight) --- */
.eqbox-row{
    display: grid;
    grid-template-columns: max-content max-content; /* no stretching */
    justify-content: center;                        /* bring them together */
    align-items: center;
    column-gap: 18px;                               /* tighten spacing */
    row-gap: 12px;
    margin: 0.25rem auto 0 auto;
  }
  
  /* figure sizing (use your size-* helpers if you want) */
  .eqbox-row .figure-inline{ margin: 0; }
  .eqbox-row .figure-inline img{
    width: 240px;   /* adjust once */
    height: auto;
    display: block;
  }
  
  /* equations stack */
  .eqbox-mathstack{
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* key: don’t center within column */
    gap: 0.35rem;
  }
  
  /* override your global center-align for MathJax inside this row */
  .eqbox-row mjx-container[display="true"]{
    text-align: left;
    margin: 0.25rem 0;
  }
  
  /* mobile: stack */
  @media (max-width: 768px){
    .eqbox-row{
      grid-template-columns: 1fr;
      justify-content: start;
    }
    .eqbox-mathstack{ align-items: flex-start; }
  }

  /* Components box: 2-case layout */
.comp-box .tight { margin: 0.35rem 0; }

.comp-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

@media (max-width: 780px){
  .comp-grid{ grid-template-columns: 1fr; }
}

.comp-case{
  background: rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
}

.comp-pill{
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(59,130,246,0.25);
  background: rgba(59,130,246,0.10);
  color: var(--ec-accent);
  margin-bottom: 0.5rem;
}

.comp-math{
  margin-top: 0.25rem;
}

.comp-note{
  color: var(--ec-text-muted);
  margin-top: 0.4rem;
}

  
/* ============================================
   PROCEDURE — Option A (aligned spacing)
   One panel + row separators, no inner cards
=============================================== */

.ec-procedure{
    /* match your other blocks */
    margin: 1.2rem 0 1.6rem 0;           /* less top, a bit more bottom */
    border-radius: var(--ec-radius-lg);
    border: 1px solid var(--ec-border-subtle);
  
    background:
      radial-gradient(circle at top left, var(--ec-accent-soft), transparent 60%),
      var(--ec-bg-surface);
  
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    box-shadow: var(--ec-shadow-soft);
    overflow: hidden;
  }
  
  /* header bar */
  .ec-procedure-head{
    padding: 10px 16px;                  /* same “feel” as your meta bars */
    border-bottom: 1px solid var(--ec-border-subtle);
    background: linear-gradient(90deg, rgba(37,99,235,0.10), transparent);
  
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  
  .ec-procedure-head h3{
    margin: 0;                           /* fix: h3 default margin */
    font-size: 1rem;
    color: var(--ec-heading);
  }
  
  /* optional chips area (if you have it) */
  .ec-procedure-chips{
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  
  /* description */
  .ec-procedure-desc{
    margin: 0;
    padding: 12px 16px 6px 16px;         /* sits flush, not “floaty” */
    color: var(--ec-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
  }
  
  /* steps list */
  .ec-procedure-steps{
    list-style: none;
    margin: 0;
    padding: 0;
  }
  
  /* each step row */
  .ec-procedure-step{
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
  
    padding: 12px 16px;                 /* aligns with head/desc padding */
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  
  .ec-procedure-step + .ec-procedure-step{
    border-top: 1px dashed var(--ec-border-subtle);
  }
  
  /* number bubble */
  .ec-procedure-num{
    width: 26px;
    height: 26px;
    margin-top: 1px;                     /* optical align with first line */
    border-radius: 999px;
  
    display: flex;
    align-items: center;
    justify-content: center;
  
    font-weight: 800;
    font-size: 0.78rem;
    color: var(--ec-link);
  
    background: var(--ec-accent-soft);
    border: 1px solid rgba(59,130,246,0.25);
  }
  
  /* text block */
  .ec-procedure-step-title{
    margin: 0 0 0.25rem 0;               /* fix: consistent title spacing */
    font-weight: 700;
    color: var(--ec-heading);
  }
  
  .ec-procedure-step-text{
    margin: 0;
    color: var(--ec-text-main);
  }
  
  /* math: override your global display-math margins */
  .ec-procedure mjx-container[display="true"]{
    text-align: left;
    margin: 0.35rem 0 0.35rem 0;         /* tighter than your global 1.0–1.2rem */
  }
  
  /* optional “check/note” at bottom */
  .ec-procedure-foot{
    padding: 10px 16px 14px 16px;
    border-top: 1px solid var(--ec-border-subtle);
    color: var(--ec-text-muted);
    font-size: 0.95rem;
  }
  
  /* mobile: tighten a bit */
  @media (max-width: 600px){
    .ec-procedure-head,
    .ec-procedure-desc,
    .ec-procedure-step,
    .ec-procedure-foot{
      padding-left: 14px;
      padding-right: 14px;
    }
  
    .ec-procedure-step{
      grid-template-columns: 30px 1fr;
      gap: 10px;
    }
  }

  /* ============================================
   PROCEDURE HEADER — single-line alignment
=============================================== */

.ec-procedure-head{
    padding: 10px 16px;
    border-bottom: 1px solid var(--ec-border-subtle);
    background: linear-gradient(90deg, rgba(37,99,235,0.10), transparent);
  }
  
  /* one horizontal row */
  .ec-procedure-title{
    display: flex;
    align-items: center;      /* KEY: vertical centering */
    gap: 10px;
    flex-wrap: wrap;          /* allows chips to wrap on small screens */
  }
  
  /* icon */
  .ec-procedure-icon{
    width: 28px;
    height: 28px;
    border-radius: 999px;
  
    display: inline-flex;
    align-items: center;
    justify-content: center;
  
    background: var(--ec-accent-soft);
    border: 1px solid var(--ec-border-subtle);
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
  }
  
  /* title text */
  .ec-procedure-title h3{
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ec-heading);
    white-space: nowrap;     /* keeps title on one line */
  }
  
  /* chips sit on same baseline */
  .ec-procedure-title .ec-example-chips{
    display: inline-flex;
    gap: 6px;
    margin-left: 6px;
  }
  
  /* mobile: allow wrapping cleanly */
  @media (max-width: 600px){
    .ec-procedure-title{
      row-gap: 6px;
    }
  
    .ec-procedure-title h3{
      white-space: normal;
    }
  }
  