/* =====================================================================
   Cardsbazzar — Base: tokens, typography, layout, buttons, header, footer
   ===================================================================== */
:root {
  /* Brand (from the Cardsbazzar logo) */
  --primary: #5a1016;
  --primary-hover: #6f161d;
  --primary-dark: #3d0a0e;
  --primary-soft: #f2e5e2;
  --primary-rgb: 90, 16, 22;
  /* Accent: brass, used sparingly on dark surfaces */
  --accent: #c49a5a;
  /* Surfaces */
  --background: #f7f4ef;
  --background-alt: #efe9e0;
  --surface: #ffffff;
  --surface-dark: #17110f;
  --surface-dark-2: #221a17;
  /* Text */
  --text-primary: #1a1412;
  --text-secondary: #5c524d;
  --text-tertiary: #766b65;
  --text-inverse: #f7f4ef;
  --text-inverse-2: rgba(247, 244, 239, 0.7);
  /* Lines */
  --border: #e2d9cf;
  --border-strong: #cbbfb2;
  --border-dark: rgba(247, 244, 239, 0.12);
  /* Status */
  --success: #1e6b47;
  --success-soft: #e3f1e9;
  --danger: #a4231b;
  --danger-soft: #f8e5e3;
  /* Type */
  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Shape */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  /* Depth, used deliberately */
  --shadow-panel: 0 30px 60px -30px rgba(23, 17, 15, 0.28), 0 0 0 1px var(--border);
  --shadow-lift: 0 18px 40px -24px rgba(23, 17, 15, 0.35);
  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.2s;
  --dur: 0.45s;
  --dur-slow: 0.8s;
  /* Layout */
  --header-h: 72px;
  --gutter: clamp(20px, 4vw, 40px);
  /* Bootstrap bridges */
  --bs-body-bg: var(--background);
  --bs-body-color: var(--text-primary);
  --bs-border-color: var(--border);
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: var(--primary-rgb);
  --bs-link-hover-color: var(--primary-hover);
  --bs-focus-ring-color: rgba(var(--primary-rgb), 0.25);
}

/* Base */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; transition: color var(--dur-fast) ease; }
a:hover { color: var(--primary-hover); }
::selection { background: var(--primary); color: var(--text-inverse); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }
.on-dark :focus-visible { outline-color: var(--accent); }
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 2000;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--surface-dark); color: var(--text-inverse); font-weight: 600;
  transition: top var(--dur-fast) ease;
}
.skip-link:focus { top: 12px; color: var(--text-inverse); }

/* Typography */
h1, h2, h3, h4 { color: inherit; margin-top: 0; }
h1, .h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.6rem, 1.55rem + 3.9vw, 4.6rem);
  line-height: 1.02; letter-spacing: -0.02em;
}
h2, .h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2rem, 1.35rem + 2.2vw, 3.1rem);
  line-height: 1.06; letter-spacing: -0.015em;
}
h3, .h3 {
  font-family: var(--font-sans); font-weight: 600;
  font-size: clamp(1.125rem, 1.02rem + 0.35vw, 1.3rem);
  line-height: 1.3; letter-spacing: -0.01em;
}
h4 { font-family: var(--font-sans); font-weight: 600; font-size: 1rem; line-height: 1.4; }
h1 em, h2 em { font-style: italic; color: var(--primary); }
.on-dark h1 em, .on-dark h2 em { color: var(--accent); }
.lead { font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem); line-height: 1.6; color: var(--text-secondary); font-weight: 400; }
.label {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary);
}
.label--rule::before { content: ""; width: 28px; height: 1px; background: currentColor; opacity: 0.6; }
.label--brand { color: var(--primary); }
.on-dark .label { color: var(--text-inverse-2); }
.on-dark .label--brand { color: var(--accent); }
.num { font-family: var(--font-mono); font-weight: 500; font-size: 0.8125rem; letter-spacing: 0.04em; color: var(--text-tertiary); }

/* Layout */
.container { max-width: 1240px; padding-left: var(--gutter); padding-right: var(--gutter); }
.section { padding: 120px 0; position: relative; scroll-margin-top: var(--header-h); }
.section--sm { padding: 80px 0; }
.section--alt { background: var(--background-alt); }
.section--ink { background: var(--surface-dark); color: var(--text-inverse); }
.section--ink p, .section--ink .lead { color: var(--text-inverse-2); }
.section--ink h2, .section--ink h3 { color: var(--text-inverse); }
.section-head { margin-bottom: 56px; }
.section-head .label { margin-bottom: 18px; }
.section-head h2 { margin-bottom: 16px; max-width: 18ch; }
.section-head p { max-width: 54ch; margin: 0; }
.section-head--split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px 64px; align-items: end; }
.section-head--split h2 { margin-bottom: 0; }
@media (max-width: 991.98px) {
  .section { padding: 88px 0; }
  .section--sm { padding: 64px 0; }
  .section-head { margin-bottom: 40px; }
  .section-head--split { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
  .section { padding: 64px 0; }
  .section--sm { padding: 48px 0; }
}

/* Buttons */
.btn-cb {
  --btn-bg: var(--primary); --btn-fg: var(--text-inverse); --btn-bd: var(--primary);
  --btn-bg-h: var(--primary-hover); --btn-fg-h: var(--text-inverse); --btn-bd-h: var(--primary-hover);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: var(--radius-sm);
  border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
  font-family: var(--font-sans); font-size: 0.9375rem; font-weight: 600; line-height: 1;
  white-space: nowrap; cursor: pointer; overflow: hidden;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) var(--ease);
}
.btn-cb:hover { background: var(--btn-bg-h); border-color: var(--btn-bd-h); color: var(--btn-fg-h); }
.btn-cb:active { transform: translateY(1px); }
.btn-cb .arrow { display: inline-block; width: 16px; height: 16px; position: relative; overflow: hidden; flex: 0 0 16px; }
.btn-cb .arrow::before, .btn-cb .arrow::after {
  content: "\f138"; font-family: "bootstrap-icons"; position: absolute; inset: 0;
  line-height: 16px; font-size: 15px; transition: transform 0.35s var(--ease-out);
}
.btn-cb .arrow::after { transform: translateX(-120%); }
.btn-cb:hover .arrow::before { transform: translateX(120%); }
.btn-cb:hover .arrow::after { transform: translateX(0); }
.btn-cb .arrow--ext::before, .btn-cb .arrow--ext::after { content: "\f144"; }
.btn-cb .arrow--ext::after { transform: translate(-120%, 120%); }
.btn-cb:hover .arrow--ext::before { transform: translate(120%, -120%); }
.btn-cb:hover .arrow--ext::after { transform: translate(0, 0); }
.btn-cb--ghost { --btn-bg: transparent; --btn-fg: var(--text-primary); --btn-bd: var(--border-strong); --btn-bg-h: var(--surface); --btn-fg-h: var(--text-primary); --btn-bd-h: var(--text-primary); }
.btn-cb--light { --btn-bg: var(--text-inverse); --btn-fg: var(--primary); --btn-bd: var(--text-inverse); --btn-bg-h: #fff; --btn-fg-h: var(--primary-dark); --btn-bd-h: #fff; }
.btn-cb--ghost-light { --btn-bg: transparent; --btn-fg: var(--text-inverse); --btn-bd: rgba(247, 244, 239, 0.3); --btn-bg-h: rgba(247, 244, 239, 0.08); --btn-fg-h: var(--text-inverse); --btn-bd-h: rgba(247, 244, 239, 0.7); }
.btn-cb--sm { min-height: 40px; padding: 0 16px; font-size: 0.875rem; }
.btn-cb--lg { min-height: 54px; padding: 0 26px; font-size: 1rem; }
.btn-cb--block { width: 100%; }
.btn-cb.is-loading { opacity: 0.75; pointer-events: none; }
.btn-cb.is-loading .arrow { display: none; }
.btn-cb .spinner { display: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn-cb.is-loading .spinner { display: inline-block; }

.link-cb {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 0.9375rem; color: var(--text-primary);
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px; background-position: 0 100%; background-repeat: no-repeat;
  padding-bottom: 2px;
  transition: background-size 0.35s var(--ease-out), color var(--dur-fast) ease;
}
.link-cb:hover { background-size: 100% 1px; color: var(--primary); }
.link-cb .bi { transition: transform 0.35s var(--ease-out); }
.link-cb:hover .bi-arrow-right { transform: translateX(3px); }
.on-dark .link-cb { color: var(--text-inverse); }
.on-dark .link-cb:hover { color: var(--accent); }

.tag {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface);
  font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); white-space: nowrap;
}
.tag--brand { border-color: rgba(var(--primary-rgb), 0.2); background: var(--primary-soft); color: var(--primary); }
.tag--dark { border-color: var(--border-dark); background: transparent; color: var(--text-inverse-2); }

/* Header */
.scroll-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 12px; pointer-events: none; }
.site-header {
  position: sticky; top: 0; z-index: 1030; height: var(--header-h);
  background: rgba(247, 244, 239, 0); border-bottom: 1px solid transparent;
  transition: background-color var(--dur) ease, border-color var(--dur) ease;
}
/* No backdrop-filter here: it would become the containing block of the
   fixed mobile menu that lives inside the header. */
.site-header.is-scrolled { background: rgba(247, 244, 239, 0.97); border-bottom-color: var(--border); }
.site-header > .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; }
.brand img { height: 40px; width: auto; border-radius: 6px; display: block; }
.site-nav .nav-list { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav .nav-link-cb {
  position: relative; display: inline-flex; align-items: center; padding: 8px 14px;
  font-size: 0.9375rem; font-weight: 500; color: var(--text-secondary); transition: color var(--dur-fast) ease;
}
.site-nav .nav-link-cb::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform 0.35s var(--ease-out);
}
.site-nav .nav-link-cb:hover { color: var(--text-primary); }
.site-nav .nav-link-cb:hover::after { transform: scaleX(1); transform-origin: left; }
.site-nav .nav-link-cb[aria-current="page"] { color: var(--text-primary); }
.site-nav .nav-link-cb[aria-current="page"]::after { transform: scaleX(1); background: var(--primary); height: 2px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.menu-toggle {
  display: none; align-items: center; gap: 10px; height: 42px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-primary); font-size: 0.875rem; font-weight: 600;
}
.menu-toggle .bars { position: relative; width: 16px; height: 10px; }
.menu-toggle .bars::before, .menu-toggle .bars::after { content: ""; position: absolute; left: 0; width: 16px; height: 1.5px; background: currentColor; }
.menu-toggle .bars::before { top: 1px; }
.menu-toggle .bars::after { top: 8px; }
@media (min-width: 992px) {
  .site-nav { flex: 1 1 auto; display: flex; justify-content: center; }
  .site-nav .offcanvas-header, .site-nav .menu-extra { display: none !important; }
  .site-nav .offcanvas-body { padding: 0; overflow: visible; }
}
@media (max-width: 991.98px) {
  .menu-toggle { display: inline-flex; }
  .header-actions .btn-cb { display: none; }
  .site-nav.offcanvas-lg {
    --bs-offcanvas-height: 100dvh; --bs-offcanvas-bg: var(--background);
    --bs-offcanvas-transition: transform 0.5s var(--ease-out); border: 0 !important;
  }
  .site-nav .offcanvas-header { height: var(--header-h); padding: 0 var(--gutter); border-bottom: 1px solid var(--border); }
  .site-nav .offcanvas-body { display: flex; flex-direction: column; padding: 20px var(--gutter) 32px; }
  .site-nav .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav .nav-list li { border-bottom: 1px solid var(--border); overflow: hidden; }
  .site-nav .nav-link-cb {
    display: flex; justify-content: space-between; padding: 18px 0;
    font-family: var(--font-display); font-size: 2rem; line-height: 1.1; color: var(--text-primary);
    transform: translateY(100%); opacity: 0;
    transition: transform 0.6s var(--ease-out), opacity 0.4s ease, color var(--dur-fast) ease;
  }
  .site-nav .nav-link-cb::after { display: none; }
  .site-nav .nav-link-cb::before { content: "\f138"; font-family: "bootstrap-icons"; order: 2; font-size: 1.25rem; color: var(--text-tertiary); align-self: center; }
  .site-nav .nav-link-cb[aria-current="page"] { color: var(--primary); }
  .site-nav.show .nav-link-cb, .site-nav.showing .nav-link-cb { transform: translateY(0); opacity: 1; }
  .site-nav .nav-list li:nth-child(2) .nav-link-cb { transition-delay: 0.04s; }
  .site-nav .nav-list li:nth-child(3) .nav-link-cb { transition-delay: 0.08s; }
  .site-nav .nav-list li:nth-child(4) .nav-link-cb { transition-delay: 0.12s; }
  .site-nav .nav-list li:nth-child(5) .nav-link-cb { transition-delay: 0.16s; }
  .site-nav .menu-extra { margin-top: auto; padding-top: 32px; display: grid; gap: 16px; }
  .site-nav .menu-extra p { margin: 0; font-size: 0.875rem; color: var(--text-secondary); }
  .site-nav .menu-extra a:not(.btn-cb) { color: var(--text-primary); font-weight: 500; }
}
.offcanvas-header { justify-content: space-between; }
.offcanvas-backdrop { background-color: var(--surface-dark); }
.offcanvas-backdrop.show { opacity: 0.35; }

/* Disclosure strip */
.disclosure { border-top: 1px solid var(--border); background: var(--background-alt); padding: 28px 0; }
.disclosure .container { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px 32px; align-items: start; }
.disclosure p { margin: 0; font-size: 0.8125rem; line-height: 1.6; color: var(--text-secondary); max-width: 110ch; }
@media (max-width: 767.98px) { .disclosure .container { grid-template-columns: 1fr; } }

/* Footer */
.site-footer { background: var(--surface-dark); color: var(--text-inverse-2); font-size: 0.9375rem; }
.site-footer a { color: var(--text-inverse-2); }
.site-footer a:hover { color: var(--text-inverse); }
.footer-top { padding: 80px 0 56px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 48px 40px; }
.footer-brand img { height: 44px; width: auto; border-radius: 6px; display: block; margin-bottom: 22px; box-shadow: 0 0 0 1px var(--border-dark); }
.footer-brand p { max-width: 36ch; margin-bottom: 24px; }
.footer-brand .contact-lines { display: grid; gap: 8px; font-size: 0.875rem; }
.footer-brand .contact-lines a { display: inline-flex; align-items: center; gap: 10px; }
.footer-brand .contact-lines .bi { color: var(--accent); }
.footer-col h2 { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-inverse); margin-bottom: 20px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-col a { display: inline-block; transition: color var(--dur-fast) ease, transform var(--dur-fast) var(--ease); }
.footer-col a:hover { transform: translateX(2px); }
.footer-col .footer-cards { display: block; columns: 2; column-gap: 24px; }
.footer-col .footer-cards li { break-inside: avoid; margin-bottom: 10px; }
.footer-legal { border-top: 1px solid var(--border-dark); padding: 28px 0 36px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 40px; align-items: start; font-size: 0.8125rem; }
.footer-legal p { margin: 0; max-width: 90ch; line-height: 1.6; }
.footer-legal .copy { white-space: nowrap; color: var(--text-inverse); }
@media (max-width: 1199.98px) { .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) {
  .footer-top { grid-template-columns: 1fr; padding: 56px 0 40px; gap: 36px; }
  .footer-legal { grid-template-columns: 1fr; }
  .footer-legal .copy { white-space: normal; }
}

/* Breadcrumbs and generic page hero */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 28px; padding: 0; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em; color: var(--text-tertiary); }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--border-strong); }
.crumbs a { color: var(--text-secondary); }
.crumbs a:hover { color: var(--primary); }
.crumbs [aria-current] { color: var(--text-primary); }
.page-hero { padding: 48px 0 0; }
.page-hero__grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px 72px; align-items: end; }
.page-hero__grid h1 { margin: 0; max-width: 15ch; }
.page-hero__grid .lead { margin: 0; }
.page-hero--rule { padding-bottom: 64px; border-bottom: 1px solid var(--border); }
@media (max-width: 991.98px) {
  .page-hero { padding: 24px 0 0; }
  .page-hero--rule { padding-bottom: 48px; }
  .page-hero__grid { grid-template-columns: 1fr; }
}

/* Closing CTA */
.closing { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px 56px; align-items: end; padding: 64px 0; border-top: 1px solid var(--border); }
.closing h2 { margin: 12px 0 0; max-width: 18ch; }
.closing .actions { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 767.98px) {
  .closing { grid-template-columns: 1fr; }
  .closing .actions .btn-cb { flex: 1 1 auto; }
}

/* Motion */
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
.page { animation: pageIn 0.5s ease backwards; }
.is-leaving .page { opacity: 0; transition: opacity 0.18s ease; }
.reveal-ready [data-reveal] {
  opacity: 0; transform: translateY(22px);
  transition: opacity 0.8s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: var(--d, 0s);
}
.reveal-ready [data-reveal="fade"] { transform: none; }
.reveal-ready [data-reveal].is-in { opacity: 1; transform: none; }
.reveal-ready [data-reveal].no-anim { transition: none; }
.hero-in { animation: fadeUp 0.9s var(--ease-out) both; animation-delay: var(--d, 0s); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; }
  .reveal-ready [data-reveal] { opacity: 1; transform: none; }
}
