/* ==========================================================================
   OTO Training Library — shared wiki theme
   Screen styling only. Print rules stay in each module's print stylesheet.
   ========================================================================== */

/* --------------------------------------------------------------- 1. Tokens */

/* Material stamps the scheme on <body>, so tokens it owns must be redefined
   at that level too — a :root override alone loses to the inherited value. */
:root,
[data-md-color-scheme="default"] {
  --oto-navy: #17324d;
  --oto-navy-deep: #102435;
  --oto-teal: #12928e;
  --oto-teal-bright: #22a6a1;
  --oto-sand: #f6f8f9;

  --md-primary-fg-color: var(--oto-navy);
  --md-primary-fg-color--dark: var(--oto-navy-deep);
  --md-accent-fg-color: var(--oto-teal);
  --md-typeset-a-color: var(--oto-teal);

  --oto-radius: 12px;
  --oto-radius-sm: 8px;
  --oto-border: rgba(23, 50, 77, 0.12);
  --oto-shadow: 0 1px 2px rgba(16, 36, 53, 0.06),
                0 8px 24px -12px rgba(16, 36, 53, 0.28);
  --oto-shadow-lift: 0 2px 4px rgba(16, 36, 53, 0.08),
                     0 16px 32px -14px rgba(16, 36, 53, 0.38);
  --oto-surface: #ffffff;
  --oto-surface-muted: var(--oto-sand);
}

[data-md-color-scheme="slate"] {
  --md-default-bg-color: #0e1720;
  --md-default-fg-color: #dce6ef;
  --md-default-fg-color--light: #a9bccd;
  --md-default-fg-color--lighter: #6f8598;
  --md-default-fg-color--lightest: #33454f;
  --md-primary-fg-color: #0e1720;
  --md-accent-fg-color: var(--oto-teal-bright);
  --md-typeset-a-color: var(--oto-teal-bright);
  --md-code-bg-color: #16232f;
  --md-code-fg-color: #d6e3ee;

  --oto-border: rgba(158, 190, 213, 0.18);
  --oto-surface: #16222d;
  --oto-surface-muted: #131e28;
  --oto-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -14px rgba(0, 0, 0, 0.7);
  --oto-shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.45), 0 18px 34px -16px rgba(0, 0, 0, 0.8);
}

/* ------------------------------------------------------- 2. Base typography */

body {
  -webkit-font-smoothing: antialiased;
}

.md-typeset {
  font-size: 0.78rem;
  line-height: 1.72;
}

.md-typeset h1 {
  margin-bottom: 1.1rem;
  color: var(--md-default-fg-color);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Prose keeps a readable measure even though the grid is wide for tables. */
.md-typeset > p,
.md-typeset > ul,
.md-typeset > ol {
  max-width: 46rem;
}

.md-typeset h2 {
  margin-top: 2.8em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--oto-border);
  font-size: 1.35em;
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* A teal tick marks the third level so the two ranks never read alike. */
.md-typeset h3 {
  position: relative;
  margin-top: 2em;
  padding-left: 0.75rem;
  font-size: 1.05em;
  font-weight: 650;
}

.md-typeset h3::before {
  position: absolute;
  top: 0.28em;
  bottom: 0.28em;
  left: 0;
  width: 3px;
  border-radius: 2px;
  background-color: var(--oto-teal);
  content: "";
}

/* Deep links land below the sticky header instead of under it. */
.md-typeset :is(h1, h2, h3, h4) {
  scroll-margin-top: 4rem;
}

/* Headline anchors stay hidden until the heading is hovered. */
.md-typeset .headerlink {
  opacity: 0;
  transition: opacity 120ms;
}

.md-typeset :hover > .headerlink,
.md-typeset .headerlink:focus {
  opacity: 1;
}

/* ------------------------------------------------------------ 3. Chrome */

.md-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.md-header--shadow {
  box-shadow: 0 1px 0 var(--oto-border), 0 6px 18px -12px rgba(16, 36, 53, 0.5);
}

.md-tabs {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Search reads as a field, not a lone magnifier: visible edge, bright
   placeholder, and the keyboard shortcut Material already binds. */
.md-search__form {
  position: relative;
  height: 2.1rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--oto-radius-sm);
  background-color: rgba(255, 255, 255, 0.14);
  transition: background-color 140ms, border-color 140ms;
}

.md-search__form:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background-color: rgba(255, 255, 255, 0.22);
}

.md-search__form:focus-within {
  border-color: var(--oto-teal-bright);
  background-color: rgba(255, 255, 255, 0.96);
}

.md-search__input {
  font-weight: 500;
}

.md-search__input::placeholder {
  color: rgba(255, 255, 255, 0.78);
}

.md-search__form:focus-within .md-search__input::placeholder {
  color: var(--md-default-fg-color--lighter);
}

.md-search__form::after {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  padding: 0.05rem 0.38rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.85);
  content: "/";
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.5;
  pointer-events: none;
  transform: translateY(-50%);
}

.md-search__form:focus-within::after {
  display: none;
}

@media screen and (max-width: 59.9375em) {
  .md-search__form::after {
    display: none;
  }
}

[dir="ltr"] .md-search__output {
  border-radius: var(--oto-radius-sm);
}

.md-nav__title {
  color: var(--md-default-fg-color--light);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.md-nav__link {
  border-radius: var(--oto-radius-sm);
  padding: 0.24rem 0.4rem;
  transition: background-color 120ms, color 120ms;
}

.md-nav__link:hover {
  background-color: var(--oto-surface-muted);
}

/* Section headings are the map of the site — they need to out-rank the
   links under them, not sit below them in contrast. */
.md-nav--primary .md-nav__item--section > .md-nav__link {
  margin: 1.5rem 0 0.45rem;
  padding: 0 0 0.4rem 0.4rem;
  border-bottom: 1px solid var(--oto-border);
  border-radius: 0;
  color: var(--md-default-fg-color);
  cursor: default;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  opacity: 1;
  text-transform: uppercase;
}

.md-nav--primary .md-nav__item--section > .md-nav__link:hover {
  background: none;
}

.md-nav--primary .md-nav__item--section > .md-nav__link .md-nav__icon {
  display: none;
}

/* The active page gets a rail, so its position in the tree is obvious. */
.md-nav--primary .md-nav__link--active,
.md-nav--primary .md-nav__link--active:hover {
  box-shadow: inset 2px 0 0 var(--oto-teal);
  background-color: color-mix(in srgb, var(--oto-teal) 10%, transparent);
  color: var(--md-accent-fg-color);
  font-weight: 650;
}

.md-sidebar--secondary .md-nav__link--active {
  background: none;
  box-shadow: none;
  color: var(--md-accent-fg-color);
  font-weight: 650;
}

/* Light vertical rules separate navigation, page, and contents. */
@media screen and (min-width: 60em) {
  .md-content {
    border-left: 1px solid var(--oto-border);
  }

  .md-content__inner {
    padding-left: 1.6rem;
  }
}

@media screen and (min-width: 76.25em) {
  .md-content {
    border-right: 1px solid var(--oto-border);
  }

  .md-content__inner {
    padding-right: 1.6rem;
  }
}

.md-footer {
  background-color: var(--oto-navy-deep);
}

.md-footer-meta {
  background-color: rgba(0, 0, 0, 0.28);
}

/* --------------------------------------------------------------- 4. Hero */

.oto-hero {
  margin: -0.4rem 0 2.2rem;
  padding: 2.1rem 2.2rem 2rem;
  border-radius: var(--oto-radius);
  background:
    radial-gradient(120% 140% at 100% 0%,
      rgba(34, 166, 161, 0.42) 0%, rgba(34, 166, 161, 0) 58%),
    linear-gradient(135deg, var(--oto-navy) 0%, var(--oto-navy-deep) 100%);
  color: #fff;
  box-shadow: var(--oto-shadow);
}

.oto-hero__eyebrow {
  display: inline-block;
  margin-bottom: 0.7rem;
  padding: 0.16rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.md-typeset .oto-hero h1 {
  margin: 0 0 0.45rem;
  color: #fff;
  font-size: 1.85rem;
  line-height: 1.15;
}

.md-typeset .oto-hero p {
  max-width: 34rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.84rem;
}

.md-typeset .oto-hero .md-button {
  margin-top: 1.2rem;
  margin-right: 0.5rem;
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

.md-typeset .oto-hero .md-button--primary {
  border-color: var(--oto-teal-bright);
  background-color: var(--oto-teal-bright);
  color: var(--oto-navy-deep);
}

.md-typeset .oto-hero .md-button:hover {
  border-color: #fff;
  background-color: #fff;
  color: var(--oto-navy);
}

/* ---------------------------------------------------------- 5. Card grid */

.md-typeset .grid.cards > ul > li,
.md-typeset .grid > .oto-card {
  border: 1px solid var(--oto-border);
  border-radius: var(--oto-radius);
  padding: 1.1rem 1.15rem;
  background-color: var(--oto-surface);
  box-shadow: var(--oto-shadow);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms;
}

.md-typeset .grid.cards > ul > li:hover,
.md-typeset .grid > .oto-card:hover {
  border-color: color-mix(in srgb, var(--oto-teal) 50%, transparent);
  box-shadow: var(--oto-shadow-lift);
}

/* Card titles are the scan target; the body text supports them. */
.md-typeset .grid.cards > ul > li > p:first-child {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.md-typeset .grid.cards > ul > li > p {
  color: var(--md-default-fg-color--light);
}

.md-typeset .grid.cards > ul > li > p:first-child,
.md-typeset .grid.cards > ul > li > p:last-child {
  color: var(--md-default-fg-color);
}

.md-typeset .grid.cards > ul > li > p:last-child {
  font-size: 0.72rem;
  font-weight: 600;
}

.md-typeset .grid.cards > ul > li > hr {
  margin: 0.6rem 0 0.7rem;
  border-color: var(--oto-border);
}

.md-typeset .grid.cards .twemoji,
.md-typeset .grid.cards .lg {
  color: var(--oto-teal);
}

/* --------------------------------------------------------- 6. Role badges */

.md-typeset .badge {
  display: inline-block;
  padding: 0.05em 0.5em;
  border: 1px solid color-mix(in srgb, var(--oto-teal) 35%, transparent);
  border-radius: 999px;
  background-color: color-mix(in srgb, var(--oto-teal) 10%, transparent);
  color: color-mix(in srgb, var(--oto-teal) 78%, var(--md-default-fg-color));
  font-size: 0.66em;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: 0.12em;
}

.md-typeset .badge.approval {
  border-color: color-mix(in srgb, #d1741f 40%, transparent);
  background-color: color-mix(in srgb, #d1741f 12%, transparent);
  color: color-mix(in srgb, #d1741f 82%, var(--md-default-fg-color));
}

/* ---------------------------------------------------------- 7. Procedures */

/* Numbered steps get a real step marker instead of a plain digit. */
.md-typeset > ol,
.md-typeset .steps ol {
  margin-left: 0;
  padding-left: 0;
  counter-reset: oto-step;
  list-style: none;
}

.md-typeset > ol > li,
.md-typeset .steps ol > li {
  position: relative;
  margin-bottom: 0.85rem;
  padding-left: 2.2rem;
  counter-increment: oto-step;
}

.md-typeset > ol > li::before,
.md-typeset .steps ol > li::before {
  position: absolute;
  top: 0.06rem;
  left: 0;
  display: flex;
  width: 1.5rem;
  height: 1.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--oto-teal);
  color: #fff;
  content: counter(oto-step);
  font-size: 0.68rem;
  font-weight: 700;
}

/* A vertical rail ties consecutive steps together. */
.md-typeset > ol > li:not(:last-child)::after,
.md-typeset .steps ol > li:not(:last-child)::after {
  position: absolute;
  top: 1.75rem;
  bottom: -0.6rem;
  left: 0.72rem;
  width: 2px;
  background-color: var(--oto-border);
  content: "";
}

/* --------------------------------------------------------------- 8. Tables */

.md-typeset table:not([class]) {
  border: 1px solid var(--oto-border);
  border-radius: var(--oto-radius-sm);
  box-shadow: none;
  font-size: 0.7rem;
}

.md-typeset table:not([class]) th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--oto-border);
  background-color: var(--oto-surface-muted);
  color: var(--md-default-fg-color);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.md-typeset table:not([class]) tr:nth-child(even) td {
  background-color: color-mix(in srgb, var(--oto-surface-muted) 55%, transparent);
}

.md-typeset table:not([class]) tr:hover td {
  background-color: color-mix(in srgb, var(--oto-teal) 7%, transparent);
}

.md-typeset table:not([class]) td {
  border-top: none;
  vertical-align: top;
}

/* ------------------------------------------------------- 9. Screenshots */

.md-typeset figure,
.md-typeset p > img {
  border-radius: var(--oto-radius-sm);
}

.md-typeset img {
  display: block;
  max-height: 30rem;
  margin: 1.3rem auto;
  border: 1px solid var(--oto-border);
  border-radius: var(--oto-radius-sm);
  background-color: var(--oto-surface-muted);
  box-shadow: var(--oto-shadow);
}

.md-typeset figure img {
  margin-bottom: 0.5rem;
}

.md-typeset figcaption {
  max-width: 34rem;
  margin: 0 auto 1.6rem;
  color: var(--md-default-fg-color--light);
  font-size: 0.68rem;
  font-style: normal;
  text-align: center;
}

/* ------------------------------------------------------- 10. Admonitions */

.md-typeset .admonition,
.md-typeset details {
  border: 1px solid var(--oto-border);
  border-left-width: 3px;
  border-radius: var(--oto-radius-sm);
  box-shadow: none;
  font-size: 0.72rem;
}

.md-typeset .admonition-title,
.md-typeset summary {
  border-radius: 0;
  font-weight: 650;
}

/* ------------------------------------------------ 11. Keys and UI labels */

.md-typeset kbd,
.md-typeset .ui {
  display: inline-block;
  padding: 0.05em 0.45em;
  border: 1px solid var(--oto-border);
  border-radius: 5px;
  background-color: var(--oto-surface-muted);
  box-shadow: 0 1px 0 var(--oto-border);
  color: var(--md-default-fg-color);
  font-size: 0.85em;
  font-weight: 600;
}

/* ------------------------------------------------------------ 12. Footer */

.oto-page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  margin-top: 3rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--oto-border);
  color: var(--md-default-fg-color--light);
  font-size: 0.66rem;
}

/* ------------------------------------------------- 13. Content measure */

/* This library is table-heavy; the stock 61rem grid squeezes the task index. */
@media screen and (min-width: 76.25em) {
  .md-grid {
    max-width: 68rem;
  }
}

/* Destination links in task indexes shouldn't wrap mid-phrase. */
.md-typeset table:not([class]) td:last-child {
  white-space: nowrap;
}

/* Keeps a short, unbreakable value — a time range, a document number — on one
   line inside a table cell. Applied per cell, never to a whole column, so a
   long task-index cell can still wrap. */
.md-typeset .nowrap {
  white-space: nowrap;
}

/* ------------------------------------------------- 14. Back to the front */

/* Present on every page of a help centre, so nobody has to reach for the
   browser's back button to change module. */
.md-banner {
  background-color: var(--oto-navy-deep);
  color: #fff;
}

.oto-backbar {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.7rem;
  font-weight: 600;
  gap: 0.4rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.oto-backbar:hover,
.oto-backbar:focus {
  color: #fff;
}

.oto-backbar__arrow {
  transition: transform 120ms;
}

.oto-backbar:hover .oto-backbar__arrow {
  transform: translateX(-2px);
}
