/* =============================================================
   1. GLOBAL & TYPOGRAPHY
   ============================================================= */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700;800&display=swap');

body {
  font-family: 'Open Sans', sans-serif;
  line-height: 1.7;
}

h1, h2, h3 {
  font-family: 'Open Sans', sans-serif;
  color: #091b34; 
  font-weight: 800;
}

h1 { border-bottom: 3px solid #ef373e; padding-bottom: 12px; }
h2 { border-left: 5px solid #ef373e; padding-left: 15px; }

/* FIX: Red links in Dark Mode for better accessibility/contrast */
[data-md-color-scheme="slate"] .md-content a {
    color: #ef373e !important;
}

/* =============================================================
   2. DARK MODE (SLATE) - Screen View
   ============================================================= */
[data-md-color-scheme="slate"] {
  --md-accent-fg-color: #ef373e; 
}

[data-md-color-scheme="slate"] .md-nav__link:hover,
[data-md-color-scheme="slate"] .md-nav__link--active {
  color: #ef373e !important;
}

[data-md-color-scheme="slate"] h1, 
[data-md-color-scheme="slate"] h2 {
  color: #ffffff !important;
}

/* =============================================================
   3. SCREEN STYLES (Website UI)
   ============================================================= */
@media screen {
  .qr, .qr-link, .qr-caption { display: none !important; }
  .video { display: block; margin-bottom: 20px; }

  .print-button {
    background-color: #ef373e;
    color: white !important;
    padding: 10px 16px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
  }

  .mmc-cta-container {
    margin-top: 60px;
    padding: 40px 20px;
    background-color: #ffffff !important;
    border: 1px solid #ddd;
    border-radius: 15px;
    text-align: center;
  }
}

/* =============================================================
   4. PRINT STYLES (Forced Light Mode + Non-Overlapping Footer)
   ============================================================= */
@media print {
  @page { 
    margin: 0.7in 0.5in 0.8in 0.5in; 
  }

  /* Force Light Mode Colors */
  * {
    color: #000 !important;
    background: transparent !important;
    -webkit-print-color-adjust: exact !important; 
    print-color-adjust: exact !important;
  }

  body { 
    background-color: #fff !important; 
    font-size: 11pt;
    display: block;
  }

  h1, h2 { color: #091b34 !important; }
  h1 { border-bottom: 3px solid #ef373e !important; margin-top: 0 !important; }
  h2 { border-left: 5px solid #ef373e !important; }

/* Hide UI elements */
.md-header, .md-sidebar, .md-footer, .md-nav, .print-button, .mmc-cta-container, .video, .video-container, .center-thumb {
  display: none !important;
}

  /* SMALL TOP-LEFT LOGO */
  body::before {
    content: "";
    display: block;
    width: 3in !important; 
    height: 1in;
    background-image: url('../images/MMC_NSS_Logo.png');
    background-repeat: no-repeat;
    background-position: left center;
    background-size: contain;
    margin-bottom: 10px;
  }

  /* PRINT FOOTER (No longer fixed, won't overlap) */
  .md-content::after {
    content: "Version 1.0 | Last Updated: April 2026 | CC BY-SA © 2026 by Neil Squire. Licensed under CC BY SA 4.0 (http://creativecommons.org/licenses/by-sa/4.0) | Source: https://github.com/makersmakingchange/GAME-Checkpoints";
    display: block;
    margin-top: 50px; /* Space between content and footer */
    padding-top: 10px;
    border-top: 1px solid #ccc;
    font-size: 8pt;
    line-height: 1.4;
    color: #444 !important;
    text-align: left;
  }

  /* QR Sizing */
  .qr img, .qr-link img { 
    width: 1.2in !important; 
    height: 1.2in !important; 
    page-break-inside: avoid; /* Prevents QR from splitting across pages */
  }
  
  .qr p, .qr-link p { font-weight: 700; margin-top: 5px; }

  /* ONLY expand external links */
  a[href^="http"]:after, a[href^="https"]:after { 
    content: " (" attr(href) ")"; 
    font-size: 0.85em; 
  }

  .md-content { margin-left: 0 !important; width: 100% !important; }
}

/* =============================================================
   5. DYNAMIC PRINT BUILDER STYLES
   ============================================================= */

.print-selector-ui {
    background: #f9f9f9;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 12px;
    margin-bottom: 2rem;
    position: relative;
    z-index: 5;
}

[data-md-color-scheme="slate"] .print-selector-ui {
    background: #2e303e;
    border-color: #444;
}

/* On-screen: Buffer is invisible */
#print-buffer {
    display: none;
}

@media print {
    /* ONLY hide the main content if we are on the page with the Print Buffer */
    /* We check if the body has a specific class, or simply target the main content 
        only when #print-buffer is present and visible */
    
    body:has(#print-buffer) .md-main__inner,
    body:has(#print-buffer) .md-header,
    body:has(#print-buffer) .md-footer,
    body:has(#print-buffer) .print-selector-ui {
        display: none !important;
    }

    /* Show the buffer content */
    #print-buffer {
        display: block !important;
        visibility: visible !important;
        width: 100%;
    }

    /* If we are NOT on the print builder page, make sure md-main__inner stays visible! */
    /* This ensures Start Here, Equipment, etc. still print normally */
    .md-main__inner {
        display: block !important;
    }

    .printable-section {
        display: block !important;
        page-break-after: always !important;
    }

    #print-buffer::before {
        content: "";
        display: block;
        width: 2in !important; 
        height: 0.6in;
        background-image: url('../images/MMC_NSS_Logo.png');
        background-repeat: no-repeat;
        background-position: left center;
        background-size: contain;
        margin-bottom: 30px;
    }
}

/* =============================================================
   6. GAMER PROFILE CARDS
   ============================================================= */

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
    margin-bottom: 40px;
}

.profile-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

/* Dark Mode adjustment for cards */
[data-md-color-scheme="slate"] .profile-card {
    background: #2e303e;
    border-color: #444;
}

.profile-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.card-image {
    height: 180px;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid #eee;
}

[data-md-color-scheme="slate"] .card-image {
    border-bottom: 1px solid #444;
}

.card-content {
    padding: 20px;
}

.card-content h3 {
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    font-size: 1.25rem !important;
    color: #091b34 !important;
}

[data-md-color-scheme="slate"] .card-content h3 {
    color: #ffffff !important;
}

.card-content p {
    margin: 5px 0 !important;
    font-size: 0.95rem;
    color: #444 !important;
}

[data-md-color-scheme="slate"] .card-content p {
    color: #ccc !important;
}

.card-link {
    display: inline-block;
    margin-top: 15px;
    color: #ef373e;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Hide cards during print if they aren't relevant, 
    or keep them simple if you want them in the PDF */
@media print {
    .profile-grid {
        display: block;
    }
    .profile-card {
        page-break-inside: avoid;
        margin-bottom: 20px;
        border: 1px solid #ccc;
    }
}

/* =============================================================
   8. QUESTIONNAIRE & RESOURCE CARDS
   ============================================================= */

/* Ensure the card content stretches to fill space so the button stays at the bottom */
.profile-card .card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.download-card-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ef373e;
    color: white !important;
    padding: 12px;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 700;
    margin-top: 20px;
    transition: background-color 0.2s ease;
}

.download-card-button:hover {
    background-color: #091b34; /* Changes to Navy on hover */
}

.download-card-button span {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Print adjustment: Hide the download buttons on paper */
@media print {
    .download-card-button {
        display: none !important;
    }
}

/* =============================================================
   9. TABLE OF CONTENTS (RIGHT SIDEBAR)
   ============================================================= */

/* 1. Hide the original title */
.md-sidebar--secondary .md-nav__title {
    display: none !important;
}

/* 2. SURGICAL FIX: Only inject the title once at the top level */
/* The "nav > ul > li" path ensures it doesn't trigger on nested <ul> elements */
.md-sidebar--secondary .md-nav > ul > li:first-child::before {
    content: "What's on this page";
    display: block !important;
    padding: 12px 16px;
    font-weight: 800;
    color: #262262; /* Your new Header Color */
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
}

/* 3. Ensure sub-lists (nested items) don't repeat the title */
.md-sidebar--secondary .md-nav .md-nav__list .md-nav__list li:first-child::before {
    content: none !important;
}

/* Dark Mode Title Color */
[data-md-color-scheme="slate"] .md-sidebar--secondary .md-nav > ul > li:first-child::before {
    color: #ffffff !important;
}

/* 4. ToC Links Styling */
.md-nav--secondary .md-nav__link {
    font-size: 0.7rem;
    border-left: 2px solid #eee;
    padding-left: 12px;
}

.md-nav--secondary .md-nav__link--active {
    color: #ef373e !important;
    font-weight: 700;
    border-left: 2px solid #ef373e !important;
}

[data-md-color-scheme="slate"] .md-nav--secondary .md-nav__link {
    border-left-color: #333;
}

/*page banner */

.page-banner {
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 25px 0; /* Creates space above and below the image */
    display: block;
}

/* for subtitle of page*/

/* Add a subheading under the main site title in the header */
.md-header__title .md-ellipsis {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    padding-top: 5px;
}

.md-header__title .md-ellipsis::after {
    content: "Gaming Accessibility Made For Everyone | Makers Making Change | Neil Squire"; /* Your Subheading Here */
    font-size: 0.6rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
    color: #ffffff; /* Adjust based on your header color */
}

/* Fail-proof Centered Image & Caption */
.center-thumb {
    text-align: center;
    margin: 30px auto;
    width: 100%;
}

.center-thumb img {
    max-width: 600px; /* YouTube thumbnail size */
    width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
    margin: 0 auto 10px auto;
}

.center-thumb p {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-top: 0 !important;
}

[data-md-color-scheme="slate"] .center-thumb p {
    color: #aaa;
}

/* =============================================================
   11. CUSTOM LOGO SIZING
   ============================================================= */

/* Targets the logo container in the header */
.md-header__button.md-logo img {
    height: 3rem !important; /* Adjust this value to your liking (default is ~1.2rem) */
    width: auto;             /* Keeps the logo from stretching */
    margin: 5px 0;          /* Adds a little vertical padding */
}

/* Adjusts the header title alignment to match the larger logo */
.md-header__title {
    display: flex;
    align-items: center;
}

/* =============================================================
   12. NAVIGATION SIDEBAR - ROOT LEVEL ONLY (FIXED ACTIVE STATES)
   ============================================================= */

/* 1. Base Weight - Bold ONLY the main root categories */
.md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__link,
.md-nav--primary > .md-nav__list > .md-nav__item > label {
    font-weight: 700 !important;
    font-size: 0.8rem;
}

/* 2. Sub-links weight (Equipment, Basics, etc.) */
.md-nav__item--nested .md-nav__item .md-nav__link {
    font-weight: 400 !important;
}

/* 3. LIGHT MODE COLORS (Default Navy) */
.md-nav__link {
    color: #091b34; 
}

/* 4. DARK MODE (SLATE) OVERRIDES */
[data-md-color-scheme="slate"] .md-nav__link {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Forces Pure White for root headers in Dark Mode when NOT active */
[data-md-color-scheme="slate"] .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__link {
    color: #ffffff !important;
}

/* FIX: Targets the outermost active titles (Start Here, etc) in Dark Mode */
[data-md-color-scheme="slate"] .md-nav__item--active > .md-nav__link,
[data-md-color-scheme="slate"] .md-nav__item--active > label,
[data-md-color-scheme="slate"] .md-nav__link--active,
[data-md-color-scheme="slate"] .md-nav__link:hover {
    color: #ef373e !important;
}

/* 5. NAVIGATION DIVIDERS (Red Lines) */
.md-nav--primary > .md-nav__list > .md-nav__item:nth-child(2) {
    border-bottom: 2px solid #ef373e;
    margin-bottom: 15px;
    padding-bottom: 15px;
}

.md-nav--primary > .md-nav__list > .md-nav__item:nth-child(4) {
    border-top: 2px solid #ef373e;
    margin-top: 15px;
    padding-top: 15px;
}

/* =============================================================
   13. LAYOUT & SPACING (Wider Content Area)
   ============================================================= */

@media screen and (min-width: 76.25em) {
  /* Increase the overall width of the site container */
  .md-grid {
    max-width: 85rem; /* Default is usually around 60rem. Increase this to push sidebars out. */
  }

  /* Increase the space for the actual text content in the middle */
  .md-main__inner {
    margin-top: 1.5rem;
  }

  /* Add extra padding to the content so it feels less cramped */
  .md-content {
    margin-right: 2rem;
    margin-left: 2rem;
  }
}


/* =============================================================
   14. CENTERED VIDEO PLAYER
   ============================================================= */

.video-container {
    display: flex;
    flex-direction: column;
    align-items: center;    /* Centers the video horizontally */
    justify-content: center;
    margin: 40px auto;      /* Top/Bottom margin and auto-centers the div */
    width: 100%;            /* The container takes full width */
}

.video-container iframe {
    width: 65% !important;  /* Adjust this percentage to your "reasonable size" */
    aspect-ratio: 16 / 9;   /* Maintains YouTube shape */
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: none;
}

/* Make it full width on mobile devices */
@media screen and (max-width: 45em) {
    .video-container iframe {
        width: 100% !important;
    }
}

/* =============================================================
   HEADER COLOR CUSTOMIZATION
   ============================================================= */

/* This targets the top bar in both Light and Dark modes */
.md-header {
    background-color: #262262 !important;
}

/* Ensure the text and icons in the header stay white for contrast */
.md-header__title, 
.md-header__button,
.md-header__topic {
    color: #ffffff !important;
}

/* Adjust the subtitle (ellipsis after) color for better visibility on #262262 */
.md-header__title .md-ellipsis::after {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Optional: If you want the search bar background to blend better */
.md-search__input {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Pathway Grid Layout */
.pathway-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 2rem 0;
}

.step-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-top: 4px solid #ef373e; /* Brand Red accent */
    padding: 20px;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

[data-md-color-scheme="slate"] .step-card {
    background: #2e303e;
    border-color: #444;
}

.step-card h3 {
    margin-top: 0 !important;
    color: #262262 !important; /* Your new Header Color */
    font-size: 1.1rem !important;
}

[data-md-color-scheme="slate"] .step-card h3 {
    color: #ffffff !important;
}

.step-card ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

.step-card li {
    font-size: 0.85rem;
    margin-bottom: 8px;
}

/* Resource Layout */
.resource-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.resource-info {
    flex: 1;
    min-width: 250px;
    background: rgba(38, 34, 98, 0.05); /* Tint of your header color */
    padding: 15px;
    border-radius: 6px;
    font-size: 0.9rem;
}

[data-md-color-scheme="slate"] .resource-info {
    background: rgba(255, 255, 255, 0.05);
}

/* =============================================================
   Table Formatting
   ============================================================= */

/* Table Caption - Brand Blue in Light Mode, Brand Red in Dark Mode */
.table-caption {
    text-align: center;
    font-size: 0.85rem;
    color: #262262 !important; /* Your Brand Dark Blue */
    margin-bottom: 4px; /* Keeping it tight to the table */
    font-weight: 800;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Dark Mode (Slate) Toggle */
[data-md-color-scheme="slate"] .table-caption {
    color: #ef373e !important; /* Your Brand Red for high contrast on dark bg */
}

/* Container & Table styling - ensures borders show in dark mode */
.centered-table-container {
    margin: 2rem auto;
    max-width: 100%; 
    display: block;
}

.centered-table-container table {
    margin: 0 auto !important;
    display: table !important;
    width: auto !important; 
    min-width: 80%; /* Forces the table to be at least 80% wide */
    border-collapse: collapse !important;
    font-size: 0.8rem !important;
}

.centered-table-container th, 
.centered-table-container td {
    border: 1px solid #dfe2e5 !important;
    padding: 12px 16px !important;
}

[data-md-color-scheme="slate"] .centered-table-container th,
[data-md-color-scheme="slate"] .centered-table-container td {
    border: 1px solid #444 !important;
}

/* =============================================================
   Filters (Theme-Aware + Stable)
   ============================================================= */

.filter-panel {
  display: flex;
  gap: 12px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 20px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  background-color: transparent;
}

/* Hover - Light Mode */
.filter-option:hover {
  background-color: rgba(38, 34, 98, 0.08);
}

/* ACTIVE (JS-controlled) - Light Mode */
.filter-option.active {
  background-color: rgba(38, 34, 98, 0.15);
  border-color: #262262;
}

/* Checkbox accent - Light Mode */
.filter-option input {
  accent-color: #262262;
}

/* Text weight */
.filter-option span {
  font-weight: 500;
}

.filter-option.active span {
  font-weight: 700;
}

/* =========================
   DARK MODE OVERRIDES
   ========================= */

[data-md-color-scheme="slate"] .filter-option {
  border-color: #444;
}

[data-md-color-scheme="slate"] .filter-option:hover {
  background-color: rgba(239, 55, 62, 0.12);
}

[data-md-color-scheme="slate"] .filter-option.active {
  background-color: rgba(239, 55, 62, 0.2);
  border-color: #ef373e;
}

[data-md-color-scheme="slate"] .filter-option input {
  accent-color: #ef373e;
}

/* =============================================================
   SUPPORT LIST LAYOUT (FIXED + STABLE)
   ============================================================= */

.support-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.support-item {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

/* DARK MODE */
[data-md-color-scheme="slate"] .support-item {
  border-color: #444;
}

/* IMAGE — STABLE SIZE, NO JUMPING */
.support-item img {
  width: 200px;
  height: 200px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

/* CONTENT */
.support-content {
  flex: 1;
  min-width: 0; /* prevents text overflow issues */
}

.meta {
  font-size: 0.9em;
  color: #555;
}

[data-md-color-scheme="slate"] .meta {
  color: #aaa;
}

/* =============================================================
   GLOBAL IMAGE SAFETY (DO NOT REMOVE)
   ============================================================= */

img {
  max-width: 100%;
  height: auto;
}

/* =============================================================
   HEADER LOGO PROTECTION
   ============================================================= */

.md-header__button.md-logo img {
  height: 3rem !important;
  width: auto !important;
  max-height: 3rem !important;
  object-fit: contain;
}

/* =============================================================
   MOBILE FIX (CRITICAL)
   ============================================================= */

@media screen and (max-width: 700px) {
  .support-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .support-item img {
    width: 150px;
    height: 150px;
  }
}