/* Tiny utility tweaks beyond Tailwind */
[x-cloak] { display: none !important; }

html { scroll-behavior: smooth; }

/* Smooth fade for HTMX swaps */
.htmx-swapping { opacity: 0; transition: opacity 200ms ease-out; }
.htmx-settling { opacity: 1; transition: opacity 200ms ease-in; }

/* Replace default focus ring with a clearly-visible custom one. We never
   suppress focus styling for keyboard users — only for mouse clicks. */
:focus-visible {
  outline: 2px solid #3B1F2B;
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }
input:focus, select:focus, textarea:focus { outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #3B1F2B;
  outline-offset: 1px;
}

/* Hide content visually while remaining accessible to screen-readers. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.sr-only.focus\:not-sr-only:focus,
.focus\:not-sr-only:focus {
  position: static; width: auto; height: auto;
  margin: 0; overflow: visible; clip: auto; white-space: normal;
}

/* Respect reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Allauth forms get cleaned up to match the storefront */
form.allauth label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: #5C3A4E; margin-bottom: 0.25rem; }
form.allauth input[type="text"],
form.allauth input[type="email"],
form.allauth input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: white;
  border: 1px solid #E8E2D9;
  margin-bottom: 1rem;
}
form.allauth button[type="submit"] {
  background: #3B1F2B;
  color: #FAF7F2;
  padding: 0.75rem 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  border-radius: 10px;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
form.allauth button[type="submit"]:hover { background: #5C3A4E; }

/* ---- Classic luxury typography ---- */
.font-brand {
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.font-display {
  font-weight: 600;
}
.brand-wordmark {
  font-family: Cinzel, Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.section-eyebrow {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #B08D57;
}
.section-label {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3B1F2B;
  margin-bottom: 0.5rem;
}
.price {
  font-family: Inter, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.price-lg {
  font-size: 1.75rem;
  line-height: 1.2;
}
.price-xl {
  font-size: 2rem;
  line-height: 1.2;
}
.price-muted {
  font-weight: 500;
  color: rgba(27, 22, 18, 0.45);
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border-top: 1px solid #E8E2D9;
  padding-top: 0.625rem;
  margin-top: 0.625rem;
  font-size: 1.125rem;
}
.total-row .total-label {
  font-weight: 500;
  color: #1B1612;
}
.stat-value {
  font-family: Inter, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 1.875rem;
  line-height: 1.2;
}

/* ---- Modern form system ---- */
.form-card {
  background: #fff;
  border: 1px solid #E8E2D9;
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 2px rgba(27, 22, 18, 0.04);
}
@media (min-width: 768px) {
  .form-card { padding: 1.75rem 2rem; }
}
.form-section-title {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.2;
  color: #1B1612;
  margin-bottom: 1rem;
}
.form-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #5C3A4E;
  margin-bottom: 0.375rem;
}
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #E8E2D9;
  border-radius: 10px;
  font-size: 1rem;
  color: #1B1612;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-input:hover { border-color: #C9A9B8; }
.form-input:focus {
  border-color: #3B1F2B;
  box-shadow: 0 0 0 3px rgba(59, 31, 43, 0.12);
}
.form-select {
  width: 100%;
  padding: 0.75rem 2.75rem 0.75rem 1rem;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235C3A4E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  border: 1px solid #E8E2D9;
  border-radius: 10px;
  font-size: 1rem;
  color: #1B1612;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-select:hover { border-color: #C9A9B8; }
.form-select:focus {
  border-color: #3B1F2B;
  box-shadow: 0 0 0 3px rgba(59, 31, 43, 0.12);
  outline: none;
}
.form-optional {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #5C3A4E;
  background: #F0EBE3;
  border: 1px solid #E8E2D9;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  line-height: 1.4;
}
.form-field--invalid .form-input,
.form-field--invalid .form-select {
  border-color: #b91c1c;
}
.form-field--invalid .form-input:focus,
.form-field--invalid .form-select:focus {
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15);
}
.form-field .iti {
  display: block;
  width: 100%;
}
.form-field .iti__tel-input.form-input {
  width: 100%;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.form-field .iti--allow-dropdown .iti__tel-input.form-input,
.form-field .iti--show-selected-dial-code .iti__tel-input.form-input {
  padding-left: calc(var(--iti-spacer-horizontal, 8px) + 52px + var(--iti-spacer-horizontal, 8px));
}
.form-field .iti__country-container {
  padding-left: 0.25rem;
}
.form-field .iti__selected-country {
  border-radius: 8px 0 0 8px;
}
.form-field .iti__dropdown-content {
  border-radius: 10px;
  border-color: #E8E2D9;
  box-shadow: 0 8px 24px rgba(27, 22, 18, 0.08);
  z-index: 50;
}
.form-field .iti__country-name {
  margin-right: 0.5rem;
}
.form-field .iti__dial-code {
  margin-left: auto;
  padding-left: 0.5rem;
}
.form-field--invalid .iti__tel-input.form-input {
  border-color: #b91c1c;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  background: transparent;
  color: #3B1F2B;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  border-radius: 10px;
  border: 1px solid #E8E2D9;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.btn-secondary:hover {
  border-color: #C9A9B8;
  background: #FAF7F2;
}
.account-address-form .form-section-title {
  font-size: 1.375rem;
  margin-bottom: 1.25rem;
}
[x-cloak] { display: none !important; }
.country-combobox {
  position: relative;
}
.country-combobox__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.country-combobox__list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  max-height: 14rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.375rem;
  list-style: none;
  background: #fff;
  border: 1px solid #E8E2D9;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(27, 22, 18, 0.12);
}
.country-combobox__option {
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9375rem;
  color: #1B1612;
}
.country-combobox__option:hover,
.country-combobox__option:focus,
.country-combobox__option--active {
  background: #F0EBE3;
  outline: none;
}
.form-hint { font-size: 0.8125rem; color: #5C3A4E; }
.form-error { font-size: 0.8125rem; color: #b91c1c; }
.form-alert {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
  padding: 1rem 1.125rem;
  margin-bottom: 1.25rem;
  background: #fdf5f5;
  border: 1px solid #e8c4c4;
  border-left: 4px solid #9b2c2c;
  border-radius: 10px;
  color: #7f1d1d;
}
.form-alert__icon {
  flex-shrink: 0;
  margin-top: 0.125rem;
  color: #b91c1c;
}
.form-alert__body { flex: 1; min-width: 0; }
.form-alert__message {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
}
.form-alert__message + .form-alert__message { margin-top: 0.5rem; }
.form-alert__actions {
  margin: -0.5rem 0 1.25rem;
  font-size: 0.8125rem;
}
.form-field { margin-bottom: 1rem; }
.form-field:last-child { margin-bottom: 0; }

.form-checkbox {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
  accent-color: #3B1F2B;
  border-radius: 4px;
  cursor: pointer;
}
.form-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: #1B1612;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.form-checkbox-label span { flex: 1; min-width: 0; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  background: #3B1F2B;
  color: #FAF7F2;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
.btn-primary:hover { background: #5C3A4E; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.checkout-page { background: linear-gradient(180deg, #FAF7F2 0%, #fff 12rem); }
.stripe-element-wrap {
  padding: 0.25rem;
  border-radius: 10px;
}

.shipping-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid #E8E2D9;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.shipping-option:has(.shipping-option__radio:checked) {
  border-color: #3B1F2B;
  box-shadow: 0 0 0 1px #3B1F2B;
}
.shipping-option:hover { border-color: #C9A9B8; }
.shipping-option__radio { accent-color: #3B1F2B; width: 1.125rem; height: 1.125rem; }
.shipping-option__body { flex: 1; min-width: 0; }
.shipping-option__title { display: block; font-size: 0.9375rem; color: #1B1612; }
.shipping-option__meta { display: block; font-size: 0.75rem; color: #5C3A4E; margin-top: 0.125rem; }
.shipping-option__price { font-size: 0.9375rem; white-space: nowrap; }

/* Auth pages */
.auth-card {
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}
.auth-card .form-card { margin-bottom: 0; }

/* Google Places suggestions dropdown (account address form) */
.pac-container { z-index: 10000; }
form.allauth input[type="text"],
form.allauth input[type="email"],
form.allauth input[type="password"] {
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form.allauth input:focus {
  border-color: #3B1F2B;
  box-shadow: 0 0 0 3px rgba(59, 31, 43, 0.12);
}
