/* =========================================================
   Facturel — Hoja de estilos compartida
   ========================================================= */

:root {
  --color-primary: #10b981;
  --color-primary-dark: #059669;
  --color-primary-soft: #d1fae5;
  --color-accent: #0f766e;
  --color-ink: #0f172a;
  --color-ink-soft: #475569;
  --color-muted: #94a3b8;
  --color-bg: #ffffff;
  --color-bg-alt: #f8fafc;
  --color-border: #e2e8f0;
  --color-success: #16a34a;
  --color-error: #dc2626;
  --color-warning: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.10);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo,
    Monaco, Consolas, monospace;

  --max-width: 1120px;
}

/* ---------- Accesibilidad ---------- */
.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;
}
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: var(--color-ink);
  color: white;
  padding: 8px 14px;
  border-radius: 6px;
  z-index: 100;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; color: white; }

/* ---------- Reset suave ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--color-ink);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }

a {
  color: var(--color-primary-dark);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--color-accent); }

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  color: var(--color-ink);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.2rem, 4vw + 1rem, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.8rem, 2vw + 1rem, 2.4rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }

p { margin: 0 0 1em; color: var(--color-ink-soft); }

ul { padding-left: 1.2em; }
li { margin-bottom: 0.4em; }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 96px 0; }
.section--alt { background: var(--color-bg-alt); }
.section--tight { padding: 64px 0; }

.eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.lead {
  font-size: 1.2rem;
  color: var(--color-ink-soft);
  max-width: 640px;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease,
    background 0.15s ease, color 0.15s ease;
  text-decoration: none;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}
.btn--primary:hover {
  background: var(--color-primary-dark);
  color: white;
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.45);
}

.btn--ghost {
  background: transparent;
  color: var(--color-ink);
  border: 1.5px solid var(--color-border);
}
.btn--ghost:hover {
  border-color: var(--color-ink);
  color: var(--color-ink);
}

.btn--block { width: 100%; }

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- Navbar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}
.nav__brand-dot {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: inline-block;
}
.nav__links {
  display: flex;
  gap: 28px;
  align-items: center;
  list-style: none;
  margin: 0; padding: 0;
}
.nav__links a {
  color: var(--color-ink-soft);
  font-weight: 500;
  font-size: 0.97rem;
}
.nav__links a:hover { color: var(--color-ink); }

.nav__toggle {
  display: none;
  background: transparent;
  border: 0;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--color-ink);
}

/* ---------- Hero ---------- */
.hero {
  padding: 80px 0 96px;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(16, 185, 129, 0.18), transparent),
    radial-gradient(900px 500px at 0% 10%, rgba(15, 118, 110, 0.10), transparent),
    var(--color-bg);
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: center;
}
.hero p.lead { font-size: 1.25rem; }
.hero__ctas {
  display: flex;
  gap: 14px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.hero__trust {
  margin-top: 18px;
  font-size: 0.92rem;
  color: var(--color-muted);
}
.hero__mock {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  max-width: 380px;
  margin-left: auto;
}
.hero__mock-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-ink-soft);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 16px;
}
.hero__mock-header .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--color-success);
}
.chat { display: flex; flex-direction: column; gap: 10px; }
.chat__msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.4;
}
.chat__msg--user {
  align-self: flex-end;
  background: #d9fdd3;
  border-bottom-right-radius: 4px;
  color: #0f172a;
}
.chat__msg--bot {
  align-self: flex-start;
  background: #f1f5f9;
  border-bottom-left-radius: 4px;
  color: #0f172a;
}

/* ---------- Cards / features ---------- */
.grid {
  display: grid;
  gap: 24px;
}
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card__icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.card h3 { margin-bottom: 8px; }
.card p { margin: 0; font-size: 0.97rem; }

/* ---------- Steps (cómo funciona) ---------- */
.steps {
  counter-reset: step;
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 40px;
}
.step {
  position: relative;
  padding: 28px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: -18px;
  left: 24px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* ---------- Callout (recuadro destacado) ---------- */
.callout {
  margin-top: 40px;
  padding: 24px 28px;
  background: white;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.callout p { margin: 0; }

/* ---------- FAQ ---------- */
.faq-list {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.faq-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.faq-item[open] {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  color: var(--color-primary-dark);
  font-weight: 400;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}
.faq-item[open] summary::after {
  content: "−";
  transform: rotate(0deg);
}
.faq-item summary h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-ink);
  display: inline;
}
.faq-item > p {
  padding: 0 24px 22px;
  margin: 0;
  color: var(--color-ink-soft);
  font-size: 0.98rem;
  line-height: 1.65;
}

/* ---------- Pricing ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 40px;
}
.plan {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
}
.plan--featured {
  border-color: var(--color-primary);
  box-shadow: 0 12px 36px rgba(16, 185, 129, 0.18);
  position: relative;
}
.plan--featured::before {
  content: "Más elegido";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: white;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
}
.plan__name { font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
.plan__price {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 6px 0;
}
.plan__price small {
  font-size: 0.9rem;
  color: var(--color-muted);
  font-weight: 500;
}
.plan__desc { color: var(--color-ink-soft); margin-bottom: 20px; }
.plan ul {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  flex-grow: 1;
}
.plan li {
  position: relative;
  padding-left: 28px;
  font-size: 0.97rem;
  color: var(--color-ink);
  margin-bottom: 10px;
}
.plan li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 700;
}

/* ---------- Footer ---------- */
.footer {
  background: var(--color-ink);
  color: #cbd5e1;
  padding: 56px 0 36px;
}
.footer a { color: #cbd5e1; }
.footer a:hover { color: white; }
.footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 36px;
}
.footer__brand { display: flex; flex-direction: column; gap: 14px; }
.footer__brand strong { color: white; font-size: 1.1rem; }
.footer h4 {
  color: white;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 8px; font-size: 0.95rem; }
.footer__copy {
  border-top: 1px solid #1e293b;
  padding-top: 24px;
  font-size: 0.88rem;
  color: var(--color-muted);
  text-align: center;
}

/* =========================================================
   Página de subida del .crt
   ========================================================= */

.upload-page {
  min-height: 100vh;
  background: var(--color-bg-alt);
  padding: 48px 0 80px;
}
.upload-shell {
  max-width: 760px;
  margin: 0 auto;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.upload-header {
  padding: 32px 40px 24px;
  border-bottom: 1px solid var(--color-border);
}
.upload-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--color-ink);
  margin-bottom: 14px;
}
.upload-header h1 {
  font-size: 1.7rem;
  margin: 0 0 8px;
}
.upload-header p { margin: 0; color: var(--color-ink-soft); }

.upload-body { padding: 32px 40px; }

.upload-step {
  margin-bottom: 36px;
  padding-bottom: 32px;
  border-bottom: 1px dashed var(--color-border);
}
.upload-step:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}
.upload-step__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.upload-step__num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.upload-step__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-ink);
  margin: 0;
}

.code-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--color-ink);
  margin: 12px 0;
  word-break: break-all;
}
.code-row button {
  margin-left: auto;
  background: white;
  border: 1px solid var(--color-border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font-sans);
  color: var(--color-ink-soft);
}
.code-row button:hover {
  border-color: var(--color-ink);
  color: var(--color-ink);
}

.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin: 16px 0 8px;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.video-wrapper iframe,
.video-wrapper video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-placeholder {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
}
.video-placeholder strong { color: white; font-size: 1.05rem; }

.dropzone {
  border: 2px dashed var(--color-border);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover,
.dropzone.is-hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}
.dropzone__icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
  display: block;
}
.dropzone__primary {
  font-weight: 600;
  color: var(--color-ink);
  display: block;
  margin-bottom: 4px;
}
.dropzone__sub {
  color: var(--color-ink-soft);
  font-size: 0.92rem;
  display: block;
}
.dropzone input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

.status {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  display: none;
}
.status.is-visible { display: block; }
.status--loading {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.status--ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.status--err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.help-list {
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  padding: 18px 24px;
  margin: 16px 0;
  font-size: 0.95rem;
}
.help-list strong { color: var(--color-ink); }

.upload-footer {
  padding: 20px 40px;
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  font-size: 0.88rem;
  color: var(--color-muted);
  text-align: center;
}

/* =========================================================
   Blog
   ========================================================= */
.article-page {
  background: var(--color-bg);
  padding: 32px 0 80px;
}
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}
.article header.article__header {
  padding: 24px 0 36px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 36px;
}
.article__meta {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 14px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.article__meta a { color: var(--color-primary-dark); }
.article h1 {
  font-size: clamp(2rem, 3vw + 1rem, 2.8rem);
  line-height: 1.15;
  margin-bottom: 18px;
}
.article__lead {
  font-size: 1.18rem;
  color: var(--color-ink-soft);
  line-height: 1.55;
  margin-bottom: 0;
}
.article__body { font-size: 1.05rem; line-height: 1.75; color: #1e293b; }
.article__body h2 {
  margin-top: 48px;
  margin-bottom: 14px;
  font-size: 1.7rem;
}
.article__body h3 {
  margin-top: 32px;
  margin-bottom: 10px;
  font-size: 1.25rem;
}
.article__body p { margin-bottom: 1.1em; }
.article__body ul, .article__body ol { padding-left: 1.3em; margin-bottom: 1.2em; }
.article__body li { margin-bottom: 0.5em; }
.article__body a { font-weight: 500; border-bottom: 1px solid var(--color-primary-soft); }
.article__body a:hover { border-bottom-color: var(--color-primary); }
.article__body blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 4px 0 4px 20px;
  margin: 24px 0;
  color: var(--color-ink-soft);
  font-style: italic;
}
.article__body code {
  background: var(--color-bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--color-accent);
}
.article__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.97rem;
}
.article__body th, .article__body td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}
.article__body th {
  background: var(--color-bg-alt);
  font-weight: 600;
  color: var(--color-ink);
}
.article__tldr {
  background: var(--color-primary-soft);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin: 28px 0 32px;
  font-size: 0.98rem;
}
.article__tldr strong { color: var(--color-accent); }
.article__cta {
  margin-top: 48px;
  padding: 32px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  text-align: center;
}
.article__cta h3 { margin-bottom: 8px; }
.article__cta p { margin-bottom: 18px; }

.blog-index {
  background: var(--color-bg-alt);
  padding: 48px 0 80px;
  min-height: 70vh;
}
.blog-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.blog-card h2 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}
.blog-card h2 a { color: var(--color-ink); }
.blog-card h2 a:hover { color: var(--color-primary-dark); }
.blog-card__meta {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 12px;
}

/* =========================================================
   404
   ========================================================= */
.notfound {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
}
.notfound__num {
  font-size: clamp(5rem, 12vw, 8rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  line-height: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { padding: 56px 0 72px; }
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .hero__mock { margin: 0 auto; }
  .grid--3, .pricing-grid, .steps { grid-template-columns: 1fr; }
  .grid--2 { grid-template-columns: 1fr; }
  .footer__inner { grid-template-columns: 1fr; gap: 32px; }
  .section { padding: 72px 0; }

  .nav__links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: white;
    flex-direction: column;
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    gap: 14px;
    align-items: flex-start;
  }
  .nav__links.is-open { display: flex; }
  .nav__toggle { display: inline-block; }
  .nav { position: relative; }

  .upload-header, .upload-body { padding-left: 24px; padding-right: 24px; }
  .upload-footer { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .upload-header h1 { font-size: 1.4rem; }
  .dropzone { padding: 36px 16px; }
}
