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

:root {
  --red: #D93025;
  --dark: #1a1a1a;
  --white: #ffffff;
  --gray: #f5f5f5;
  --border: #e0e0e0;
  --text: #333;
  --text-light: #777;
  --cart-width: 420px;
  --radius: 8px;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Hero ── */
.hero {
  position: relative;
  width: 100vw;
  height: 100vh;
  cursor: pointer;
  overflow: hidden;
  background: #f0ebe3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 44%;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Rotating "buy now" Text ── */
.rotating-text {
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: spin 14s linear infinite;
}

.ring-item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform: rotate(var(--a));
}

.ring-item span {
  position: absolute;
  transform: translateY(clamp(-380px, -44vmin, -220px)) translateX(-50%);
  white-space: nowrap;
  font-family: 'Pacifico', cursive;
  font-size: clamp(2rem, 5.5vmin, 3.6rem);
  color: var(--red);
  user-select: none;
}

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

/* ── Hint ── */
.hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.5rem 1.2rem;
  border-radius: 100px;
  opacity: 1;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.hint.fade-out {
  opacity: 0;
}

/* ── Overlay ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  z-index: 100;
  cursor: pointer;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── Cart Sidebar ── */
.cart {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--cart-width);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--white);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 101;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.cart.active {
  transform: translateX(0);
}

.cart-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text);
  line-height: 1;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.cart-close:hover {
  background: var(--gray);
}

/* ── Steps ── */
.step {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.step.hidden {
  display: none;
}

.step-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

/* ── Cart Product ── */
.cart-product {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--gray);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.cart-product-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.cart-product-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.cart-product-price {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-light);
}

/* ── Quantity ── */
.qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.qty-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  color: var(--text);
}

.qty-btn:hover {
  background: var(--gray);
  border-color: var(--text);
}

.qty-value {
  font-size: 1.2rem;
  font-weight: 600;
  min-width: 2rem;
  text-align: center;
}

/* ── Summary ── */
.cart-summary {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-bottom: 1.5rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.summary-total {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.8rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  padding: 1rem;
  background: var(--dark);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: auto;
}

.btn-primary:hover {
  background: #333;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-back {
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  margin-bottom: 1rem;
  transition: color 0.2s;
}

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

/* ── Form ── */
.form-group {
  margin-bottom: 0.8rem;
}

.form-row {
  display: flex;
  gap: 0.8rem;
}

.form-row .form-group {
  flex: 1;
}

input, select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--dark);
}

input.invalid {
  border-color: var(--red);
}

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='%23777' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ── Loading state ── */
.btn-primary.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-primary.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: loader 0.6s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

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

/* ── Responsive ── */
@media (max-width: 480px) {
  .cart {
    width: 100vw;
    padding: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .step {
    flex: unset;
  }

  .btn-primary {
    margin-top: 1.5rem;
  }

  .step-title {
    font-size: 1.15rem;
    margin-bottom: 1rem;
  }

  .cart-product {
    margin-bottom: 1rem;
  }

  .qty {
    margin-bottom: 1rem;
  }

  .cart-summary {
    margin-bottom: 1rem;
  }

  .form-group {
    margin-bottom: 0.6rem;
  }

  input, select {
    padding: 0.75rem 0.85rem;
    font-size: 16px;
  }

  .ring-item span {
    font-size: 1.6rem;
    transform: translateY(-36vmin) translateX(-50%);
  }

  .hint {
    font-size: 0.75rem;
    bottom: 1.5rem;
  }
}

@media (max-width: 360px) {
  .cart {
    padding: 1.2rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}
