:root,
[data-bs-theme="dark"] {
  --bs-body-bg: #0c0e12;
  --bs-body-color: #e8eaed;
  --bs-secondary-color: #9aa3b2;
  --bs-border-color: #2a303a;
  --bs-primary: #38bfff;
  --bs-primary-rgb: 56, 191, 255;
  --bs-link-color: #38bfff;
  --bs-link-hover-color: #7dd4ff;
  --bs-focus-ring-color: rgba(56, 191, 255, 0.4);
  --site-elevated: #1a1e26;
  --site-muted-bg: #14171d;

  /*
    Corner radius. Bootstrap's own radius tokens are raised a step so every stock component
    (buttons, inputs, dropdowns, modal, badges) rounds consistently, and custom surfaces
    below reference the same tokens instead of hard-coded values.
  */
  --bs-border-radius: 0.5rem;
  --bs-border-radius-sm: 0.375rem;
  --bs-border-radius-lg: 0.75rem;
  --bs-border-radius-xl: 1rem;
}

body {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}

.site-navbar {
  background-color: var(--bs-body-bg);
}

.navbar-brand,
.nav-link {
  color: var(--bs-body-color) !important;
}

.nav-link.active,
.nav-link:hover,
.nav-link:focus {
  color: var(--bs-primary) !important;
}

.guides-nav-menu,
.character-nav-menu {
  --bs-dropdown-bg: var(--site-elevated);
  --bs-dropdown-border-color: var(--bs-border-color);
  --bs-dropdown-link-color: var(--bs-body-color);
  --bs-dropdown-link-hover-color: var(--bs-primary);
  --bs-dropdown-link-hover-bg: var(--site-muted-bg);
  --bs-dropdown-header-color: var(--bs-secondary-color);
}

.guides-nav-menu {
  min-width: 18rem;
}

.character-nav-menu {
  min-width: 14rem;
}

.character-nav-menu form {
  margin: 0;
}

.character-nav-menu .dropdown-item.active {
  color: var(--bs-primary);
  background-color: var(--site-muted-bg);
}

.character-portrait {
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--site-muted-bg);
  border: 1px solid var(--bs-border-color);
}

.character-portrait-nav {
  width: 1.75rem;
  height: 1.75rem;
}

.character-portrait-account {
  width: 2.5rem;
  height: 2.5rem;
}

.character-portrait-search {
  width: 2.5rem;
  height: 2.5rem;
}

.character-portrait-player {
  width: 8rem;
  height: 11rem;
  border-radius: var(--bs-border-radius);
}

.character-portrait-player-avatar {
  width: 6rem;
  height: 6rem;
}

.character-portrait-comment {
  width: 2rem;
  height: 2rem;
}

.character-portrait-fallback {
  display: inline-block;
  flex-shrink: 0;
}

.player-search-row:hover,
.player-search-row:focus-visible {
  background-color: var(--site-muted-bg);
}

.player-bio {
  white-space: pre-wrap;
}

.guides-nav-section + .guides-nav-section {
  margin-top: 1rem;
}

.guides-nav-submenu {
  position: relative;
}

.guides-nav-submenu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.guides-nav-submenu-caret {
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.7;
  flex-shrink: 0;
}

.guides-nav-flyout {
  --bs-dropdown-bg: var(--site-elevated);
  --bs-dropdown-border-color: var(--bs-border-color);
  --bs-dropdown-link-color: var(--bs-body-color);
  --bs-dropdown-link-hover-color: var(--bs-primary);
  --bs-dropdown-link-hover-bg: var(--site-muted-bg);
  min-width: 11rem;
}

/* Mobile / collapsed nav: show duty types inline under each expansion. */
@media (max-width: 991.98px) {
  .guides-nav-submenu-caret {
    display: none;
  }

  .guides-nav-flyout {
    position: static;
    display: block;
    float: none;
    border: 0;
    box-shadow: none;
    padding: 0 0 0.35rem 0.75rem;
    margin: 0;
    background-color: transparent;
  }
}

@media (min-width: 992px) {
  /* Roughly 14rem per editor-defined column, plus the menu's own padding. */
  .guides-nav-menu {
    min-width: calc(var(--guides-nav-columns, 1) * 14rem + 2rem);
  }

  /* Wowhead-style open-on-hover for the Guides mega menu on desktop. */
  .navbar .nav-item.dropdown:hover > .guides-nav-menu {
    display: block;
    margin-top: 0;
  }

  .guides-nav-flyout {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    margin: 0 0 0 -0.15rem;
    padding: 0.35rem 0;
  }

  .guides-nav-flyout-start {
    left: auto;
    right: 100%;
    margin: 0 -0.15rem 0 0;
  }

  .guides-nav-submenu:hover > .guides-nav-flyout,
  .guides-nav-submenu:focus-within > .guides-nav-flyout {
    display: block;
  }

  .guides-nav-submenu:hover > .guides-nav-submenu-link,
  .guides-nav-submenu:focus-within > .guides-nav-submenu-link {
    color: var(--bs-primary);
    background-color: var(--site-muted-bg);
  }
}

.btn-primary {
  --bs-btn-bg: #38bfff;
  --bs-btn-border-color: #38bfff;
  --bs-btn-hover-bg: #0ea5f0;
  --bs-btn-hover-border-color: #0ea5f0;
  --bs-btn-active-bg: #0284c7;
  --bs-btn-active-border-color: #0284c7;
  --bs-btn-color: #082f49;
  --bs-btn-hover-color: #082f49;
  --bs-btn-active-color: #fff;
}

/* XIVAuth's own brand blue, used only for the Sign in with XIVAuth button (a third-party mark, not a site accent). */
.btn-xivauth {
  --bs-btn-bg: #00a8e8;
  --bs-btn-border-color: #00a8e8;
  --bs-btn-hover-bg: #0093cc;
  --bs-btn-hover-border-color: #0093cc;
  --bs-btn-active-bg: #007fb0;
  --bs-btn-active-border-color: #007fb0;
  --bs-btn-color: #04131c;
  --bs-btn-hover-color: #04131c;
  --bs-btn-active-color: #04131c;
  --bs-btn-focus-shadow-rgb: 0, 168, 232;
  --bs-btn-font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
}

.btn-xivauth .xivauth-logo {
  height: 1.5em;
  width: auto;
}

.btn-outline-secondary {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: var(--bs-border-color);
  --bs-btn-hover-bg: var(--site-elevated);
  --bs-btn-hover-border-color: var(--bs-border-color);
  --bs-btn-hover-color: var(--bs-body-color);
}

.min-vh-50 {
  min-height: 50vh;
}

.guides-category-tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  background-color: var(--site-elevated);
  color: var(--bs-body-color);
  text-decoration: none;
  overflow: hidden;
}

.guides-category-tile:hover,
.guides-category-tile:focus {
  border-color: var(--bs-primary);
  color: var(--bs-body-color);
}

.guides-category-tile:hover .guides-category-tile-label,
.guides-category-tile:focus .guides-category-tile-label {
  color: var(--bs-primary);
}

.guides-category-tile-media {
  display: block;
  aspect-ratio: 16 / 9;
  background-color: var(--site-muted-bg);
  overflow: hidden;
}

.guides-category-tile-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guides-category-tile-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem 1rem;
}

.guides-category-tile-label {
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
}

.guides-type-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background-color: transparent;
  color: var(--bs-body-color);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.925rem;
}

.guides-type-link:hover,
.guides-type-link:focus {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}

.guides-type-link.is-active {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
  background-color: var(--site-muted-bg);
}

.guides-hub-count {
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
}

.guides-type-link.is-active .guides-hub-count {
  color: var(--bs-primary);
}

/*
  Rows are separated by space rather than rules, so nothing competes with the rounded hover fill.
  Flex `gap` skips rows the folder filter hides, keeping the spacing even while filtering.
*/
.guide-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.guide-list[hidden] {
  display: none;
}

/*
  Guide list row: [ square thumbnail | text ].
  The row has a fixed height and no padding, so the thumbnail (a flex item that stretches to
  the row height, with a flex-basis equal to that height) is a flush square. Spacing between
  the thumbnail and text comes from `gap`, never from padding on the row.
*/
.guide-list-link {
  --guide-row-height: 6rem;
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
  height: var(--guide-row-height);
  padding: 0;
  /* Clips the flush thumbnail and the hover fill to the rounded corners; the thumbnail stays square and unpadded. */
  border-radius: var(--bs-border-radius-lg);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}

.guide-list-link:hover {
  background-color: rgba(26, 30, 38, 0.7);
}

.guide-list-link:hover .guide-title {
  color: var(--bs-primary);
}

/* Crop (background-size / background-position) is set inline per guide. */
.guide-list-thumb {
  flex: 0 0 var(--guide-row-height);
  background-color: var(--site-muted-bg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.guide-list-text {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
}

/* Long titles clamp to two lines so the fixed row height never clips mid-line. */
.guide-list-name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-align: left;
}

.guide-list-link .guide-title {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
}

/* Text-only rows (Stratagems have no image): no thumbnail, so the row sizes to its text. */
.guide-list-link.guide-list-link-text {
  height: auto;
  padding: 0.75rem 1rem;
}

.guide-list-link-text .guide-list-text {
  flex-wrap: wrap;
  column-gap: 0.75rem;
  row-gap: 0.25rem;
}

.guide-list-link-text .guide-title {
  font-size: 1.25rem;
}

.guide-list-byline {
  margin-left: 0.4rem;
  color: var(--bs-secondary-color);
  font-size: 1rem;
  font-weight: 400;
}

.guide-hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: clamp(7.875rem, 21vw, 14.4375rem);
  padding: 2rem 0;
  overflow: hidden;
}

.guide-hero-media {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Smallest screens: keep a simple top fade so the title stays readable. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #fff 55%, #fff 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #fff 55%, #fff 100%);
}

.guide-hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Vertical focus comes from --guide-hero-focus-y (set by the hero partial). */
  object-position: center var(--guide-hero-focus-y, 50%);
}

/* xs: banner image full width, title and meta below (no overlay). */
@media (max-width: 575.98px) {
  .guide-hero {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 0;
    overflow: visible;
  }

  .guide-hero-media {
    position: relative;
    inset: auto;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    overflow: hidden;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .guide-hero-media img {
    object-position: center var(--guide-hero-focus-y, 50%);
  }

  .guide-hero-copy {
    max-width: none;
    padding-top: 1rem;
  }
}

/*
 * sm+: image alpha fades to transparent (page background shows through) —
 * clear area on the left for the title; gentler fades on top, bottom, and right.
 */
@media (min-width: 576px) {
  .guide-hero-media {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .guide-hero-media img {
    object-position: 72% var(--guide-hero-focus-y, 50%);
    -webkit-mask-image:
      linear-gradient(
        to right,
        transparent 0%,
        transparent 18%,
        #fff 42%,
        #fff 78%,
        transparent 100%
      ),
      linear-gradient(
        to bottom,
        transparent 0%,
        #fff 20%,
        #fff 80%,
        transparent 100%
      );
    -webkit-mask-composite: source-in;
    mask-image:
      linear-gradient(
        to right,
        transparent 0%,
        transparent 18%,
        #fff 42%,
        #fff 78%,
        transparent 100%
      ),
      linear-gradient(
        to bottom,
        transparent 0%,
        #fff 20%,
        #fff 80%,
        transparent 100%
      );
    mask-composite: intersect;
  }
}

.guide-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 42rem;
}

.guide-hero-title {
  margin: 0;
  max-width: 42rem;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--bs-body-color);
}

.guide-hero-byline,
.guide-hero-verified {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  color: var(--bs-secondary-color);
}

.guide-hero-verified {
  margin-top: 0.5rem;
}

.guide-hero-byline strong {
  color: var(--bs-body-color);
  font-weight: 600;
}

.guide-folder-tagline .blockquote {
  color: var(--bs-secondary-color);
  font-size: 1.125rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.55;
}

.guide-body {
  line-height: 1.65;
}

.guide-body h2,
.guide-body h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  scroll-margin-top: 5rem;
}

.guide-body p,
.guide-body ul,
.guide-body ol {
  margin-bottom: 1rem;
}

.guide-body a {
  color: var(--bs-primary);
}

.guide-figure {
  margin: 1.5rem 0 2rem;
  padding: 0;
}

.guide-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  background-color: var(--site-muted-bg);
}

.guide-figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
}

.guide-toc {
  top: 1.25rem;
  padding: 1rem 0;
}

/* The Stratagem page's right column: role select above the table of contents, sticky together. */
.stratagem-aside {
  top: 1.25rem;
}

.guide-toc-link {
  color: var(--bs-secondary-color);
  text-decoration: none;
  font-size: 0.925rem;
}

.guide-toc-link:hover,
.guide-toc-link:focus {
  color: var(--bs-primary);
}

.breadcrumb-item a {
  color: var(--bs-primary);
  text-decoration: none;
}

.breadcrumb-item.active {
  color: var(--bs-secondary-color);
}

.text-secondary {
  color: var(--bs-secondary-color) !important;
}

.badge.text-bg-secondary {
  background-color: var(--site-elevated) !important;
  color: var(--bs-body-color) !important;
}

.quick-search-panel {
  background-color: var(--site-elevated);
  border-color: var(--bs-border-color) !important;
}

.quick-search-input {
  background-color: var(--site-muted-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color);
}

.quick-search-input:focus {
  background-color: var(--site-muted-bg);
  border-color: var(--bs-primary);
  color: var(--bs-body-color);
  box-shadow: 0 0 0 0.2rem var(--bs-focus-ring-color);
}

.quick-search-row {
  min-height: 3.5rem;
}

.quick-search-row:hover,
.quick-search-row:focus-visible,
.quick-search-row.is-active {
  background-color: var(--site-muted-bg);
}

/* Filled rather than outlined, so it reads differently from the focused input's ring. */
.quick-search-row.is-active {
  background-color: transparent;
  background-image: linear-gradient(
    to right,
    rgba(var(--bs-primary-rgb), 0.18),
    rgba(var(--bs-primary-rgb), 0.04) 70%
  );
  box-shadow: inset 3px 0 0 var(--bs-primary);
}

.quick-search-thumb {
  flex: 0 0 3.5rem;
  width: 3.5rem;
  align-self: stretch;
  border-radius: var(--bs-border-radius-sm);
  background-color: var(--site-muted-bg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.quick-search-thumb-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bs-secondary-color);
}

.quick-search-type {
  padding-right: 0.5rem;
}

/* Guide comments: keep members' line breaks and stop long words breaking the layout. */
.guide-comment-body {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* Libraries: Strategy Boards, Raidplans and videos. */
/* A nested embedded Stratagem lines up with the outer one (DESIGN.md §5.8: one level of
   indentation however deep): it undoes the outer embed's ps-3 and border, so the borders overlap. */
.stratagem-embed .stratagem-embed {
  margin-left: calc(-1rem - var(--bs-border-width));
}

/* Stratagem macros keep their line breaks and wrap long lines inside the body column. */
.stratagem-macro-text {
  padding: 0.75rem 1rem;
  border: var(--bs-border-width) solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  white-space: pre-wrap;
  word-break: break-word;
}

.library-description {
  white-space: pre-line;
  margin-bottom: 1rem;
}

.strategy-board-frame {
  aspect-ratio: 4 / 3;
  max-width: 100%;
  background-color: var(--site-muted-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  overflow: hidden;
}

.strategy-board-canvas,
.strategy-board-thumb canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.strategy-board-thumb {
  display: flex;
  align-items: center;
}

.strategy-board-thumb canvas {
  height: auto;
}

.strategy-board-code {
  flex: 1 1 14rem;
  max-width: 28rem;
  font-family: var(--bs-font-monospace);
}

.video-player {
  background-color: var(--site-muted-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  overflow: hidden;
}

.video-player iframe {
  border: 0;
}

.video-player-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bs-body-color);
}

.video-player-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-player-play {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background-color: rgba(12, 14, 18, 0.8);
  color: var(--bs-primary);
}

.video-player-preview:hover .video-player-play,
.video-player-preview:focus-visible .video-player-play {
  background-color: var(--bs-primary);
  color: #082f49;
}

.video-player-start {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--bs-border-radius-sm);
  background-color: rgba(12, 14, 18, 0.8);
  font-size: 0.875rem;
}
