/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── VARIABLES ── */
:root {
  --white:   #ffffff;
  --off:     #f7f7f7;
  --border:  #e5e5e5;
  --text:    #111111;
  --muted:   #666666;
  --light:   #999999;
  --accent:  #111111;
  --danger:  #cc3333;
  --success: #1a7f45;
  --radius:  8px;
  --shadow:  0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
}

/* ── BASE ── */
html { scroll-behavior: smooth; }

body {
  background: var(--white);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── HEADER ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 5vw;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.logo span { font-weight: 300; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav a {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.site-nav a:hover { color: var(--text); }

.site-nav a.active { color: var(--text); font-weight: 500; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--text);
  color: var(--white);
  border-color: var(--text);
}

.btn-primary:hover { opacity: 0.82; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover { border-color: var(--text); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover { opacity: 0.82; }

.btn-sm { font-size: 0.8rem; padding: 0.4rem 0.85rem; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── FORMS ── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--text);
}

textarea { resize: vertical; min-height: 80px; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 0.35rem;
}

/* ── CARD ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

/* ── PAGE WRAPPER ── */
.page-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 5vw 4rem;
}

.page-wrap-sm {
  max-width: 440px;
  margin: 0 auto;
  padding: 3rem 5vw 4rem;
}

/* ── SECTION HEADING ── */
.section-heading {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.section-sub {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

/* ── DIVIDER ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── BADGE ── */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-unpaid   { background: #fff0f0; color: #cc3333; border: 1px solid #ffb3b3; }
.badge-pending  { background: #fff7e6; color: #b35900; border: 1px solid #ffd591; }
.badge-ready    { background: #e6f7ee; color: #1a7f45; border: 1px solid #95de9a; }
.badge-complete { background: #f0f0f0; color: #555;    border: 1px solid #d9d9d9; }

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text);
  color: var(--white);
  font-size: 0.875rem;
  padding: 0.65rem 1.25rem;
  border-radius: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── COLOR SWATCH ── */
.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.color-option {
  position: relative;
}

.color-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.color-option label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.color-option input[type="radio"]:checked + label {
  border-color: var(--text);
  background: var(--off);
  font-weight: 600;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
}

/* ── RAINBOW SWATCHES ── */
.swatch-rainbow {
  background: linear-gradient(135deg, red, orange, yellow, green, blue, violet);
}

.swatch-army {
  background: linear-gradient(135deg, #4a5e2a, #8b7355, #3d4f1e, #6b7c3a, #5c4a2a, #4a6b2a);
}

.swatch-glow {
  background: linear-gradient(135deg, #39ff14, #00ffff, #ff00ff);
  box-shadow: 0 0 4px #39ff1466;
}

.swatch-black  { background: #111111; }
.swatch-red    { background: #e53935; }
.swatch-orange { background: #fb8c00; }
.swatch-yellow { background: #fdd835; }
.swatch-green  { background: #43a047; }
.swatch-blue   { background: #1e88e5; }
.swatch-purple { background: #8e24aa; }

/* ── PRODUCT GRID ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.product-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
}

.product-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.product-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--off);
}

.product-thumb {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--off);
  border-bottom: 1px solid var(--border);
}

.product-thumb-placeholder {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.product-thumb--articulated-snake {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 50%, #a5d6a7 100%);
}

.product-thumb--passthrough-fidget {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 50%, #90caf9 100%);
}

.product-thumb--marble-run {
  background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 50%, #ce93d8 100%);
}

.product-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
}

.product-colors { margin-top: 0.15rem; }

.product-colors-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--light);
  margin-bottom: 0.45rem;
}

.product-colors-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 100px;
}

.color-chip-more {
  font-weight: 500;
  color: var(--light);
}

.stock-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  align-self: flex-start;
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  border: 1.5px solid;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stock-badge .stock-qty {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.stock-badge.in-stock {
  color: var(--success);
  border-color: var(--success);
  background: rgba(26, 127, 69, 0.08);
}

.stock-badge.out-of-stock {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(204, 51, 51, 0.08);
}

.product-note {
  font-size: 0.78rem;
  color: var(--light);
  font-style: italic;
}

.product-order-btn { margin-top: auto; width: 100%; }

.product-body .btn { margin-top: auto; }

.product-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.product-price {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.product-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ── ORDER TABLE ── */
.order-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.order-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.order-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.order-table tr:last-child td { border-bottom: none; }

/* ── AUTH DIVIDER ── */
.or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--light);
  font-size: 0.8rem;
  margin: 1.25rem 0;
}

.or-divider::before, .or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── GOOGLE BUTTON ── */
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-google:hover { background: var(--off); border-color: #ccc; }

.btn-google svg { flex-shrink: 0; }

/* ── HERO ── */
.hero {
  padding: 4rem 5vw 3.5rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  margin-bottom: 0.75rem;
}

.hero p {
  font-size: 1rem;
  color: var(--muted);
  max-width: 460px;
  margin: 0 auto 1.75rem;
}

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 5vw;
  text-align: center;
  font-size: 0.8rem;
  color: var(--light);
}

/* ── SPINNER ── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.spinner-dark {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--text);
}

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

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-state p { margin-bottom: 1rem; }

/* ── MOBILE NAV ── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  margin: 0 auto;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-user {
  font-size: 0.8rem;
  color: var(--light);
}

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  margin: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.modal-price { font-weight: 700; color: var(--text); }

.section-rule {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--light);
  margin: 1.5rem 0 0.75rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.selected-color-display {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.75rem;
  min-height: 1.2em;
}

.selected-color-display strong { color: var(--text); }

.order-success {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

.order-success h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0.75rem 0 0.5rem;
}

.order-success p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.checkmark {
  font-size: 2.5rem;
  color: var(--success);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* ── INFO GRID ── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.info-grid-item strong {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.info-grid-item p {
  font-size: 0.875rem;
  color: var(--muted);
}

.market-banner {
  background: var(--off);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.market-banner h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.market-banner p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
}

.market-banner p + p { margin-top: 0.35rem; }

/* ── PRODUCT LIGHTBOX ── */
.product-card {
  cursor: pointer;
}

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}

.lightbox-overlay.open { display: flex; }

.lightbox {
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 820px;
  margin: auto;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.2);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  position: relative;
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.08);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10;
}

.lightbox-close:hover { background: rgba(0,0,0,0.16); }

.lightbox-image-wrap {
  background: var(--off);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
}

.lightbox-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lightbox-image-placeholder {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3rem;
  text-align: center;
}

.lightbox-body {
  padding: 2rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  max-height: 80vh;
}

.lightbox-name {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  padding-right: 2rem;
}

.lightbox-price {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.lightbox-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

.lightbox-colors-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--light);
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.lightbox-color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lightbox-actions {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.lightbox-note {
  font-size: 0.78rem;
  color: var(--light);
  font-style: italic;
  text-align: center;
}

@media (max-width: 640px) {
  .lightbox {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .lightbox-image-wrap {
    min-height: 220px;
    max-height: 280px;
  }

  .lightbox-body {
    padding: 1.5rem;
    max-height: none;
  }
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .nav-toggle { display: flex; }

  .site-nav {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 5vw 1rem;
    box-shadow: var(--shadow);
  }

  .site-nav a,
  .site-nav .nav-user,
  .site-nav .btn {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--off);
  }

  .site-nav .btn {
    margin-top: 0.5rem;
    text-align: center;
    border-bottom: none;
  }

  .site-header.nav-open .site-nav { display: flex; }

  .site-header.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }

  .site-header.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .product-grid { grid-template-columns: 1fr; }
  .order-table th:nth-child(3),
  .order-table td:nth-child(3) { display: none; }
  .form-row-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
