/* ==========================================================================
   A4A — Aircraft Maintenance Assistance | quantumflight.ai
   Edgent LLC

   Design direction: the visual grammar of an aircraft technical manual and
   an airframe data plate. Condensed grotesque for stencilled display type,
   a screen-legible serif for body copy (the printed-manual register), and a
   monospace for specification data. The signature device is the
   WARNING / CAUTION / NOTE block used the way MIL-spec technical manuals
   actually use it: WARNING = risk to people, CAUTION = risk to equipment
   or to the mission, NOTE = advisory. It carries the honest content.

   Self-contained: all fonts are local subsets. No external requests.
   ========================================================================== */

/* --------------------------------------------------------------- fonts -- */
/* Liberation Sans Narrow — SIL Open Font License 1.1 */
@font-face {
  font-family: "A4A Display";
  src: url("fonts/disp-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* DejaVu Serif — Bitstream Vera / DejaVu license (permissive) */
@font-face {
  font-family: "A4A Body";
  src: url("fonts/body-reg.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "A4A Body";
  src: url("fonts/body-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* DejaVu Sans Mono — Bitstream Vera / DejaVu license (permissive) */
@font-face {
  font-family: "A4A Mono";
  src: url("fonts/mono-reg.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "A4A Mono";
  src: url("fonts/mono-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------- tokens -- */
:root {
  --ff-display: "A4A Display", "Liberation Sans Narrow", "Arial Narrow", sans-serif;
  --ff-body: "A4A Body", Georgia, "Times New Roman", serif;
  --ff-mono: "A4A Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;

  /* Light: engineering vellum, cool neutral. Not cream. */
  --bg: #e7eae9;
  --surface: #f2f4f3;
  --surface-2: #dde2e1;
  --ink: #14181b;
  --ink-2: #454e54;
  --rule: #b9c0c1;
  --rule-strong: #7b8587;
  --amber: #6f4106;      /* caution amber, darkened for text contrast */
  --amber-edge: #b8791a; /* amber for rules and non-text marks */
  --warn: #8c2818;
  --focus: #0b4f8a;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --shell: 74rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13171a;
    --surface: #1a2024;
    --surface-2: #232b30;
    --ink: #e4e8ea;
    --ink-2: #a2adb3;
    --rule: #2d363c;
    --rule-strong: #647279;
    --amber: #eaa843;
    --amber-edge: #b0761f;
    --warn: #f2907a;
    --focus: #7cc0ff;
  }
}

/* Explicit overrides win in both directions for a manual theme toggle. */
:root[data-theme="light"] {
  --bg: #e7eae9; --surface: #f2f4f3; --surface-2: #dde2e1;
  --ink: #14181b; --ink-2: #454e54; --rule: #b9c0c1; --rule-strong: #7b8587;
  --amber: #6f4106; --amber-edge: #b8791a; --warn: #8c2818; --focus: #0b4f8a;
}
:root[data-theme="dark"] {
  --bg: #13171a; --surface: #1a2024; --surface-2: #232b30;
  --ink: #e4e8ea; --ink-2: #a2adb3; --rule: #2d363c; --rule-strong: #647279;
  --amber: #eaa843; --amber-edge: #b0761f; --warn: #f2907a; --focus: #7cc0ff;
}

/* ---------------------------------------------------------------- base -- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;       /* body must never scroll sideways */
  text-rendering: optimizeLegibility;
}

p { max-width: var(--measure); }

a {
  color: inherit;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }

/* Visible focus everywhere — not a colour-only cue. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 1px;
}

::selection { background: var(--amber-edge); color: #fff; }

/* ------------------------------------------------------------- layout -- */
.shell {
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.75rem 1.25rem;
  font-family: var(--ff-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 100;
}
.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* ------------------------------------------------------------- header -- */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 40;
}
.masthead__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 3.5rem;
  flex-wrap: wrap;
}
.wordmark {
  font-family: var(--ff-mono);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark span { color: var(--amber); }

.nav ul {
  display: flex;
  gap: clamp(0.85rem, 2.4vw, 1.75rem);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.nav a {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.35rem 0;
  display: inline-block;
  border-bottom: 2px solid transparent;
}
.nav a:hover,
.nav a:focus-visible { color: var(--ink); border-bottom-color: var(--amber-edge); }

.theme-toggle {
  font-family: var(--ff-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--rule-strong);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  border-radius: 0;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-2); }

/* --------------------------------------------------------------- hero -- */
.hero {
  border-bottom: 1px solid var(--rule);
  padding-block: clamp(3rem, 9vw, 6.5rem) clamp(2.5rem, 6vw, 4rem);
  position: relative;
}
/* Faint drafting grid — atmosphere, never a carrier of meaning. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--rule) 1px, transparent 1px),
    linear-gradient(to bottom, var(--rule) 1px, transparent 1px);
  background-size: 5.5rem 5.5rem;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse 70% 80% at 15% 0%, #000 10%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 15% 0%, #000 10%, transparent 75%);
}
.hero > * { position: relative; }

.eyebrow {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 1.25rem;
  max-width: none;
}

.hero__title {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(4.5rem, 19vw, 12rem);
  line-height: 0.82;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0;
}
.hero__expand {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(1.35rem, 4.6vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0.75rem 0 0;
  max-width: none;
}
.hero__lede {
  font-size: clamp(1.0625rem, 1.7vw, 1.3125rem);
  line-height: 1.55;
  max-width: 36rem;
  margin: 2rem 0 0;
}
.hero__lede strong { font-weight: 700; }

/* ---------------------------------------------------- data plate (spec) -- */
/* The airframe data plate: the hero's thesis, and it rhymes with the
   credentials block at the foot of the page. */
.plate {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  border: 1px solid var(--rule-strong);
  background: var(--surface);
}
.plate__cap {
  max-width: none;
  font-family: var(--ff-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--rule-strong);
  background: var(--surface-2);
}
.plate dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(9.5rem, 15rem) 1fr;
}
.plate dt,
.plate dd {
  margin: 0;
  padding: 0.7rem 1rem;
  font-family: var(--ff-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  border-top: 1px solid var(--rule);
}
.plate dt {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-right: 1px solid var(--rule);
}
.plate dd { overflow-wrap: anywhere; }
.plate dl > dt:first-of-type,
.plate dl > dt:first-of-type + dd { border-top: 0; }
.plate .flag { color: var(--amber); font-weight: 700; }

@media (max-width: 34rem) {
  .plate dl { grid-template-columns: 1fr; }
  .plate dt { border-right: 0; padding-bottom: 0.15rem; }
  .plate dd { border-top: 0; padding-top: 0.15rem; }
  .plate dl > dt { border-top: 1px solid var(--rule); }
  .plate dl > dt:first-of-type { border-top: 0; }
}

/* ------------------------------------------------------------ sections -- */
.band { border-bottom: 1px solid var(--rule); padding-block: clamp(3rem, 8vw, 5.5rem); }
.band--tint { background: var(--surface); }

.band__head { margin-bottom: clamp(2rem, 4vw, 3rem); }

h2 {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  margin: 0;
  max-width: 22ch;
}
h3 {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(1.1rem, 2.3vw, 1.4rem);
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}
h4 {
  font-family: var(--ff-mono);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
  color: var(--ink-2);
}

.lead { font-size: 1.1875rem; line-height: 1.6; max-width: 38rem; }
.muted { color: var(--ink-2); }

/* Two-column prose that collapses cleanly. */
.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
}

/* --------------------------------------------------- capability entries -- */
/* A definition list, not a card grid: these are named functions, and the
   name/description relationship is the real structure. */
.functions { margin: 0; }
.functions > div {
  border-top: 1px solid var(--rule);
  padding-block: 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  gap: 0.5rem clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
.functions > div:last-child { border-bottom: 1px solid var(--rule); }
.functions dt {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 2.1vw, 1.3rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.15;
}
.functions dd { margin: 0; }
.functions dd p { margin: 0; max-width: 40rem; }

.tag {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--amber-edge);
  color: var(--amber);
  padding: 0.15rem 0.45rem;
  margin-top: 0.6rem;
  white-space: nowrap;
}

@media (max-width: 46rem) {
  .functions > div { grid-template-columns: 1fr; }
}

/* ------------------------------------------- WARNING / CAUTION / NOTE -- */
/* The signature device. Used the way a technical manual uses it:
   WARNING = risk to people. CAUTION = risk to equipment or mission.
   NOTE    = advisory. Type and border carry the level, never colour alone. */
.advisory {
  border: 2px solid var(--ink-2);
  background: var(--surface);
  margin: 2rem 0;
  max-width: 46rem;
}
.advisory__label {
  max-width: none;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.4rem 1rem;
  border-bottom: 2px solid var(--ink-2);
  color: var(--ink);
}
.advisory__body { padding: 1.15rem 1.35rem; }
.advisory__body > :first-child { margin-top: 0; }
.advisory__body > :last-child { margin-bottom: 0; }
.advisory p { max-width: none; }

.advisory--warning { border-color: var(--warn); }
.advisory--warning .advisory__label {
  border-bottom-color: var(--warn);
  color: var(--warn);
}
.advisory--caution { border-color: var(--amber-edge); }
.advisory--caution .advisory__label {
  border-bottom-color: var(--amber-edge);
  color: var(--amber);
}
.advisory--note { border-color: var(--rule-strong); }
.advisory--note .advisory__label {
  border-bottom-color: var(--rule-strong);
  color: var(--ink-2);
  letter-spacing: 0.24em;
}

/* -------------------------------------------------------------- tables -- */
.table-scroll { overflow-x: auto; margin-block: 2rem; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 40rem;
  font-size: 0.9375rem;
}
caption {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-2);
  padding-bottom: 0.75rem;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule);
}
thead th {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--rule-strong);
  color: var(--ink);
}
tbody th {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------- step sequence -- */
/* Numbered because a maintenance procedure genuinely is ordered — the
   number is the information, not decoration. */
.sequence { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.sequence > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--rule);
}
.sequence > li:last-child { border-bottom: 1px solid var(--rule); }
.sequence > li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--ff-mono);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--amber);
  padding-top: 0.15rem;
}
.sequence h3 { margin-bottom: 0.35rem; }
.sequence p { margin: 0; max-width: 42rem; }

@media (max-width: 34rem) {
  .sequence > li { grid-template-columns: 1fr; gap: 0.5rem; }
}

/* --------------------------------------------------------------- lists -- */
.plain { list-style: none; margin: 0; padding: 0; }
.plain li {
  padding-left: 1.35rem;
  position: relative;
  margin-bottom: 0.7rem;
  max-width: var(--measure);
}
.plain li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.55rem;
  height: 1px;
  background: var(--amber-edge);
}

/* Change-bar list: the vertical rule a TO revision puts in the margin. */
.changebar {
  border-left: 3px solid var(--amber-edge);
  padding-left: 1.25rem;
  margin: 1.75rem 0;
}
.changebar > :first-child { margin-top: 0; }
.changebar > :last-child { margin-bottom: 0; }

/* ---------------------------------------------------------- credentials -- */
.creds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule-strong);
  border-left: 1px solid var(--rule-strong);
}
.creds > div {
  border-right: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  padding: 1.15rem 1.25rem;
  background: var(--surface);
}
.creds dt {
  font-family: var(--ff-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0.35rem;
}
.creds dd {
  margin: 0;
  font-family: var(--ff-mono);
  font-size: 0.9375rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.codes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.codes li {
  font-family: var(--ff-mono);
  font-size: 0.8125rem;
  border: 1px solid var(--rule-strong);
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
}
.codes li b { font-weight: 700; color: var(--amber); }

/* ------------------------------------------------------------- contact -- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  margin-top: 2rem;
}
.contact-grid a { font-family: var(--ff-mono); font-size: 0.9375rem; }

/* -------------------------------------------------------------- footer -- */
.colophon {
  padding-block: 2.5rem 3.5rem;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.colophon p { max-width: 46rem; }
.colophon a { color: var(--ink-2); }

/* --------------------------------------------------- entrance sequence -- */
/* One orchestrated page-load reveal, and nothing else moves. */
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise 620ms cubic-bezier(0.16, 0.84, 0.34, 1) both; }
  .reveal:nth-child(1) { animation-delay: 40ms; }
  .reveal:nth-child(2) { animation-delay: 110ms; }
  .reveal:nth-child(3) { animation-delay: 180ms; }
  .reveal:nth-child(4) { animation-delay: 250ms; }
  .reveal:nth-child(5) { animation-delay: 320ms; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(0.75rem); }
    to   { opacity: 1; transform: none; }
  }
}

/* ------------------------------------------------------------- printing -- */
@media print {
  .masthead, .theme-toggle, .skip { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .band, .hero { border-color: #999; }
  .hero::before { display: none; }
}

/* ------------------------------------------------------- spacing utils -- */
/* These exist so the page can hold a strict Content-Security-Policy with no
   'unsafe-inline' in style-src. Inline style attributes would be blocked. */
.mt-3 { margin-top: 0.85rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 2rem; }
.mt-7 { margin-top: 3rem; }
.mono-sm { font-family: var(--ff-mono); font-size: 0.9375rem; }

/* Contact fields are section subheadings (h3) but read as small labels. */
.field-label {
  font-family: var(--ff-mono);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 0.4rem;
}

/* ------------------------------------------------- narrow-viewport fixes -- */
/* Code chips keep their code and label on one line where there is room, but
   must be allowed to wrap before they push the page sideways. */
@media (max-width: 40rem) {
  .codes li { white-space: normal; }
  .codes { gap: 0.35rem; }
}

/* A wide table scrolls inside its own container; the page body never does. */
.table-scroll { max-width: 100%; min-width: 0; }
.band, .hero, .shell { min-width: 0; }

/* Long unbroken strings (URLs, codes) must not set the page width. */
.creds dd, .plate dd, .contact-grid p { overflow-wrap: anywhere; }
