/* =========================================================================
   First Step Firearm Training — stylesheet
   Hand-written, dependency-free CSS: mobile-first, CSS variables, no
   build step required, so it runs on any standard PHP/Apache host.
   ========================================================================= */

:root {
  /* Brand palette: black / red / grey, matching the client logo */
  --color-ink:        #121212;   /* near-black: headings, dark sections */
  --color-ink-soft:   #1e1e1e;   /* cards on dark sections */
  --color-forest:     #1a1a1a;   /* footer background */
  --color-red:        #c8181a;   /* primary brand accent */
  --color-red-dark:   #9c1315;   /* hover / pressed state */
  --color-red-light:  #ff8d8a;   /* accent text on dark backgrounds (contrast-safe) */
  --color-cream:      #f2f2f2;   /* page background (light grey) */
  --color-paper:      #ffffff;   /* card background */
  --color-line:       #dcdcdc;   /* borders */
  --color-text:       #1a1a1a;   /* body text */
  --color-text-muted: #666666;   /* secondary text */
  --color-muted-on-dark: #c9c9c9; /* secondary text on dark backgrounds */
  --color-success:    #2f6d3a;
  --color-error:      #a3312a;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.14);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.22);

  --container-width: 1160px;
  --header-height: 76px;
}

/* ---- Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, picture, svg { display: block; max-width: 100%; }
img { height: auto; background: var(--color-line); }
img.img-fallback { object-fit: contain; padding: 1.5rem; opacity: .55; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; font-weight: 700; color: var(--color-ink); }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.25rem; }
p  { max-width: 62ch; }
button { font: inherit; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- Accessibility ------------------------------------------------------ */
.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;
}
.skip-link {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--color-ink); color: #fff; padding: .6rem 1rem;
  border-radius: var(--radius-sm); z-index: 200; transition: top .2s ease;
}
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--color-red); outline-offset: 2px; }

/* ---- Layout ------------------------------------------------------------ */
.container { width: 100%; max-width: var(--container-width); margin-inline: auto; padding-inline: 1.25rem; }
section { padding-block: clamp(3rem, 6vw, 5.5rem); }
.section-head { max-width: 48rem; margin-bottom: 2.5rem; }
.section-head .eyebrow { display: inline-block; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; color: var(--color-red-dark); margin-bottom: .5rem; }
.muted { color: var(--color-text-muted); }
.bg-ink { background: var(--color-ink); color: #f2f2f2; }
.bg-ink h2, .bg-ink h3 { color: #fff; }
.bg-ink .eyebrow { color: var(--color-red-light); }
.bg-ink .muted { color: var(--color-muted-on-dark); }
.bg-paper { background: var(--color-paper); }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.4rem; border-radius: var(--radius-sm); font-weight: 700;
  border: 2px solid transparent; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--color-red); color: #fff; }
.btn-primary:hover { background: var(--color-red-dark); }
.btn-outline { border-color: currentColor; }
.btn-light { background: #fff; color: var(--color-ink); }
.btn-light:hover { background: var(--color-cream); }
.btn-block { width: 100%; }
.btn-sm { padding: .5rem 1rem; font-size: .9rem; }

/* ---- Header / Nav -------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid var(--color-line);
  /* Note: intentionally no backdrop-filter here. On WebKit/Safari it turns
     this element into the containing block for any position:fixed
     descendant (like the mobile nav panel below), which breaks full-screen
     overlays nested inside it. */
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-height); gap: 1rem; }
.brand { display: flex; align-items: center; }
.brand-logo-horizontal { height: 38px; width: auto; background: transparent; }

@media (min-width: 480px) {
  .brand-logo-horizontal { height: 44px; }
}

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; background: none; border: none; cursor: pointer; z-index: 110;
}
.nav-toggle-bar { width: 24px; height: 2px; background: var(--color-ink); transition: transform .2s ease, opacity .2s ease; }

.primary-nav { display: flex; align-items: center; gap: 1.75rem; }
.primary-nav ul { display: flex; gap: 1.5rem; font-weight: 600; }
.primary-nav a { padding: .4rem 0; border-bottom: 2px solid transparent; }
.primary-nav a:hover, .primary-nav a.active { border-color: var(--color-red); }
.nav-cta { flex-shrink: 0; padding: .9rem 2rem !important; }

.header-social { display: flex; align-items: center; gap: .75rem; }
.header-social a { color: var(--color-text-muted); transition: color .15s ease; }
.header-social a:hover { color: var(--color-red); }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    position: fixed; inset: 0 0 0 30%; z-index: 105; background: var(--color-cream);
    flex-direction: column; align-items: stretch; justify-content: center;
    padding: 2rem; gap: 2rem; transform: translateX(100%);
    transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  .primary-nav.open { transform: translateX(0); }
  .primary-nav ul { flex-direction: column; gap: 1.25rem; font-size: 1.2rem; }
  .header-social { justify-content: center; }
  .header-social a svg { width: 24px; height: 24px; }
  .nav-cta { text-align: center; }
  body.nav-open { overflow: hidden; }
}

/* ---- Hero ---------------------------------------------------------------- */
.hero {
  position: relative; color: #fff; overflow: hidden;
  background: linear-gradient(180deg, rgba(10,10,10,.80), rgba(10,10,10,.90)), var(--color-ink);
  background-size: cover; background-position: center;
  padding-block: clamp(3.5rem, 9vw, 7rem);
}
.hero-inner { display: grid; gap: 2.5rem; align-items: center; }
.hero h1 { color: #fff; margin-bottom: 1rem; }
.hero .lede { font-size: 1.15rem; color: #dcdcdc; max-width: 46ch; margin-bottom: 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-bottom: 1.5rem; }
.hero-trust { display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: .9rem; color: #cfcfcf; }
.hero-trust li { display: flex; align-items: center; gap: .4rem; }
.hero-media { border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lg); }
.hero-media img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }

@media (min-width: 860px) {
  .hero-inner { grid-template-columns: 1.1fr .9fr; }
}

/* ---- Services strip -------------------------------------------------------- */
.services-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.service-card {
  background: var(--color-paper); border: 1px solid var(--color-line); border-radius: var(--radius-md);
  padding: 1.5rem; display: flex; flex-direction: column; gap: .6rem;
}
.service-card .icon-badge { width: 42px; height: 42px; border-radius: 50%; background: rgba(200,24,26,.10); display: flex; align-items: center; justify-content: center; color: var(--color-red-dark); }
.bg-ink .service-card { background: var(--color-ink-soft); border-color: rgba(255,255,255,.1); }
.bg-ink .service-card h3 { color: #fff; }
.bg-ink .service-card .icon-badge { background: rgba(200,24,26,.18); color: var(--color-red-light); }

/* ---- Course CTA cards (homepage) ------------------------------------------- */
.course-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.course-card {
  background: var(--color-paper); border-radius: var(--radius-lg); border: 1px solid var(--color-line);
  padding: 1.75rem; display: flex; flex-direction: column; gap: 1rem; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.course-card .icon-badge { width: 48px; height: 48px; border-radius: var(--radius-sm); background: var(--color-ink); color: var(--color-red); display: flex; align-items: center; justify-content: center; }
.course-card .price { font-weight: 700; color: var(--color-red-dark); font-size: 1.05rem; }
.course-card .cta-row { margin-top: auto; }

/* Small pill tags used to list firearm-type variants (homepage cards + course detail) */
.variants { display: flex; flex-wrap: wrap; gap: .4rem; }
.variants li { background: var(--color-cream); border: 1px solid var(--color-line); border-radius: 999px; padding: .2rem .7rem; font-size: .78rem; font-weight: 600; color: var(--color-text-muted); }

/* ---- Course detail (courses.php) ------------------------------------------- */
.course-detail {
  background: var(--color-cream); border-radius: var(--radius-lg); border: 1px solid var(--color-line);
  padding: clamp(1.5rem, 4vw, 2.5rem); margin-bottom: 2rem; scroll-margin-top: calc(var(--header-height) + 1rem);
}
.course-detail .variants li { background: var(--color-paper); }
.course-detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.course-detail-price { text-align: right; }
.course-detail-price .amount { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--color-red-dark); }
.includes-list { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-block: 1.25rem; }
.includes-list li { display: flex; gap: .55rem; align-items: flex-start; }
.includes-list svg { flex-shrink: 0; margin-top: .2rem; color: var(--color-success); }
.prereq-note { background: #fbeaea; border: 1px solid #f0c4c2; color: #7a1f1d; padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .92rem; }

/* ---- Photo gallery + lightbox ------------------------------------------------ */
.gallery-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.gallery-item {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1;
  border-radius: var(--radius-md); overflow: hidden; border: none; padding: 0;
  background: var(--color-ink-soft); cursor: zoom-in;
}
.gallery-item .gallery-thumb { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.gallery-item::after {
  content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0); transition: background .2s ease;
}
.gallery-item:hover .gallery-thumb { transform: scale(1.06); }
.gallery-item:hover::after { background: rgba(0,0,0,.18); }
.gallery-item:focus-visible { outline: 3px solid var(--color-red); outline-offset: 2px; }

.lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(8,8,8,.96);
  display: flex; align-items: center; justify-content: center; padding: 3.5rem 1.25rem;
}
.lightbox[hidden] { display: none; }
.lightbox-image { max-width: min(90vw, 1200px); max-height: 82vh; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.lightbox-close,
.lightbox-nav {
  position: absolute; border: none; border-radius: 50%; background: rgba(255,255,255,.1);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.lightbox-close:hover, .lightbox-nav:hover { background: rgba(255,255,255,.22); }
.lightbox-close { top: 1.25rem; right: 1.25rem; width: 44px; height: 44px; font-size: 1.6rem; line-height: 1; }
.lightbox-nav { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; font-size: 1.1rem; }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-counter { position: absolute; bottom: 1.25rem; left: 50%; transform: translateX(-50%); color: #cfcfcf; font-size: .85rem; }
body.lightbox-open { overflow: hidden; }

@media (max-width: 600px) {
  .lightbox { padding: 3rem .75rem; }
  .lightbox-nav { width: 40px; height: 40px; }
  .lightbox-prev { left: .4rem; }
  .lightbox-next { right: .4rem; }
}

/* ---- Process / terms ------------------------------------------------------- */
.step-list { counter-reset: step; display: grid; gap: 1.25rem; }
.step-list li { display: flex; gap: 1rem; align-items: flex-start; }
.step-list li::before {
  counter-increment: step; content: counter(step);
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: var(--color-red); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display);
}
.terms-list li { padding-left: 1.4rem; position: relative; margin-bottom: .6rem; }
.terms-list li::before { content: "—"; position: absolute; left: 0; color: var(--color-red-dark); }

/* ---- Testimonial / trust band ---------------------------------------------- */
.trust-band { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); text-align: center; }
.trust-band strong { display: block; font-family: var(--font-display); font-size: 2rem; color: var(--color-red); }

/* ---- CTA band --------------------------------------------------------------- */
.cta-band { background: var(--color-ink); color: #fff; padding-block: 3rem; }
.cta-band-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1.5rem; }
.cta-band h2 { color: #fff; margin-bottom: .4rem; }
.cta-band p { color: #cfcfcf; }
.cta-band-actions { display: flex; gap: .8rem; flex-wrap: wrap; }

/* ---- About page -------------------------------------------------------------- */
.about-grid { display: grid; gap: 2.5rem; align-items: center; }
.about-photo { border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.about-photo img { aspect-ratio: 3/4; object-fit: cover; width: 100%; }
.credential-list li { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .7rem; }
@media (min-width: 860px) { .about-grid { grid-template-columns: .8fr 1.2fr; } }

/* ---- Contact page -------------------------------------------------------------- */
.contact-grid { display: grid; gap: 2.5rem; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 1fr 1.2fr; } }
.contact-card { background: var(--color-paper); border: 1px solid var(--color-line); border-radius: var(--radius-lg); padding: 1.75rem; }
.contact-methods li { display: flex; gap: .7rem; align-items: center; padding-block: .6rem; border-bottom: 1px solid var(--color-line); }
.contact-methods li:last-child { border-bottom: none; }

.form-field { margin-bottom: 1.1rem; }
.form-field label { display: block; font-weight: 700; margin-bottom: .35rem; font-size: .92rem; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: .75rem .9rem; border: 1.5px solid var(--color-line); border-radius: var(--radius-sm);
  font: inherit; background: #fff; color: var(--color-text);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--color-red); }
.form-field textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; gap: 1rem; }
@media (min-width: 560px) { .form-row.two-col { grid-template-columns: 1fr 1fr; } }
.form-hint { font-size: .82rem; color: var(--color-text-muted); margin-top: .3rem; }
.honeypot-field { position: absolute; left: -9999px; top: -9999px; }

.alert { padding: 1rem 1.2rem; border-radius: var(--radius-sm); margin-bottom: 1.5rem; font-weight: 600; }
.alert-success { background: #e7f3e8; color: var(--color-success); border: 1px solid #b9dcc0; }
.alert-error { background: #f8e7e5; color: var(--color-error); border: 1px solid #eab8b3; }

/* ---- Footer ------------------------------------------------------------------- */
.site-footer { background: var(--color-forest); color: #d4d4d4; padding-top: 3.5rem; }
.footer-grid { display: grid; gap: 2.5rem; padding-bottom: 2.5rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.footer-grid h3 { color: #fff; font-size: 1rem; margin-bottom: .8rem; }
.footer-grid a:hover { color: var(--color-red-light); }
.footer-nav ul li, .footer-contact ul li { margin-bottom: .55rem; }
.social-links { display: flex; gap: .8rem; margin-top: 1rem; }
.social-links a { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; }
.footer-bottom { padding-block: 1.25rem; font-size: .85rem; color: #a0a0a0; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.3fr 1fr 1fr; } }

/* ---- Utility spacing --------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.text-center { text-align: center; margin-inline: auto; }
