/* ============================================================
   Donación · Terremoto 2026 — Apple-style UI
   Mobile-first. Sólo capa visual; la lógica vive en app.js
   ============================================================ */

/* ── Design tokens ── */
:root {
  --bg:          #F5F5F7;
  --surface:     #FFFFFF;
  --surface-2:   #FAFAFA;

  --text:        #1D1D1F;
  --text-2:      #6E6E73;
  --text-3:      #86868B;

  --line:        rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);

  --accent:      #007AFF;
  --accent-ink:  #0061CC;
  --positive:    #34C759;
  --positive-ink:#248A3D;
  --alert:       #FF9500;
  --error:       #FF3B30;

  --glass:       rgba(245, 245, 247, 0.72);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-pill: 980px;

  --shadow-card: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --shadow-soft: 0 1px 1px rgba(0,0,0,.03), 0 3px 12px rgba(0,0,0,.04);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Inter", "Segoe UI", Roboto, sans-serif;

  --maxw: 680px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent); text-decoration: none; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -60px; left: 12px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-md);
  z-index: 200;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

/* ── Header (frosted glass) ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.header-titles { min-width: 0; }
.site-title {
  font-size: 1.0625rem;       /* 17px */
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
  white-space: nowrap;
}
.site-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0;
}
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 0 rgba(52,199,89,.5);
  animation: livePulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(52,199,89,.45); }
  70%  { box-shadow: 0 0 0 6px rgba(52,199,89,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,199,89,0); }
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.lang-toggle {
  display: flex;
  gap: 2px;
  background: rgba(0,0,0,0.06);
  border-radius: 9px;
  padding: 2px;
  flex-shrink: 0;
}
.lang-btn {
  padding: 4px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: background .18s, color .18s;
  font-family: var(--font);
  letter-spacing: 0.01em;
}
.lang-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.lang-btn:active { opacity: .7; }
.header-link {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  text-align: right;
  line-height: 1.25;
  max-width: 120px;
}
.header-link:active { opacity: .55; }

/* ── Status bar ── */
.status-bar {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.875rem;
  line-height: 1.45;
}
.status-bar.error { background: rgba(255,59,48,.08);  color: #B3261E; }
.status-bar.info  { background: rgba(0,122,255,.08);  color: var(--accent-ink); }
.hidden { display: none !important; }

/* ── Intro ── */
.intro-section {
  padding: 20px 0 4px;
}
.intro-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 10px;
}
.intro-text:last-child { margin-bottom: 0; }

/* ── Filters (iOS chip scroller) ── */
.filters-section {
  padding: 16px 0 6px;
}
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-btn {
  flex-shrink: 0;
  appearance: none;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-2);
  background: rgba(0,0,0,.05);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, transform .12s ease;
}
.filter-btn:hover { background: rgba(0,0,0,.08); }
.filter-btn:active { transform: scale(.95); }
.filter-btn.active {
  background: var(--accent);
  color: #fff;
}
.filter-sep {
  flex-shrink: 0;
  width: 0.5px;
  align-self: center;
  height: 20px;
  background: var(--line-strong);
  margin: 0 2px;
}

/* ── Category group ── */
.cat-group {
  margin-top: 30px;
  animation: rise .45s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cat-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 12px;
  font-size: 1.375rem;        /* 22px */
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.cat-count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-3);
  background: rgba(0,0,0,.05);
  padding: 2px 9px;
  border-radius: var(--r-pill);
  letter-spacing: 0;
}

/* ── Org card ── */
.org-card {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 18px 16px;
  margin-bottom: 14px;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.org-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1.0625rem;       /* 17px */
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  line-height: 1.3;
}
.org-name:active { opacity: .55; }

.badges { display: flex; gap: 6px; flex-shrink: 0; }
.badge {
  font-size: 0.6875rem;       /* 11px */
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.badge-nacional      { background: rgba(52,199,89,.14);  color: var(--positive-ink); }
.badge-internacional { background: rgba(0,122,255,.12);  color: var(--accent-ink); }
.badge-otro          { background: rgba(0,0,0,.05);      color: var(--text-3); }

.fuente-link {
  flex-shrink: 0;
  width: 100%;
  margin-top: 2px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
}
.fuente-link:active { opacity: .55; }

.org-rubro {
  margin-top: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: -0.005em;
}

/* ── Métodos de donación (filas tappables tipo iOS) ── */
.methods {
  margin-top: 14px;
  border-top: 0.5px solid var(--line);
}
.method {
  display: block;
  border-bottom: 0.5px solid var(--line);
}
.method:last-child { border-bottom: none; }

/* fila: label izquierda + acción/hint derecha */
.method-summary,
.method-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px;
  cursor: pointer;
  list-style: none;
  border-radius: 10px;
  transition: background .18s ease;
}
.method-summary::-webkit-details-marker { display: none; }
.method-summary:hover,
.method-link:hover { background: rgba(0,0,0,.025); }
.method-summary:active,
.method-link:active { background: rgba(0,0,0,.05); }

.method-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.method-flag { font-size: 1.05rem; line-height: 1; }

/* acción de enlace directo */
.method-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent);
  white-space: nowrap;
}
.method-arrow { transition: transform .2s ease; }
.method-link:hover .method-arrow { transform: translateX(3px); }

/* hint del acordeón */
.method-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
}
.chev {
  width: 7px; height: 7px;
  border-right: 1.8px solid var(--text-3);
  border-bottom: 1.8px solid var(--text-3);
  transform: rotate(-45deg);
  transition: transform .25s ease;
}
.method-acc[open] .chev { transform: rotate(45deg); }
.method-acc[open] .method-hint { color: var(--accent); }
.method-acc[open] .chev {
  border-color: var(--accent);
  transform: rotate(45deg);
}

/* cuerpo desplegado — altura animada vía JS */
.method-body {
  height: 0;
  overflow: hidden;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-line;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
  transition: height .32s cubic-bezier(.22,.61,.36,1);
}
.method-acc[open] .method-body { padding: 2px 2px 16px; }
/* si el detalle se abre sin JS (reduce-motion), que muestre todo */
@media (prefers-reduced-motion: reduce) {
  .method-acc[open] .method-body { height: auto; }
}

/* ── Empty / loading ── */
.empty-msg {
  text-align: center;
  color: var(--text-3);
  font-size: 0.9375rem;
  padding: 48px 0;
}

/* ── Guía anti-fraude ── */
.guia {
  margin: 44px 0 12px;
  padding: 28px 24px 24px;
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-soft);
}
.guia-title {
  font-size: 1.5rem;          /* 24px */
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--text);
}
.guia-intro {
  margin-top: 8px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-2);
}
.guia-subtitle {
  margin-top: 24px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--alert);
}
.guia-list {
  list-style: none;
  margin-top: 6px;
}
.guia-item {
  padding: 16px 0;
  border-bottom: 0.5px solid var(--line);
}
.guia-item:last-child { border-bottom: none; }
.guia-item-title {
  position: relative;
  padding-left: 18px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.4;
}
.guia-item-title::before {
  content: "";
  position: absolute;
  left: 0; top: 0.5em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--alert);
}
.guia-item-desc {
  margin-top: 6px;
  padding-left: 18px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-2);
}
.guia-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 0.5px solid var(--line);
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
}

/* ── Footer ── */
.site-footer {
  margin-top: 28px;
  padding: 26px 0 calc(34px + env(safe-area-inset-bottom));
  border-top: 0.5px solid var(--line);
}
.site-footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.site-footer nav {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
}
.site-footer nav a { font-weight: 500; }
.site-footer nav span { color: var(--text-3); }
.footer-note {
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ── Tablet / desktop refinements ── */
@media (min-width: 600px) {
  .site-title { font-size: 1.1875rem; }
  .don-section { grid-template-columns: 1fr 1fr; }
  .fuente-link { width: auto; margin-top: 0; margin-left: auto; }
  .org-rubro { margin-top: 10px; }
}

/* ── Reduce motion ── */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
}
