/* ==========================================================================
   Textacho — hoja de estilo propia
   Estilo "editor limpio" para escritores. Paleta crema/papel + tinta + naranja.
   Mobile-first. Sin librerías externas.
   ========================================================================== */

:root {
  /* Paleta papel/tinta/naranja */
  --paper:      #f7f3ea;   /* fondo crema */
  --paper-2:    #fffdf7;   /* tarjetas, más claro */
  --paper-3:    #efe8d8;   /* bordes suaves / franjas */
  --ink:        #2a2622;   /* texto principal, tinta oscura */
  --ink-soft:   #5c554c;   /* texto secundario */
  --ink-faint:  #8a8177;   /* metadatos */
  --accent:     #d9662b;   /* naranja tinta */
  --accent-2:   #b84e1c;   /* naranja oscuro (hover) */
  --accent-bg:  #fbe9dd;   /* fondo naranja suave */
  --ok:         #3f7d4e;
  --warn:       #b8860b;
  --danger:     #b3402b;
  --line:       #e2d9c6;   /* líneas divisorias */

  /* Tipografía */
  --serif: Georgia, "Times New Roman", "Iowan Old Style", "Palatino Linotype", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  "SFMono-Regular", ui-monospace, "Cascadia Mono", "Consolas", "Liberation Mono", Menlo, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(42,38,34,.06), 0 8px 24px rgba(42,38,34,.06);
  --maxw: 940px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #1c1a17;
    --paper-2:   #26231f;
    --paper-3:   #2f2b26;
    --ink:       #ece5d8;
    --ink-soft:  #b9b0a1;
    --ink-faint: #8c8375;
    --accent:    #e07a44;
    --accent-2:  #f0915d;
    --accent-bg: #3a2c22;
    --line:      #38332c;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  /* textura sutil de papel con degradado apenas perceptible */
  background-image:
    radial-gradient(circle at 20% 0%, rgba(217,102,43,.04), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(217,102,43,.03), transparent 35%);
  background-attachment: fixed;
}

/* ------- Tipografía titulares (serif) ------- */
h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--ink);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.01em;
}
h1 { font-size: 2rem; margin: 0 0 .4em; }
h2 { font-size: 1.5rem; margin: 1.8em 0 .5em; }
h3 { font-size: 1.2rem; margin: 1.4em 0 .4em; }

p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }

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

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

/* ------- Skip link ------- */
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0; z-index: 200;
}
.skip:focus { left: 0; }

/* ------- Header / nav ------- */
.site-header {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(1.1);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 16px;
  min-height: 62px; flex-wrap: wrap;
}
.brand {
  font-family: var(--serif);
  font-weight: 700; font-size: 1.35rem;
  color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand .logo {
  font-size: 1.3rem;
  filter: saturate(1.2);
}
.brand b { color: var(--accent); }

.nav-toggle {
  margin-left: auto;
  display: none;
  background: transparent; border: 1px solid var(--line);
  color: var(--ink); border-radius: var(--radius-sm);
  font-size: 1.1rem; padding: 6px 12px; cursor: pointer;
}

.main-nav { margin-left: auto; }
.main-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.main-nav a {
  display: block; padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: .95rem; font-weight: 500;
}
.main-nav a:hover { background: var(--accent-bg); color: var(--accent-2); text-decoration: none; }
.main-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-bg); }

@media (max-width: 720px) {
  .nav-toggle { display: inline-block; }
  .main-nav {
    flex-basis: 100%; margin-left: 0;
    display: none;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 2px; padding-bottom: 12px; }
  .main-nav a { padding: 10px 12px; }
}

/* ------- Hero ------- */
.hero { padding: 40px 0 8px; }
.hero .eyebrow {
  color: var(--accent); font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .12em;
  font-family: var(--sans); margin: 0 0 8px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 2.9rem); margin-bottom: .3em; }
.hero .lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 60ch; }

/* ------- Main / secciones ------- */
main { padding: 24px 0 60px; }
.section { margin: 40px 0; }

/* ------- Cards ------- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

/* ------- Herramienta (editor) ------- */
.tool { margin: 24px 0; }
.tool-grid { display: grid; gap: 18px; }
@media (min-width: 860px) {
  .tool-grid.split { grid-template-columns: 1fr 1fr; align-items: start; }
}

.field-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .85rem; color: var(--ink-faint); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px;
}

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  line-height: 1.6;
  resize: vertical;
}
textarea {
  min-height: 240px;
  /* rayado sutil de cuaderno */
  background-image: linear-gradient(var(--paper-2) 0, var(--paper-2) 100%);
}
textarea:focus, input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
textarea::placeholder, input::placeholder { color: var(--ink-faint); }

.output-box {
  font-family: var(--mono);
  font-size: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-height: 240px;
  overflow: auto;
}

/* ------- Botones ------- */
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.btn {
  font-family: var(--sans);
  font-size: .95rem; font-weight: 600;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-ghost { background: transparent; }
.btn[aria-pressed="true"] { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-2); }
.btn.copied { background: var(--ok); border-color: var(--ok); color: #fff; }

.opt-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.opt-row label { font-size: .95rem; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; }
.opt-row input[type="number"] { width: 90px; }
.opt-row select { width: auto; min-width: 140px; }

/* ------- Estadísticas ------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 18px 0;
}
@media (min-width: 560px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 780px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat .num {
  font-family: var(--serif);
  font-size: 1.7rem; font-weight: 700; color: var(--accent);
  line-height: 1.1; display: block;
}
.stat .lbl {
  font-size: .72rem; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; display: block;
}

/* ------- Contador de redes ------- */
.net-list { display: grid; gap: 10px; margin: 16px 0; }
.net {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.net .net-ico { font-size: 1.3rem; width: 1.6em; text-align: center; }
.net .net-name { font-weight: 600; min-width: 120px; }
.net .net-bar {
  flex: 1; height: 8px; background: var(--paper-3);
  border-radius: 99px; overflow: hidden;
}
.net .net-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s, background .2s; }
.net .net-count { font-family: var(--mono); font-size: .9rem; min-width: 90px; text-align: right; color: var(--ink-soft); }
.net.over .net-fill { background: var(--danger); }
.net.over .net-count { color: var(--danger); font-weight: 700; }
.net.warn .net-fill { background: var(--warn); }

/* ------- Aviso / toast ------- */
.notice {
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  padding: 12px 16px; border-radius: var(--radius-sm);
  color: var(--ink); margin: 16px 0; font-size: .95rem;
}
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: 99px; font-size: .9rem; font-weight: 500;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------- Contenido de texto (artículos) ------- */
.prose { max-width: 68ch; }
.prose h2 { border-bottom: 1px solid var(--line); padding-bottom: .2em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }
.prose code {
  font-family: var(--mono); font-size: .9em;
  background: var(--paper-3); padding: 2px 6px; border-radius: 4px;
}
.prose blockquote {
  margin: 1em 0; padding: 6px 18px; border-left: 3px solid var(--accent);
  color: var(--ink-soft); font-style: italic;
}

/* ------- Rejilla de herramientas (home / índice) ------- */
.tool-cards {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 620px) { .tool-cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .tool-cards { grid-template-columns: 1fr 1fr 1fr; } }
.tool-cards a.tcard {
  display: block; text-decoration: none; color: inherit;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  transition: transform .1s, border-color .12s, box-shadow .12s;
}
.tool-cards a.tcard:hover {
  transform: translateY(-2px); border-color: var(--accent);
  box-shadow: var(--shadow); text-decoration: none;
}
.tool-cards .tc-ico { font-size: 1.8rem; }
.tool-cards h3 { margin: 10px 0 4px; }
.tool-cards p { color: var(--ink-soft); font-size: .95rem; margin: 0; }

/* ------- FAQ ------- */
.faq details {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-2); margin-bottom: 10px; padding: 0 16px;
}
.faq summary {
  cursor: pointer; padding: 14px 0; font-weight: 600;
  font-family: var(--serif); font-size: 1.05rem; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: "\2013"; }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq .faq-a { padding: 12px 0 16px; color: var(--ink-soft); }

/* ------- Ad slot placeholder ------- */
.ad-slot {
  margin: 28px 0; padding: 14px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--ink-faint); font-size: .8rem; background: var(--paper);
  min-height: 90px; display: flex; align-items: center; justify-content: center;
}

/* ------- Footer ------- */
.site-footer {
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  padding: 40px 0 30px; margin-top: 40px;
  font-size: .92rem; color: var(--ink-soft);
}
.footer-grid {
  display: grid; gap: 26px; grid-template-columns: 1fr;
}
@media (min-width: 640px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 { font-family: var(--serif); font-size: 1rem; margin: 0 0 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--accent); }
.footer-bottom {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  font-size: .85rem; color: var(--ink-faint);
}

/* ------- Breadcrumb ------- */
.crumbs { font-size: .85rem; color: var(--ink-faint); margin: 20px 0 0; }
.crumbs a { color: var(--ink-soft); }

/* ------- Cookie banner ------- */
.cookie {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 250;
  background: var(--paper-2); border-top: 1px solid var(--line);
  padding: 16px 20px; box-shadow: 0 -4px 24px rgba(0,0,0,.08);
  display: none;
}
.cookie.show { display: block; }
.cookie .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.cookie p { margin: 0; flex: 1; min-width: 220px; font-size: .9rem; color: var(--ink-soft); }
.cookie .cookie-btns { display: flex; gap: 8px; }

/* ------- 404 ------- */
.notfound { text-align: center; padding: 60px 0; }
.notfound .big { font-family: var(--serif); font-size: 5rem; color: var(--accent); line-height: 1; margin: 0; }

/* ------- utilidades ------- */
.center { text-align: center; }
.muted { color: var(--ink-faint); }
.mt0 { margin-top: 0; }
.small { font-size: .88rem; }
hr.rule { border: none; border-top: 1px solid var(--line); margin: 32px 0; }
