/* ==========================================================================
   Cub Scout Pack 83 — Denver, NC
   One stylesheet for the whole site. Edit colours and spacing here rather
   than inside the pages, so a change lands everywhere at once.
   ========================================================================== */

:root {
  /* Scouting America brand colours (Pantone 294 / 116). Don't drift from
     these two without a reason — they are the official ones. */
  --blue:        #003f87;
  --blue-dark:   #002d61;
  --gold:        #ffc53d;
  --gold-deep:   #f2b32c;
  --orange:      #d1440f;

  --ink:         #17281f;
  --ink-soft:    #46594e;
  --ink-faint:   #6b7c72;
  --paper:       #fffdf7;
  --mint:        #eaf5f0;
  --mint-line:   #cfe3d9;

  --wrap:        1180px;
  --radius:      16px;
  --radius-pill: 100px;

  --display: "Fredoka", "Trebuchet MS", "Segoe UI", sans-serif;
  --body: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

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

img { max-width: 100%; height: auto; display: block; }

a { color: var(--blue); }
a:hover { color: var(--blue-dark); }

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

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- buttons ------------------------------------------------------------ */

.btn {
  display: inline-block;
  touch-action: manipulation;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  padding: 17px 30px;              /* keeps the tap target above 44px */
  border-radius: var(--radius-pill);
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform .12s ease, background-color .12s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--blue); color: var(--paper); }
.btn-primary:hover { background: var(--blue-dark); color: var(--paper); }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: #0d1a13; color: var(--paper); }

/* --- header ------------------------------------------------------------- */

.site-header { background: var(--blue); }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand svg { flex: none; }
.brand-name {
  font-family: var(--display); font-size: 22px; font-weight: 700;
  color: var(--paper); letter-spacing: -.01em; line-height: 1.1;
}
.brand-name span { color: var(--gold); }

.site-nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.site-nav a {
  color: #c3d5ea; text-decoration: none; font-weight: 700; font-size: 15.5px;
  padding: 6px 0;
}
.site-nav a:hover { color: var(--paper); }
.site-nav a.nav-cta {
  background: var(--gold); color: var(--ink);
  font-family: var(--display); font-size: 16px; font-weight: 600;
  padding: 12px 24px; border-radius: var(--radius-pill);
}
.site-nav a.nav-cta:hover { background: var(--gold-deep); color: var(--ink); }

/* --- hero --------------------------------------------------------------- */

.hero { background: var(--gold); padding: 52px 0 56px; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; }
.hero-copy { display: flex; flex-direction: column; gap: 20px; }

.eyebrow {
  align-self: flex-start; background: var(--orange); color: #fff;
  font-family: var(--display); font-size: 14px; font-weight: 500;
  padding: 8px 16px; border-radius: var(--radius-pill);
}

.hero h1 {
  margin: 0;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(38px, 6vw, 62px);
  line-height: 1.02; letter-spacing: -.02em;
  text-wrap: balance;
}
.hero p { margin: 0; font-size: clamp(17px, 2vw, 19px); font-weight: 600; color: #4a3a10; max-width: 42ch; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 4px; }

.hero-photo {
  align-self: center;
  background: var(--gold-deep);
  border: 3px solid var(--ink);
  border-radius: 20px;
  overflow: hidden;
  /* placeholder styling, only visible before a photo is added */
  display: flex; align-items: center; justify-content: center;
  color: #8a6512; font-size: 13px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; text-align: center;
}
.hero-photo img { width: 100%; height: auto; display: block; border-radius: 17px; }

/* --- generic section ---------------------------------------------------- */

.section { padding: 56px 0; }
.section-alt { background: var(--mint); }

.section h2 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(28px, 4vw, 36px);
  margin: 0 0 8px; letter-spacing: -.01em; text-wrap: balance;
}
.section .lede { margin: 0 0 28px; color: var(--ink-soft); max-width: 62ch; }

/* --- card grids --------------------------------------------------------- */

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--mint); border: 2px solid var(--ink);
  border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.card.tint-orange { background: #fdeee8; }
.card.tint-gold { background: #fff6dd; }
.card h3 { font-family: var(--display); font-weight: 600; font-size: 20px; margin: 0; }
.card p { margin: 0; font-size: 15.5px; color: #3c4c43; }
.card svg { flex: none; }

/* --- dens --------------------------------------------------------------- */

.dens { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.den {
  touch-action: manipulation;
  border: 2px solid var(--ink); border-radius: 14px;
  padding: 18px 12px; text-align: center; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; gap: 2px;
}
.den:hover { transform: translateY(-2px); }
.den-name { font-family: var(--display); font-size: 19px; font-weight: 600; }
.den-grade { font-size: 13.5px; font-weight: 700; opacity: .8; }
.den-lion    { background: #f7d64a; }
.den-tiger   { background: #f2963d; }
.den-wolf    { background: #d9534f; color: #fff; }
.den-bear    { background: #8a5a2b; color: #fff; }
.den-webelos { background: #2f7fbf; color: #fff; }
.den-aol     { background: #0f6b4f; color: #fff; }

/* --- events ------------------------------------------------------------- */

.event { display: flex; flex-direction: column; gap: 9px; }
.event h3 { font-family: var(--display); font-size: 18px; font-weight: 600; margin: 0; line-height: 1.2; }
.event .meta { font-size: 14px; color: var(--ink-faint); }

/* --- facts / key-value list -------------------------------------------- */

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--ink); border: 2px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.fact { background: var(--paper); padding: 22px; display: flex; flex-direction: column; gap: 5px; }
.fact dt { font-family: var(--display); font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.fact dd { margin: 0; font-family: var(--display); font-size: 23px; font-weight: 600; }
.fact .note { font-size: 14.5px; color: var(--ink-soft); font-family: var(--body); font-weight: 400; }

/* --- calendar ----------------------------------------------------------- */

.calendar-frame { border: 2px solid var(--ink); border-radius: var(--radius); overflow: hidden; background: #fff; }
.calendar-frame iframe { display: block; width: 100%; height: 620px; border: 0; }

/* --- cubmaster ---------------------------------------------------------- */

.cubmaster { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: start; }
.cubmaster img { border-radius: var(--radius); border: 2px solid var(--ink); width: 100%; }
.cubmaster blockquote {
  margin: 0; font-size: 18.5px; line-height: 1.6; color: var(--ink);
}
.cubmaster .attrib { margin-top: 12px; font-weight: 700; }
.cubmaster .attrib span { display: block; font-weight: 400; color: var(--ink-faint); font-size: 15px; }

/* --- inquiry form ------------------------------------------------------- */

.ask { background: var(--orange); color: #fff; border-radius: var(--radius); padding: 32px; }
.ask h2 { color: #fff; }
.ask p { color: #ffe0d6; max-width: 46ch; }
.ask form { display: flex; flex-direction: column; gap: 12px; max-width: 460px; margin-top: 20px; }
.ask label { font-weight: 700; font-size: 15px; }
.ask input, .ask select, .ask textarea {
  font-family: var(--body); font-size: 16px; padding: 14px 16px;
  border: 0; border-radius: 10px; width: 100%;
}
.ask .btn-dark { align-self: flex-start; }

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

.site-footer { background: var(--ink); color: #a9bdb2; padding: 36px 0; font-size: 15px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.site-footer a { color: #cfe3d9; }
.site-footer p { margin: 0 0 4px; }

/* --- preview banner (staging only) -------------------------------------- */

.preview-banner {
  background: var(--ink); color: var(--gold); text-align: center;
  font-size: 14px; font-weight: 700; padding: 8px 16px;
}

/* ==========================================================================
   Responsive. Everything above is the desktop layout; these collapse it.
   ========================================================================== */

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 0; }
  .hero-copy { padding-bottom: 8px; }
  .hero-photo { border-radius: 20px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dens { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cubmaster { grid-template-columns: 1fr; }
  .cubmaster img { max-width: 200px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .site-header .wrap { justify-content: center; }
  .site-nav { gap: 16px; justify-content: center; }
  .section { padding: 40px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .dens { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1 1 100%; text-align: center; }
  .calendar-frame iframe { height: 520px; }
  .ask { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .den:hover { transform: none; }
}

/* ==========================================================================
   Photo gallery — event cards open a lightbox
   ========================================================================== */

/* The <button> is the control; .event-shot is the picture frame.
   Safari does not treat a <button> as a containing block for absolutely
   positioned children, so the badge must be positioned against this inner
   wrapper instead — otherwise it escapes the card. */
.event-photo {
  display: block; width: 100%; padding: 0; border: 0;
  background: none; cursor: pointer; font: inherit; color: inherit;
  text-decoration: none;
  /* iOS Safari: without this a tap can be held for the double-tap-to-zoom
     gesture instead of firing a click, which reads as "the card does
     nothing but the page resizes". */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(23, 40, 31, .15);
}
.event-shot {
  position: relative; display: block;
  aspect-ratio: 4 / 3;              /* the FRAME holds the shape... */
  border-radius: 12px; overflow: hidden;
  background: var(--mint-line);
}
.event-shot img {
  position: absolute; inset: 0;     /* ...and the photo just fills it. */
  width: 100%; height: 100%;
  max-width: 100%; object-fit: cover; display: block;
}
.event-photo:hover .event-shot img { filter: brightness(1.04); }

.event-more {
  position: absolute; right: 8px; bottom: 8px;
  background: var(--orange); color: #fff;
  font-family: var(--display); font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius-pill);
  pointer-events: none;
}

.event .blurb { margin: 0; font-size: 15px; color: var(--ink-soft); }

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(12, 20, 15, .94);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  overscroll-behavior: contain;
}
.lightbox[hidden] { display: none; }

/* The arrows are positioned against the overlay, not laid out beside the
   photo. In a flex row they competed with the image for width and got
   pushed off a phone screen entirely. */
.lb-stage {
  margin: 0; display: flex; flex-direction: column; gap: 12px;
  align-items: center; max-width: 100%; max-height: 100%;
}
.lb-stage img {
  max-width: min(1100px, calc(100vw - 32px));
  max-height: 76vh;
  width: auto; height: auto;
  border-radius: 10px; object-fit: contain;
}
.lb-stage figcaption {
  color: #e6ece8; font-size: 15px; text-align: center;
  display: flex; gap: 12px; align-items: baseline; justify-content: center; flex-wrap: wrap;
  max-width: min(1100px, calc(100vw - 32px));
}
.lb-stage figcaption span:last-child { color: #9fb0a6; font-size: 13.5px; }

.lightbox button {
  position: absolute;
  background: rgba(255, 255, 255, .14); color: #fff;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  border: 0; border-radius: 50%;
  width: 52px; height: 52px;                 /* comfortably above the 44px tap target */
  font-size: 30px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lightbox button:hover { background: rgba(255, 255, 255, .26); }

.lb-close { top: 16px; right: 16px; font-size: 26px; }
.lb-prev  { left: 16px;  top: 50%; transform: translateY(-50%); }
.lb-next  { right: 16px; top: 50%; transform: translateY(-50%); }

@media (max-width: 720px) {
  .lightbox { padding: 8px; }
  .lb-stage img { max-height: 62vh; }
  .lb-stage { padding-bottom: 76px; }        /* room for the controls below */

  /* On a phone the arrows sit in the bottom corners: always on screen,
     within thumb reach, and never over the photo. */
  .lightbox .lb-prev, .lightbox .lb-next {
    top: auto; bottom: max(18px, env(safe-area-inset-bottom));
    transform: none;
    width: 56px; height: 56px; font-size: 28px;
    background: rgba(255, 255, 255, .18);
  }
  .lightbox .lb-prev { left: 18px; }
  .lightbox .lb-next { right: 18px; }
  .lightbox .lb-close {
    top: max(12px, env(safe-area-inset-top)); right: 12px;
    width: 44px; height: 44px; font-size: 24px;
  }
}

.lightbox.is-single .lb-prev,
.lightbox.is-single .lb-next { display: none; }

/* ==========================================================================
   Join page — reuses the homepage hero grid, with the meeting card sitting
   where the hero photo does.
   ========================================================================== */

/* Three children: the copy, the meeting card, the fact tiles. On desktop the
   card spans both rows on the right; on a phone it comes second, so the call
   to action is reached before the reading. */
.join-hero .wrap {
  grid-template-columns: 1.05fr 1fr;
  grid-template-areas:
    "copy  card"
    "facts card";
  align-items: start;
  row-gap: 10px;
}
.join-hero .hero-copy { grid-area: copy; gap: 18px; }
/* Centred across both hero rows, the way the home page floats its hero photo
   against the headline. Overrides `.meeting-card { align-self: start }`. */
.join-hero .meeting-card { grid-area: card; align-self: center; }
.join-hero .facts { grid-area: facts; margin: 0; }

/* On gold, the fact tiles keep the site's ink border and paper cells. */
.join-hero .fact { background: #fff6e3; }

.meeting-card {
  align-self: start;
  background: var(--blue); color: #fff;
  border: 3px solid var(--blue-dark);
  border-radius: 20px;
  padding: 28px;
  display: flex; flex-direction: column; gap: 14px;
}
/* Scoped two classes deep so they beat `.hero p`, which would otherwise
   paint this card's text in the hero's dark-on-gold colour. */
.meeting-card .mc-label {
  margin: 0; max-width: none;
  font-family: var(--display); font-size: 12.5px; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--gold);
}
.meeting-card .mc-when {
  margin: 0; max-width: none; color: #fff;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(30px, 3.6vw, 38px); line-height: 1.06;
  letter-spacing: -.01em;
}
.meeting-card .mc-what {
  margin: 0; max-width: none; font-weight: 400;
  font-size: 16px; line-height: 1.55; color: #cfdcee;
}
.meeting-card .mc-note {
  margin: 0; max-width: none; font-weight: 400;
  font-size: 15.5px; line-height: 1.5; color: #cfdcee;
  border-top: 1px solid rgba(255, 255, 255, .22); padding-top: 14px;
}
.meeting-card .mc-cta {
  background: var(--gold); color: var(--ink);
  text-align: center; margin-top: 2px;
}
.meeting-card .mc-cta:hover { background: var(--gold-deep); color: var(--ink); }
.meeting-card .mc-alt { margin: 0; max-width: none; font-weight: 400; text-align: center; font-size: 15px; color: #a8bcd8; }
.meeting-card .mc-alt a { color: #fff; }
.meeting-card .mc-alt a:hover { color: var(--gold); }

@media (max-width: 900px) {
  .join-hero .wrap {
    grid-template-columns: 1fr;
    grid-template-areas: "copy" "card" "facts";
  }
  .meeting-card { padding: 24px; }
}


/* --- FAQ accordion ------------------------------------------------------ */

.faq { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.faq-item {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq-item summary {
  list-style: none;                      /* hide the default triangle */
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(23, 40, 31, .1);
  padding: 18px 54px 18px 20px;          /* room for the +/- marker */
  position: relative;
  font-family: var(--display);
  font-size: 18px; font-weight: 600; line-height: 1.3;
}
.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {               /* our own marker, drawn as a cross */
  content: ""; position: absolute; right: 22px; top: 50%;
  width: 15px; height: 15px; margin-top: -7px;
  background:
    linear-gradient(var(--orange), var(--orange)) center/15px 2.5px no-repeat,
    linear-gradient(var(--orange), var(--orange)) center/2.5px 15px no-repeat;
  transition: transform .18s ease;
}
.faq-item[open] summary::after {         /* rotate to a minus */
  background: linear-gradient(var(--orange), var(--orange)) center/15px 2.5px no-repeat;
  transform: rotate(180deg);
}
.faq-item summary:hover { background: var(--mint); }

.faq-body { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.faq-body p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink-soft); }
.faq-body .faq-src { font-size: 14px; color: var(--ink-faint); }

@media (max-width: 620px) {
  .faq-item summary { font-size: 17px; padding: 16px 48px 16px 16px; }
  .faq-body { padding: 0 16px 16px; }
}

/* Photo tiles with the galleries switched off. The covers still show; the
   badge and the click are gone, so nothing hints at a gallery that is not
   there yet. Remove `is-static` from the section in index.html to restore. */
#recent.is-static .event-more { display: none; }
#recent.is-static .event-photo { pointer-events: none; cursor: default; }

/* Honeypot field on the inquiry form. Positioned off-screen rather than
   display:none, because some bots skip anything explicitly hidden.
   The same rule is ALSO inline on the element in join/index.html: a visitor
   holding a cached copy of this stylesheet would otherwise see the field. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* One-column hero, used by the thank-you page. Without this the hero grid
   would leave a wide empty column where the photo normally sits. */
.wrap-narrow { display: block !important; }
.wrap-narrow .hero-copy { max-width: 720px; }

/* Shown only when contact.php bounces the visitor back with ?error=... */
/* Two classes deep so it beats `.ask p`, which sets a pale colour. */
.ask .form-error {
  margin: 0; padding: 12px 16px; border-radius: 12px;
  background: #fff; color: #7a1d05; font-weight: 700;
}
