@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Combined Arms Battalion — site styles */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:    #10151b;
  --bg-2:  #151b23;
  --line:  #262e38;
  --line-2:#1d242c;

  --text:  #e4e8ed;
  --body:  #b9c1cb;
  --muted: #838d99;

  --gold:  #c9a349;
  --gold-2:#dcbc76;

  --wrap:  980px;
  --font:  'Inter', -apple-system, Segoe UI, Roboto, sans-serif;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: var(--gold); text-decoration: underline; }
strong { color: var(--text); font-weight: 600; }
ul { list-style: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: rgba(201, 163, 73, 0.28); color: #fff; }

h1, h2, h3, h4 { color: var(--text); font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.95rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1rem; max-width: 72ch; }
p:last-child { margin-bottom: 0; }
.lede { color: var(--body); }

/* header */
.masthead { border-bottom: 1px solid var(--line); background: var(--bg); }
.masthead__inner {
  max-width: var(--wrap);
  margin: 0 auto;
  min-height: 66px;
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.4rem;
}
.brand { display: flex; align-items: center; gap: 0.7rem; margin-right: auto; color: var(--text); }
.brand:hover { color: var(--text); text-decoration: none; }
.brand__mark { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }
.brand__name { display: block; font-weight: 600; font-size: 0.98rem; line-height: 1.3; }
.brand__unit { display: block; font-size: 0.78rem; color: var(--muted); }

.mainnav { display: flex; align-items: center; gap: 1.3rem; }
.mainnav a { font-size: 0.93rem; color: var(--body); }
.mainnav a:hover { color: var(--text); text-decoration: none; }
.mainnav a[aria-current='page'] { color: var(--gold-2); }

.masthead__cta { font-size: 0.93rem; color: var(--gold-2); }
.navtoggle {
  display: none;
  width: 36px; height: 32px;
  flex-direction: column; justify-content: center; gap: 5px;
  padding: 0 7px;
  background: none; border: 1px solid var(--line); border-radius: 4px;
  cursor: pointer;
}
.navtoggle span { display: block; height: 2px; background: var(--body); }

/* page shell */
.shell { flex: 1; width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.5rem 4.5rem; }
.shell--narrow { max-width: 720px; }

.section { padding-top: 2.6rem; }
.section--tight { padding-top: 1.6rem; }
.section__head { margin-bottom: 1.1rem; }
.section__sub { margin-top: 0.4rem; color: var(--muted); font-size: 0.95rem; }

.rule { height: 1px; background: var(--line-2); border: 0; margin-top: 2.6rem; }

.breadcrumb { padding-top: 1.4rem; font-size: 0.87rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb span { margin: 0 0.35rem; }

.pagehead { padding: 1.8rem 0 1.5rem; border-bottom: 1px solid var(--line-2); }
.pagehead__title { font-size: 2.05rem; }
.pagehead__sub { margin-top: 0.6rem; }
.pagehead__meta {
  display: flex; flex-wrap: wrap; gap: 0.1rem 1.5rem;
  margin-top: 0.9rem; font-size: 0.87rem; color: var(--muted);
}
.pagehead__meta b { color: var(--body); font-weight: 500; }

.sublabel {
  margin: 1.8rem 0 0.7rem;
  font-size: 0.95rem; font-weight: 600; color: var(--text);
}
.sublabel:first-child { margin-top: 0; }

.source { margin-top: 2.6rem; padding-top: 1rem; border-top: 1px solid var(--line-2); font-size: 0.88rem; color: var(--muted); }
.source p { max-width: none; }

/* buttons and links */
.btn {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  font-family: inherit; font-size: 0.93rem;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: none;
  cursor: pointer;
}
.btn:hover { color: var(--text); border-color: #3a444f; text-decoration: none; }
.btn--primary { color: #14181d; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.btn--primary:hover { color: #14181d; background: var(--gold-2); border-color: var(--gold-2); }
.btn--sm { padding: 0.35rem 0.8rem; font-size: 0.87rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.backlink { display: inline-block; margin-top: 2.4rem; font-size: 0.92rem; color: var(--muted); }
.backlink:hover { color: var(--gold); }
.inline-link { color: var(--gold-2); }

/* prose blocks — deliberately unboxed */
.panel { }
.panel + .panel { margin-top: 1rem; }

.grid { display: grid; gap: 1.6rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.card { display: block; color: var(--body); }
a.card:hover { color: var(--body); text-decoration: none; }
.card__title { display: block; font-weight: 600; color: var(--text); margin-bottom: 0.15rem; }
a.card:hover .card__title { color: var(--gold-2); }
.card__desc { display: block; font-size: 0.93rem; color: var(--muted); }

.tile { }
.tile__name { font-weight: 600; color: var(--text); margin-bottom: 0.1rem; }
.tile p { font-size: 0.93rem; color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.93rem; min-width: 380px; }
table.data th {
  padding: 0 1.2rem 0.5rem 0;
  text-align: left; font-size: 0.87rem; font-weight: 600;
  color: var(--muted); border-bottom: 1px solid var(--line);
}
table.data td { padding: 0.65rem 1.2rem 0.65rem 0; border-bottom: 1px solid var(--line-2); color: var(--body); }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data .role { display: flex; align-items: center; gap: 0.5rem; color: var(--text); }
table.data .role img { width: 19px; height: 19px; object-fit: contain; }

/* notes */
.notice {
  display: block;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 2px solid var(--line);
  font-size: 0.94rem;
}
.notice__label { display: block; font-weight: 600; color: var(--text); }
.notice--brass { border-left-color: var(--gold); }
.notice--alert { border-left-color: #b5544e; }
.notice + .notice { margin-top: 1.1rem; }
.notice p { max-width: none; }

/* numbered instructions */
.steps { display: grid; gap: 1.1rem; counter-reset: none; }
.step { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.9rem; }
.step__num { font-weight: 600; color: var(--gold); font-size: 0.95rem; line-height: 1.7; }
.step__body h3 { margin-bottom: 0.1rem; }
.step__body p { font-size: 0.94rem; color: var(--muted); }

/* stats */
.stats {
  display: flex; flex-wrap: wrap; gap: 1.6rem 2.8rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}
.stat__value { display: block; font-size: 1.3rem; font-weight: 600; color: var(--text); line-height: 1.4; }
.stat__label { display: block; font-size: 0.87rem; color: var(--muted); }

/* contents sidebar */
.layout-toc { display: grid; grid-template-columns: 175px 1fr; gap: 3rem; margin-top: 2rem; align-items: start; }
.toc { position: sticky; top: 2rem; }
.toc__label { font-size: 0.87rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }
.toc a { display: block; padding: 0.22rem 0; font-size: 0.91rem; color: var(--muted); }
.toc a:hover { color: var(--body); text-decoration: none; }
.toc a.is-active { color: var(--gold-2); }

/* units */
.unitcard { display: grid; grid-template-columns: 3.6rem 1fr; gap: 1rem; padding: 1.05rem 0; border-bottom: 1px solid var(--line-2); color: var(--body); }
a.unitcard:hover { color: var(--body); text-decoration: none; }
.unitcard__num { font-size: 1.15rem; font-weight: 600; color: var(--gold); line-height: 1.5; }
.unitcard__num small { display: block; font-size: 0.75rem; font-weight: 400; color: var(--muted); line-height: 1.2; }
.unitcard__name { display: block; font-weight: 600; color: var(--text); }
a.unitcard:hover .unitcard__name { color: var(--gold-2); }
.unitcard__desc { display: block; font-size: 0.93rem; color: var(--muted); }

.chip { font-size: 0.85rem; font-weight: 400; color: var(--muted); }

.unitbanner { padding: 1.8rem 0 1.5rem; border-bottom: 1px solid var(--line-2); }
.unitbanner__title { font-size: 2.05rem; }
.unitbanner__sub { margin-top: 0.5rem; color: var(--muted); }

.layout-side { display: grid; grid-template-columns: 1fr 220px; gap: 3rem; margin-top: 2rem; align-items: start; }
.sidebar { position: sticky; top: 2rem; display: grid; gap: 1.6rem; }
.factsheet__head { font-weight: 600; color: var(--text); font-size: 0.95rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--line); }
.factsheet dt { padding-top: 0.7rem; font-size: 0.85rem; color: var(--muted); }
.factsheet dd { font-size: 0.93rem; color: var(--text); }

/* rank lists */
.roster { display: grid; }
.roster__row { display: grid; grid-template-columns: 1.9rem 1fr; gap: 0.9rem; align-items: baseline; padding: 0.6rem 0; border-bottom: 1px solid var(--line-2); }
.roster__row:last-child { border-bottom: 0; }
.roster__icon { width: 22px; height: 22px; object-fit: contain; position: relative; top: 4px; }
.roster__icon--blank { width: 22px; height: 22px; }
.roster__name { display: block; font-weight: 600; color: var(--text); }
.roster__desc { display: block; font-size: 0.93rem; color: var(--muted); }

.reqs { display: grid; }
.req { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 1.2rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line-2); }
.req:last-child { border-bottom: 0; }
.req__rank { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--text); }
.req__rank img { width: 19px; height: 19px; object-fit: contain; }
.req__body { font-size: 0.93rem; color: var(--muted); }

.list { display: grid; gap: 0.45rem; }
.list li { position: relative; padding-left: 1.1rem; font-size: 0.96rem; max-width: 72ch; }
.list li::before { content: '—'; position: absolute; left: 0; color: var(--muted); }
.list--cols { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0.45rem 2.4rem; }

.entries { display: grid; }
.entry { padding: 0.6rem 0; border-bottom: 1px solid var(--line-2); font-size: 0.94rem; color: var(--muted); max-width: 78ch; }
.entry:last-child { border-bottom: 0; }
.entry b { color: var(--text); font-weight: 600; }

/* history */
.records { display: grid; gap: 2rem; }
.record__code { font-size: 0.87rem; color: var(--muted); }
.record__title { font-size: 1.05rem; margin: 0.1rem 0 0.35rem; }
.record__body { font-size: 0.95rem; color: var(--muted); }

/* gallery */
.filters { display: flex; flex-wrap: wrap; gap: 1.1rem; margin: 1.6rem 0 1.2rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line-2); }
.filter {
  padding: 0; background: none; border: 0;
  font-family: inherit; font-size: 0.93rem; color: var(--muted); cursor: pointer;
}
.filter:hover { color: var(--body); }
.filter.is-active { color: var(--gold-2); font-weight: 600; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 0.5rem; }
.shot { aspect-ratio: 16 / 10; overflow: hidden; border-radius: 3px; background: var(--bg-2); cursor: pointer; }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot:hover img { opacity: 0.82; }

.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 3.5rem 1.5rem;
  background: rgba(8, 11, 15, 0.96);
}
.lightbox.is-open { display: flex; }
.lightbox figure { max-width: 1000px; width: 100%; text-align: center; }
.lightbox img { max-width: 100%; max-height: 78vh; margin: 0 auto; border-radius: 3px; }
.lightbox img.is-fading { opacity: 0.3; }
.lightbox figcaption { margin-top: 0.8rem; font-size: 0.9rem; color: var(--body); }
.lb-btn {
  position: absolute; width: 40px; height: 40px;
  font-size: 1.2rem; color: var(--text);
  background: none; border: 1px solid var(--line); border-radius: 4px; cursor: pointer;
}
.lb-btn:hover { border-color: #3a444f; }
.lb-close { top: 1.2rem; right: 1.2rem; }
.lb-prev { left: 1.2rem; top: 50%; }
.lb-next { right: 1.2rem; top: 50%; }

/* home */
.hero { display: grid; grid-template-columns: 1fr 190px; gap: 3rem; align-items: center; padding: 3rem 0 2.4rem; }
.hero__title { font-size: 2.4rem; line-height: 1.2; }
.hero__title span { color: inherit; }
.hero__motto { margin-top: 0.5rem; color: var(--muted); font-style: italic; }
.hero__lede { margin-top: 1.1rem; }
.hero__actions { margin-top: 1.6rem; }
.hero__crest img { width: 100%; }

/* footer */
.sitefoot { margin-top: auto; border-top: 1px solid var(--line-2); }
.sitefoot__inner {
  max-width: var(--wrap); margin: 0 auto;
  padding: 2rem 1.5rem 1.2rem;
  display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 2rem;
}
.sitefoot__brand { display: flex; gap: 0.8rem; }
.sitefoot__brand img { width: 34px; height: 34px; object-fit: contain; }
.sitefoot__name { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.sitefoot__motto { font-size: 0.87rem; color: var(--muted); font-style: italic; }
.sitefoot h4 { font-size: 0.9rem; margin-bottom: 0.4rem; }
.sitefoot ul { display: grid; gap: 0.25rem; }
.sitefoot ul a { font-size: 0.9rem; color: var(--muted); }
.sitefoot ul a:hover { color: var(--text); }
.sitefoot__base {
  max-width: var(--wrap); margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 1.5rem;
  font-size: 0.85rem; color: var(--muted);
}

/* misc */
.code-tag { font-family: ui-monospace, Consolas, monospace; font-size: 0.88rem; color: var(--body); }
a.code-tag { color: var(--gold-2); }
.stack > * + * { margin-top: 1.1rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 1.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* responsive */
@media (max-width: 900px) {
  .layout-toc, .layout-side { grid-template-columns: 1fr; gap: 1.8rem; }
  .toc { display: none; }
  .sidebar { position: static; }
  .navtoggle { display: flex; }
  .masthead__cta { display: none; }
  .mainnav {
    display: none;
    width: 100%;
    order: 3;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding-top: 0.5rem;
  }
  .mainnav.is-open { display: flex; }
  .mainnav a { width: 100%; padding: 0.55rem 0; border-bottom: 1px solid var(--line-2); }
  .masthead__inner { flex-wrap: wrap; }
  .hero { grid-template-columns: 1fr; gap: 1.8rem; padding: 2.2rem 0 2rem; }
  .hero__crest { order: -1; }
  .hero__crest img { width: 130px; }
  .sitefoot__inner { grid-template-columns: 1fr 1fr; }
  .sitefoot__brand { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .shell, .masthead__inner { padding-left: 1.2rem; padding-right: 1.2rem; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; gap: 1.4rem; }
  .req { grid-template-columns: 1fr; gap: 0.15rem; }
  .brand__unit { display: none; }
  .pagehead__title, .unitbanner__title, .hero__title { font-size: 1.7rem; }
  .lb-prev { left: 0.5rem; }
  .lb-next { right: 0.5rem; }
}
