/* ==========================================================================
   fr24 web — document pages (/docs/, /test/, /log/)
   --------------------------------------------------------------------------
   Same token vocabulary as static/app.css. These pages used to be dark-only
   with hard-coded hex values repeated per page; they now follow the reader's
   system theme and share one stylesheet.
   ========================================================================== */

:root {
  color-scheme: light dark;

  --fs-xs: 11px; --fs-sm: 12.5px; --fs-base: 14px;
  --fs-md: 15px; --fs-lg: 19px; --fs-xl: 25px;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;
  --sp-4: 16px; --sp-5: 22px; --sp-6: 34px;

  --r-sm: 5px; --r-md: 8px; --r-lg: 12px;

  --bg:        #f7f8fa;
  --surface:   #ffffff;
  --surface-2: #f0f2f6;
  --ink:       #1a2029;
  --ink-2:     #4d5765;
  --ink-3:     #7b8593;
  --line:      #dde3ea;
  --accent:    #1668c8;
  --brand:     #b8801c;

  --ok-bg: #dcf3e4; --ok-fg: #14683a;
  --bad-bg: #fadfe0; --bad-fg: #9c2229;
  --warn-bg: #fdf0dc; --warn-fg: #8a5714;

  --c-military: #4f8b3b; --c-government: #7d5bc4; --c-passenger: #2f76cf;
  --c-cargo: #c2811f;    --c-helicopter: #bc4a76; --c-other: #64707e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0d1116;
    --surface:   #141920;
    --surface-2: #1a212a;
    --ink:       #e2e7ee;
    --ink-2:     #a5aebc;
    --ink-3:     #78828f;
    --line:      #262e3a;
    --accent:    #6cb6ff;
    --brand:     #ffd54a;

    --ok-bg: #123d24; --ok-fg: #7ee2a8;
    --bad-bg: #43181c; --bad-fg: #ff9aa2;
    --warn-bg: #2a1d12; --warn-fg: #ffcf9a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: var(--fs-base)/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:where(a, button, input, select):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm);
}

code, pre { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
code {
  background: var(--surface-2); color: var(--ink);
  padding: 1.5px 5px; border-radius: var(--r-sm); font-size: .88em;
  border: 1px solid var(--line);
}
pre {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4);
  overflow-x: auto; font-size: var(--fs-sm); line-height: 1.6;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

h1 { font-size: var(--fs-xl); margin: 0 0 var(--sp-2); letter-spacing: -.4px; }
h2 {
  font-size: var(--fs-lg); margin: var(--sp-6) 0 var(--sp-3);
  padding-top: var(--sp-2); border-top: 1px solid var(--line);
  letter-spacing: -.2px;
}
h3 { font-size: var(--fs-md); margin: var(--sp-5) 0 var(--sp-2); color: var(--ink-2); }
p { margin: 0 0 var(--sp-3); }

table {
  border-collapse: collapse; width: 100%; margin: var(--sp-3) 0;
  font-size: var(--fs-sm); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden;
}
th, td {
  border-bottom: 1px solid var(--line); padding: var(--sp-2) var(--sp-3);
  text-align: left; vertical-align: top;
}
tr:last-child td { border-bottom: 0; }
th { background: var(--surface-2); font-weight: 650; color: var(--ink-2); }
tbody tr:hover td { background: var(--surface-2); }

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: var(--sp-3) var(--sp-5);
  display: flex; gap: var(--sp-4); align-items: center;
  font-size: var(--fs-sm);
}
.topbar b { color: var(--brand); font-weight: 750; }
.topbar a { color: var(--ink-2); font-weight: 600; }
.topbar a:hover { color: var(--accent); text-decoration: none; }

.wrap {
  max-width: 1180px; margin: 0 auto; display: flex; gap: var(--sp-6);
  padding: var(--sp-5) var(--sp-5) 80px;
}
nav.side {
  flex: 0 0 214px; position: sticky; top: 62px; align-self: flex-start;
  max-height: calc(100vh - 84px); overflow-y: auto; font-size: var(--fs-sm);
}
nav.side a {
  display: block; padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm); color: var(--ink-2);
}
nav.side a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
main { flex: 1 1 auto; min-width: 0; }

.muted { color: var(--ink-3); }
.pill {
  display: inline-block; padding: 1.5px var(--sp-2); border-radius: 10px;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .3px;
}
.ok  { background: var(--ok-bg);  color: var(--ok-fg); }
.bad { background: var(--bad-bg); color: var(--bad-fg); }

button {
  font: inherit; font-size: var(--fs-sm); font-weight: 650;
  background: var(--accent); color: #fff; border: 1px solid transparent;
  padding: 7px var(--sp-4); border-radius: var(--r-md); cursor: pointer;
  transition: filter .15s ease;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: default; filter: none; }

input[type=text], select {
  font: inherit; font-size: var(--fs-sm);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 7px var(--sp-3); max-width: 100%;
}
input[type=text] { width: 320px; }
input[type=text]:focus, select:focus { border-color: var(--accent); }

/* shared stat cards (/test/ and /log/) */
.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: var(--sp-3); margin: var(--sp-3) 0;
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4);
}
.card .k {
  font-size: var(--fs-xs); color: var(--ink-3); text-transform: uppercase;
  letter-spacing: .8px; font-weight: 650;
}
.card .v {
  font-size: 22px; font-weight: 700; margin-top: 3px;
  font-variant-numeric: tabular-nums; letter-spacing: -.4px;
}

.spin { animation: sp 1s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }

/* flight-log table bits */
.bar3 {
  flex: 0 0 3px; border-radius: 2px; display: inline-block; width: 3px;
  height: 1em; vertical-align: -2px; margin-right: 7px;
}
.c-military { background: var(--c-military); }
.c-government { background: var(--c-government); }
.c-passenger { background: var(--c-passenger); }
.c-cargo { background: var(--c-cargo); }
.c-helicopter { background: var(--c-helicopter); }
.c-other { background: var(--c-other); }

td.rte { min-width: 260px; }
/* the class swatch + its label must stay on one line, never stack */
td.cls { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center;
  margin: var(--sp-4) 0;
}
.off {
  padding: var(--sp-4); background: var(--warn-bg);
  border: 1px solid color-mix(in srgb, var(--warn-fg) 35%, transparent);
  border-radius: var(--r-md); color: var(--warn-fg);
}
.num { font-variant-numeric: tabular-nums; text-align: right; }
.mono { font-family: ui-monospace, Consolas, monospace; }

/* A caveat that needs to stop the eye, without the weight of a full callout. */
p.warn {
  border-left: 3px solid var(--warn-fg, #b26a00);
  background: var(--warn-bg, rgba(255, 176, 32, .10));
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm, 4px);
}

/* The generated function reference: ~220 rows, so it has to stay dense and
   scannable. Line numbers right-aligned, names monospaced, one row per
   function; the table scrolls inside itself on a narrow screen. */
table.ref { font-size: var(--fs-xs); table-layout: fixed; }
table.ref td, table.ref th { padding: 2px var(--sp-2); vertical-align: top; }
table.ref td:nth-child(1) { width: 4.5rem; }
table.ref td:nth-child(2) { width: 17rem; word-break: break-word; }
table.ref td:nth-child(3) { width: 3rem; text-align: center; }
table.ref code { font-size: inherit; background: none; padding: 0; }
table.ref tbody tr:hover { background: var(--surface-2, rgba(127, 127, 127, .07)); }
@media (max-width: 820px) {
  table.ref { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 820px) {
  .wrap { flex-direction: column; gap: var(--sp-4); }
  nav.side { position: static; flex-basis: auto; max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
