/* Shared UX foundations. Load after page styles so every route uses the same
   interaction rules without replacing its layout or business-specific states. */
@import url("./arleth/tokens/spacing.css");

:root {
  --ux-ink: #221a12;
  --ux-muted: #665747;
  --ux-blue: #163a8a;
  --ux-blue-hover: #102c69;
  --ux-paper: #fbf8f3;
  --ux-border: #a99a85;
  --ux-danger: #a83b2b;
  --ux-success: #365f3a;
  --ux-target: 44px;
  --ux-gutter: clamp(16px, 3vw, 28px);
  --ux-section: clamp(40px, 6vw, 80px);
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 8rem;
}

body { overflow-wrap: break-word; }
main, section, article, form, fieldset { min-width: 0; }
img, video { max-width: 100%; }
button, input, select, textarea { font-family: inherit; }
button, summary, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, [role="button"], summary { touch-action: manipulation; }

/* A two-colour ring remains visible on light cards and dark navigation. */
:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ux-blue) !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px #fff;
}
[tabindex="-1"]:focus { scroll-margin-top: 8rem; }

button:not([class*="tweak"]), [role="button"], summary,
:is(.btn, .btn-buy, .btn-small, .btn-contact, .btn-go-shop, .btn-wa,
    .btn-msn, .btn-ghost, .back-link, .nav-cart, .nav-region,
    .nav-link, .nav-link-mobile, .social-link, .whatsapp-btn) {
  min-height: var(--ux-target);
}
button:not([class*="tweak"]), .nav-cart, .social-link {
  min-width: var(--ux-target);
}
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }
button:disabled { opacity: .65; }
[aria-busy="true"] { cursor: progress; }

/* Inputs keep their boundaries visible; placeholders supplement real labels. */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]),
select, textarea {
  min-height: var(--ux-target);
  max-width: 100%;
  font-size: 1rem;
  line-height: 1.5;
  border-color: var(--ux-border);
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ux-muted); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ux-blue); }
[aria-invalid="true"] { border: 2px solid var(--ux-danger) !important; }
.ux-field-error { color: var(--ux-danger); font-size: .875rem; line-height: 1.5; }

/* Orange and WhatsApp green need dark foregrounds for readable text. */
.btn-naranja { color: var(--ux-ink); }
.btn-naranja:hover { color: var(--ux-ink); }
.btn-naranja:active { color: #fff; }
.btn-wa, .btn-wa:hover, .btn-wa:active,
.fab-wa, .fab-wa:hover, .whatsapp-btn, .whatsapp-btn:hover {
  color: #102c1b;
}
.nav-cart:hover { color: var(--ux-blue); }
.nav-cart, .nav-region { min-width: var(--ux-target); height: var(--ux-target); }
.nav-link:not(.nav-link-mobile) { display: inline-flex; align-items: center; }
.nav-links { gap: var(--space-6); }
.nav-logo { flex-shrink: 0; }
.nav-inner { gap: var(--space-4); }
.nav-logo-tag { color: var(--ux-muted); }
.pdp-aparta-num { color: #9e5c00; }
.cart-step:not(.active):not(.done) .step-num { color: var(--ux-ink); }
.section-head { margin-bottom: clamp(32px, 5vw, 56px); }
.section-head p { max-width: 60ch; line-height: 1.7; }
.footer-list a, .footer-links a { display: inline-flex; align-items: center; min-height: 32px; }

/* Reading links use a signifier beyond colour. */
:is(.policy-content, .order-notes-content, .customer-info) a {
  color: var(--ux-blue);
  text-decoration: underline;
  text-underline-offset: .2em;
}
:is(.policy-content, .order-notes-content, .customer-info) a:hover { color: var(--ux-blue-hover); }

.ux-skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 100001;
  transform: translateY(-180%);
  padding: 12px 20px;
  background: var(--ux-blue);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font: 600 1rem/1.5 system-ui, sans-serif;
}
.ux-skip-link:focus { transform: translateY(0); color: #fff; }
.ux-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Long dialogs remain usable at high zoom and with a virtual keyboard. */
.modal :is(.modal-content, .modal-body) { max-width: 100%; }
.modal .modal-content { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }

@media (max-width: 600px) {
  html { scroll-padding-top: 6rem; }
  input, select, textarea { font-size: 16px; }
  .nav-inner { padding: 12px 16px; gap: 8px; }
  .nav-logo-tag { display: none; }
  .nav-cta { gap: 8px; }
  .nav-link-mobile { font-size: .875rem; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .footer { padding-top: 48px; margin-top: 56px; }
  .footer-bottom { gap: 12px; }
  .btn { white-space: normal; text-align: center; }
  .toast-container { max-width: calc(100vw - 32px); }
}

@media (max-width: 380px) {
  .nav-logo-text { font-size: 1.125rem; }
  .nav-logo-icon { width: 100px; height: auto; }
  .nav-link-mobile { font-size: .75rem; }
  .nav-region { padding-inline: 8px; }
  .nav-logo { gap: 6px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 340px) {
  .nav-link-mobile[href*="testimonios"] { display: none; }
}

/* Respect motion preferences in legacy pages as well as the current design. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline-color: Highlight !important;
  }
  button, .btn, input, select, textarea { border: 1px solid ButtonText; }
}
