/* ============================================================
   Accessly — Mobile dynamics (compartilhado)
   Carregar DEPOIS de tokens.css, base.css, components.css
   ============================================================ */

/* ---------- TOUCH ACTION (fix double-tap zoom) ---------- */
button,
a,
input,
select,
textarea,
[role="button"],
[data-ripple],
.ripple-host,
label {
  touch-action: manipulation;
}

/* ---------- TOUCH-SPECIFIC: smooth scroll em mobile ---------- */
@media (hover: none) {
  html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  /* Em desktop não aplicamos scroll-behavior para não interferir
     em libs que precisam controlar o scroll programaticamente. */
}

/* ---------- SELEÇÃO DE TEXTO ---------- */
::selection {
  background: rgba(220, 38, 38, 0.35);
  color: #fff;
  text-shadow: none;
}

::-moz-selection {
  background: rgba(220, 38, 38, 0.35);
  color: #fff;
  text-shadow: none;
}

/* ---------- FOCUS-VISIBLE (acessibilidade por teclado) ---------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid #DC2626;
  outline-offset: 3px;
  border-radius: 6px;
}

button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #DC2626;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #DC2626;
  outline-offset: 2px;
  border-color: #DC2626;
}

/* Remove o ring padrão quando é clique de mouse (não é :focus-visible) */
:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- RIPPLE ---------- */
.ripple-host,
[data-ripple] {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.ax-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transform: scale(0);
  pointer-events: none;
  animation: ax-ripple-anim 0.6s ease-out forwards;
  z-index: 1;
}

@keyframes ax-ripple-anim {
  to {
    transform: scale(3);
    opacity: 0;
  }
}

/* ---------- REVEAL ---------- */
.reveal,
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.in,
.reveal.revealed,
[data-reveal].in,
[data-reveal].revealed {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* Variações */
.reveal-left  { transform: translateX(-30px); }
.reveal-right { transform: translateX(30px); }
.reveal-scale { transform: scale(0.94); }

.reveal-left.in,  .reveal-left.revealed,
.reveal-right.in, .reveal-right.revealed,
.reveal-scale.in, .reveal-scale.revealed {
  transform: none;
}

/* ---------- ACTIVE STATES (touch only) ---------- */
@media (hover: none) {
  .btn-primary:active,
  .btn-secondary:active,
  [data-active-scale]:active {
    transform: scale(0.97);
    transition: transform 0.1s ease-out;
  }
}

/* ---------- FIX: DATE / TIME INPUT OVERFLOW (iOS + Android) ---------- */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
  filter: invert(1);
}

input[type="date"]::-moz-focus-inner,
input[type="time"]::-moz-focus-inner {
  border: 0;
  padding: 0;
}

/* ---------- FIX: SELECT / INPUT GERAIS ---------- */
select,
input,
textarea {
  min-width: 0;
  max-width: 100%;
}

/* ---------- AUTOFILL (Chrome) — evita fundo branco feio ---------- */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px rgba(20, 20, 20, 1) inset;
  transition: background-color 5000s ease-in-out 0s;
  caret-color: #fff;
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  .ax-ripple { display: none !important; }
  .reveal,
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}