/* ==========================================================================
   Terms and Conditions (page-terms-and-conditions.php)
   Loaded only on that page.
   ========================================================================== */
.terms-page {
  --t-navy: #0f143a;
  --t-navy-2: #1b2160;
  --t-yellow: #f3c91a;
  --t-red: #8f1c2c;
  --t-maroon: #8f1c2c;
  --t-sky: #9ccaf5;
  --t-ink: #2a2f4a;
  --t-line: #e3e6f0;
  --t-offset: calc(var(--header-h, 96px) + 1.5rem);
  background: #f4f6fb;
}
html:has(.terms-page) { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html:has(.terms-page) { scroll-behavior: auto; } }

/* ---------- Hero ---------- */
.terms-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 55% 90% at 92% 0%, rgba(143, 28, 44, 0.22), transparent 60%),
    radial-gradient(ellipse 40% 70% at 0% 100%, rgba(156, 202, 245, 0.16), transparent 60%),
    linear-gradient(135deg, #0f143a 0%, #161c52 60%, #0f143a 100%);
  color: #fff;
  padding: clamp(2.5rem, 5vw, 3.75rem) 0 clamp(4.5rem, 7vw, 5.5rem);
}
.terms-hero::after { /* fine diagonal texture */
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 14px);
  pointer-events: none;
}
.terms-hero__inner { position: relative; z-index: 1; }
.terms-hero__eyebrow {
  display: inline-flex; align-items: center; gap: 0.55rem;
  margin: 0 0 0.9rem;
  padding: 0.38rem 0.85rem;
  border: 1px solid rgba(243, 201, 26, 0.35);
  border-radius: 999px;
  background: rgba(243, 201, 26, 0.08);
  font-family: var(--font-display);
  font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--t-yellow);
}
.terms-hero__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--t-yellow); box-shadow: 0 0 0 4px rgba(243,201,26,0.18); }
.terms-hero__title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.75rem, 1rem + 3.4vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #fff;
  white-space: nowrap;
}
.terms-hero__title::after {
  content: "";
  display: block;
  width: 64px; height: 4px; margin-top: 1rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--t-yellow) 0 60%, var(--t-red) 60% 100%);
}
.terms-hero__lede {
  margin: 1rem 0 0;
  max-width: 56ch;
  font-size: clamp(0.98rem, 0.9rem + 0.3vw, 1.1rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
}
.terms-hero__meta {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  margin: 1.5rem 0 0; padding: 0; list-style: none;
}
.terms-hero__meta li {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.86rem; font-weight: 600; color: #fff;
}
.terms-hero__k {
  margin-right: 0.35rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--t-sky);
}

/* ---------- Layout ---------- */
.terms-body { padding: 0 0 clamp(3rem, 6vw, 5rem); }
.terms-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.75rem);
  align-items: start;
  margin-top: -3rem; /* card overlaps the hero */
  position: relative; z-index: 2;
}

/* ---------- TOC ---------- */
.terms-aside {
  position: sticky;
  top: var(--t-offset);
  display: grid; gap: 1rem;
  max-height: calc(100vh - var(--t-offset) - 1rem);
  overflow: auto;
  scrollbar-width: thin;
}
.terms-toc {
  background: #fff;
  border: 1px solid var(--t-line);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(15, 20, 58, 0.08);
  overflow: hidden;
}
.terms-toc__summary {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 1rem 1.15rem 0.85rem;
  list-style: none;
  cursor: default;
  border-bottom: 1px solid var(--t-line);
  background: linear-gradient(180deg, #fff, #fafbfe);
}
.terms-toc__summary::-webkit-details-marker { display: none; }
.terms-toc__label {
  font-family: var(--font-display);
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--t-navy);
}
.terms-toc__count {
  min-width: 1.6rem; padding: 0.1rem 0.45rem;
  border-radius: 999px; background: var(--t-yellow);
  font-size: 0.72rem; font-weight: 800; color: var(--t-navy); text-align: center;
}
.terms-toc__chev { display: none; margin-left: auto; width: 10px; height: 10px; border-right: 2px solid var(--t-navy); border-bottom: 2px solid var(--t-navy); transform: rotate(45deg); transition: transform .2s ease; }
.terms-toc__list { list-style: none; margin: 0; padding: 0.5rem; counter-reset: none; }
.terms-toc__list li { margin: 0; }
.terms-toc__list a {
  position: relative;
  display: flex; align-items: baseline; gap: 0.65rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.83rem; font-weight: 600; line-height: 1.3;
  color: #4a4f6a;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.terms-toc__text { text-transform: uppercase; letter-spacing: 0.02em; font-size: 0.76rem; }
.terms-toc__num {
  flex: none;
  font-family: var(--font-display);
  font-size: 0.72rem; font-weight: 800;
  color: #a2a7bf;
  font-variant-numeric: tabular-nums;
}
.terms-toc__list a:hover { background: #f2f4fa; color: var(--t-navy); }
.terms-toc__list a.is-active {
  background: var(--t-navy);
  color: #fff;
}
.terms-toc__list a.is-active .terms-toc__num { color: var(--t-yellow); }
.terms-toc__list a.is-active { box-shadow: inset 3px 0 0 var(--t-red); }

.terms-help {
  padding: 1.1rem 1.15rem;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--t-navy) 0%, #1b2160 100%);
  color: #fff;
  box-shadow: 0 14px 40px rgba(15, 20, 58, 0.12);
}
.terms-help__title { margin: 0 0 0.35rem; font-family: var(--font-head); font-weight: 600; font-size: 0.95rem; color: #fff; }
.terms-help__mail { display: inline-block; font-weight: 600; font-size: 0.9rem; color: var(--t-yellow); text-decoration: none; border-bottom: 1px solid rgba(243,201,26,0.4); word-break: break-all; }
.terms-help__mail:hover { border-bottom-color: var(--t-yellow); }
.terms-help__print {
  display: block; width: 100%;
  margin-top: 0.9rem; padding: 0.6rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font: 600 0.82rem/1 var(--font-sans); color: #fff;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.terms-help__print:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.4); }

/* ---------- Content card ---------- */
.terms-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--t-line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 20, 58, 0.10);
  padding: clamp(1.5rem, 4vw, 3.25rem) clamp(1.25rem, 4.5vw, 3.75rem);
  color: var(--t-ink);
  font-size: 1.02rem;
  line-height: 1.75;
}
.terms-card > * { max-width: 72ch; }
.terms-card p { margin: 0 0 1.05em; }
.terms-card a { color: var(--t-maroon); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.terms-card a:hover { color: var(--t-red); }
.terms-card strong { color: var(--t-navy); }

.terms-intro {
  margin-bottom: 2.25rem;
  padding: 1.1rem 1.3rem;
  border-radius: 12px;
  background: #f4f7fd;
  border: 1px solid #dfe8f6;
  border-left: 4px solid var(--t-sky);
  font-size: 0.95rem; line-height: 1.65;
  color: var(--t-navy);
}
.terms-intro p { margin: 0; }
.terms-intro p + p { margin-top: 0.5em; }

.terms-sec {
  scroll-margin-top: var(--t-offset);
  padding: 2rem 0 0.75rem;
  border-top: 1px solid var(--t-line);
}
.terms-intro + .terms-sec, .terms-card > .terms-sec:first-child { border-top: 0; padding-top: 0; }
.terms-sec__h {
  display: flex; align-items: center; gap: 0.85rem;
  margin: 0 0 1rem;
  font-family: var(--font-head);
  font-size: clamp(1.02rem, 0.95rem + 0.35vw, 1.22rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.04em;
  color: var(--t-navy);
}
.terms-sec__num {
  flex: none;
  display: inline-grid; place-items: center;
  width: 2.35rem; height: 2.35rem;
  border-radius: 10px;
  background: var(--t-navy);
  color: var(--t-yellow);
  font-size: 0.85rem; font-weight: 800; letter-spacing: 0;
  box-shadow: inset 0 -3px 0 var(--t-yellow);
  font-variant-numeric: tabular-nums;
}
.terms-sec__body h3 {
  scroll-margin-top: var(--t-offset);
  margin: 1.5rem 0 0.6rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--t-yellow);
  font-family: var(--font-head);
  font-size: 1rem; font-weight: 600;
  color: var(--t-navy);
}

/* Lists */
.terms-sec__body ul, .terms-sec__body ol { margin: 0.25rem 0 1.25rem; padding: 0; list-style: none; }
.terms-sec__body ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.5rem 0.75rem;
}
.terms-sec__body ul li {
  position: relative;
  display: flex; align-items: center; gap: 0.6rem;
  margin: 0;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  background: #f6f7fb;
  border: 1px solid var(--t-line);
  font-size: 0.93rem; line-height: 1.4;
}
.terms-sec__body ul li::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  border-radius: 2px; transform: rotate(45deg);
  background: var(--t-red);
}
.terms-sec__body ol { counter-reset: tli; }
.terms-sec__body ol li { counter-increment: tli; position: relative; padding-left: 2rem; margin-bottom: 0.5rem; }
.terms-sec__body ol li::before { content: counter(tli); position: absolute; left: 0; top: 0.1em; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--t-navy); color: var(--t-yellow); font: 800 0.72rem/1.4rem var(--font-display); text-align: center; }

/* Callouts */
.terms-sec__body blockquote,
.terms-sec--notice .terms-sec__body {
  margin: 0 0 1.25rem;
  padding: 1.1rem 1.3rem;
  border-radius: 12px;
  background: #fffbea;
  border: 1px solid #f6e39a;
  border-left: 4px solid var(--t-yellow);
  color: #3a3410;
}
.terms-sec--notice .terms-sec__body p { margin: 0; font-size: 0.9rem; line-height: 1.7; letter-spacing: 0.01em; }
.terms-sec--notice .terms-sec__num { background: var(--t-red); color: #fff; box-shadow: inset 0 -3px 0 var(--t-maroon); }
.terms-sec__body blockquote p:last-child { margin-bottom: 0; }

.terms-updated {
  margin-top: 1.75rem !important;
  padding-top: 1rem;
  border-top: 1px dashed var(--t-line);
  font-size: 0.85rem;
  font-style: italic;
  color: #6b7090;
}

.terms-card__foot {
  display: flex; justify-content: flex-end;
  margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--t-line);
  max-width: none;
}
.terms-top {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: var(--t-navy);
  color: #fff !important;
  font: 700 0.82rem/1 var(--font-display);
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}
.terms-top span { color: var(--t-yellow); }
.terms-top:hover { background: #f3c91a; color: #0f143a !important; transform: translateY(-1px); } /* 1.8.422: was red */
.terms-top:hover span { color: #0f143a; }

.terms-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 900;
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--t-navy); color: var(--t-yellow);
  font-size: 1.15rem; font-weight: 800; text-decoration: none;
  box-shadow: 0 10px 26px rgba(15, 20, 58, 0.3);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s, background .15s ease;
}
.terms-fab.is-visible { opacity: 1; visibility: visible; transform: none; }
.terms-fab:hover { background: #f3c91a; color: #0f143a; } /* 1.8.422: was red */

/* ---------- Mobile / tablet ---------- */
@media (max-width: 960px) {
  .terms-layout { grid-template-columns: minmax(0, 1fr); margin-top: -2.25rem; gap: 1rem; }
  .terms-aside { position: sticky; top: calc(var(--header-h, 72px) + 0.5rem); z-index: 5; max-height: none; overflow: visible; }
  .terms-help { display: none; }
  .terms-toc__summary { cursor: pointer; border-bottom: 0; padding: 0.9rem 1.1rem; }
  .terms-toc[open] .terms-toc__summary { border-bottom: 1px solid var(--t-line); }
  .terms-toc__chev { display: block; }
  .terms-toc[open] .terms-toc__chev { transform: rotate(-135deg); }
  .terms-toc__nav { max-height: 55vh; overflow: auto; }
  .terms-toc__list a.is-active::before { display: none; }
}
@media (max-width: 600px) {
  .terms-hero__title { white-space: normal; }
  .terms-hero__meta li { font-size: 0.8rem; padding: 0.4rem 0.7rem; }
  .terms-card { border-radius: 14px; font-size: 0.98rem; }
  .terms-sec__h { gap: 0.65rem; }
  .terms-sec__num { width: 2rem; height: 2rem; font-size: 0.78rem; }
  .terms-sec__body ul { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .terms-sec__body ul { grid-template-columns: 1fr; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .site-announce, .terms-aside, .terms-fab, .terms-card__foot, .breadcrumbs, nav[aria-label="Breadcrumb"] { display: none !important; }
  .terms-page, .terms-hero { background: #fff !important; color: #000 !important; }
  .terms-hero { padding: 0 0 1rem; }
  .terms-hero__title, .terms-hero__lede, .terms-hero__meta li { color: #000 !important; }
  .terms-layout { display: block; margin: 0; }
  .terms-card { box-shadow: none; border: 0; padding: 0; }
  .terms-sec { break-inside: avoid-page; }
}

/* ---------- 1.8.395 — Policy pages (Firearm Safety, Privacy, Shipping & Returns) share this layout ---------- */
.policy-page .terms-hero__eyebrow a { color: inherit; text-decoration: none; }
.policy-page .terms-hero__eyebrow a:hover, .policy-page .terms-hero__eyebrow a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.terms-help__all {
  display: block; margin-top: 0.6rem; text-align: center;
  font: 600 0.8rem/1.2 var(--font-sans); color: rgba(255, 255, 255, 0.78); text-decoration: none;
}
.terms-help__all:hover, .terms-help__all:focus-visible { color: var(--t-yellow); }
.policy-page .terms-sec__body img { max-width: 100%; height: auto; border-radius: 10px; }
.policy-page .terms-sec__body table { width: 100%; border-collapse: collapse; }
@media (max-width: 600px) {
  .policy-page .terms-hero__title { white-space: nowrap; font-size: clamp(1.45rem, 7.4vw, 2.2rem); }
}
/* Policy content has mixed inline markup inside list items — keep each item one text block (no flex columns). */
.policy-page .terms-sec__body ul { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.policy-page .terms-sec__body ul:has(> li > strong), .policy-page .terms-sec__body ul:has(> li > b) { grid-template-columns: minmax(0, 1fr); }
.policy-page .terms-sec__body ul li { display: block; padding: 0.6rem 0.85rem 0.6rem 1.7rem; }
.policy-page .terms-sec__body ul li::before { position: absolute; left: 0.75rem; top: 1.05em; }
