/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #eceef6;
  --text: #232323;
  --muted: #6e6e6e;
  --line: #dcdde8;
  --accent: #45489a;
  --accent-strong: #363979;
  --accent-soft: #e9eaf6;
  --on-accent: #ffffff;
  --brand-red: #d80c0c;
  --corp-bar: #45489a;
  --corp-dark: #232323;
  --sans: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(35, 35, 35, .05), 0 12px 32px -12px rgba(35, 35, 35, .16);
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --radius: 18px;
  --radius-sm: 10px;
  --gutter: 16px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --surface: #1e1e1e;
    --surface-2: #2a2a33;
    --text: #f1f1f1;
    --muted: #a8a8b3;
    --line: #34343f;
    --accent: #8f93e8;
    --accent-strong: #b0b3f0;
    --accent-soft: #272a4d;
    --on-accent: #10123a;
    --brand-red: #ff5c5c;
    --corp-bar: #45489a;
    --corp-dark: #0f0f0f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .5);
    --warn: #f3b453;
    --warn-soft: #33270f;
    --danger: #f28b82;
    --danger-soft: #3a1a18;
    color-scheme: dark;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--accent); }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.02em; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: var(--gutter); }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 99;
  padding: .6rem 1rem; background: var(--text); color: var(--bg);
  border-radius: 8px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Header / footer
   ============================================================= */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); text-decoration: none; font-weight: 800; font-size: 1.15rem; }
.logo span { color: var(--text); letter-spacing: -0.02em; }
.header-note { color: var(--muted); font-size: .82rem; font-weight: 500; }

.site-footer { margin-top: 56px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; align-items: center; padding-block: 24px; }
.footer-inner nav { display: flex; gap: 18px; }
.footer-inner a { color: var(--muted); }

/* =============================================================
   5. Hero + tool card
   ============================================================= */
.hero { padding-top: 14px; }
.hero h1 { font-size: clamp(1.55rem, 1.1rem + 2.2vw, 2.4rem); font-weight: 800; }
.subtitle { color: var(--muted); margin-top: 4px; max-width: 60ch; font-size: .92rem; line-height: 1.5; }

.tool-card {
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  gap: 16px;
  grid-template-areas: "content" "preview" "design";
}
.tool-content { grid-area: content; min-width: 0; }
.tool-preview { grid-area: preview; min-width: 0; }
.tool-design { grid-area: design; min-width: 0; display: grid; gap: 14px; }

.noscript { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-weight: 600; grid-column: 1 / -1; }

/* Tabs */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.tabs [role="tab"] {
  padding: 6px; border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--muted);
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

/* Fields */
.panel { margin-top: 10px; display: grid; gap: 10px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field em { font-style: normal; font-weight: 500; opacity: .8; }
.field input, .field textarea, .field select, .size select {
  width: 100%; min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus, .field select:focus, .size select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-row { display: grid; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; font-weight: 500; cursor: pointer; align-self: end; padding-block: 8px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Preview */
.qr-stage {
  position: relative;
  display: grid; place-items: center;
  padding: 10px;
  border-radius: 14px;
  background: var(--surface-2);
}
.qr-stage[data-transparent="true"] {
  background-color: #fff;
  background-image: conic-gradient(#e6e8e4 25%, #fff 0 50%, #e6e8e4 0 75%, #fff 0);
  background-size: 16px 16px;
}
.qr-canvas { width: min(100%, 196px); aspect-ratio: 1; }
.qr-canvas canvas, .qr-canvas svg { width: 100% !important; height: 100% !important; }
.qr-badge {
  position: absolute; top: 10px; left: 10px;
  padding: 2px 9px; border-radius: 99px;
  background: var(--text); color: var(--bg);
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  opacity: 0; transition: opacity .2s;
}
.tool-card[data-state="idle"] .qr-badge { opacity: .85; }
.tool-card[data-state="idle"] .qr-canvas { opacity: .45; }
.tool-card[data-state="error"] .qr-canvas { opacity: .15; filter: grayscale(1); }

.qr-status { margin-top: 8px; font-size: .85rem; color: var(--muted); text-align: center; min-height: 1.4em; }
.tool-card[data-state="error"] .qr-status { color: var(--danger); font-weight: 600; }

.warnings { list-style: none; padding: 0; display: grid; gap: 6px; margin-top: 8px; }
.warnings:empty { display: none; }
.warnings li { padding: 7px 10px; border-radius: 9px; font-size: .82rem; line-height: 1.4; background: var(--warn-soft); color: var(--warn); }
.warnings li.is-danger { background: var(--danger-soft); color: var(--danger); }

.download { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.download .size { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.download .size select { width: auto; flex: 1; padding: 8px 10px; }
.download .btn-primary { grid-column: 1 / -1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 14px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 700; font-size: .95rem;
  transition: transform .15s var(--ease-out), background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-size: 1.02rem; min-height: 50px; }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn-small { min-height: 38px; padding: 7px 12px; font-size: .88rem; }
.btn.is-done { border-color: var(--accent); color: var(--accent); }
.btn-primary.is-done { color: var(--on-accent); }

/* Design controls */
.group { border: 0; padding: 0; min-width: 0; }
.group legend { font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; padding: 0; }

.styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.style-opt { cursor: pointer; }
.style-opt input { position: absolute; opacity: 0; pointer-events: none; }
.style-opt span {
  display: grid; justify-items: center; gap: 4px;
  padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line);
  font-size: .76rem; font-weight: 600; color: var(--muted);
  transition: border-color .15s, background .15s, color .15s;
}
.style-opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.style-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw { width: 24px; height: 24px; fill: currentColor; color: var(--text); }

.colors { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.color { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; cursor: pointer; }
.color input { width: 40px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; }

.center-opts { display: grid; gap: 10px; }
.emojis { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  font-size: 1.25rem; line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  transition: border-color .15s, background .15s;
}
.emoji:hover { border-color: var(--accent); }
.emoji[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.logo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.file-btn { position: relative; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-btn.is-active { border-color: var(--accent); background: var(--accent-soft); }

/* Under the tool */
.privacy-badge { margin-top: 14px; display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; color: var(--text); }
.privacy-badge svg { color: var(--accent); flex: none; margin-top: 2px; }
.limits { margin-top: 4px; font-size: .82rem; color: var(--muted); padding-left: 26px; }

/* =============================================================
   6. Content sections
   ============================================================= */
.ad-slot { margin-top: 32px; min-height: 100px; }
.ad-slot ins.adsbygoogle { width: 100%; }
.ad-incontent { min-height: 250px; }

.how, .seo, .faq { margin-top: 48px; }
.how h2, .seo h2, .faq h2 { font-size: clamp(1.3rem, 1rem + 1.2vw, 1.75rem); font-weight: 800; }
.steps { list-style: none; padding: 0; margin-top: 18px; display: grid; gap: 14px; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.steps svg { color: var(--accent); }
.steps h3 { margin-top: 10px; font-size: 1.05rem; }
.steps p { margin-top: 4px; color: var(--muted); font-size: .94rem; }

.prose { max-width: 760px; }
.prose p, .prose ul { margin-top: 12px; }
.prose h3 { margin-top: 26px; font-size: 1.15rem; }
.prose ul { padding-left: 1.2em; display: grid; gap: 6px; }

.faq { max-width: 760px; }
.faq h2 { margin-bottom: 14px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: 14px 28px 14px 0; position: relative;
  font-weight: 700;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font-size: 1.3rem; color: var(--accent); transition: transform .2s var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: 14px; color: var(--muted); }

/* Legal pages */
.legal { padding-top: 32px; }
.legal h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
.legal h2 { margin-top: 28px; font-size: 1.2rem; }
.legal .todo { background: var(--warn-soft); color: var(--warn); padding: 1px 6px; border-radius: 6px; font-weight: 600; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .qr-canvas { width: min(100%, 240px); }
  .subtitle { font-size: .98rem; }
  .tabs { grid-template-columns: repeat(6, 1fr); }
  .field-row { grid-template-columns: 1fr 1fr; }
  .download { grid-template-columns: auto 1fr auto auto; align-items: center; }
  .download .size { grid-column: auto; }
  .download .btn-primary { grid-column: auto; }
  .steps { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 960px) {
  .hero { padding-top: 36px; }
  .tool-card {
    padding: 22px;
    gap: 22px 28px;
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas: "content preview" "design preview";
    grid-template-rows: auto 1fr;
    align-items: start;
  }
  .tool-preview { position: sticky; top: 16px; }
  .qr-canvas { width: 100%; max-width: 280px; }
  .download { grid-template-columns: 1fr 1fr; }
  .download .size, .download .btn-primary { grid-column: 1 / -1; }
}

/* =============================================================
   9. Reduced motion (only intrusive effects)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* =============================================================
   10. Capa corporativa — mismos colores y cabecera que tecnohalecatez.com.co
   ============================================================= */
.site-header { background: var(--corp-bar); border-bottom: 0; color: #fff; }
.header-inner { flex-wrap: wrap; gap: 6px 14px; padding-block: 8px; min-height: 60px; }
.brand-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.corp { display: block; flex: none; line-height: 0; }
.corp img { height: 26px; width: auto; }
.brand-sep { width: 1px; height: 24px; background: rgba(255, 255, 255, .35); flex: none; }
.site-header .logo { color: var(--brand-red); }
.site-header .logo span { color: #fff; }
.site-header .header-note { color: rgba(255, 255, 255, .8); }
.site-header a.header-note:hover { color: #fff; }
.site-header .tool-nav a { color: rgba(255, 255, 255, .82); }
.site-header .tool-nav a:hover, .site-header .tool-nav a.is-current { color: #fff; background: rgba(255, 255, 255, .15); }
.site-footer { background: var(--corp-dark); color: #b9b9b9; border-top: 0; }
.site-footer a { color: #e6e6e6; }
.site-footer .credits a { color: #b9b9b9; }
@media (max-width: 539px) {
  .corp img { height: 20px; }
  .brand-group { gap: 8px; }
  .site-header .logo span { font-size: 1rem; }
  .site-header .header-note { display: none; }
}

/* Migas de pan y tarjetas de herramientas (la página /herramientas/) */
.breadcrumb { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--accent); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }
.suite-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.suite-card { display: grid; grid-template-columns: 36px 1fr; gap: 4px 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.suite-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.suite-card img { width: 36px; height: 36px; grid-row: span 2; }
.suite-card strong { color: var(--accent); font-size: .98rem; }
.suite-card span { font-size: .86rem; color: var(--muted); line-height: 1.45; }

/* Menú de la categoría en la cabecera (lo genera scripts/sync_tools.py) */
.tool-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.tool-nav a { padding: 6px 10px; border-radius: 8px; font-weight: 700; font-size: .88rem; text-decoration: none; }
.site-header .tool-nav a { color: rgba(255, 255, 255, .82); }
.site-header .tool-nav a:hover, .site-header .tool-nav a.is-current { color: #fff; background: rgba(255, 255, 255, .15); }

/* El menú de la categoría es una sola fila: si sus enlaces no caben (celular, tableta), se desliza en vez de ensanchar la página */
.site-header .tool-nav { min-width: 0; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.site-header .tool-nav::-webkit-scrollbar { display: none; }
.site-header .tool-nav a { flex: none; white-space: nowrap; }

/* Celulares muy estrechos (320-379 px): logo y nombre algo más pequeños para que quepan */
@media (max-width: 379px) {
  .brand-group { gap: 6px; }
  .corp img { height: 16px; }
  .site-header .logo { gap: 6px; }
  .site-header .logo svg { width: 24px; height: 24px; flex: none; }
  .site-header .logo span { font-size: .92rem; }
}

/* Botones «¿Te sirvió? Compártela» bajo cada herramienta */
.share { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.share-title { font-weight: 700; font-size: .95rem; }
.share-links { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; text-decoration: none; cursor: pointer; transition: border-color .15s, background-color .15s; }
.share-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.share-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.share-btn::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dot, var(--accent)); flex: none; }
.share-btn[hidden] { display: none; }
.share-wa { --dot: #25d366; }
.share-fb { --dot: #1877f2; }
.share-x { --dot: var(--text); }
.share-tg { --dot: #29a9eb; }
.share-mail { --dot: var(--brand-red); }
.share-native { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.share-native::before { display: none; }
.share-native:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

/* Captura «Así se ve» de la herramienta en uso, al inicio del contenido */
.tool-shot { margin: 16px 0 24px; }
.tool-shot img { display: block; width: 100%; max-width: 760px; height: auto; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); background: var(--surface); }
.tool-shot figcaption { margin-top: 8px; max-width: 760px; font-size: .86rem; color: var(--muted); line-height: 1.45; }

/* Bloque «Aprende más en el blog» (2 artículos relacionados con la herramienta) */
.learn { margin-top: 48px; }
.learn h2 { font-size: clamp(1.2rem, 1rem + 1vw, 1.5rem); font-weight: 800; }
.learn-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.learn-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.learn-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.learn-kicker { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.learn-card strong { color: var(--accent); font-size: 1.02rem; line-height: 1.35; }
.learn-card span:last-child { font-size: .88rem; color: var(--muted); line-height: 1.5; }
