/* ============================================================
   mayusculasminusculas.ar — Sistema visual unificado
   app.css  ·  Cáscara, navegación, componentes compartidos
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  /* Identidad (no tocar: son la marca) */
  --brand-900: #0b3940;
  --brand-800: #0f4a54;
  --brand-700: #13525c;
  --brand: #196774;
  --brand-400: #40a9bb;
  --brand-100: #d7e9eb;
  --brand-50: #eef6f6;

  /* Neutros */
  --ink: #15262a;
  --ink-2: #41585f;
  --ink-3: #6d878e;
  --line: #ccdadb;
  --line-2: #c6dbde;
  --surface: #ffffff;
  --surface-2: #f7fbfb;
  --bg: #eef4f4;

  /* Semánticos */
  --ok: #0f8a4a;
  --ok-soft: #e7f7ee;
  --danger: #b03a2e;
  --danger-soft: #fbeceb;

  /* Acento activo — lo reescribe cada herramienta */
  --accent: var(--brand);
  --accent-strong: var(--brand-800);
  --accent-soft: var(--brand-50);
  --accent-line: var(--brand-100);
  --accent-on: #ffffff;

  /* Geometría */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(11, 57, 64, .06), 0 1px 3px rgba(11, 57, 64, .05);
  --shadow-2: 0 4px 16px -6px rgba(11, 57, 64, .18);
  --shadow-3: 0 18px 40px -18px rgba(11, 57, 64, .35);

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --shell: 980px;
  --nav-h: 62px;
  --header-h: 58px;
}

/* Acento por herramienta: un solo swap de variables unifica todo */
body[data-tool="whatsapp"] {
  --accent: #0f8a4a;
  --accent-strong: #0b6b3a;
  --accent-soft: #eaf8f0;
  --accent-line: #c6e9d6;
}

body[data-tool="rss"] {
  --accent: #b6480f;
  --accent-strong: #8f380b;
  --accent-soft: #fdf1e9;
  --accent-line: #f6d8c4;
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
}

button,
input,
select,
textarea { font: inherit; color: inherit; }

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-weight: 700;
  text-decoration: none;
  transition: top .16s ease;
}
.skip-link:focus { top: 12px; }

.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;
}

/* ---------- 3. Encabezado ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0px 0px 28px -2px #00000042;
}

/* IMPORTANTE — no agregar backdrop-filter, filter, transform, perspective ni
   will-change acá mientras la barra de herramientas viva adentro del <header>.
   Cualquiera de esas propiedades convierte al elemento en bloque contenedor de
   sus descendientes con position:fixed, así que la .toolnav dejaría de anclarse
   al viewport y se pegaría al borde inferior del encabezado, tapando el logo.
   Por eso el desenfoque se aplica sólo a partir de 860px, donde la .toolnav ya
   es position:static y no la afecta. */
@media (min-width: 860px) {
  .site-header {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(1.4) blur(10px);
  }
}

.site-header__inner {
  max-width: var(--shell);
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--brand-900);
  flex: 0 0 auto;
}

.brand__mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.brand__name {
  font-size: .95rem;
  line-height: 1.1;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.brand__name b { font-weight: 800; }
.brand__name span { font-weight: 500; color: var(--ink-2); }
.brand__name i { font-style: normal; font-weight: 500; color: var(--ink-3); }

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.iconbtn {
  height: 36px;
  min-width: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--brand-800);
  border-radius: var(--r-pill);
  font-size: .8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, transform .08s ease;
}
.iconbtn:hover { background: var(--brand-50); }
.iconbtn:active { transform: scale(.96); }
.iconbtn[hidden] { display: none; }
.iconbtn svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- 4. Navegación de herramientas ----------
   Un solo elemento: barra flotante en móvil, segmentado en el header en escritorio. */
.toolnav {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  width: min(440px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(1.5) blur(12px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-3);
  transition: transform .22s ease, opacity .18s ease;
}

.toolnav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  border-radius: var(--r-pill);
  text-decoration: none;
  color: var(--ink-3);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .01em;
  transition: background .15s ease, color .15s ease;
}
.toolnav__item:hover { color: var(--brand-800); background: var(--brand-50); }

.toolnav__icon {
  display: grid;
  place-items: center;
  height: 18px;
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: -.03em;
}
.toolnav__icon svg { width: 18px; height: 18px; fill: currentColor; }

.toolnav__item[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-on);
  box-shadow: 0 6px 14px -6px var(--accent);
}
.toolnav__item[aria-current="page"]:hover {
  background: var(--accent-strong);
  color: var(--accent-on);
}

/* Se aparta cuando se abre el teclado del móvil */
body.kb-open .toolnav {
  transform: translate(-50%, 160%);
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 860px) {
  .toolnav {
    position: static;
    transform: none;
    width: auto;
    margin-left: 18px;
    display: flex;
    gap: 2px;
    padding: 4px;
    background: var(--surface-2);
    border-radius: var(--r-pill);
    box-shadow: none;
    backdrop-filter: none;
  }
  .toolnav__item {
    flex-direction: row;
    gap: 7px;
    min-height: 36px;
    padding: 0 16px;
    font-size: .8125rem;
  }
  body.kb-open .toolnav { transform: none; opacity: 1; pointer-events: auto; }
  body { padding-bottom: 0; }
}

/* ---------- 5. Estructura de página ---------- */
.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.toolhead { margin: 4px 0 16px; }

.eyebrow {
  margin: 0 0 6px;
  font-size: .6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
}

.toolhead h1 {
  margin: 0;
  font-size: clamp(1.35rem, 1.05rem + 1.4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.2;
  color: var(--brand-900);
}

.toolhead .lede {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: .95rem;
  max-width: 62ch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0px 0px 20px 0px #0000001f;
  overflow: hidden;
}

.card__body { padding: 16px; }

@media (min-width: 720px) {
  .shell { padding: 28px 20px 56px; }
  .card__body { padding: 22px; }
}

/* ---------- 6. Campos de texto ---------- */
.field {
  position: relative;
  display: flex;
  flex-direction: column;
}

.field__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
}

.textarea {
  width: 100%;
  min-height: 168px;
  padding: 14px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 16px; /* evita el zoom automático en iOS */
  line-height: 1.55;
  resize: vertical;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.textarea::placeholder { color: #93aab0; }
.textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.textarea[readonly] { background: var(--accent-soft); border-color: var(--accent-line); }

/* Pastilla de estado: el componente que se repite en las tres herramientas */
.pill-meta {
  align-self: flex-end;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: .75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- 7. Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: .9375rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; fill: currentColor; flex: 0 0 auto; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary {
  background: var(--accent);
  color: var(--accent-on);
  box-shadow: 0 8px 18px -10px var(--accent);
}
.btn--primary:hover:not(:disabled) { background: var(--accent-strong); }

.btn--ghost {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--brand-800);
}
.btn--ghost:hover:not(:disabled) { background: var(--brand-50); }

.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--ink-3);
  min-height: 38px;
  padding: 0 10px;
  font-size: .8125rem;
}
.btn--quiet:hover:not(:disabled) { color: var(--danger); background: var(--danger-soft); }

.btn--block { width: 100%; }

/* Chips: selección de modo (una sola opción activa) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 42px;
  padding: 0 15px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}

/* Toggles: opciones acumulativas */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px 0 10px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font-size: .8125rem;
  font-weight: 700;
  cursor: pointer;
}
.toggle::before {
  content: "";
  width: 16px; height: 16px;
  border: 1.5px solid var(--line-2);
  border-radius: 5px;
  flex: 0 0 auto;
}
.toggle[aria-pressed="true"] {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.toggle[aria-pressed="true"]::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='M6.2 11.6 3 8.4l1.1-1.1 2.1 2.1 5-5L12.3 5z'/%3E%3C/svg%3E") center/contain no-repeat;
  border-color: var(--accent);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.actions .btn { flex: 1 1 180px; }

/* ---------- 8. Publicidad ----------
   Espacio siempre reservado: el bloque no puede empujar la herramienta. */
.adslot {
  max-width: var(--shell);
  margin: 22px auto;
  padding: 0 16px;
}

.adslot__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  background: rgba(255, 255, 255, .55);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
}

.adslot__tag {
  font-size: .625rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-3);
}

.adslot--mobile .adslot__inner { min-height: 62px; }

/* En local no se cargan anuncios: el hueco se marca para ver el espacio
   real que van a ocupar y detectar solapamientos antes de publicar. */
.adslot[data-ad-preview] .adslot__inner {
  background:
    repeating-linear-gradient(45deg,
      transparent 0 10px,
      rgba(25, 103, 116, .05) 10px 20px);
}
.adslot--flow .adslot__inner { min-height: 268px; }

@media (min-width: 860px) {
  .adslot--mobile { display: none; }
}
@media (max-width: 859px) {
  .adslot--desktop { display: none; }
}

/* ---------- 9. Contenido secundario / SEO ---------- */
.prose {
  max-width: 70ch;
  margin: 32px auto 0;
  color: var(--ink-2);
}
.prose h2 {
  margin: 30px 0 8px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.015em;
  color: var(--brand-900);
}
.prose h3 {
  margin: 22px 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-800);
}
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--accent); font-weight: 600; }

.faq { max-width: 70ch; margin: 0 auto; }
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  margin-bottom: 8px;
  overflow: hidden;
}
.faq summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 700;
  color: var(--brand-900);
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  float: right;
  font-weight: 800;
  color: var(--accent);
}
.faq details[open] summary::after { content: "−"; }
.faq details > p { margin: 0; padding: 0 16px 14px; color: var(--ink-2); font-size: .9375rem; }

.related {
  max-width: var(--shell);
  margin: 34px auto 0;
  padding: 0 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .related { grid-template-columns: 1fr 1fr; } }

.related__card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, transform .12s ease;
}
.related__card:hover { border-color: var(--brand-400); transform: translateY(-2px); }
.related__card strong { display: block; color: var(--brand-900); font-size: .95rem; }
.related__card span { font-size: .8125rem; color: var(--ink-3); }
.related__icon {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: var(--r-sm);
  background: var(--brand-50);
  color: var(--brand);
  font-weight: 800;
  font-size: .8125rem;
}
.related__icon svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- 10. Pie legal ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: 36px;
}
.site-footer__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 22px 16px 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: space-between;
  font-size: .8125rem;
  color: var(--ink-3);
}
.site-footer a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.site-footer a:hover { color: var(--brand); text-decoration: underline; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }

/* ---------- 11. Aviso, alertas, toast ---------- */
.alert {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: .9rem;
  margin: 14px 0;
}
.alert strong { font-weight: 800; }
.alert--error { background: var(--danger-soft); border-color: #f0c7c2; color: #8c2d22; }
.alert--ok { background: var(--ok-soft); border-color: #bfe7d1; color: #0a6537; }

.empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 26px 18px;
  text-align: center;
  color: var(--ink-3);
  font-size: .875rem;
}
.empty__glyph {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.05em;
  color: var(--accent-line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 22px);
  transform: translate(-50%, 12px);
  z-index: 120;
  max-width: calc(100% - 32px);
  padding: 11px 20px;
  border-radius: var(--r-pill);
  background: var(--brand-900);
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
  box-shadow: var(--shadow-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 860px) {
  .toast { bottom: 26px; }
}

/* ---------- 12. Hoja inferior (emojis, plantillas, ayuda) ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(11, 42, 48, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 140;
  max-width: 620px;
  margin: 0 auto;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-3);
  transform: translateY(101%);
  transition: transform .24s cubic-bezier(.32, .72, 0, 1);
}
.sheet.is-open { transform: translateY(0); }

.sheet__handle {
  width: 40px; height: 4px;
  margin: 10px auto 2px;
  border-radius: 2px;
  background: var(--line-2);
}
.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.sheet__head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--brand-900);
}
.sheet__close {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  border: none;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-800);
  font-size: 1rem;
  cursor: pointer;
}
.sheet__body {
  overflow-y: auto;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* ---------- 13. Utilidades ---------- */
.mono { font-family: var(--font-mono); }
.hide-mobile { display: none; }
@media (min-width: 720px) { .hide-mobile { display: initial; } }