/*
 * CPMS public site - shared stylesheet
 *
 * Typography here is deliberately NOT taken from
 * frontend/design-system/cpms-ui-tokens.css. That file specifies
 * "Arial Narrow", "Roboto Condensed" - condensed faces, which the
 * accessibility supplement forbids outright - and a scale starting at
 * 0.75rem (12px) when the mandated floor is 18px.
 *
 * The rules this file follows, from the presbyopia-first supplement:
 *   - nothing below 18px anywhere on the page
 *   - auxiliary labels at 20px or more
 *   - section headings 28-36px
 *   - body line-height at least 1.45 (1.6 used here)
 *   - no condensed faces, no weight below 400, no all-caps paragraphs
 *   - controls at least 44x44px
 *   - contrast target 7:1 for body and critical text
 *   - text never sits on imagery without an opaque surface
 *   - reduced motion honoured
 *
 * No external requests: no web fonts, no CDN, no analytics. The page is
 * self-contained so it loads fast and leaks nothing.
 */

/* ---------------------------------------------------------------- tokens */

:root {
  /* Surfaces: near-black through deep navy */
  --canvas: #04101a;
  --surface-1: #081a29;
  --surface-2: #0d2537;
  --surface-raised: #123048;
  --border: #2c4a63;
  --border-strong: #47708f;

  /* Text: warm white, high contrast. On --canvas these measure
     approximately 16.8:1, 11.2:1 and 7.4:1 respectively. */
  --text: #f2f8fc;
  --text-secondary: #c9d9e5;
  --text-muted: #9fb4c4;

  /* Status. Colour never carries meaning alone - every use is paired
     with a word or an icon. */
  --accent: #7fd9f2;
  --accent-strong: #a8e6f8;
  --focus: #ffd98a;
  --success: #9ad94a;
  --caution: #f5b23f;
  --critical: #ff8b85;

  /* Type scale. The smallest value on the page is 18px. */
  --fs-body: 19px;
  --fs-label: 20px;
  --fs-body-lg: 21px;
  --fs-h3: 28px;
  --fs-h2: clamp(30px, 3vw, 36px);
  --fs-h1: clamp(38px, 5.5vw, 62px);

  --lh-body: 1.6;
  --lh-heading: 1.25;
  --measure: 68ch;

  /* No condensed faces. System stack keeps the page dependency-free. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  --radius: 10px;
  --radius-lg: 16px;
  --target: 44px;
}

/* ------------------------------------------------------------------ base */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  /* Guards against a browser or extension shrinking the page below the
     mandated floor. */
  min-height: 100vh;
}

h1,
h2,
h3 {
  line-height: var(--lh-heading);
  margin: 0 0 var(--space-4);
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  letter-spacing: -0.02em;
}
h2 {
  font-size: var(--fs-h2);
}
h3 {
  font-size: var(--fs-h3);
}

p,
li {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

p {
  margin: 0 0 var(--space-4);
  max-width: var(--measure);
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-strong);
}

strong {
  font-weight: 600;
  color: var(--text);
}

code {
  font-family: var(--font-mono);
  /*
   * Absolute, not relative. A relative size drops below the 18px floor
   * the moment code appears inside an 18px context such as a table
   * cell, which is exactly what happened before this was pinned.
   */
  font-size: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
}

pre {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  overflow-x: auto;
  font-size: 18px;
  line-height: 1.55;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}

/* Focus must be unmistakable for keyboard users. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  background: var(--surface-raised);
  color: var(--text);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius);
  border: 2px solid var(--accent);
  font-size: var(--fs-label);
  transition: top 160ms ease;
}

.skip-link:focus {
  top: var(--space-4);
}

/* --------------------------------------------------------------- layout */

.wrap {
  width: min(1180px, 100% - var(--space-8));
  margin-inline: auto;
}

.wrap--reading {
  width: min(820px, 100% - var(--space-8));
}

/* --------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  /* Opaque, not translucent: readability must not depend on what is
     behind it. */
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding-block: var(--space-4);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text);
  margin-right: auto;
}

.brand__mark {
  width: 38px;
  height: 38px;
  flex: none;
}

.brand__name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.brand__sub {
  display: block;
  font-size: 18px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 var(--space-4);
  border-radius: var(--radius);
  font-size: var(--fs-label);
  text-decoration: none;
  color: var(--text-secondary);
}

.site-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ------------------------------------------------------- language toggle */

.lang {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.lang__btn {
  min-height: var(--target);
  min-width: 58px;
  padding: 0 var(--space-4);
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--fs-label);
  font-weight: 600;
  line-height: var(--lh-body);
  cursor: pointer;
}

.lang__btn + .lang__btn {
  border-left: 1px solid var(--border-strong);
}

.lang__btn[aria-pressed="true"] {
  background: var(--accent);
  color: #052030;
}

.lang__btn:hover:not([aria-pressed="true"]) {
  background: var(--surface-2);
  color: var(--text);
}

/*
 * Bilingual switching.
 *
 * Both languages are present in the markup with proper lang attributes,
 * which is what assistive technology needs to pronounce each correctly.
 * CSS hides the inactive one; [hidden] would be wrong here because the
 * content is not conceptually hidden, only inactive.
 */
html[data-lang="el"] [lang="en"],
html[data-lang="en"] [lang="el"] {
  display: none;
}

/* ----------------------------------------------------------------- hero */

.hero {
  position: relative;
  padding-block: var(--space-24) var(--space-16);
  overflow: hidden;
}

/*
 * Atmosphere without imagery.
 *
 * The supplement requires every aircraft shown anywhere to be a
 * recognisable F-16, and no verified F-16 asset is available to this
 * page. A wrong silhouette would breach a hard rule, so the page shows
 * no aircraft at all: the mood is carried by light and a horizon, drawn
 * in CSS. Nothing here sits behind body text.
 */
.hero::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto;
  height: 130%;
  background:
    radial-gradient(
      60% 50% at 50% 0%,
      rgb(43 122 160 / 30%) 0%,
      transparent 70%
    ),
    radial-gradient(
      40% 40% at 85% 20%,
      rgb(122 92 42 / 18%) 0%,
      transparent 70%
    );
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border-strong),
    transparent
  );
}

.hero__inner {
  position: relative;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-6);
}

.hero__lede {
  font-size: var(--fs-body-lg);
  color: var(--text-secondary);
  max-width: 60ch;
  margin-bottom: var(--space-8);
}

.hero__actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  align-items: center;
}

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--target);
  padding: var(--space-3) var(--space-8);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--fs-label);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.btn--primary {
  background: var(--accent);
  color: #04202e;
}

.btn--primary:hover {
  background: var(--accent-strong);
  color: #04202e;
}

.btn--secondary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn--block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* -------------------------------------------------------------- sections */

.section {
  padding-block: var(--space-16);
  border-top: 1px solid var(--border);
}

.section__title {
  margin-bottom: var(--space-3);
}

.section__intro {
  color: var(--text-secondary);
  font-size: var(--fs-body-lg);
  margin-bottom: var(--space-12);
}

/* ----------------------------------------------------------------- cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: var(--space-6);
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}

.card h3 {
  margin-bottom: var(--space-3);
}

.card p:last-child {
  margin-bottom: 0;
}

.card__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-size: var(--fs-label);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

/* ----------------------------------------------------------------- login */

.login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: var(--space-16);
  align-items: start;
}

@media (max-width: 900px) {
  .login {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}

.field {
  margin-bottom: var(--space-6);
}

.field label {
  display: block;
  font-size: var(--fs-label);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text);
}

.field input {
  width: 100%;
  min-height: var(--target);
  padding: var(--space-3) var(--space-4);
  background: var(--canvas);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  /* 19px, matching body: form text is functional text. */
  font-size: var(--fs-body);
}

.field input::placeholder {
  color: var(--text-muted);
}

.field input:focus-visible {
  border-color: var(--accent);
}

.field__hint {
  font-size: 18px;
  color: var(--text-muted);
  margin: var(--space-2) 0 0;
}

/*
 * Status messages. Each carries a word, never colour alone, and each is
 * announced to screen readers through aria-live on the container.
 */
.status {
  display: none;
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid;
  font-size: var(--fs-body);
}

.status[data-state="info"],
.status[data-state="error"],
.status[data-state="success"] {
  display: block;
}

.status[data-state="info"] {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.status[data-state="error"] {
  background: #2a1214;
  border-color: var(--critical);
  color: #ffd9d7;
}

.status[data-state="success"] {
  background: #10251a;
  border-color: var(--success);
  color: #d8f5c0;
}

.status__label {
  font-weight: 600;
  display: block;
  margin-bottom: var(--space-1);
}

/* ------------------------------------------------------------ note block */

.note {
  background: var(--surface-2);
  border-left: 4px solid var(--caution);
  border-radius: var(--radius);
  padding: var(--space-6);
  margin-block: var(--space-6);
}

.note--info {
  border-left-color: var(--accent);
}

.note p:last-child {
  margin-bottom: 0;
}

.note__label {
  display: block;
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--caution);
  margin-bottom: var(--space-2);
}

.note--info .note__label {
  color: var(--accent);
}

/* ---------------------------------------------------------------- tables */

.table-scroll {
  overflow-x: auto;
  margin-block: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
}

th,
td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 18px;
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: var(--fs-label);
}

tr:last-child td {
  border-bottom: 0;
}

/* --------------------------------------------------------------- manual */

.manual-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--space-12);
  align-items: start;
  padding-block: var(--space-12);
}

@media (max-width: 940px) {
  .manual-layout {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
}

.toc {
  position: sticky;
  top: 104px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

@media (max-width: 940px) {
  .toc {
    position: static;
  }
}

.toc h2 {
  font-size: 22px;
  margin-bottom: var(--space-4);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
}

.toc a {
  display: block;
  min-height: var(--target);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: 18px;
  text-decoration: none;
  color: var(--text-secondary);
}

.toc a::before {
  content: counter(toc);
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
}

.toc a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.manual h2 {
  /* Anchored headings must not hide under the sticky header. */
  scroll-margin-top: 104px;
  padding-top: var(--space-8);
  margin-top: var(--space-8);
  border-top: 1px solid var(--border);
}

.manual > section:first-of-type h2 {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.manual h3 {
  margin-top: var(--space-8);
}

.manual ul,
.manual ol {
  max-width: var(--measure);
  padding-left: var(--space-6);
}

.manual li {
  margin-bottom: var(--space-3);
}

/* --------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-12);
  color: var(--text-muted);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text-secondary);
}

.site-footer p {
  font-size: 18px;
  margin: 0;
}

/* ------------------------------------------------------------- utilities */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------------------------------------- printing */

@media print {
  .site-header,
  .site-footer,
  .toc,
  .lang,
  .hero::before {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card,
  .panel,
  .note {
    border: 1px solid #999;
  }
}
