/* ==========================================================================
   ConectaLetras — Fichas de letras
   Paleta: verde botella + crema + madera clara (estilo Scrabble).
   Tipografía serif humanista para titulares + sans del sistema para cuerpo.
   Mobile-first. Sin dependencias externas.
   ========================================================================== */

:root {
  --bottle:      #14432c;   /* verde botella, fondo profundo */
  --bottle-2:    #1c5638;   /* verde tablero */
  --bottle-3:    #0e3421;   /* verde más oscuro */
  --cream:       #f4ead2;   /* crema, fondo claro */
  --cream-2:     #fbf5e6;   /* crema clara, tarjetas */
  --tile:        #f2e2b8;   /* ficha de madera */
  --tile-edge:   #d8c188;   /* borde ficha */
  --tile-shadow: #b79a52;   /* sombra ficha */
  --wood:        #c99a5b;   /* madera clara / atril */
  --wood-dark:   #a97c3f;
  --ink:         #23301f;   /* texto oscuro sobre crema */
  --ink-dim:     #5c6b52;   /* texto atenuado */
  --ink-cream:   #f4ead2;   /* texto crema sobre verde */
  --ink-cream-dim:#c3d3bf;
  --accent:      #d24d3a;   /* rojo teja para acentos/CTA */
  --accent-2:    #e8a13c;   /* mostaza cálida */
  --gold:        #c99a5b;
  --ok:          #2f7d4f;
  --line:        rgba(35,48,31,.14);

  --radius: 16px;
  --radius-sm: 9px;
  --shadow: 0 10px 28px rgba(14,52,33,.18);
  --shadow-tile: 0 3px 0 var(--tile-shadow), 0 6px 14px rgba(120,90,30,.28);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, sans-serif;

  --wrap: 1080px;
}

/* Reset */
*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 50% -8%, rgba(28,86,56,.10), transparent 60%),
    var(--cream);
  line-height: 1.6;
  font-size: 17px;
  min-height: 100vh;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--bottle-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1,h2,h3,h4 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(1.9rem, 6vw, 3rem); letter-spacing: -.5px; }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.dim { color: var(--ink-dim); }
.center { text-align: center; }

/* ------------------------------ Header ------------------------------ */
.site-header {
  background: var(--bottle);
  color: var(--ink-cream);
  border-bottom: 4px solid var(--wood);
  position: sticky; top: 0; z-index: 40;
}
.nav {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--serif); font-size: 1.35rem; font-weight: 700;
  color: var(--ink-cream); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .tiles { display: inline-flex; gap: 3px; margin-right: 6px; }
.brand .t {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  background: var(--tile); color: var(--ink);
  border-radius: 5px; font-weight: 800; font-size: .95rem;
  box-shadow: 0 2px 0 var(--tile-shadow);
  font-family: var(--sans);
}
.nav-toggle {
  margin-left: auto;
  background: transparent; border: 1.5px solid rgba(244,234,210,.4);
  color: var(--ink-cream); font-size: 1.2rem;
  width: 42px; height: 40px; border-radius: 9px; cursor: pointer;
}
.nav-links { display: none; width: 100%; }
.nav-links.open { display: block; }
.nav-links a {
  display: block; padding: 10px 4px; color: var(--ink-cream);
  border-bottom: 1px solid rgba(244,234,210,.12);
}
.nav-links a[aria-current="page"] { color: var(--accent-2); font-weight: 700; }

@media (min-width: 760px) {
  .nav-toggle { display: none; }
  .nav-links { display: flex !important; width: auto; margin-left: auto; gap: 6px; }
  .nav-links a { border: none; padding: 8px 12px; border-radius: 8px; }
  .nav-links a:hover { background: rgba(244,234,210,.1); text-decoration: none; }
}

/* ------------------------------ Hero ------------------------------ */
.hero {
  background: linear-gradient(180deg, var(--bottle) 0%, var(--bottle-3) 100%);
  color: var(--ink-cream);
  padding: 34px 0 40px;
  border-bottom: 4px solid var(--wood);
}
.hero h1 { color: #fff; }
.hero .lead { color: var(--ink-cream-dim); font-size: 1.08rem; max-width: 40ch; }
.kicker {
  display: inline-block; font-size: .78rem; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--accent-2); font-weight: 700;
  margin-bottom: 8px;
}
.tiles-word { display: flex; gap: 5px; flex-wrap: wrap; margin: 4px 0 14px; }
.tile {
  position: relative;
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  background: var(--tile);
  color: var(--ink);
  border-radius: 8px;
  font-family: var(--serif); font-weight: 700; font-size: 1.5rem;
  box-shadow: var(--shadow-tile);
  text-transform: uppercase;
}
.tile .pts {
  position: absolute; right: 4px; bottom: 2px;
  font-family: var(--sans); font-size: .55rem; font-weight: 700;
  color: var(--ink-dim);
}

/* ------------------------------ Tool card ------------------------------ */
.tool {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 22px 0;
}
.tool.on-hero {
  margin-top: 22px;
  box-shadow: 0 16px 40px rgba(14,52,33,.35);
}
.tool h2 { display: flex; align-items: center; gap: 8px; }
.tool .badge {
  font-family: var(--sans); font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  background: var(--bottle-2); color: var(--cream);
  padding: 3px 8px; border-radius: 999px;
}

label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.field { margin-bottom: 14px; }
input[type="text"], select {
  width: 100%; padding: 12px 14px;
  font-size: 1.05rem; font-family: var(--sans);
  border: 2px solid var(--tile-edge);
  border-radius: var(--radius-sm);
  background: #fff; color: var(--ink);
}
input[type="text"]:focus, select:focus { border-color: var(--bottle-2); outline: none; }
.input-letras { letter-spacing: 3px; text-transform: uppercase; font-weight: 700; }

.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > .field { flex: 1 1 140px; margin-bottom: 0; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border: none; border-radius: var(--radius-sm);
  font-size: 1rem; font-weight: 700; font-family: var(--sans);
  background: var(--accent); color: #fff; cursor: pointer;
  box-shadow: 0 3px 0 #a83322;
  transition: transform .05s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #a83322; }
.btn.secondary { background: var(--bottle-2); box-shadow: 0 3px 0 var(--bottle-3); }
.btn.secondary:active { box-shadow: 0 1px 0 var(--bottle-3); }
.btn.ghost {
  background: transparent; color: var(--bottle-2);
  border: 2px solid var(--tile-edge); box-shadow: none;
}
.btn.small { padding: 8px 14px; font-size: .9rem; }

/* Resultados */
.results-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin: 18px 0 10px; flex-wrap: wrap;
}
.results-head .count { font-weight: 700; color: var(--bottle-2); }
.words {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.words li {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--tile); color: var(--ink);
  border: 1px solid var(--tile-edge);
  border-radius: 8px; padding: 6px 11px;
  font-weight: 600; text-transform: uppercase;
  box-shadow: 0 2px 0 var(--tile-shadow);
  font-size: .95rem;
}
.words li .len {
  font-family: var(--sans); font-size: .7rem; font-weight: 700;
  color: var(--ink-dim); background: rgba(0,0,0,.05);
  border-radius: 5px; padding: 1px 5px;
}
.words.by-group { display: block; }
.wgroup { margin-bottom: 14px; }
.wgroup h4 {
  font-family: var(--sans); font-size: .8rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--ink-dim); margin: 0 0 8px;
}
.wgroup ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

.empty { color: var(--ink-dim); font-style: italic; padding: 8px 0; }

/* Contador Scrabble */
.score-board {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 14px;
}
.score-tiles { display: flex; gap: 5px; flex-wrap: wrap; }
.score-total {
  font-family: var(--serif); font-weight: 700;
  background: var(--bottle-2); color: var(--cream);
  border-radius: 12px; padding: 12px 18px; text-align: center;
  min-width: 92px;
}
.score-total b { display: block; font-size: 2rem; line-height: 1; }
.score-total span { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; }

/* Chips valores letras */
.legend {
  margin-top: 12px; font-size: .85rem; color: var(--ink-dim);
}
.legend code {
  background: var(--tile); border: 1px solid var(--tile-edge);
  border-radius: 5px; padding: 1px 6px; font-weight: 700; color: var(--ink);
}

/* ------------------------------ Content ------------------------------ */
main { padding-bottom: 20px; }
.section { padding: 26px 0; }
.section.alt { background: var(--cream-2); border-block: 1px solid var(--line); }

.article { max-width: 68ch; }
.article h2 { margin-top: 1.4em; }
.article h3 { margin-top: 1.2em; }
.article ul, .article ol { padding-left: 1.3em; margin: 0 0 1em; }
.article li { margin-bottom: .4em; }
.article .meta { color: var(--ink-dim); font-size: .9rem; margin-bottom: 1.4em; }

.callout {
  background: var(--bottle);
  color: var(--ink-cream);
  border-radius: var(--radius);
  padding: 18px 20px; margin: 22px 0;
  border-left: 6px solid var(--accent-2);
}
.callout a { color: var(--accent-2); }

.cards { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 680px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 920px) { .cards.three { grid-template-columns: repeat(3,1fr); } }
.card {
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); display: block; color: inherit;
}
.card:hover { text-decoration: none; transform: translateY(-2px); transition: transform .12s; }
.card h3 { color: var(--bottle-2); }

/* FAQ */
.faq details {
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 4px 16px; margin-bottom: 10px;
}
.faq summary {
  cursor: pointer; font-weight: 700; padding: 10px 0;
  font-family: var(--serif); font-size: 1.05rem;
}
.faq details[open] summary { color: var(--bottle-2); }

/* ADSLOT */
.adslot {
  display: block; margin: 22px auto; max-width: 728px;
  min-height: 90px; border: 1px dashed var(--tile-edge);
  border-radius: var(--radius-sm); color: var(--ink-dim);
  display: grid; place-items: center; font-size: .8rem;
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(201,154,91,.06) 10px, rgba(201,154,91,.06) 20px);
}

/* ------------------------------ Footer ------------------------------ */
.site-footer {
  background: var(--bottle-3); color: var(--ink-cream-dim);
  border-top: 4px solid var(--wood); margin-top: 30px;
  padding: 30px 0 20px;
}
.footer-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 680px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 { color: var(--cream); font-family: var(--sans); font-size: .85rem; text-transform: uppercase; letter-spacing: 1px; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 7px; }
.footer-links a { color: var(--ink-cream-dim); }
.footer-links a:hover { color: var(--cream); }
.site-footer .brand { color: var(--cream); }
.copyright {
  border-top: 1px solid rgba(244,234,210,.14); margin-top: 22px; padding-top: 16px;
  font-size: .82rem; color: var(--ink-cream-dim);
}

/* Cookie banner */
.cookie-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60;
  background: var(--bottle); color: var(--ink-cream);
  border: 1px solid var(--wood); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  display: none; gap: 12px; align-items: center; flex-wrap: wrap;
}
.cookie-banner.show { display: flex; }
.cookie-banner p { margin: 0; flex: 1 1 240px; font-size: .9rem; }
.cookie-banner a { color: var(--accent-2); }
.cookie-banner .actions { display: flex; gap: 8px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: .9rem; opacity: 0; pointer-events: none; transition: all .25s; z-index: 70;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 680px) {
  .footer-grid { align-items: start; }
}
