/* ============================================================
   CCR Cards - design tokens + shop components
   Brand constants are verbatim from the brand guide "Web
   Starter Kit". The token + base layer is kept in sync by
   hand with the website and label maker; when you change it,
   change it in all three repos together.
   ============================================================ */

:root {
  color-scheme: dark;

  --ccr-navy: #011135;
  --ccr-white: #FFFFFF;
  --ccr-lavender: #CAC9EF;
  --ccr-purple: #7371F4;
  --ccr-cyan: #41D3EA;
  --ccr-gradient: linear-gradient(180deg, #7371F4 0%, #41D3EA 100%);

  --text: var(--ccr-white);
  --text-muted: var(--ccr-lavender);
  --text-inverse: var(--ccr-navy);
  --link: var(--ccr-cyan);
  --surface: var(--ccr-navy);
  --panel: #0A1E4E;
  --chrome: #010B24;
  --rule: rgba(202, 201, 239, .22);

  --surface-raised: var(--panel);
  --surface-soft: var(--chrome);
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
  --overlay: rgba(1, 11, 36, .72);
  --focus-ring: 0 0 0 4px rgba(65, 211, 234, .28);
}

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

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }

[x-cloak] { display: none !important; }

h1, h2, h3 {
  margin: 0;
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
  line-height: 1.08;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }
h3 { font-size: 1rem; }

p { margin: 0; }

a { color: var(--link); }

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

button, input, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

:focus-visible {
  outline: 3px solid var(--ccr-cyan);
  outline-offset: 3px;
  box-shadow: var(--focus-ring);
}

.container {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 0 20px;
}
.min-zero { min-width: 0; }

.price, .numeric, .tabular, .cart-count, .price-row {
  font-variant-numeric: tabular-nums;
}

.text-muted {
  color: var(--text-muted);
}

/* ----- Header / nav ----- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--chrome);
  border-bottom: 1px solid var(--rule);
}

.header-shell {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 76px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  text-decoration: none;
}

.brand img { height: 48px; width: auto; }

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 12px;
  min-width: 0;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 99px;
  border: 1px solid var(--rule);
  object-fit: cover;
}

.username {
  max-width: 160px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: .9rem;
  font-weight: 500;
}

.global-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
  align-items: center;
}

.global-nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}

.global-nav a:hover {
  color: var(--link);
}

.global-nav a:hover,
.global-nav a.active {
  border-bottom-color: var(--ccr-cyan);
}

.site-nav-wrap {
  border-top: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: thin;
}

.site-nav {
  display: flex;
  gap: 26px;
  align-items: center;
  min-width: max-content;
}

.site-nav button {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 13px 0 11px;
  color: var(--text);
  font-weight: 500;
}

.site-nav button:hover {
  color: var(--link);
}

.site-nav button:hover,
.site-nav button.active {
  border-bottom-color: var(--ccr-cyan);
}

/* ----- Buttons ----- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  border: 2px solid transparent;
  padding: 10px 18px;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease, border-color .16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-primary {
  background: var(--ccr-white);
  color: var(--ccr-navy);
}

.btn-accent {
  background: var(--ccr-gradient);
  color: var(--ccr-white);
}

.btn-accent-outline {
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    var(--ccr-gradient) border-box;
  border-color: transparent;
  color: var(--ccr-cyan);
}

.btn-ghost {
  background: transparent;
  border-color: var(--ccr-white);
  color: var(--ccr-white);
}

.btn-sm {
  min-height: 34px;
  padding: 8px 12px;
  font-size: .86rem;
}

.btn-block { width: 100%; }

.btn-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--link);
}


.cart-button {
  position: relative;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--ccr-gradient);
  color: var(--ccr-white);
  font-size: .72rem;
  font-weight: 600;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 99px;
  border: 1px solid var(--rule);
  background: var(--chrome);
  color: var(--text);
  font-weight: 600;
}

.icon-button:hover { box-shadow: var(--shadow); }

/* ----- Hero ----- */

.hero {
  background: var(--ccr-gradient);
  color: var(--ccr-white);
  padding: 58px 0 64px;
}

.hero .container {
  display: grid;
  grid-template-columns: minmax(160px, .8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(24px, 5vw, 64px);
}

.hero-logo {
  justify-self: center;
  width: min(100%, 240px);
}

.hero-content {
  display: grid;
  justify-items: start;
  gap: 18px;
  max-width: 640px;
}

.hero h1,
.hero p { color: var(--ccr-white); }

.hero-tagline {
  font-family: "Exo 2", sans-serif;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.hero-copy {
  max-width: 620px;
  font-size: 1.05rem;
}

/* ----- Layout / panels ----- */

.main-content { padding: 28px 0 44px; }

.page-section { display: grid; gap: 22px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-kicker {
  margin-top: 6px;
  color: var(--text-muted);
}

.card,
.search-panel,
.shop-card,
.wishlist-card,
.order-card,
.state-card,
.role-notice {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.search-panel { padding: 18px; }

.search-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
}

.search-row {
  display: grid;
  gap: 10px;
}

.search-input {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--chrome);
  padding: 14px 16px;
  color: var(--text);
  font-weight: 500;
}

.search-input::placeholder {
  color: rgba(202, 201, 239, .68);
}

.inline-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--text-muted);
  font-size: .9rem;
}

.state-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 52px 20px;
  text-align: center;
}

.state-title {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ----- Shop cards ----- */

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 24px;
}

.shop-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease;
}

.shop-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(1, 17, 53, .10);
}

.card-image-frame {
  position: relative;
  aspect-ratio: 488 / 680;
  overflow: hidden;
  background: var(--chrome);
  border-bottom: 1px solid var(--rule);
}

.card-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  background: linear-gradient(180deg, var(--chrome), var(--panel));
  color: var(--text-muted);
  font-weight: 600;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.card-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.card-title {
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  overflow-wrap: anywhere;
  font-weight: 600;
  line-height: 1.25;
}

.card-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.heart-button {
  width: 34px;
  height: 34px;
  border-radius: 99px;
  border: 1px solid var(--rule);
  background: var(--chrome);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1;
}
.heart-button.is-active {
  background: var(--ccr-lavender);
  border-color: var(--ccr-lavender);
}

.stock-list {
  display: grid;
  gap: 10px;
}

.stock-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px 12px;
  min-height: 28px;
  color: var(--text);
  font-size: .86rem;
}

.price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(82px, max-content);
  align-items: center;
  gap: 10px;
  min-height: 28px;
  color: var(--text);
  font-size: .86rem;
}

.stock-row.is-muted { opacity: .54; }

.stock-label {
  display: inline-flex;
  flex: 1 1 9rem;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: visible;
  white-space: normal;
  font-weight: 500;
  line-height: 1.3;
}

.stock-value,
.out-of-stock,
.stock-row .spinner {
  justify-self: auto;
  margin-left: auto;
  text-align: right;
  white-space: normal;
}

.stock-value {
  display: inline-flex;
  flex: 1 1 7.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px 6px;
  min-width: min(100%, 7.5rem);
  line-height: 1.3;
}

.out-of-stock {
  flex: 0 1 auto;
  line-height: 1.3;
}

.stock-row .spinner {
  flex: 0 0 auto;
}

.price {
  color: var(--ccr-cyan);
  font-weight: 600;
  white-space: nowrap;
}

.out-of-stock {
  color: var(--text-muted);
}

.card-actions,
.wishlist-actions,
.order-actions {
  display: grid;
  gap: 8px;
}

.card-actions {
  margin-top: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  background: var(--ccr-lavender);
  color: var(--ccr-navy);
  padding: 4px 9px;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge-status { text-transform: capitalize; }

/* ----- Wishlist / orders ----- */

.wishlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.wishlist-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.wishlist-card .card-image-frame {
  width: 96px;
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.wishlist-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.orders-list {
  display: grid;
  gap: 16px;
}

.order-card {
  padding: 18px;
}

.order-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.order-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.order-meta {
  margin-top: 6px;
  color: var(--text);
  opacity: .68;
  font-size: .85rem;
}

.order-total {
  text-align: right;
}

.order-lines {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.order-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  font-size: .92rem;
}

.order-line-name {
  min-width: 0;
}

.order-actions {
  grid-template-columns: repeat(2, minmax(0, max-content));
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.role-notice {
  padding: 14px 16px;
}

/* ----- Pagination / spinner ----- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
}

.spinner {
  display: inline-block;
  width: 34px;
  height: 34px;
  border: 4px solid var(--rule);
  border-top-color: var(--ccr-cyan);
  border-radius: 99px;
  animation: spin .8s linear infinite;
}

.spinner-small {
  width: 18px;
  height: 18px;
  border-width: 3px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Cart slide-over ----- */

.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
}

.cart-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: var(--overlay);
}

.cart-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(430px, 100%);
  height: 100%;
  background: var(--panel);
  box-shadow: -10px 0 32px rgba(0, 0, 0, .35);
}

.cart-header,
.cart-footer {
  padding: 18px;
  border-bottom: 1px solid var(--rule);
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cart-footer {
  border-top: 1px solid var(--rule);
  border-bottom: 0;
}

.cart-body {
  flex: 1 1 auto;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
}

.cart-empty { padding: 34px 0; text-align: center; }

.cart-item {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--chrome);
}

.cart-thumb {
  position: relative;
  width: 60px;
  aspect-ratio: 488 / 680;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--chrome);
}

.cart-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-body {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.cart-item-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  line-height: 1.25;
}

.cart-item-title span:first-child {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quantity-stepper {
  display: inline-grid;
  grid-template-columns: 32px minmax(30px, auto) 32px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: var(--chrome);
}

.qty-button {
  width: 32px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.qty-value {
  min-width: 30px;
  text-align: center;
  font-weight: 600;
}

.remove-button {
  border: 0;
  background: transparent;
  color: var(--link);
  font-weight: 600;
}

.cart-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.buyer-notice {
  margin-top: 12px;
  text-align: center;
  font-weight: 600;
}

.cart-enter,
.cart-leave { transition: opacity .18s ease; }

.cart-enter .cart-panel,
.cart-leave .cart-panel { transition: transform .2s ease; }

.cart-enter-start,
.cart-leave-end { opacity: 0; }

.cart-enter-start .cart-panel,
.cart-leave-end .cart-panel { transform: translateX(100%); }

.cart-enter-end,
.cart-leave-start { opacity: 1; }

.cart-enter-end .cart-panel,
.cart-leave-start .cart-panel { transform: translateX(0); }

/* ----- Toasts ----- */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(202, 201, 239, .28);
  border-radius: 14px;
  background: var(--ccr-navy);
  color: var(--ccr-white);
  box-shadow: 0 12px 30px rgba(1, 17, 53, .18);
}

.toast p { color: var(--ccr-white); }

.toast button {
  border: 0;
  background: transparent;
  color: var(--ccr-white);
  font-weight: 600;
}

/* ----- Footer ----- */

.site-footer {
  background: var(--chrome);
  border-top: 1px solid var(--rule);
  color: var(--text-muted);
  padding: 40px 0;
  font-size: .95rem;
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
}

.footer-tagline {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
}

.site-footer a {
  color: var(--text);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }

  .header-shell {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 14px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .brand { justify-self: center; }

  .brand img { height: 44px; }

  .global-nav { gap: 16px; }

  .header-actions {
    justify-self: center;
    justify-content: center;
  }

  .username { display: none; }

  .site-nav {
    justify-content: flex-start;
    gap: 20px;
    padding-right: 12px;
  }

  .hero { padding: 42px 0 48px; }

  .hero .container {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .hero-logo { width: 150px; }

  .hero-content {
    justify-items: center;
    max-width: 34rem;
  }

  .main-content { padding-top: 22px; }

  .section-heading,
  .order-header {
    display: grid;
    gap: 10px;
  }

  .order-total { text-align: left; }

  .shop-grid { grid-template-columns: 1fr; gap: 16px; }

  .wishlist-grid { grid-template-columns: 1fr; }

  .wishlist-card { grid-template-columns: 82px minmax(0, 1fr); gap: 12px; }

  .wishlist-card .card-image-frame { width: 82px; }

  .card-body { gap: 14px; padding: 14px; }

  .stock-row, .price-row { font-size: .82rem; }

  .cart-panel { width: 100%; }

  .toast-stack { right: 16px; bottom: 16px; width: calc(100vw - 32px); }
}
