/******************************************************************************
*** Section: Properties
*** Defines the CSS properties used throughout the styling of this site.
***
*** :root contains standardized properties for colors, sizes, etc
*** [data-bs-theme=*] contains the specific color styling for the theme.
******************************************************************************/
:root {
  --mg-orange-dark-rgb: 231, 60, 0;
  --mg-orange-light-rgb: 212, 93, 53;
  --mg-orange-dark: rgba(var(--mg-orange-dark-rgb), 1);
  --mg-orange-light: rgba(var(--mg-orange-light-rgb), 1);
  --navbar-height: 62px;
}

[data-bs-theme="light"] {
  --mg-orange-primary: var(--mg-orange-dark);
  --mg-orange-secondary: var(--mg-orange-light);
  --mg-logo: url('/images/logo_light.svg');

  --bs-link-color-rgb: var(--mg-orange-dark-rgb);
  --bs-link-hover-color-rgb: var(--mg-orange-light-rgb);
}

[data-bs-theme="dark"] {
  --mg-orange-primary: var(--mg-orange-light);
  --mg-orange-secondary: var(--mg-orange-dark);
  --mg-logo: url('/images/logo_dark.svg');

  --bs-link-color-rgb: var(--mg-orange-light-rgb);
  --bs-link-hover-color-rgb: var(--mg-orange-dark-rgb);
}

/*******************************************************************************
*** Section: General
*** General styling across HTMLspecific elements
*******************************************************************************/

body {
font-family: 'Inter', sans-serif;
}

body[data-layout="landing"] > main {
  max-width: 1320px !important;
}

body[data-disable-toc="true" i] .toc-offcanvas {
  visibility: hidden;
}

th:has(a img[alt^="Figure"]),
td:has(a img[alt^="Figure"]) {
  width: 50%;
}

th video,
td video {
  width: 100%;
  height: 100%
}


/*******************************************************************************
*** Section: Bootstrap Overrides
*** Contains various overrides to the built-in bootstrap classes and properties
*** at the class selector level
*******************************************************************************/

/*  Use MonoGame orange as the hover and active color for navbars */
.navbar {
--bs-navbar-hover-color: var(--mg-orange-secondary);
--bs-navbar-active-color: var(--mg-orange-primary);
}

.nav {
--bs-nav-link-color: var(--bs-body-color);
--bs-nav-link-hover-color: var(--mg-orange-primary);
}

/*  Bootstrap doesn't provide an .active class for .nav by default so we have */
/*  to create it ourselves.... */
.nav .active {
color: var(--mg-orange-primary)
}

/*******************************************************************************
*** Section: Navbar Fixes
*** The main monogame website uses bootstrap 5.3.2 while docfx is sitll on
*** bootstrap 3.4.1.  The following are fixes for the top navbar specifically
*** so that it looks the same as the main website
*******************************************************************************/
nav#autocollapse > div.container-xxl {
  max-width: 1320px;
}


/*******************************************************************************
*** Section: MonoGame Utility Classes
*** Utility classes used throughout the site that provide some MonoGame specific
*** styling.
*** Classes begin with '.mg-'
*******************************************************************************/
.mg-color-orange {
color: var(--mg-orange-primary);
}

.mg-logo {
content: var(--mg-logo);
}

.mg-box-shadow {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

.mg-box-shadow:hover,
.mg-box-shadow:focus {
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}

.mg-social-link {
  text-decoration: none;
  color: var(--bs-body-color);
  font-size: 24px;
  filter: brightness(100%);
}

.mg-social-link:hover,
.mg-social-link:focus {
  filter: brightness(120%);
}

.mg-card {
  border: 1px solid;
  border-color: var(--bs-body-color);
  border-radius: .5rem;
  position: relative;
  overflow: hidden;
  height: 100%;
}

.mg-card-thumbnail {
  aspect-ratio: 16/9;
  filter: brightness(100%);
  border-radius: 7px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: var(--bs-body);
  -webkit-transition: filter 0.1s ease-in-out, transform 0.25s ease-in-out;
  -moz-transition: filter 0.1s ease-in-out, transform 0.25s ease-in-out;
  -ms-transition: filter 0.1s ease-in-out, transform 0.25s ease-in-out;
  -o-transition: filter 0.1s ease-in-out, transform 0.25s ease-in-out;
  transition: filter 0.1s ease-in-out, transform 0.25s ease-in-out;

}

.mg-card-thumbnail-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background-repeat: no-repeat;
  background-position: center center;
  filter: drop-shadow(6px 6px 6px #000C);
}

.mg-card:hover .mg-card-thumbnail,
.mg-card:focus .mg-card-thumbnail {
  filter: brightness(110%);
  transform: scale(1.1);
}

@media (prefers-reduced-motion) {
    .mg-card:hover .mg-card-thumbnail,
    .mg-card:focus .mg-card-thumbnail {
        transform: none;
    }
}

.mg-card-body {
  padding-inline: 2rem;
  padding-block: 1rem;
}

.mg-card-title {
  font-size: 22px;
  font-weight: 700;
}

.mg-card-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-style: italic;
}

.mg-no-link {
  text-decoration: none;
  color: var(--bs-body-color);
}

.mg-donate-button {
  --bs-btn-bg: #F1465A;
  --bs-btn-hover-bg: #F25265;
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
}

/*******************************************************************************
*** Some adjustments to give the content some space.
*******************************************************************************/

h1 {
  margin-top: 1.5em;
}
h2 {
  margin-top: 1.25em;
}
h3 {
  margin-top: 1em;
}
h4 {
  margin-top: 0.75em;
}
h5 {
  margin-top: 0.5em;
}

p img {
  margin-top: 3em;
  margin-bottom: 3em;
}

.alert
{
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}

/* Resolves issue where xref links in table columns will break and wrap text in
the middle of the word */
td > .xref {
  word-break: normal;
}

/* 
  Sometimes the default table styling will leave later columns in a table squished.
  Put a <div class="fixed-table"> tag rigt before a table to force constant width.
*/ 
.fixed-table + .table-responsive table {
  table-layout: fixed !important;
}

/*******************************************************************************
*** Section: Question and Answer Sections
*** Styling for the questions and answers sections in tutorials
*******************************************************************************/
.question-answer {
  position: relative;
  margin: 1rem 0 2rem 0;
  padding: 0.75rem;
  border: 2px solid var(--mg-orange-primary);
  border-radius: 4px;
  background-color: var(--bs-body-bg);
  cursor: pointer;
}

/* Initial blacked-out state */
.question-answer:not(.revealed) {
  color: transparent;
  background-color: var(--bs-body-bg);
  user-select: none;
}

/* Show "Click to reveal" text when not revealed */
.question-answer:not(.revealed)::before {
  content: "Click to reveal answer";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bs-body-color);
  font-weight: bold;
  pointer-events: none;
}

/* Reveal on hover style (optional) */
.question-answer:not(.revealed):hover {
  background-color: var(--bs-secondary-bg);
}

/* Make it accessible */
.question-answer:focus {
  outline: 2px solid var(--mg-orange-secondary);
}

/* Hide all child elements when not revealed */
.question-answer:not(.revealed) * {
  opacity: 0;
}

/* When revealed, show content normally */
.question-answer.revealed {
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
}

.question-answer.revealed * {
  opacity: 1;
}

/*******************************************************************************
*** Section: Carousel for docs landing page
*******************************************************************************/
.carousel {
  margin-bottom: 3rem;
  border: 1px solid;
  border-color: var(--bs-body-color);
  border-radius: .5rem;
  overflow: hidden; 
}

.carousel-item {
  height: 400px;
  position: relative;
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.carousel-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.4) 30%, rgba(0, 0, 0, 0) 50%);
  pointer-events: none;
}

.carousel-caption {
  bottom: 0;
  left: 0;
  right: auto;
  text-align: left;
  padding: 3rem;
  z-index: 10;
  max-width: 600px;
  color: white;
}

.carousel-caption h1 {
  margin-top: 0;
  font-weight: 700;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.carousel-caption p {
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  margin-bottom: 1.5rem;
}

.carousel-caption .btn {
  background-color: var(--mg-orange-primary);
  border-color: var(--mg-orange-primary);
  color: white;
  font-weight: 600;
  padding: 0.75rem 2rem;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease-in-out;
}

.carousel-caption .btn:hover,
.carousel-caption .btn:focus {
  background-color: var(--mg-orange-secondary);
  border-color: var(--mg-orange-secondary);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px 0 rgba(0, 0, 0, 0.4);
}

.carousel-indicators {
  margin-bottom: 1rem;
}

.carousel-indicators [data-bs-target] {
  background-color: var(--mg-orange-secondary) !important;
  opacity: 0.6;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
}

.carousel-indicators .active {
  opacity: 1;
  background-color: var(--mg-orange-primary) !important;
}

@media (max-width: 768px) {
  .carousel-item {
    height: 300px;
  }
  
  .carousel-caption {
    padding: 2rem 1rem;
    max-width: 100%;
  }
  
  .carousel-caption h1 {
    font-size: 1.75rem;
  }
  
  .carousel {
    margin-bottom: 3rem;
  }
}

/*******************************************************************************
*** Section: Print Styles
*** Styles applied when printing or generating PDF
*******************************************************************************/

@media print {
  /* Hide site footer in PDF */
  footer,
  .footer,
  #footer {
    display: none !important;
  }

  /* Hide navigation elements */
  .navbar,
  nav.navbar,
  header nav {
    display: none !important;
  }

  /* Hide sidebar/TOC navigation */
  .toc-offcanvas,
  .sidetoc {
    display: none !important;
  }

  /* Hide contribution/edit buttons */
  .contribution,
  .edit-this-page {
    display: none !important;
  }

  /* Hide video elements */
  video,
  iframe[src*="youtube"],
  iframe[src*="vimeo"],
  .video-container,
  .embed-responsive {
    display: none !important;
  }

  /* Force question-answer elements to be revealed in PDF */
  .question-answer,
  .question-answer:not(.revealed) {
    color: var(--bs-body-color) !important;
    background-color: var(--bs-body-bg) !important;
    user-select: auto !important;
  }

  .question-answer:not(.revealed)::before {
    display: none !important;
  }

  .question-answer *,
  .question-answer:not(.revealed) * {
    opacity: 1 !important;
  }

  /* Prevent page breaks inside question-answer blocks */
  .question-answer {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Prevent page breaks inside paragraphs and common block elements */
  /* Exclude TOC navigation which needs to allow breaks for long lists */
  p, blockquote, .alert {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Allow page breaks in TOC navigation lists */
  .toc ul,
  .toc li,
  .toc .nav,
  .sidetoc ul,
  .sidetoc li {
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  /* Keep content list items together, but not TOC */
  article ul,
  article ol,
  article li,
  main > ul,
  main > l,
  main > li {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Ensure proper page breaks */
  h1, h2, h3, h4 {
    page-break-after: avoid;
  }

  pre, code, table {
    page-break-inside: avoid;
  }

  /* Flatten tabs for PDF - show all tab content */
  .tabGroup {
    border: none !important;
  }

  .tabGroup > ul[role="tablist"] {
    display: none !important;
  }

  .tabGroup > section,
  .tabGroup > .tabpanel,
  .tabGroup .tab-pane,
  .tabGroup [role="tabpanel"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    height: auto !important;
    overflow: visible !important;
    padding: 15px 0 !important;
    border-bottom: 1px solid #ddd !important;
    margin-bottom: 15px !important;
  }

  /* Base label styling for tab panels */
  .tabGroup > section::before,
  .tabGroup > .tabpanel::before,
  .tabGroup [role="tabpanel"]::before {
    display: block;
    font-weight: bold;
    font-size: 14px;
    color: #e73c00;
    margin-bottom: 10px;
    padding: 5px 10px;
    background-color: #f5f5f5;
    border-left: 3px solid #e73c00;
  }

  /* OS-specific tab labels - scoped to tabGroup */
  .tabGroup [id*="_windows"]::before { content: "Windows" !important; }
  .tabGroup [id*="_macos"]::before { content: "macOS" !important; }
  .tabGroup [id*="_ubuntu"]::before { content: "Ubuntu" !important; }
  .tabGroup [id*="_linux"]:not([id*="_arch"])::before { content: "Linux" !important; }
  .tabGroup [id$="_arch"]::before,
  .tabGroup [id*="_arch_"]::before { content: "Arch Linux" !important; }

  /* IDE-specific tab labels - scoped to tabGroup */
  .tabGroup [id*="_vscode"]::before { content: "Visual Studio Code" !important; }
  .tabGroup [id*="_rider"]::before { content: "JetBrains Rider" !important; }

  /* Other common tab labels - scoped to tabGroup */
  .tabGroup [id*="_csharp"]::before { content: "C#" !important; }
  .tabGroup [id*="_opengl"]::before { content: "OpenGL" !important; }
  .tabGroup [id*="_directx"]::before { content: "DirectX" !important; }
  .tabGroup [id*="_desktopgl"]::before { content: "DesktopGL" !important; }

  /* Remove last border */
  .tabGroup > section:last-child,
  .tabGroup > .tabpanel:last-child,
  .tabGroup [role="tabpanel"]:last-child {
    border-bottom: none !important;
  }
}
