/* Arma 3 scripting reference: map-paper palette, side colours carry meaning. */
:root {
  --paper: #edefe8;        /* map paper */
  --paper-2: #e3e7dc;      /* panels, code */
  --ink: #1d2620;
  --muted: #586459;
  --rule: #c7cebf;
  --contour: #8a9a6c;      /* terrain lines */
  --olive: #4a5c2c;
  --blufor: #0d58a6;       /* links, commands */
  --indfor: #2c7531;       /* functions, local variables */
  --opfor: #a41d1d;        /* warnings */
  --civ: #6b2f8f;          /* numbers */
  --sand: #8a5a0b;         /* strings */
  --focus: #0d58a6;
  --masthead: #dfe4d6;

  --f-text: "Barlow", "Segoe UI", system-ui, sans-serif;
  --f-head: "Barlow Semi Condensed", "Barlow", "Segoe UI", system-ui, sans-serif;
  --f-code: "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  --measure: 44rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151a16;
    --paper-2: #1d241e;
    --ink: #dbe2d4;
    --muted: #97a393;
    --rule: #2f3a30;
    --contour: #56664a;
    --olive: #a9bd7a;
    --blufor: #78b0ef;
    --indfor: #7fc77f;
    --opfor: #ef7b72;
    --civ: #c79be3;
    --sand: #ddb76a;
    --focus: #78b0ef;
    --masthead: #1a211b;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--f-text);
  font-kerning: normal;
}

a { color: var(--blufor); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: .5rem; background: var(--paper); padding: .4rem .8rem; z-index: 50; }
.skip:focus { left: .5rem; }

/* ---- top bar ---------------------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .6rem 1.5rem;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font: 700 1.15rem/1 var(--f-head); color: var(--ink); text-decoration: none; white-space: nowrap;
}
/* a grid square, as on the in-game map */
.brand-mark {
  width: 1.05rem; height: 1.05rem; border: 2px solid var(--olive);
  background:
    linear-gradient(var(--olive), var(--olive)) center / 2px 100% no-repeat,
    linear-gradient(var(--olive), var(--olive)) center / 100% 2px no-repeat;
}
.topnav { display: flex; gap: 1.1rem; font: 500 1.02rem/1 var(--f-head); }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--ink); }

.search { position: relative; margin-left: auto; width: min(26rem, 100%); }
.search input {
  width: 100%; padding: .5rem 2.2rem .5rem .75rem;
  font: 400 .98rem/1.2 var(--f-text); color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 4px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.search-key {
  position: absolute; right: .55rem; top: 50%; transform: translateY(-50%);
  font: 500 .75rem/1 var(--f-code); color: var(--muted);
  border: 1px solid var(--rule); border-radius: 3px; padding: .15rem .35rem;
}
.search input:focus + .search-key { display: none; }

.results {
  position: absolute; left: 0; right: 0; top: calc(100% + .35rem);
  margin: 0; padding: .3rem; list-style: none;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 10px 30px -12px rgb(0 0 0 / .35);
  max-height: min(70vh, 34rem); overflow-y: auto; z-index: 30;
}
.results a {
  display: grid; grid-template-columns: 1fr auto; gap: .1rem .75rem;
  padding: .45rem .6rem; border-radius: 3px; text-decoration: none; color: var(--ink);
}
.results .r-name { font: 600 .95rem/1.3 var(--f-code); overflow-wrap: anywhere; }
.results .r-kind { font: 500 .8rem/1.3 var(--f-head); color: var(--muted); }
.results .r-sum { grid-column: 1 / -1; font-size: .88rem; line-height: 1.35; color: var(--muted); }
.results .r-fn .r-name { color: var(--indfor); }
.results .r-cmd .r-name { color: var(--blufor); }
.results [aria-selected="true"] a, .results a:hover { background: var(--paper-2); }
.results .r-empty { padding: .6rem; color: var(--muted); font-size: .92rem; }

/* ---- masthead with generated terrain ------------------------------------------------------ */

.masthead {
  position: relative; z-index: 1;
  background: var(--masthead);
  border-bottom: 1px solid var(--rule);
}
.terrain {
  position: absolute; inset: 0; overflow: hidden; color: var(--contour); pointer-events: none;
  /* keep the left side, where the title sits, quiet */
  -webkit-mask-image: linear-gradient(to right, transparent 35%, #000 85%);
  mask-image: linear-gradient(to right, transparent 35%, #000 85%);
}
.terrain svg { width: 100%; height: 100%; display: block; }
.masthead-inner {
  position: relative;
  max-width: 72rem; margin: 0 auto; padding: 2.4rem 1.5rem 2rem;
}
.kind { margin: 0 0 .35rem; font: 500 1.02rem/1.3 var(--f-head); color: var(--muted); }
.kind a { color: inherit; }
.name {
  margin: 0;
  font: 600 clamp(2.1rem, 1.3rem + 3.4vw, 3.6rem)/1.05 var(--f-code);
  letter-spacing: -.02em; overflow-wrap: anywhere;
}
.name-long { font-size: clamp(1.6rem, 1rem + 2.6vw, 2.7rem); }
.page-index .name, .home-title { font-family: var(--f-head); font-weight: 700; letter-spacing: -.01em; }
.lede { max-width: var(--measure); margin: .8rem 0 0; font-size: 1.15rem; line-height: 1.5; }

.facts { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.1rem 0 0; padding: 0; list-style: none; }
.fact {
  font: 500 .9rem/1 var(--f-head); padding: .38rem .6rem; border-radius: 3px;
  border: 1.5px solid var(--olive); color: var(--olive); background: transparent;
}
/* global = filled, local = outlined: shape carries the difference, not only colour */
.fact-global { background: var(--olive); color: var(--paper); }
.fact-server { border-color: var(--opfor); color: var(--opfor); }
.fact-status { background: var(--opfor); border-color: var(--opfor); color: var(--paper); }
.fact-branch { border-style: dashed; }
.fact-version { border-color: var(--ink); color: var(--ink); }
.fact-muted { border-color: var(--rule); color: var(--muted); }
.formats { margin: 1.1rem 0 0; font-size: .95rem; color: var(--muted); }

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

.layout {
  display: grid; grid-template-columns: 12.5rem minmax(0, var(--measure));
  gap: 3.5rem; max-width: 72rem; margin: 0 auto; padding: 2rem 1.5rem 4rem;
}
.layout-wide { grid-template-columns: minmax(0, 1fr); }

.toc { position: sticky; top: 4.6rem; align-self: start; max-height: calc(100vh - 6rem); overflow-y: auto; font-size: .95rem; }
.toc-title { margin: 0 0 .5rem; font: 600 1rem/1.2 var(--f-head); color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0 0 0 .8rem; border-left: 2px solid var(--rule); }
.toc li { margin: .3rem 0; }
.toc .toc-3 { padding-left: .9rem; font-size: .9rem; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--blufor); }

/* ---- content ---------------------------------------------------------------------------------- */

.content { min-width: 0; }
.content > :first-child { margin-top: 0; }
.content h2 {
  margin: 2.6rem 0 .9rem; padding-bottom: .3rem;
  font: 600 1.65rem/1.2 var(--f-head); border-bottom: 1px solid var(--rule);
}
.content h3 { margin: 1.9rem 0 .6rem; font: 600 1.25rem/1.25 var(--f-head); color: var(--olive); }
.content :where(h4, h5, h6) { margin: 1.7rem 0 .5rem; font: 600 1.12rem/1.3 var(--f-head); }
.content :where(p, ul, ol) { margin: .75rem 0; }
.content :where(ul, ol) { padding-left: 1.4rem; }
.content :where(li) { margin: .3rem 0; }
.content li > p { margin: .3rem 0; }

code {
  font: 400 .88em/1.4 var(--f-code);
  background: var(--paper-2); padding: .08em .3em; border-radius: 3px;
}
pre.code {
  position: relative; margin: 1rem 0; padding: .95rem 1.1rem;
  background: var(--paper-2); border-left: 3px solid var(--olive); border-radius: 0 4px 4px 0;
  overflow-x: auto; font-size: .9rem; line-height: 1.55; tab-size: 4;
}
pre.code code { background: none; padding: 0; font-size: inherit; line-height: inherit; }
.copy {
  position: absolute; top: .45rem; right: .45rem;
  font: 500 .8rem/1 var(--f-head); color: var(--muted);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; padding: .3rem .55rem;
  cursor: pointer; opacity: 0;
}
pre.code:hover .copy, .copy:focus-visible { opacity: 1; }
@media (hover: none) { .copy { opacity: 1; } }

/* SQF tokens */
.t-cmd { color: var(--blufor); text-decoration: none; }
.t-fn { color: var(--indfor); text-decoration: none; }
.t-cmd:hover, .t-fn:hover { text-decoration: underline; }
.t-string { color: var(--sand); }
.t-number { color: var(--civ); }
.t-comment { color: var(--muted); font-style: italic; }
.t-local { color: var(--indfor); font-style: italic; }
.t-pp { color: var(--opfor); }

kbd {
  font: 500 .82em/1 var(--f-code); padding: .12em .4em;
  border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 3px; background: var(--paper);
}

.table-wrap { overflow-x: auto; margin: 1rem 0; }
table { border-collapse: collapse; font-size: .95rem; }
th, td { border: 1px solid var(--rule); padding: .4rem .6rem; text-align: left; vertical-align: top; }
th { background: var(--paper-2); font-family: var(--f-head); font-weight: 600; }

blockquote { margin: 1rem 0; padding: .1rem 1rem; border-left: 3px solid var(--rule); color: var(--muted); }
.alert { color: var(--ink); background: var(--paper-2); border-left-color: var(--olive); border-radius: 0 4px 4px 0; padding: .6rem 1rem; }
.alert > p { margin: .4rem 0; }
.alert-title { font: 600 1rem/1.2 var(--f-head); color: var(--olive); }
.alert-important, .alert-warning, .alert-caution { border-left-color: var(--opfor); }
.alert-important .alert-title, .alert-warning .alert-title, .alert-caution .alert-title { color: var(--opfor); }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

/* community notes */
.notes .note { margin: 1.2rem 0; padding: .9rem 1.1rem; border: 1px solid var(--rule); border-radius: 4px; }
.note header { display: flex; gap: .75rem; align-items: baseline; font-family: var(--f-head); }
.note header strong { font-weight: 600; font-size: 1.05rem; }
.note time { color: var(--muted); font-size: .92rem; }
.note > p:last-child { margin-bottom: 0; }

/* ---- index pages ------------------------------------------------------------------------------- */

.group-jump ul { columns: 15rem; column-gap: 2rem; list-style: none; margin: 0 0 1rem; padding: 0; }
.group-jump li { break-inside: avoid; padding: .15rem 0; }
.count { color: var(--muted); font: 400 .85rem/1 var(--f-code); }

.group h2 { margin: 2.6rem 0 .8rem; font: 600 1.6rem/1.2 var(--f-head); border-bottom: 1px solid var(--rule); padding-bottom: .3rem; }
.entries { list-style: none; margin: 0; padding: 0; }
.entries li {
  display: grid; grid-template-columns: minmax(10rem, 17rem) 1fr; gap: 1.5rem;
  padding: .4rem 0; border-bottom: 1px dotted var(--rule);
}
.entry-name { font: 600 .92rem/1.5 var(--f-code); overflow-wrap: anywhere; }
.page-index .entry-name { color: var(--blufor); }
.entry-summary { color: var(--muted); font-size: .96rem; line-height: 1.45; }

/* ---- home -------------------------------------------------------------------------------------- */

.page-home .masthead-inner { padding: 4rem 1.5rem 3.2rem; }
.home-title { font-size: clamp(2.4rem, 1.4rem + 4.2vw, 4.4rem); max-width: 14ch; }
.search-hero { margin: 1.8rem 0 0; width: min(38rem, 100%); }
.search-hero input { padding: .85rem 1rem; font-size: 1.15rem; background: var(--paper); border-width: 1.5px; }

.home-grid { display: grid; grid-template-columns: 1fr 1fr minmax(16rem, 20rem); gap: 3rem; }
.home-col h2, .home-side h2 { margin: 0 0 .8rem; font: 600 1.45rem/1.2 var(--f-head); }
.home-col h2 a { color: var(--ink); }
.home-side h2 { font-size: 1.2rem; }
.home-side section + section { margin-top: 2.4rem; }
.group-list, .recent, .data-list { list-style: none; margin: 0; padding: 0; }
.group-list li { padding: .18rem 0; }
.recent li { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px dotted var(--rule); }
.recent a { font: 600 .9rem/1.4 var(--f-code); overflow-wrap: anywhere; }
.recent time { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.data-list li { margin: .5rem 0; font-size: .95rem; color: var(--muted); }
.data-list a { font-family: var(--f-code); font-size: .9rem; }
.home-side p { font-size: .95rem; color: var(--muted); }

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

.footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: .92rem; }
.footer-inner { max-width: 72rem; margin: 0 auto; padding: 1.4rem 1.5rem 2rem; }

/* ---- small screens ---------------------------------------------------------------------------- */

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
  .home-grid { grid-template-columns: 1fr 1fr; }
  .home-side { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: .6rem 1rem; padding: .6rem 1rem; position: static; }
  .search { width: 100%; order: 3; }
  .search-key { display: none; }
  .masthead-inner, .layout, .footer-inner { padding-left: 1rem; padding-right: 1rem; }
  .page-home .masthead-inner { padding-top: 2.4rem; padding-bottom: 2.2rem; }
  .entries li { grid-template-columns: 1fr; gap: .1rem; }
  .home-grid { grid-template-columns: 1fr; gap: 2rem; }
  pre.code { margin-left: -1rem; margin-right: -1rem; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
