/* ============================================================
   NCODP — LEADER PRESENCE & MILITARY BEARING
   Shared stylesheet for all training products.
   Palette derived from AGSU heritage colors named in AD 2025-18.
   ============================================================ */

:root {
  /* --- ground & ink --- */
  --paper:      #F2F1EC;   /* field-manual stock */
  --paper-2:    #E8E7DF;   /* recessed panel */
  --paper-3:    #DEDCD1;   /* rule / hairline */
  --ink:        #17190F;   /* deep olive-black */
  --ink-2:      #414534;   /* secondary text */
  --ink-3:      #6B6F5C;   /* captions, meta */

  /* --- uniform colors (AD 2025-18, encl 2) --- */
  --olive:      #4A5240;   /* AGSU heritage green */
  --olive-lt:   #6E7860;
  --taupe:      #AF9E7D;   /* heritage taupe 565 */
  --tan:        #C9B894;   /* heritage tan 566 */
  --walnut:     #5C4630;   /* heritage walnut 567 */

  /* --- semantic --- */
  --go:         #4A6B3F;
  --caution:    #9A6B14;
  --stop:       #8E3B2E;

  /* --- solid fills carrying light text. Deliberately NOT overridden
         in dark mode, so #F2F1EC text keeps its contrast in both themes. --- */
  --fill:       #4A5240;   /* AGSU heritage green */
  --fill-hover: #414534;   /* one step deeper */

  /* --- type --- */
  --display: "Oswald", "Haettenschweiler", "Arial Narrow", sans-serif;
  --body:    "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --mono:    "IBM Plex Mono", "Consolas", "Courier New", monospace;

  --maxw: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:   #14160F;
    --paper-2: #1D2017;
    --paper-3: #2C3024;
    --ink:     #E9E7DB;
    --ink-2:   #BDBCAC;
    --ink-3:   #8B8D7B;
    --olive:   #93A47F;
    --olive-lt:#B3C09F;
    --taupe:   #C9B894;
    --tan:     #DBCBA8;
    --walnut:  #B08C63;
    --go:      #8CB77C;
    --caution: #D9A441;
    --stop:    #D4796A;
  }
}
:root[data-theme="dark"] {
  --paper:   #14160F;
  --paper-2: #1D2017;
  --paper-3: #2C3024;
  --ink:     #E9E7DB;
  --ink-2:   #BDBCAC;
  --ink-3:   #8B8D7B;
  --olive:   #93A47F;
  --olive-lt:#B3C09F;
  --taupe:   #C9B894;
  --tan:     #DBCBA8;
  --walnut:  #B08C63;
  --go:      #8CB77C;
  --caution: #D9A441;
  --stop:    #D4796A;
}

/* ============================================================
   BASE
   ============================================================ */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.08;
  text-wrap: balance;
  margin: 0;
  letter-spacing: 0.01em;
}

p { margin: 0 0 0.75em; }
p:last-child { margin-bottom: 0; }

a { color: var(--walnut); text-underline-offset: 2px; }

strong { font-weight: 700; color: var(--ink); }

em.term {
  font-style: normal;
  font-weight: 700;
  color: var(--walnut);
}

:focus-visible {
  outline: 2px solid var(--walnut);
  outline-offset: 2px;
}

img, svg { max-width: 100%; }

/* ============================================================
   TYPOGRAPHIC UTILITIES
   ============================================================ */

.eyebrow {
  font-family: var(--display);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.kicker {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--walnut);
}

.lede {
  font-size: 1.12rem;
  color: var(--ink-2);
  max-width: var(--maxw);
}

.small { font-size: 0.86rem; }
.meta  { font-size: 0.8rem; color: var(--ink-3); }

.mono {
  font-family: var(--mono);
  font-size: 0.82em;
  font-variant-numeric: tabular-nums;
}

/* Doctrinal paragraph number, e.g. 2-14 */
.para {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-3);
  white-space: nowrap;
}

/* REFERENCE stamp — names the publication a claim comes from */
.ref-stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--olive);
  border: 1px solid var(--olive);
  border-radius: 2px;
  padding: 0.18em 0.5em;
  white-space: nowrap;
}
.ref-stamp::before {
  content: "REF";
  font-weight: 600;
  opacity: 0.55;
  letter-spacing: 0.1em;
}
.ref-stamp.unverified {
  color: var(--caution);
  border-color: var(--caution);
  border-style: dashed;
}

/* ============================================================
   RUNNING HEAD — mimics FM/ADP page furniture
   ============================================================ */

.runhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1.5px solid var(--olive);
  padding-bottom: 0.35rem;
  margin-bottom: 1rem;
  font-family: var(--display);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--olive);
}

.runfoot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--paper-3);
  padding-top: 0.35rem;
  margin-top: auto;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ============================================================
   CALLOUTS
   ============================================================ */

.callout {
  border-left: 3px solid var(--taupe);
  background: var(--paper-2);
  padding: 0.85rem 1rem;
  margin: 1rem 0;
}
.callout > .eyebrow { display: block; margin-bottom: 0.3rem; }

.callout.key     { border-left-color: var(--olive); }
.callout.warn    { border-left-color: var(--caution); }
.callout.stopper { border-left-color: var(--stop); }
.callout.go      { border-left-color: var(--go); }

/* Discussion prompt — the interactive beats of the block */
.prompt {
  border: 1.5px solid var(--walnut);
  border-radius: 2px;
  padding: 0.9rem 1.05rem;
  margin: 1.1rem 0;
  background: transparent;
}
.prompt .eyebrow { color: var(--walnut); display: block; margin-bottom: 0.35rem; }
.prompt ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.prompt li { margin-bottom: 0.3rem; }

/* Pull quote */
.pull {
  font-family: var(--display);
  font-weight: 300;
  font-size: 1.5rem;
  line-height: 1.25;
  color: var(--olive);
  border-top: 2px solid var(--taupe);
  border-bottom: 2px solid var(--taupe);
  padding: 0.7rem 0;
  margin: 1.2rem 0;
  text-wrap: balance;
}
.pull cite {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 0.5rem;
}

/* ============================================================
   LISTS
   ============================================================ */

ul.clean, ol.clean { margin: 0.5rem 0; padding-left: 1.15rem; }
ul.clean li, ol.clean li { margin-bottom: 0.38rem; }

/* Check-box list for self-assessment / inspection */
ul.checklist {
  list-style: none;
  margin: 0.6rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}
ul.checklist li {
  position: relative;
  padding-left: 1.65rem;
  font-size: 0.94rem;
}
ul.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.22rem;
  width: 0.95rem;
  height: 0.95rem;
  border: 1.5px solid var(--olive);
  border-radius: 1px;
}

/* Do / Don't split */
.dodont {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 0.9rem;
  margin: 1rem 0;
}
.dodont section {
  border-top: 3px solid var(--paper-3);
  padding-top: 0.6rem;
}
.dodont section.do    { border-top-color: var(--go); }
.dodont section.dont  { border-top-color: var(--stop); }
.dodont h4 {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}
.dodont section.do h4   { color: var(--go); }
.dodont section.dont h4 { color: var(--stop); }
.dodont ul { margin: 0; padding-left: 1.05rem; font-size: 0.9rem; }
.dodont li { margin-bottom: 0.3rem; }

/* ============================================================
   GRIDS & CARDS
   ============================================================ */

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; }

/* The four components of Presence, and similar enumerations.
   Numbered only where the content genuinely is an ordered set. */
.component {
  border-top: 2px solid var(--olive);
  padding-top: 0.55rem;
}
.component h4 {
  font-size: 1.02rem;
  margin-bottom: 0.28rem;
  color: var(--ink);
}
.component p { font-size: 0.88rem; color: var(--ink-2); margin: 0; }

/* ============================================================
   TABLES
   ============================================================ */

.tablewrap { overflow-x: auto; margin: 1rem 0; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.data caption {
  text-align: left;
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 0.4rem;
}
table.data th {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: #F2F1EC;
  background: var(--fill);
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--fill);
}
table.data td {
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--paper-3);
  vertical-align: top;
}
table.data tbody tr:nth-child(even) td { background: var(--paper-2); }
table.data td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================
   FORM FIELDS — DA-form vernacular: corner label, ruled box
   ============================================================ */

.field {
  border: 1px solid var(--ink-2);
  padding: 0.28rem 0.5rem 0.5rem;
  min-height: 2.7rem;
  position: relative;
  background: transparent;
}
.field > label,
.field > .flabel {
  display: block;
  font-family: var(--display);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.15rem;
}
.field .fill { min-height: 1.15rem; display: block; }
.field.tall { min-height: 5.5rem; }
.field.taller { min-height: 9rem; }

.fieldrow {
  display: grid;
  gap: -1px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

/* Writing lines for handwritten forms */
.lines {
  display: block;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 1.45rem,
    var(--paper-3) 1.45rem,
    var(--paper-3) calc(1.45rem + 1px)
  );
}
.lines.n3 { height: 4.5rem; }
.lines.n4 { height: 6rem; }
.lines.n6 { height: 9rem; }
.lines.n8 { height: 12rem; }

.sigline {
  border-bottom: 1px solid var(--ink-2);
  height: 1.6rem;
  margin-top: 0.9rem;
}

/* ============================================================
   RISK MATRIX
   ============================================================ */

table.matrix { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
table.matrix th, table.matrix td {
  border: 1px solid var(--ink-2);
  padding: 0.35rem 0.3rem;
  text-align: center;
  font-family: var(--display);
  letter-spacing: 0.04em;
}
table.matrix th {
  font-size: 0.66rem;
  text-transform: uppercase;
  background: var(--paper-2);
  color: var(--ink-2);
}
td.r-EH { background: #8E3B2E; color: #fff; font-weight: 600; }
td.r-H  { background: #C06A2E; color: #fff; font-weight: 600; }
td.r-M  { background: #D9B441; color: #17190F; font-weight: 600; }
td.r-L  { background: #6E8A5A; color: #fff; font-weight: 600; }

/* ============================================================
   PRINT
   ============================================================ */

.screen-only { display: block; }

@media print {
  :root {
    --paper: #ffffff;
    --paper-2: #F1F0EA;
    --paper-3: #C9C7BB;
    --ink: #000000;
    --ink-2: #2E3126;
    --ink-3: #5A5D4C;
  }
  body { background: #fff; font-size: 10.5pt; }
  .screen-only { display: none !important; }
  .callout, .prompt, .field, table.data th { break-inside: avoid; }
  h1, h2, h3, h4 { break-after: avoid; }
  a { color: inherit; text-decoration: none; }
}

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

/* ============================================================
   DIAGRAMS — hand-authored inline SVG, theme-aware via tokens
   ============================================================ */

figure.dg {
  margin: 0.9rem 0;
  border: 1px solid var(--paper-3);
  background: var(--paper-2);
  padding: 0.7rem 0.8rem 0.6rem;
}
figure.dg svg { display: block; width: 100%; max-width: 100%; height: auto; }
figure.dg figcaption {
  font-size: 0.76rem; line-height: 1.4; color: var(--ink-3);
  margin-top: 0.45rem; border-top: 1px solid var(--paper-3); padding-top: 0.35rem;
}
figure.dg figcaption strong { color: var(--ink-2); }

/* structural strokes follow the page foreground so both themes work */
.dg-line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.dg-fill { fill: var(--paper); stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.dg-thin { fill: none; stroke: currentColor; stroke-width: 1; opacity: .55; }
.dg-ghost{ fill: none; stroke: currentColor; stroke-width: 1.2; opacity: .35; stroke-dasharray: 4 4; }

/* the measured thing carries the one accent hue */
.dg-dim  { fill: none; stroke: var(--walnut); stroke-width: 1.5; }
.dg-env  { fill: none; stroke: var(--walnut); stroke-width: 1.4; stroke-dasharray: 5 4; }
.dg-zone { fill: none; stroke: var(--taupe); stroke-width: 9; opacity: .6; stroke-linecap: round; }
.dg-ok   { fill: none; stroke: var(--go);   stroke-width: 2; }
.dg-okf  { fill: var(--go);  opacity: .22; stroke: var(--go); stroke-width: 1.4; }
.dg-badf { fill: var(--stop); opacity: .20; stroke: var(--stop); stroke-width: 1.4; }

text.dg-t { fill: currentColor; font-family: var(--mono); font-size: 11px; }
text.dg-s { fill: currentColor; font-family: var(--mono); font-size: 9.5px; opacity: .72; }
text.dg-m { fill: var(--walnut); font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
text.dg-h {
  fill: var(--olive); font-family: var(--display); font-size: 12.5px;
  font-weight: 600; letter-spacing: 0.1em;
}
text.dg-no { fill: var(--stop); font-family: var(--mono); font-size: 10.5px; font-weight: 600; }
text.dg-yes{ fill: var(--go);  font-family: var(--mono); font-size: 10.5px; font-weight: 600; }

@media print {
  figure.dg { break-inside: avoid; background: #fff; }
  .dg-zone, .dg-okf, .dg-badf { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Official figures reproduced from Army publications */
figure.plate {
  margin: 0.8rem 0;
  border: 1px solid var(--paper-3);
  background: #ffffff;
  padding: 0.6rem 0.7rem 0.5rem;
}
figure.plate img {
  display: block; width: 100%; height: auto;
  mix-blend-mode: multiply;
}
figure.plate figcaption {
  font-size: 0.72rem; line-height: 1.38; color: var(--ink-3);
  margin-top: 0.4rem; border-top: 1px solid var(--paper-3); padding-top: 0.3rem;
}
figure.plate .src {
  display: block; font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--walnut); margin-top: 0.2rem;
}
.plategrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.7rem; align-items: start; }
.plategrid figure.plate { margin: 0; }
@media print { figure.plate { break-inside: avoid; } figure.plate img { mix-blend-mode: normal; } }


/* ============================================================
   INK SAVER — line art on white, for cheap high-volume printing.
   Removes every solid fill; keeps meaning by switching colour
   coding over to line weight and dash pattern, so it survives a
   black-and-white copier.
   ============================================================ */

.ink-saver table.data th {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink-3);
  border-bottom: 2px solid var(--ink);
}
.ink-saver table.data tbody tr:nth-child(even) td { background: transparent; }
.ink-saver table.roster th,
.ink-saver table.rw th {
  background: transparent; color: var(--ink);
  border: 1px solid var(--ink-3); border-bottom: 2px solid var(--ink);
}
.ink-saver table.roster td.n { background: transparent; }

.ink-saver .callout   { background: transparent; }
.ink-saver figure.dg  { background: transparent; }
.ink-saver .cardface  { background: transparent; }

.ink-saver .steps li::before {
  background: transparent; color: var(--walnut);
  border: 1.5px solid var(--walnut);
}
.ink-saver .qbox .qn {
  background: transparent; color: var(--walnut);
  border: 1.5px solid var(--walnut);
}
.ink-saver ol.runsheet li::before {
  background: transparent; color: var(--olive);
  border: 1.5px solid var(--olive);
}

/* Leadership Requirements Model — keylines instead of filled bands */
.ink-saver .lrm-mini .band {
  background: transparent; color: var(--olive); padding-left: 0;
  border-bottom: 1.5px solid var(--olive);
}
.ink-saver .lrm-mini .col { background: transparent; }
.ink-saver .lrm-mini .col.spot { background: transparent; border: 2px solid var(--olive); }
.ink-saver .lrm-mini .col.spot h5 { color: var(--olive); }
.ink-saver .lrm-mini .col.spot li { color: var(--ink); font-weight: 700; }
.ink-saver .lrm-band > .band-label {
  background: transparent; color: var(--olive); border: 1.5px solid var(--olive);
}
.ink-saver .lrm-col { background: transparent; }
.ink-saver .lrm-col.spotlight { background: transparent; border: 2px solid var(--olive); }
.ink-saver .lrm-col.spotlight h5 { color: var(--olive); }
.ink-saver .lrm-col.spotlight li { color: var(--ink); font-weight: 700; }

/* Cover — a keyline frame rather than a solid block of toner */
.ink-saver .cover { background: transparent; border: 2px solid var(--olive); color: var(--ink); }
.ink-saver .cover h1 { color: var(--olive); }
.ink-saver .cover h1 span { color: var(--walnut); }
.ink-saver .cover .crest { color: var(--walnut); }
.ink-saver .cover .tag { color: var(--ink-2); border-left-color: var(--walnut); }
.ink-saver .cover .ref-stamp { color: var(--olive); border-color: var(--olive); }
.ink-saver .cover .owner { color: var(--ink-2); border-top-color: var(--ink-3); }
.ink-saver .cover .owner .line { border-bottom-color: var(--ink-3); }

/* Diagrams — outline only. Prohibited reads as dashed, authorised as solid,
   so the distinction survives a greyscale copier. */
.ink-saver .dg-zone { opacity: .55; stroke-width: 6; }
.ink-saver .dg-okf  { fill: none; stroke-width: 2; }
.ink-saver .dg-badf { fill: none; stroke-width: 2; stroke-dasharray: 6 3; }

/* Risk matrix — pattern, not fill */
.ink-saver td.r-EH, .ink-saver td.r-H,
.ink-saver td.r-M,  .ink-saver td.r-L { background: transparent; color: var(--ink); }
.ink-saver td.r-EH { border: 3px double var(--ink); }
.ink-saver td.r-H  { border: 2px solid var(--ink); }
.ink-saver td.r-M  { border: 1px dashed var(--ink); }
.ink-saver td.r-L  { border: 1px solid var(--ink-3); }
.ink-saver .risk { background: transparent !important; color: var(--ink) !important; border: 1px solid var(--ink-2); }

/* Toolbar segmented control */
.seg { display: inline-flex; border: 1px solid rgba(242,241,236,.55); border-radius: 2px; overflow: hidden; }
.seg button { border: none !important; border-radius: 0 !important; margin: 0; }
.seg button + button { border-left: 1px solid rgba(242,241,236,.4) !important; }
.seg button[aria-pressed="true"] { background: #F2F1EC; color: var(--fill); }
