/* ==========================================================================
   BASE — colores, tipografías, texturas y piezas comunes
   ========================================================================== */

@font-face { font-family: 'EB Garamond'; font-weight: 400; font-style: normal; font-display: swap; src: url('../assets/fonts/eb-garamond-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 500; font-style: normal; font-display: swap; src: url('../assets/fonts/eb-garamond-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 600; font-style: normal; font-display: swap; src: url('../assets/fonts/eb-garamond-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 400; font-style: italic; font-display: swap; src: url('../assets/fonts/eb-garamond-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 400; font-style: normal; font-display: swap; src: url('../assets/fonts/montserrat-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 500; font-style: normal; font-display: swap; src: url('../assets/fonts/montserrat-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 600; font-style: normal; font-display: swap; src: url('../assets/fonts/montserrat-latin-600-normal.woff2') format('woff2'); }

:root {
  /* Identidad Elemental */
  --verde: #364d3e;
  --verde-osc: #26372c;
  --verde-claro: #e3e8df;
  --acento: #c4590f;
  --acento-osc: #a5470a;
  --crema: #f5f3ee;
  --arena: #f4eed7;
  --texto: #333333;
  /* Toques Catriman */
  --fuego: #f5a44e;
  --brasa: #e07a2c;
  --tierra: #8a5a3b;
  --madera: #b98a5e;
  --carbon: #2b2621;
  --suave: #6b655c;
  --linea: rgba(54, 77, 62, 0.14);
  --linea-fuerte: rgba(54, 77, 62, 0.28);

  --ok: #4f7a4a;
  --aviso: #c98a1b;
  --alerta: #b9461a;

  --serif: 'EB Garamond', Garamond, 'Times New Roman', serif;
  --sans: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radio: 18px;
  --radio-s: 12px;
  --sombra: 0 1px 2px rgba(43, 38, 33, .05), 0 8px 24px -12px rgba(43, 38, 33, .18);
  --sombra-alta: 0 2px 4px rgba(43, 38, 33, .06), 0 18px 40px -16px rgba(43, 38, 33, .28);
  --lado: 16px;
  --ease: cubic-bezier(.22, .61, .36, 1);

  /* Textura de papel (ruido muy suave) */
  --papel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .18 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* Vetas de madera muy sutiles */
  --vetas: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='120'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.004 .09' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .18 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E");
}

@media (min-width: 720px) { :root { --lado: 28px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--texto);
  background-color: var(--crema);
  background-image: var(--papel);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; color: var(--verde); line-height: 1.12; margin: 0; letter-spacing: -0.005em; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: var(--acento); }
:focus-visible { outline: 3px solid var(--fuego); outline-offset: 3px; border-radius: 6px; }

.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Iconos ---------- */
.ico { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 52px; padding: .8em 1.5em;
  border: 0; border-radius: 999px;
  font-family: var(--sans); font-weight: 600; font-size: 1rem; letter-spacing: .01em;
  background: var(--verde); color: #fff;
  box-shadow: 0 6px 18px -8px rgba(38, 55, 44, .6);
  transition: transform .2s var(--ease), background-color .2s, box-shadow .2s;
  text-decoration: none; touch-action: manipulation;
}
.btn:hover { background: var(--verde-osc); }
.btn:active { transform: scale(.97); }
.btn--fuego { background: var(--acento); box-shadow: 0 8px 22px -8px rgba(196, 89, 15, .65); }
.btn--fuego:hover { background: var(--acento-osc); }
.btn--claro { background: #fff; color: var(--verde); box-shadow: var(--sombra); }
.btn--claro:hover { background: var(--arena); }
.btn--borde { background: transparent; color: var(--verde); box-shadow: inset 0 0 0 1.5px var(--linea-fuerte); }
.btn--borde:hover { background: rgba(54, 77, 62, .06); }
.btn--grande { min-height: 64px; padding: 1em 2em; font-size: 1.12rem; }
.btn--redondo { width: 52px; min-height: 52px; padding: 0; }

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: #fff; border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 22px;
  position: relative;
}
.tarjeta--arena { background: var(--arena); background-image: var(--papel); }

.etiqueta {
  display: inline-flex; align-items: center; gap: .45em;
  font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--acento);
}
.pastilla {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .28em .8em; border-radius: 999px;
  font-size: .78rem; font-weight: 500;
  background: var(--verde-claro); color: var(--verde);
}
.pastilla--fuego { background: #fbe3cc; color: var(--acento-osc); }
.pastilla--pendiente { background: transparent; color: var(--suave); box-shadow: inset 0 0 0 1px currentColor; border: 0; }

/* ---------- Foto / ilustración de relleno ---------- */
.foto {
  position: relative; overflow: hidden; margin: 0;
  border-radius: var(--radio);
  background: var(--arena);
}
.foto > svg.ilus { position: absolute; inset: 0; width: 100%; height: 100%; }
.foto > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Logo con texto de respaldo ---------- */
.logo { display: inline-flex; align-items: center; gap: .55em; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.logo img { height: 100%; width: auto; }
.logo__texto { font-family: var(--serif); font-size: 1.15em; color: var(--verde); letter-spacing: .01em; white-space: nowrap; }
.logo__marca { width: 1.6em; height: 1.6em; flex: none; }

/* ---------- Pie ---------- */
.pie-demo {
  font-size: .72rem; letter-spacing: .06em; color: var(--suave); text-align: center; opacity: .8;
}

/* ---------- Avisos efímeros ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 90;
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--carbon); color: #fff; padding: .8em 1.3em; border-radius: 999px;
  font-size: .92rem; box-shadow: var(--sombra-alta);
  transition: opacity .3s, transform .3s var(--ease); pointer-events: none;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
