:root {
  --brand: #3f6fd1;
  --brand-dark: #2c56ad;
  --brand-soft: #eaf1ff;
  --ink: #0f1f3d;
  --ink-soft: #5b6b85;
  --paper: #ffffff;
  --paper-alt: #f6f8fb;
  --line: #e4e9f2;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Inter", Helvetica, Arial, sans-serif;
  scroll-behavior: smooth;
}

body.modal-open {
  overflow: hidden;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

#logo-mark {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-word {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
}

.site-nav a:hover {
  color: var(--brand-dark);
}

.nav-cta {
  background: var(--brand);
  color: #fff !important;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 700 !important;
}

.nav-cta:hover {
  background: var(--brand-dark);
}

.cart-trigger {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}

.cart-trigger:hover, .primary-button:hover {
  background: var(--brand-dark);
}

#cart-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.4em;
  height: 1.4em;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  font-size: .75em;
}

/* ---------- Hero ---------- */

.hero {
  background: linear-gradient(180deg, var(--brand-soft) 0%, var(--paper) 100%);
  height: 340px;
  padding: 30px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
}

.hero-inner {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .76rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin: 0 0 18px;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 5.4rem);
  line-height: 1.08;
  letter-spacing: -.035em;
  margin: 0;
  font-weight: 800;
}

.hero-wheel {
  display: inline-block;
  color: var(--brand-dark);
  transition: transform .22s ease, opacity .22s ease;
}

.hero-category {
  display: block;
  max-width: 100%;
  white-space: normal;
  line-height: 1.04;
  text-align: center;
}

.hero-category .hero-wheel {
  display: inline;
  max-width: 100%;
  white-space: normal;
  font-size: clamp(1.55rem, 5.7vw, 5.4rem);
  letter-spacing: -.04em;
}

.hero-period {
  color: var(--ink);
  white-space: nowrap;
}

.hero-wheel.is-spinning {
  opacity: 0;
  transform: translateY(-.35em) rotateX(80deg);
}

.hero-copy {
  max-width: 600px;
  margin: 24px auto 28px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.hero-cta {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 13px 26px;
  border-radius: 999px;
  box-shadow: 0 14px 28px -10px rgba(63, 111, 209, .5);
}

.hero-cta:hover {
  background: var(--brand-dark);
}

/* ---------- Filter bar ---------- */

.filter-bar {
  position: sticky;
  top: 61px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  transition: transform .24s ease;
}

.filter-bar.is-hidden {
  transform: translateY(-110%);
}

.filter-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
}

.filter-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-right: 4px;
}

.filter-select {
  appearance: none;
  background: var(--paper-alt) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6"><path d="M0 0 L5 6 L10 0 Z" fill="%235b6b85"/></svg>') no-repeat right 14px center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 34px 9px 16px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.filter-select:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.filter-clear {
  border: none;
  background: none;
  color: var(--brand-dark);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 4px;
}

.filter-clear:hover {
  text-decoration: underline;
}

#result-count {
  margin-left: auto;
  font-size: .82rem;
  color: var(--ink-soft);
}

/* ---------- Catalog grid ---------- */

.catalog {
  padding: 40px 0 100px;
  background: var(--paper);
}

.catalog-header {
  padding: 30px 0 22px;
}

.catalog-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.product-card {
  display: flex;
  flex-direction: row-reverse;
  gap: 14px;
  align-items: flex-start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  transition: transform .2s ease, box-shadow .2s ease;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px -18px rgba(15, 31, 61, 0.3);
}

.card-thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-thumb canvas {
  width: 58px;
  height: 58px;
  display: block;
}

.card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.card-tag {
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--brand-dark);
  background: var(--brand-soft);
  padding: 3px 8px;
  border-radius: 999px;
}

.card-title {
  font-size: 1rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.25;
}

.card-desc {
  font-size: .82rem;
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sentinel {
  height: 1px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
  font-size: .95rem;
}

/* ---------- Commerce overlays ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 31, 61, .58);
  backdrop-filter: blur(6px);
}

.modal-backdrop[hidden] {
  display: none;
}

.product-modal, .checkout-modal {
  position: relative;
  width: min(100%, 760px);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  background: #fff;
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(15, 31, 61, .28);
}

.product-modal {
  overflow: hidden;
  max-height: calc(100vh - 28px);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-soft);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.modal-layout {
  display: grid;
  gap: 24px;
}

.modal-image {
  min-height: 190px;
  display: grid;
  place-items: center;
  background: var(--paper-alt);
  border-radius: 16px;
}

.modal-image canvas {
  width: 190px;
  height: 190px;
}

.modal-content h2, .checkout-modal h2 {
  max-width: calc(100% - 32px);
  margin: 4px 0 8px;
  font-size: clamp(1.55rem, 4vw, 2.25rem);
  line-height: 1.08;
}

.modal-kicker {
  margin: 0;
  color: var(--brand-dark);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.modal-price {
  margin: 0 0 18px;
  color: var(--brand-dark);
  font-size: 1.35rem;
  font-weight: 800;
}

.product-details {
  display: grid;
  gap: 13px;
  margin: 0 0 22px;
}

.product-details div {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.product-details dt {
  display: none;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.product-details dd {
  margin: 0;
  font-size: .9rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.primary-button {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.cart-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 70;
  display: flex;
  width: min(100%, 430px);
  flex-direction: column;
  padding: 22px;
  background: #fff;
  box-shadow: -18px 0 50px rgba(15, 31, 61, .16);
  transform: translateX(105%);
  transition: transform .25s ease;
}

.cart-drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.cart-items {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 18px 0;
}

.cart-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.cart-row strong {
  font-size: .88rem;
}

.cart-row span {
  color: var(--ink-soft);
  font-size: .8rem;
}

.cart-row button {
  grid-column: 2;
  border: 0;
  background: none;
  color: var(--brand-dark);
  cursor: pointer;
  font-size: .76rem;
}

.cart-empty {
  padding: 30px 0;
  color: var(--ink-soft);
  text-align: center;
}

.cart-summary, .checkout-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 16px 0;
  font-size: .95rem;
}

.cart-summary strong, .checkout-total strong {
  font-size: 1.25rem;
}

.checkout-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  margin: 20px 0 14px;
}

.checkout-fields label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: .76rem;
  font-weight: 700;
}

.checkout-fields input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--ink);
  font: inherit;
}

.full-field {
  grid-column: 1 / -1;
}

.checkout-note {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: .75rem;
  line-height: 1.45;
}

.status-screen {
  min-height: 390px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
}

.status-screen h2 {
  margin: 0;
}

.status-screen p {
  margin: 0;
  color: var(--ink-soft);
}

.address-ghosts {
  display: grid;
  width: min(100%, 340px);
  gap: 9px;
}

.address-ghosts span {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(90deg, #fff, var(--paper-alt), #fff);
}

.status-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid var(--brand-soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.medicaid-mark {
  color: #1477b9;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -.04em;
}

.success-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(15, 31, 61, .56);
  pointer-events: none;
}

.success-screen[hidden] {
  display: none;
}

.success-message {
  position: relative;
  z-index: 2;
  padding: 34px 42px;
  border-radius: 22px;
  background: #fff;
  color: var(--brand-dark);
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  font-weight: 900;
  text-align: center;
  box-shadow: 0 24px 60px rgba(15, 31, 61, .28);
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti i {
  position: absolute;
  top: -10%;
  width: 9px;
  height: 18px;
  background: var(--brand);
  animation: fall 2.2s linear infinite;
}

.confetti i:nth-child(3n) { background: #ef7a65; }
.confetti i:nth-child(3n + 1) { background: #e7bc4d; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fall { to { transform: translateY(120vh) rotate(720deg); } }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ink);
  color: #b9c6de;
  padding: 40px 0 26px;
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: #fff;
}

.footer-nav {
  display: flex;
  gap: 22px;
}

.footer-nav a {
  color: #b9c6de;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 600;
}

.footer-nav a:hover {
  color: #fff;
}

.footer-disclaimer, .footer-copy {
  font-size: .78rem;
  line-height: 1.6;
  color: #8fa0c2;
  margin: 18px 0 0;
}

@media (max-width: 640px) {
  .header-inner, .filter-inner {
    padding: 12px 18px;
  }
  .site-nav a:not(.nav-cta) {
    display: none;
  }
  .site-nav {
    gap: 8px;
  }
  .nav-cta {
    padding: 9px 16px;
    font-size: .82rem !important;
  }
  .brand-word {
    font-size: 1.1rem;
  }
  .filter-bar {
    top: 57px;
  }
  .filter-inner {
    flex-wrap: wrap;
  }
  .filter-select {
    flex: 1 1 140px;
  }
  .product-grid {
    grid-template-columns: 1fr;
  }
  #result-count {
    width: 100%;
    margin-left: 0;
  }
  .product-modal, .checkout-modal {
    padding: 20px;
    border-radius: 18px;
  }
  .product-modal {
    padding: 16px;
  }
  .modal-layout {
    gap: 16px;
  }
  .modal-image {
    min-height: 112px;
  }
  .modal-image canvas {
    width: 112px;
    height: 112px;
  }
  .product-details {
    gap: 8px;
    margin-bottom: 14px;
  }
  .product-details div {
    padding-top: 7px;
  }
  .product-details dd {
    font-size: .82rem;
    line-height: 1.3;
  }
}
