/* Achados Floripa — componentes reutilizáveis (.btn, .chip, .field, .modal, .toast) */
* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--af-ink);
  background: var(--af-sand);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body:has(dialog[open]) { overflow: hidden; }
a { color: var(--af-sea-700); text-decoration-thickness: 1.5px; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 3px solid var(--af-sea-300); outline-offset: 2px; }
[hidden] { display: none !important; }

.ic {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--touch);
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition:
    transform var(--motion-fast) var(--ease),
    background var(--motion-fast),
    box-shadow var(--motion-fast);
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--af-sea-700); color: #fff; }
.btn-primary:hover { background: var(--af-sea-900); }
.btn-ghost { border: 1.5px solid rgba(14, 74, 92, 0.25); color: var(--af-sea-900); }
.btn-coral { background: var(--af-coral); color: #fff; }
.btn-coral:hover { background: #a94a30; }
.btn.sm { min-height: 40px; padding: 0.4rem 1rem; }

.chip {
  flex: none;
  min-height: 40px;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1.5px solid rgba(14, 74, 92, 0.18);
  background: #fff;
  color: var(--af-sea-900);
  font-weight: 500;
  font-size: 0.9rem;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.chip[aria-pressed="true"],
.chip.is-active {
  background: var(--af-sea-700);
  color: #fff;
  border-color: var(--af-sea-700);
}

.badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}
.badge-lost { background: rgba(196, 92, 62, 0.15); color: #a94a30; }
.badge-found { background: rgba(45, 106, 79, 0.15); color: var(--af-leaf); }
.badge-region { background: var(--af-foam); color: var(--af-sea-700); }

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  color: var(--af-sea-900);
}
.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: var(--touch);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(14, 74, 92, 0.2);
  font: inherit;
  font-size: 1rem;
  background: #fff;
  color: var(--af-ink);
}
.field textarea { min-height: 5.5rem; resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--af-danger) !important; }
.field-help { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--af-muted); }
.field-error { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--af-danger); }

.check {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--af-muted);
  margin-bottom: 1rem;
}
.check input {
  margin-top: 0.25rem;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--af-sea-700);
  flex: none;
}

/* Dialog / modal (bottom-sheet mobile) */
dialog.af-modal {
  border: 0;
  padding: 0;
  color: var(--af-ink);
  background: #fff;
  width: 100%;
  max-width: 100%;
  max-height: 92dvh;
  margin: auto 0 0;
  border-radius: 26px 26px 0 0;
  overflow: auto;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.3);
  overscroll-behavior: contain;
}
dialog.af-modal::backdrop {
  background: rgba(10, 47, 58, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
dialog.af-modal[open] { animation: af-sheet 0.45s var(--ease); }
@keyframes af-sheet {
  from { transform: translateY(100%); }
}
@media (min-width: 800px) {
  dialog.af-modal {
    margin: auto;
    max-width: 32rem;
    max-height: 88dvh;
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.4);
  }
  dialog.af-modal[open] { animation: af-pop 0.4s var(--ease); }
  @keyframes af-pop {
    from { opacity: 0; transform: scale(0.96) translateY(14px); }
  }
}
.af-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 3;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.af-modal__body { padding: 1.4rem 1.4rem 1.7rem; }

/* Modal legal — leitura confortável no celular (bottom sheet) e desktop */
dialog.af-modal--legal {
  max-height: 92dvh;
}
@media (min-width: 800px) {
  dialog.af-modal--legal {
    max-width: 36rem;
    max-height: 88dvh;
  }
}
dialog.af-modal--legal .af-modal__body {
  padding-top: 3rem;
}
dialog.af-modal--legal h2:first-of-type {
  font: 700 clamp(1.35rem, 4vw, 1.7rem) / 1.2 var(--font-display);
  color: var(--af-sea-900);
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
  padding-right: 2.5rem;
}

.legal-doc {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--af-ink);
}
.legal-doc__lead {
  font-size: 1.02rem;
  color: var(--af-sea-900);
  margin: 0 0 1.25rem;
}
.legal-doc h2 {
  font: 700 1.05rem / 1.3 var(--font-display);
  color: var(--af-sea-900);
  margin: 1.4rem 0 0.5rem;
}
.legal-doc p,
.legal-doc ul {
  margin: 0 0 0.75rem;
}
.legal-doc ul {
  padding-left: 1.15rem;
}
.legal-doc li {
  margin-bottom: 0.35rem;
}
.legal-doc__foot {
  margin-top: 1.25rem !important;
  padding-top: 1rem;
  border-top: 1px solid rgba(14, 74, 92, 0.12);
  color: var(--af-muted);
  font-size: 0.9rem;
}
.legal-page .legal-doc h2 {
  font-size: 1.2rem;
  margin-top: 1.75rem;
}

/* Link que abre modal (dentro do checkbox) */
.link-inline {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--af-sea-700);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-inline:hover { color: var(--af-sea-900); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  z-index: 100;
  transform: translate(-50%, 180%);
  max-width: calc(100% - 2rem);
  padding: 0.8rem 1.3rem;
  border-radius: 999px;
  background: var(--af-sea-900);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  transition: transform var(--motion-med) var(--ease);
}
.toast.on { transform: translate(-50%, 0); }
.toast--ok { background: var(--af-ok); }
.toast--err { background: var(--af-danger); }

.warn {
  display: flex;
  gap: 0.7rem;
  background: rgba(196, 92, 62, 0.1);
  border-left: 3px solid var(--af-coral);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  margin: 1rem 0;
}
.warn .ic { color: var(--af-coral); margin-top: 0.15rem; }

.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--af-muted);
}
.empty strong {
  display: block;
  font: 700 1.4rem var(--font-display);
  color: var(--af-sea-900);
  margin-bottom: 0.4rem;
}

.lang-switcher form {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: rgba(14, 74, 92, 0.08);
}
.lang-switcher button {
  min-height: 36px;
  min-width: 2.5rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--af-sea-900);
}
.lang-switcher button[aria-current="true"] {
  background: var(--af-sea-700);
  color: #fff;
}

@keyframes af-rise {
  from { opacity: 0; transform: translateY(18px); }
}

/* Post upload — preview + overlay de progresso */
.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0 0;
}
.photo-preview[hidden] { display: none !important; }
.photo-preview__item {
  position: relative;
  margin: 0;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--af-foam);
}
.photo-preview__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-preview__rm {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.6rem;
  height: 1.6rem;
  border: 0;
  border-radius: 999px;
  background: rgba(10, 30, 36, 0.72);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.compress-status {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--af-muted);
}
.af-upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(8, 28, 34, 0.55);
  backdrop-filter: blur(4px);
}
.af-upload-overlay[hidden] { display: none !important; }
.af-upload-overlay__card {
  width: min(22rem, 100%);
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.25rem 1.5rem;
  box-shadow: var(--shadow-soft);
  text-align: center;
}
.af-upload-overlay__card p {
  margin: 0 0 0.85rem;
  font: 600 1rem var(--font-body);
  color: var(--af-sea-900);
}
.af-upload-overlay__track {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(14, 74, 92, 0.12);
  overflow: hidden;
}
.af-upload-overlay__bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--af-coral, #c45c3e);
  transition: width 0.15s ease-out;
}
