/* ==========================================================================
   1. HERO SECTION (Landing Page)
   ========================================================================== */

/* The Main Box */
.hero-container {
    text-align: center;
    padding: 3rem 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(180deg, rgba(0,128,128,0.05) 0%, rgba(255,255,255,0.5) 100%);
    border-radius: 12px;
    border: 1px solid rgba(0,128,128,0.1);
}

/* 1. THE FIX: Force Logo and Title onto one line */
.hero-title-group {
    display: flex;
    flex-direction: row;       /* Force horizontal layout */
    align-items: center;       /* Vertically align logo and text */
    justify-content: center;   /* Center the whole group on page */
    gap: 1.5rem;               /* Space between Logo and Title */
    margin-bottom: 1rem;
}

/* 2. THE FIX: Force the Image Size */
.hero-title-group img {
    height: 60px !important;   /* Force logo to be small */
    width: auto !important;
    margin: 0 !important;      /* Remove extra spacing */
    filter: drop-shadow(0 2px 4px rgba(0,128,128,0.2));
}

/* 3. THE FIX: Fix the Title Alignment */
.hero-title-group h1 {
    font-size: 3rem !important;
    font-weight: 800;
    margin: 0 !important;      /* Remove default H1 margins */
    color: var(--md-primary-fg-color);
    line-height: 1;
}

/* Mobile: Stack them only on very small screens */
@media screen and (max-width: 600px) {
    .hero-title-group {
        flex-direction: column;
    }
}

/* The Tagline */
.hero-container p.tagline {
    font-size: 1.3rem;
    color: var(--md-default-fg-color--light);
    margin: 0 auto 1.5rem auto;
    max-width: 700px;
}

/* Button Container */
.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* External Badges */
.external-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 3rem;
    opacity: 0.9;
}

/* ==========================================================================
   2. BUTTON STYLING
   ========================================================================== */

/* Force Button Shape */
.hero-actions a.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

/* Primary Button (Teal) */
.hero-actions a.btn-primary {
    background-color: var(--md-primary-fg-color);
    color: #ffffff !important;
    border: 2px solid var(--md-primary-fg-color);
}
.hero-actions a.btn-primary:hover {
    background-color: var(--md-primary-fg-color--dark);
    box-shadow: 0 4px 10px rgba(0, 128, 128, 0.4);
}

/* Secondary Button (Outline) */
.hero-actions a.btn-secondary {
    background-color: transparent;
    color: var(--md-primary-fg-color) !important;
    border: 2px solid var(--md-primary-fg-color);
}
.hero-actions a.btn-secondary:hover {
    background-color: rgba(0, 128, 128, 0.1);
}

/* ==========================================================================
   3. HEADER CUSTOMIZATION (Top Left Logo)
   ========================================================================== */

.md-header .md-header__button.md-logo img,
.md-header .md-header__button.md-logo svg {
    height: 42px;
    width: auto;
}

.md-header .md-header__button.md-logo:hover {
    opacity: 0.8;
}

/* ==========================================================================
   4. CODE BLOCKS (Sleek Frame)
   ========================================================================== */

/* Style the Container (The Box) */
.md-typeset pre {
    border: 1px solid rgba(128, 128, 128, 0.15);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    background-color: var(--md-code-bg-color);
    padding: 0 !important;
    margin-top: 1em;
    margin-bottom: 1em;
}

/* Style the Inner Content (The Text) */
.md-typeset pre > code {
    padding: 8px 12px !important;
    font-size: 0.9em;
}

.md-typeset pre:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    border-color: rgba(128, 128, 128, 0.3);
    transition: all 0.2s ease;
}

/* ==========================================================================
   5. PEOPLE GRID
   ========================================================================== */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    text-align: center;
    margin: 2em 0;
}

.people-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.people-profile img {
    border-radius: 50%;
    width: 100px;
    height: 100px;
    object-fit: cover;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.people-profile img:hover {
    transform: scale(1.05);
}

.people-profile a {
    font-weight: bold;
    text-decoration: none;
    color: var(--md-typeset-a-color);
}

/* ==========================================================================
   6. MERMAID DIAGRAMS
   ========================================================================== */

/* Center the diagram automatically */
.mermaid {
    display: flex;
    justify-content: center;
    margin: 2em 0; /* Add some vertical breathing room */
}

/* ==========================================================================
   7. TABLE & MATH TWEAKS (Final Fix)
   ========================================================================== */

/* 1. MATH SIZING */
.md-typeset table mjx-container {
    font-size: 135% !important;
    outline: none !important;
}

/* 2. TABLE WRAPPER FIXES */
/* Force the wrapper to hide scrollbars */
.md-typeset__table {
    scrollbar-width: none !important;        /* Firefox */
    -ms-overflow-style: none !important;     /* IE/Edge */
    overflow-y: hidden !important;           /* Kill vertical scrollbar */
    overflow-x: auto !important;             /* Keep horizontal scroll */
}

/* Hide the bar for Webkit (Chrome/Safari) */
.md-typeset__table::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* 3. CELL PADDING */
.md-typeset table td,
.md-typeset table th {
    padding: 18px 12px !important;
    vertical-align: middle !important;
}

/* 4. MATHJAX SPECIFIC OVERRIDES (The likely culprit) */
/* This stops MathJax from creating its own internal scrollbox */
mjx-container {
    overflow: visible !important;
}

/* 5. FORCE TABLE WIDTH */
/* This ensures the table takes the space it needs without triggering the wrapper's vertical limit */
.md-typeset table {
    display: table !important;
    width: 100% !important;
}

/* ==========================================================================
   8. DARK MODE ADJUSTMENTS
   ========================================================================== */

/* Target the Slate (Dark) theme specifically */
[data-md-color-scheme="slate"] .hero-container {
    /* Change the gradient: Dark Teal -> Transparent (instead of White) */
    background: linear-gradient(180deg, rgba(0, 128, 128, 0.15) 0%, rgba(0, 0, 0, 0) 100%);

    /* Darken the border so it's subtle against the black background */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Optional: Make the logo shadow lighter/glowy in dark mode */
[data-md-color-scheme="slate"] .hero-logo-small {
    filter: drop-shadow(0 0 15px rgba(0, 128, 128, 0.6));
}

/* ==========================================================================
   9. DIAGRAM VARIABLES (Light/Dark Mode)
   ========================================================================== */

/* LIGHT MODE COLORS (ENSURE HIGH CONTRAST) */
[data-md-color-scheme="default"] {
    /* User Code: Near-White background, Black text (CRISP) */
    --dia-user-bg: #FAFAFA;
    --dia-user-stroke: #333333;
    --dia-user-text: #000000;

    /* Pytket Backend: Very Light Teal, Darker Teal text */
    --dia-pytket-bg: #E0F7FA;
    --dia-pytket-stroke: #00695C;
    --dia-pytket-text: #004D40;

    /* NVIDIA: Light Green, Dark Green text */
    --dia-nvidia-bg: #F1F8E9;
    --dia-nvidia-stroke: #76B900;
    --dia-nvidia-text: #33691E;

    /* Hardware: Near-White background, Black text */
    --dia-hw-bg: #FAFAFA;
    --dia-hw-stroke: #000000;
    --dia-hw-text: #000000;

    /* Edge Labels */
    --dia-edge-text: #333333;
    --dia-edge-bg: #FFFFFF;
}

/* DARK MODE COLORS (keep the previous dark palette) */
[data-md-color-scheme="slate"] {
    --dia-user-bg: #37474F;
    --dia-user-stroke: #90A4AE;
    --dia-user-text: #FFFFFF;

    --dia-pytket-bg: #004D40;
    --dia-pytket-stroke: #4DB6AC;
    --dia-pytket-text: #FFFFFF;

    --dia-nvidia-bg: #558B2F;
    --dia-nvidia-stroke: #AED581;
    --dia-nvidia-text: #FFFFFF;

    --dia-hw-bg: #121212;
    --dia-hw-stroke: #E0E0E0;
    --dia-hw-text: #FFFFFF;

    --dia-edge-text: #E0E0E0;
    --dia-edge-bg: #1e1e1e;
}

/* ==========================================================================
   10. MERMAID BINDINGS (Apply Variables to Graph)
   ========================================================================== */

/* 1. USER NODE (Class: user) */
.mermaid .node.user rect,
.mermaid .node.user polygon,
.mermaid .node.user path {
    fill: var(--dia-user-bg) !important;
    stroke: var(--dia-user-stroke) !important;
    stroke-width: 2px !important;
}
/* Force Text Color (SVG + HTML) */
.mermaid .node.user text,
.mermaid .node.user span,
.mermaid .node.user .label {
    fill: var(--dia-user-text) !important;   /* SVG text color */
    color: var(--dia-user-text) !important;  /* HTML text color */
}

/* 2. PYTKET BACKEND (Class: pytket) */
.mermaid .node.pytket rect,
.mermaid .node.pytket polygon {
    fill: var(--dia-pytket-bg) !important;
    stroke: var(--dia-pytket-stroke) !important;
    stroke-width: 2px !important;
}
.mermaid .node.pytket text,
.mermaid .node.pytket span,
.mermaid .node.pytket .label {
    fill: var(--dia-pytket-text) !important;
    color: var(--dia-pytket-text) !important;
}

/* 3. NVIDIA SDK (Class: nvidia) */
.mermaid .node.nvidia rect,
.mermaid .node.nvidia polygon {
    fill: var(--dia-nvidia-bg) !important;
    stroke: var(--dia-nvidia-stroke) !important;
    stroke-width: 2px !important;
}
.mermaid .node.nvidia text,
.mermaid .node.nvidia span,
.mermaid .node.nvidia .label {
    fill: var(--dia-nvidia-text) !important;
    color: var(--dia-nvidia-text) !important;
}

/* 4. HARDWARE (Class: hardware) */
.mermaid .node.hardware rect,
.mermaid .node.hardware polygon {
    fill: var(--dia-hw-bg) !important;
    stroke: var(--dia-hw-stroke) !important;
    stroke-width: 3px !important;
    stroke-dasharray: 5 5;
}
.mermaid .node.hardware text,
.mermaid .node.hardware span,
.mermaid .node.hardware .label {
    fill: var(--dia-hw-text) !important;
    color: var(--dia-hw-text) !important;
}

/* 5. EDGE LABELS (The text on arrows) */
.mermaid .edgeLabel {
    background-color: var(--dia-edge-bg) !important;
    color: var(--dia-edge-text) !important;
}
.mermaid .edgeLabel rect {
    fill: var(--dia-edge-bg) !important;
    opacity: 1 !important;
}
.mermaid .edgeLabel span {
    background-color: var(--dia-edge-bg) !important;
    color: var(--dia-edge-text) !important;
}

/* ==========================================================================
   11. MERMAID CONTROL FIXES
   ========================================================================== */

/* Hides the default Zoom/Pan toolbar buttons */
.mermaid .mermaid-toolbar {
    display: none !important;
}
