/* eagerarms.com: one stylesheet for every page. Colors: blue background, white text,
   maroon menu highlight. --blue is #0077A8 (white text 5.0:1, WCAG AA). */
:root {
  --blue: #0077A8;
  --blue-dark: #005A80;
  --maroon: #8E4035;
  --menu-bg: #eee;
  --menu-line: #999;
  --page: 54rem;
}

html { font-size: 118.75%; -webkit-text-size-adjust: 100%; } /* 19px; site.js scales it with A-/A+ */
body {
  margin: 0;
  background: var(--blue);
  color: #fff;
  font-family: Verdana, Tahoma, Arial, sans-serif;
  line-height: 1.6;
}
.page { max-width: var(--page); margin: 0 auto; padding: 0 1rem; }

a { color: #fff; text-decoration-thickness: 1px; text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 0; background: #fff; color: #000; padding: .5rem 1rem; z-index: 200; }
.skip:focus { left: 1rem; }

/* header: guidon, logo, 1st Cav patch */
.site-header .brand { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem 0; text-decoration: none; }
.site-header img { display: block; height: auto; max-width: 100%; }
.brand .flag { width: 28%; max-width: 161px; }
.brand .logo { flex: 0 1 284px; text-align: center; }
.brand .logo img { margin: 0 auto; }
.brand .subtitle { display: block; color: #830010; font-weight: bold; font-size: clamp(.7rem, 2.6vw, .85rem); line-height: 1.3; }
.brand .patch { width: 13%; max-width: 76px; }

/* menu (built by site.js) */
#nav { position: relative; z-index: 100; display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; font-size: .8rem; }
#nav ul { list-style: none; margin: 0; padding: 0; }
#nav button, #nav a { font: inherit; line-height: 1.3; color: #000; text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; }
.menu { display: flex; flex-wrap: wrap; background: var(--menu-bg); border: 1px solid var(--menu-line); flex: 1 1 auto; }
.menu > li { position: relative; }
.menu > li + li { border-left: 1px solid var(--menu-line); }
.menu > li > a, .menu > li > button { display: flex; align-items: center; height: 100%; padding: .4rem .5rem; min-height: 44px; box-sizing: border-box; white-space: nowrap; }
.menu li li > a, .menu li li > button { display: block; width: 100%; box-sizing: border-box; padding: .45rem .9rem; white-space: nowrap; }
.menu button::after { content: " \25BE"; font-size: .8em; }
#nav .menu li:hover > a, #nav .menu li:hover > button, #nav .menu a:focus-visible, #nav .menu button:focus-visible,
#nav .menu .open > button { background: var(--maroon); color: #fff; }
.menu [aria-current="page"] { font-weight: bold; }
.menu > li.current > a, .menu > li.current > button { box-shadow: inset 0 -4px 0 var(--maroon); }
.menu ul { display: none; background: var(--menu-bg); border: 1px solid var(--menu-line); }
.menu .open > ul { display: block; }
.menu > li > ul { position: absolute; left: -1px; top: 100%; min-width: 100%; max-height: 75vh; overflow-y: auto; box-shadow: 3px 3px 6px rgba(0,0,0,.4); }
.menu li li ul { border: 0; border-left: 4px solid var(--maroon); margin-left: .9rem; } /* third level opens in place */
.menu > li:last-child > ul, .menu > li:nth-last-child(2) > ul { left: auto; right: -1px; }
@media (hover: hover) and (min-width: 60em) {
  .menu > li:hover > ul { display: block; }
}
.menu-toggle { display: none; }
.textsize { display: flex; align-items: center; gap: .3rem; margin-left: auto; color: #fff; }
#nav .textsize button { min-width: 44px; min-height: 44px; background: var(--menu-bg); border: 1px solid var(--menu-line); text-align: center; font-weight: bold; }
#nav .textsize button:hover { background: var(--maroon); color: #fff; }

@media (max-width: 60em) {
  #nav { font-size: 1rem; }
  #nav .menu-toggle { display: block; padding: .5rem 1rem; min-height: 48px; background: var(--menu-bg); border: 1px solid var(--menu-line); font-weight: bold; }
  .menu { display: none; flex: 1 1 100%; flex-direction: column; order: 1; }
  .menu > li > a, .menu > li > button { height: auto; width: 100%; }
  #nav.open .menu { display: flex; }
  .menu > li + li { border-left: 0; border-top: 1px solid var(--menu-line); }
  .menu > li > ul { position: static; min-width: 0; box-shadow: none; max-height: none; border: 0; border-left: 4px solid var(--maroon); margin-left: .9rem; }
  .menu li li > a, .menu li li > button { white-space: normal; min-height: 44px; }
}

/* page content */
main { padding: 1rem 0 3rem; } /* as wide as the header and menu, like the original site */
main { overflow-wrap: break-word; }
main a { overflow-wrap: anywhere; } /* long web addresses */
h1 { font-size: 1.8rem; line-height: 1.25; margin: 1rem 0; }
h2 { font-size: 1.35rem; }
img { max-width: 100%; height: auto; }
.photo, .caption { display: block; text-align: center; } /* a photo on its own line, and its caption */
.photo { margin: 1rem 0 .5rem; }
.caption { margin-top: 1rem; }
.photo + .caption { margin-top: 0; }
.caption + .photo { margin-top: .25rem; }
main img[align="left"] { margin: 0 1rem .5rem 0; }
main img[align="right"] { margin: 0 0 .5rem 1rem; }
main table { max-width: 100%; border-collapse: collapse; margin: 0 auto; } /* photo pairs sit centered */
main td { vertical-align: top; }
main input[type="button"], main button { font: inherit; padding: .5rem 1rem; margin: .25rem 0; cursor: pointer; }
hr { border: 0; border-top: 2px solid rgba(255,255,255,.6); }

/* data tables (the roster): scroll sideways on narrow screens */
.table-scroll { overflow-x: auto; }
table.data { font-size: .85rem; }
table.data td, table.data th { border: 1px solid #fff; padding: .15rem .4rem; white-space: nowrap; }

/* phones: layout tables (photo pairs etc.) stack into one column */
@media (max-width: 40em) {
  main table:not(.data), main table:not(.data) > tbody, main table:not(.data) > * > tr, main table:not(.data) > * > * > td { display: block; width: auto !important; }
  main img[align] { float: none; display: block; margin: .5rem auto; }
}

/* photo galleries */
.gallery { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 1.25rem 1rem; }
.gallery a { display: block; text-decoration: none; font-size: .85rem; line-height: 1.35; text-align: center; }
.gallery img { display: block; width: 100%; height: 8rem; object-fit: contain; margin-bottom: .35rem; }
.gallery span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.gallery a:hover span { text-decoration: underline; }

/* photo viewer (site.js) */
#viewer { border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #111; color: #fff; }
#viewer::backdrop { background: #111; }
#viewer[open] { display: flex; flex-direction: column; }
#viewer figure { flex: 1; min-height: 0; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .5rem; }
#viewer img { flex: 1; min-height: 0; max-width: 100%; object-fit: contain; }
#viewer figcaption { font-size: 1.1rem; padding: .5rem 1rem 0; max-width: 50rem; text-align: center; }
#viewer .bar { display: flex; gap: .5rem; justify-content: center; align-items: center; padding: .5rem; flex-wrap: wrap; }
#viewer button { font: inherit; font-size: 1rem; font-weight: bold; min-height: 48px; padding: .5rem 1rem; background: var(--menu-bg); color: #000; border: 0; border-radius: 4px; cursor: pointer; }
#viewer button:hover { background: var(--maroon); color: #fff; }
#viewer .count { min-width: 6rem; text-align: center; }

@media print {
  body { background: #fff; color: #000; }
  a { color: #000; }
  #nav, .skip { display: none; }
  table.data td, table.data th { border-color: #000; }
}
