/* =========================================================
   RADaero wiki theme
   Matches the rad.aero WordPress theme (rad_theme/style.css and
   additional.css): grey page, white rounded card, monospace type,
   rainbow divider under the header, translucent menu pills.
   ========================================================= */

/* Same font files as rad.aero (rad_theme/assets/fonts). Copy them again if
   the site's fonts change. FiraCode is under the OFL, see FiraCode-LICENSE.txt. */
@font-face {
  font-family: "NerdFont";
  src: url("../assets/fonts/FiraCodeNerdFontMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "NerdFont";
  src: url("../assets/fonts/FiraCodeNerdFontMono-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "NerdFont";
  src: url("../assets/fonts/FiraCodeNerdFontMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --rad-bg: #666666;
  --rad-text: rgba(255, 255, 255, 0.92);
  --rad-muted: rgba(255, 255, 255, 0.72);
  --rad-card-border: #e5e5e5;
  --rad-radius: 18px;
  --rad-max: 61rem;
  --rad-gutter: 18px;
  --rad-mono: "NerdFont", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  --rad-rainbow: linear-gradient(90deg, #003f5b, #2b4b7d, #5f5195, #98509d,
    #cc4c91, #f25375, #ff6f4e, #ff9913);
}

[data-md-color-scheme="default"] {
  --md-text-font-family: var(--rad-mono);
  --md-code-font-family: var(--rad-mono);
  --md-primary-fg-color: #000000;
  --md-primary-fg-color--light: #222222;
  --md-primary-fg-color--dark: #000000;
  --md-primary-bg-color: #ffffff;
  --md-accent-fg-color: #98509d;
  --md-default-fg-color: #000000;
  --md-default-fg-color--light: #333333;
  --md-typeset-color: #000000;
  --md-typeset-a-color: #000000;
}

html,
body {
  background-color: var(--rad-bg);
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Header ---------- */

.rad-header {
  position: relative;
  height: auto;
  padding: 22px var(--rad-gutter) 0;
  margin-bottom: 12px;
  background: transparent;
  color: var(--rad-text);
  box-shadow: none;
}

.rad-header.md-header--shadow {
  box-shadow: none;
}

.rad-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  max-width: var(--rad-max);
  margin: 0 auto;
  padding-bottom: 22px;
}

.rad-header__logo img {
  display: block;
  max-height: 150px;
  width: auto;
}

/* Rainbow divider under the header, same as .site-header::after */
.rad-header::after {
  content: "";
  display: block;
  max-width: var(--rad-max);
  height: 10px;
  margin: 0 auto;
  border-radius: 4px;
  background: var(--rad-rainbow);
}

.rad-header__menu {
  flex: 1 1 auto;
}

.rad-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rad-menu a,
.rad-pill {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--rad-text);
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.rad-menu a:hover,
.rad-menu a:focus-visible,
.rad-pill:hover {
  background: rgba(0, 0, 0, 0.22);
  color: var(--rad-text);
}

.rad-menu a.is-current {
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 255, 255, 0.32);
}

.rad-header__tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* "Table of Contents" tab: a vertical pull tab on the left edge of the window
   that opens the page list drawer. Only shown when the sidebar is a drawer.
   It slides out with the drawer (Material's 12.1rem width and timing), so
   tapping it again closes the drawer. Reads bottom to top. */
.rad-toc-tab {
  display: none;
}

@media screen and (max-width: 76.234375em) {
  .rad-toc-tab {
    position: fixed;
    top: 50%;
    left: 0;
    /* Same layer as Material's overlay, and later in the page, so it stays on top */
    z-index: 5;
    display: block;
    padding: 20px 10px;
    writing-mode: vertical-rl;
    transform: translateY(-50%) rotate(180deg);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    /* Rotated 180deg, so these corners show on the right */
    border-radius: 10px 0 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-right: 0;
    background: #333333;
    color: #ffffff;
    font-size: 16px;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    user-select: none;
  }

  .rad-toc-tab:hover {
    background: #000000;
  }

  [data-md-toggle="drawer"]:checked ~ .rad-toc-tab {
    transform: translateX(12.1rem) translateY(-50%) rotate(180deg);
  }
}

/* Page list drawer: starts at the very top of the window (the 16px offset
   above is for the desktop sidebars), and its title bar is a lighter grey than
   the page so the black "AERO" in the logo shows. */
@media screen and (max-width: 76.234375em) {
  .md-sidebar.md-sidebar--primary {
    top: 0;
  }

  .md-nav--primary .md-nav__title[for="__drawer"] {
    background-color: #7a7a7a;
    color: #ffffff;
  }
}

/* Search sits in the header on the grey background */
.rad-header .md-search__form {
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.rad-header .md-search__form:hover {
  background: rgba(0, 0, 0, 0.22);
}

.rad-header .md-search__input::placeholder {
  color: var(--rad-muted);
}

.rad-header .md-search__input,
.rad-header .md-search__icon {
  color: var(--rad-text);
}

/* Once the search box is open, its results panel is white like the card */
[data-md-toggle="search"]:checked ~ .md-header .md-search__form {
  background: #ffffff;
  border-color: var(--rad-card-border);
  border-radius: 10px 10px 0 0;
}

[data-md-toggle="search"]:checked ~ .md-header .md-search__input,
[data-md-toggle="search"]:checked ~ .md-header .md-search__icon,
[data-md-toggle="search"]:checked ~ .md-header .md-search__input::placeholder {
  color: #000000;
}

.rad-header .md-search__output {
  border-radius: 0 0 10px 10px;
}

/* Desktop: the box widens leftward over the menu instead of
   wrapping onto a new row, and stays above the dimming overlay */
@media screen and (min-width: 60em) {
  .rad-header {
    z-index: 5;
  }

  .rad-header .md-search {
    position: relative;
    width: 11.7rem;
    height: 1.8rem;
  }

  .rad-header .md-search__inner {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
  }
}

/* ---------- Content card ---------- */

.md-main__inner {
  max-width: var(--rad-max);
  margin-top: 16px;
  margin-bottom: 40px;
  background: #ffffff;
  border: 1px solid var(--rad-card-border);
  border-radius: var(--rad-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

@media screen and (max-width: 61.984375em) {
  .md-main__inner {
    margin-left: var(--rad-gutter);
    margin-right: var(--rad-gutter);
  }
}

/* Sidebars sit inside the card, so they stick below the page top */
.md-sidebar {
  top: 16px;
}

/* ---------- Typography ---------- */

.md-typeset {
  color: #000000;
}

.md-typeset h1 {
  margin-bottom: 0.9em;
  color: #000000;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: 0;
}

.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  color: #000000;
  font-weight: 700;
  letter-spacing: 0;
}

.md-typeset h2 {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rad-card-border);
}

/* Links look like the Downloads page links */
.md-typeset a {
  color: #000000;
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.35);
  text-underline-offset: 3px;
}

.md-typeset a:hover,
.md-typeset a:focus {
  color: #000000;
  text-decoration-color: #000000;
}

.md-typeset .headerlink {
  text-decoration: none;
}

/* Sidebar navigation */
.md-nav__link--active,
.md-nav__item .md-nav__link--active,
.md-nav__item .md-nav__link--active code {
  color: #000000;
  font-weight: 700;
}

.md-nav__link:hover,
.md-nav__link:focus {
  color: var(--md-accent-fg-color);
}

/* Black buttons with white text, as on the shop */
.md-typeset .md-button {
  border: 0;
  border-radius: 14px;
  background: #000000;
  color: #ffffff;
  text-decoration: none;
}

.md-typeset .md-button:hover,
.md-typeset .md-button:focus {
  background: #222222;
  color: #ffffff;
}

/* Key/value tables have no header text */
.md-typeset table:not([class]) thead:has(th:first-child:empty) {
  display: none;
}

.md-typeset table:not([class]) {
  border: 1px solid var(--rad-card-border);
  border-radius: 12px;
}

.md-typeset img {
  border-radius: 8px;
}

.md-typeset .figure-medium {
  display: block;
  max-width: 460px;
  margin: 1rem auto;
}

/* Text and an image in two columns. Stacks on narrow screens. */
.md-typeset .side-by-side {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  align-items: center;
  gap: 1.5rem;
}
.md-typeset .side-by-side > p {
  margin: 0;
}
.md-typeset .side-by-side .figure-screen {
  margin: 0 auto;
  max-width: 100%;
}
@media (max-width: 600px) {
  .md-typeset .side-by-side {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Round EFIS screen captures: transparent outside the screen, so no corner rounding. */
.md-typeset .figure-screen {
  display: block;
  max-width: min(620px, 100%);
  margin: 1rem auto;
  border-radius: 0;
}

/* Product cards on the home page, styled like .resource-card */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.md-typeset .product-grid > a {
  display: block;
  padding: 16px;
  border: 1px solid var(--rad-card-border);
  border-radius: var(--rad-radius);
  color: #000000;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease;
}

.md-typeset .product-grid > a:hover {
  background: #f5f5f5;
  transform: translateY(-1px);
}

.product-grid img {
  display: block;
  height: 200px;
  margin: 0 auto 0.75rem;
  object-fit: contain;
}

.product-grid strong {
  display: block;
  font-size: 1.1em;
}

/* ---------- Footer ---------- */

.rad-footer {
  padding: 18px;
  background: transparent;
  color: var(--rad-muted);
  font-size: 12px;
  text-align: center;
}

/* ---------- Small screens ---------- */

/* Logo and Menu/search share the top row; site menu wraps below */
@media (max-width: 900px) {
  .rad-header__menu {
    order: 3;
    flex-basis: 100%;
  }
}

@media (max-width: 700px) {
  .rad-header__logo img {
    max-height: 72px;
  }

  .rad-menu {
    gap: 8px;
  }

  .rad-menu a,
  .rad-pill {
    padding: 6px 8px;
    font-size: 14px;
  }
}

@media (max-width: 600px) {
  .rad-header::after {
    height: 5px;
  }
}

/* Back-to-top button. Material positions it below the header from JavaScript,
   assuming a sticky header. Ours scrolls away, so pin it near the top of the window. */
.md-top {
  top: 16px !important;
}
