:root {
  --bg: #ffffff;
  --text: #121212;
  --text-muted: rgba(18, 18, 18, 0.68);
  --border: rgba(18, 18, 18, 0.1);
  --border-strong: rgba(18, 18, 18, 0.22);
  --dark-box: #242833;
  --button-bg: #121212;
  --button-text: #ffffff;
  --subtle-bg: #f5f5f5;
}

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

[hidden] {
  display: none !important;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

/* Header */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.site-header__inner {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand__logo {
  height: 38px;
  width: auto;
  display: block;
}

.cart-btn {
  position: relative;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cart-btn:hover {
  opacity: 0.72;
}

.cart-btn__count {
  position: absolute;
  bottom: 4px;
  right: 3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 50%;
  background: var(--text);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cart-btn__count[hidden] {
  display: none !important;
}

/* Hero Banner (matching original DEUFOL Shop layout) */
.banner {
  position: relative;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow: hidden;
}

.banner__media {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

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

.banner__box {
  position: relative;
  z-index: 2;
  background: transparent;
  color: #ffffff;
  max-width: 720px;
  width: 100%;
  padding: 20px;
  text-align: center;
}

.banner__heading {
  margin: 0 0 14px;
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  font-weight: 400;
  letter-spacing: 0.03em;
}

.banner__text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.85);
}

/* Catalog */
.catalog {
  flex: 1;
  padding-top: 48px;
  padding-bottom: 72px;
}

.catalog__heading {
  margin: 0 0 32px;
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px 24px;
}

.product-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.product-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--subtle-bg);
  overflow: hidden;
  margin-bottom: 14px;
}

.product-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease, transform 0.4s ease;
}

.product-card__img--secondary {
  opacity: 0;
}

.product-card:hover .product-card__img--has-secondary.product-card__img--primary {
  opacity: 0;
}

.product-card:hover .product-card__img--secondary {
  opacity: 1;
  transform: scale(1.03);
}

.product-card:hover .product-card__img--primary:not(.product-card__img--has-secondary) {
  transform: scale(1.03);
}

.soldout-badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 2;
  background: var(--dark-box);
  color: #ffffff;
  font-size: 0.75rem;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.product-card__title {
  margin: 0 0 6px;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text);
}

.product-card:hover .product-card__title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.product-card__price {
  font-size: 0.95rem;
  color: var(--text);
}

/* Modal & Drawer */
.modal-backdrop,
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(18, 18, 18, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop[hidden],
.drawer-backdrop[hidden] {
  display: none !important;
}

.modal {
  position: relative;
  background: #ffffff;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.icon-close {
  border: none;
  background: transparent;
  color: var(--text);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal > .icon-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
}

.product-modal__body {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  padding: 40px;
}

.gallery__main {
  aspect-ratio: 1 / 1;
  background: var(--subtle-bg);
  overflow: hidden;
  margin-bottom: 10px;
}

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

.gallery__thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.gallery__thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--subtle-bg);
  cursor: pointer;
  opacity: 0.65;
}

.gallery__thumb.active {
  border-color: var(--text);
  opacity: 1;
}

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

.modal-details {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-details__title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1.3;
}

.modal-details__price {
  font-size: 1.15rem;
}

.variant-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variant-pill {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

.variant-pill.active {
  background: var(--text);
  color: #ffffff;
  border-color: var(--text);
}

.variant-pill:disabled {
  opacity: 0.4;
  text-decoration: line-through;
  cursor: not-allowed;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  height: 44px;
}

.qty-control__btn {
  width: 40px;
  height: 100%;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
}

.qty-control__btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.qty-control__input {
  width: 44px;
  height: 100%;
  border: none;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text);
  background: transparent;
  -moz-appearance: textfield;
}

.qty-control__input::-webkit-inner-spin-button,
.qty-control__input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.modal-details__desc {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.modal-details__list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  height: 46px;
  padding: 0 24px;
  border: 1px solid var(--button-bg);
  background: var(--button-bg);
  color: var(--button-text);
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover:not(:disabled) {
  opacity: 0.88;
}

.btn--secondary {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn--soldout,
.btn:disabled {
  background: var(--subtle-bg);
  border-color: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn--full {
  width: 100%;
}

/* Drawer */
.drawer-backdrop {
  justify-content: flex-end;
  padding: 0;
}

.drawer {
  width: 100%;
  max-width: 460px;
  height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
}

.drawer__header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 400;
}

.drawer__content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer__footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}

.drawer__subtotal {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  margin-bottom: 16px;
}

.drawer__actions-split {
  display: flex;
  gap: 10px;
}

/* Cart Items */
.cart-items {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cart-item {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 16px;
  align-items: start;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.cart-item__img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  background: var(--subtle-bg);
}

.cart-item__title {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 400;
}

.cart-item__variant {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.cart-item__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-item__remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.cart-item__price {
  font-size: 0.92rem;
}

.cart-empty {
  text-align: center;
  padding: 64px 16px;
  color: var(--text-muted);
}

/* Checkout Form */
.form-row {
  display: grid;
  gap: 12px;
}

.form-row--2col {
  grid-template-columns: 1fr 1fr;
}

.form-row--3col {
  grid-template-columns: 100px 1fr 140px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-field label {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background-color: #ffffff;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.form-field textarea {
  height: auto;
  min-height: 68px;
  resize: vertical;
}

.form-field select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23121212' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: 1px solid var(--text);
  border-color: var(--text);
}

.form-field--invalid label {
  color: #dc2626;
  font-weight: 600;
}

.form-field--invalid input,
.form-field--invalid select,
.form-field--invalid textarea {
  border-color: #dc2626 !important;
  outline-color: #dc2626 !important;
  background-color: #fef2f2;
}

.checkout-error {
  padding: 12px;
  border: 1px solid #dc2626;
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 8px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
  margin-top: auto;
}

.site-footer__copy {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text);
  color: #ffffff;
  padding: 12px 18px;
  font-size: 0.85rem;
}

@media (max-width: 980px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .container {
    padding: 0 18px;
  }
  .banner__media {
    grid-template-columns: 1fr;
  }
  .banner__media img:last-child {
    display: none;
  }
  .banner__box {
    padding: 32px 24px;
  }
  .product-modal__body {
    grid-template-columns: 1fr;
    padding: 24px;
  }
  .form-row--2col,
  .form-row--3col {
    grid-template-columns: 1fr;
  }
}
