/* Portada editorial: paleta del logo UpapLegalTech (#102A43, #1769AA, #1C9A8B, #FFFFFF).
 * Opción 4 por defecto (oscura) y Opción 1 clara.
 */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg-canvas: #102a43;
  --bg-subtle: #172846;
  --bg-card: #172846;
  --border-light: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(255, 255, 255, 0.28);
  --text-main: #ffffff;
  --text-muted: #9fb3c8;
  --text-faint: #627d98;
  --color-primary: #1c9a8b;
  --color-secondary: #1769aa;
  --surface: #102a43;
  --surface-2: #172846;
  --line: rgba(255, 255, 255, 0.16);
  --ink: #ffffff;
  --muted: #9fb3c8;
  --blue: #1769aa;
}

html[data-theme="light"],
html[data-visual="opcion-1"] {
  color-scheme: light;
  --bg-canvas: #f4f9fc;
  --bg-subtle: #edf4fa;
  --bg-card: #ffffff;
  --border-light: #d4e2ee;
  --border-strong: #b7cde5;
  --text-main: #102a43;
  --text-muted: #486581;
  --text-faint: #829ab1;
  --color-primary: #1769aa;
  --color-secondary: #1c9a8b;
  --surface: #ffffff;
  --surface-2: #edf4fa;
  --line: #d4e2ee;
  --ink: #102a43;
  --muted: #486581;
  --blue: #1769aa;
}

body.editorial-system {
  background: var(--bg-canvas);
  color: var(--text-main);
  min-height: 100vh;
}

/* Cabecera canónica unificada */
.topline {
  background: var(--bg-canvas);
  color: var(--text-muted);
  font: 11px/1.4 var(--mono, monospace);
  letter-spacing: .1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-light);
}
.topline .wrap {
  width: min(1200px, calc(100% - 32px));
  min-height: 36px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.topline strong {
  color: var(--color-primary);
  font-weight: 700;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg-canvas) 92%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
}
.header-inner {
  width: min(1200px, calc(100% - 32px));
  min-height: 74px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 19px;
  font-weight: 760;
  letter-spacing: -.04em;
  white-space: nowrap;
  color: var(--text-main);
  text-decoration: none;
}
.brand img {
  width: 32px;
  height: 40px;
  object-fit: contain;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
}
.nav-links > a:not(.nav-cta) {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--text-main);
  text-decoration: none;
  transition: color .18s;
}
.nav-links > a:not(.nav-cta):hover,
.nav-links > a[aria-current="page"] {
  color: var(--color-primary);
}
.apps-menu {
  position: relative;
}
.apps-menu summary {
  list-style: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-main);
}
.apps-menu summary::-webkit-details-marker {
  display: none;
}
.apps-menu summary::after {
  content: '⌄';
  font-size: 15px;
  color: var(--color-primary);
}
.apps-dropdown {
  position: absolute;
  top: 50px;
  left: -16px;
  z-index: 40;
  width: 360px;
  padding: 12px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: 0 22px 55px -14px rgba(7, 28, 60, 0.35);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.apps-dropdown a {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 8px;
  text-decoration: none;
  transition: background .18s ease;
}
.apps-dropdown a:hover {
  background: var(--bg-subtle);
}
.app-drop-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: contain;
  border-radius: 7px;
  margin-top: 2px;
}
.app-drop-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.app-drop-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}
.app-drop-sub {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-muted);
}
.nav-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-toggle,
.mobile-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-main);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
.theme-toggle {
  font-size: 18px;
}
.mobile-toggle {
  display: none;
  font-size: 20px;
}
.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 7px;
  background: var(--color-primary);
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  transition: transform .2s, background .2s;
}
.nav-cta:hover {
  background: var(--color-secondary);
  color: #ffffff !important;
  transform: translateY(-2px);
}

/* Desactivar regla legacy de styles-v2.css que oculta nav-links en <760px */
.site-header .nav-links {
  position: static !important;
  display: flex !important;
  align-items: center !important;
  gap: clamp(8px, 1vw, 14px) !important;
  font-size: 13.5px !important;
  font-weight: 650 !important;
  white-space: nowrap !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

@media (max-width: 1024px) {
  .header-inner {
    position: relative;
  }
  .mobile-toggle {
    display: inline-grid !important;
  }
  .site-header .nav-links {
    display: none !important;
    position: absolute !important;
    top: calc(100% + 1px) !important;
    left: -16px !important;
    right: -16px !important;
    z-index: 35 !important;
    padding: 16px 20px 22px !important;
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-light) !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25) !important;
    align-items: stretch !important;
    font-size: 14px !important;
    white-space: normal !important;
  }
  .site-header.is-open .nav-links {
    display: grid !important;
    gap: 4px !important;
  }
  .nav-links > a:not(.nav-cta) {
    padding: 8px 12px;
  }
  .apps-menu summary {
    padding: 8px 12px;
  }
  .apps-dropdown {
    position: static;
    width: 100%;
    box-shadow: none;
    margin: 4px 0 10px;
  }
  .nav-cta {
    width: 100%;
    margin-top: 8px;
    padding: 12px 20px;
  }
}

/* Presentación editorial V3 limitada al hub de recursos. */
.v3-resources.wrap {
  width: min(1200px, calc(100% - 32px));
  max-width: 1200px;
  padding-inline: 0;
  margin-inline: auto;
}

.v3-resources .p3-resource-hero {
  margin: 52px 0 28px;
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--bg-canvas), var(--bg-subtle));
  box-shadow: 0 24px 60px -46px rgba(7, 28, 60, .35);
}

.v3-resources .p3-resource-hero h1 {
  max-width: 16ch;
  text-wrap: balance;
}

.v3-resources .p3-resource-hero p { max-width: 68ch; }

.v3-resources .p3-resource-card {
  margin-block: 24px;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 16px 40px -34px rgba(7, 28, 60, .3);
}

.v3-resources :focus-visible { outline-offset: 4px; }

@media (max-width: 760px) {
  .v3-resources.wrap { width: min(100% - 24px, 1200px); }
  .v3-resources .p3-resource-hero { margin-top: 28px; }
}

/* Navegación de continuidad para las páginas de producto. */
.product-journey { box-sizing:border-box; width:min(1240px, calc(100% - 48px)); margin:64px auto 0; padding:clamp(24px,4vw,42px); border:1px solid #d9e0d8; border-radius:16px; background:#f3f5ef; color:#172d2a; font-family:Inter,'Avenir Next',Arial,sans-serif; }
.product-journey *, .product-journey *::before, .product-journey *::after { box-sizing:border-box; }
.product-journey__eyebrow { margin:0 0 8px; color:#386b5b; font-size:11px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.product-journey h2 { margin:0 0 8px; color:#102a43; font:400 clamp(26px,3vw,36px)/1.15 Georgia,serif; }
.product-journey p:not(.product-journey__eyebrow) { margin:0; color:#486581; font-size:15px; }
.product-journey nav { display:flex; flex-wrap:wrap; gap:10px; margin-top:22px; }
.product-journey a { display:inline-flex; align-items:center; min-height:44px; padding:10px 15px; border:1px solid #c8dceb; border-radius:7px; color:#102a43; background:#ffffff; font-size:13px; font-weight:700; text-decoration:none; }
.product-journey a:hover { border-color:#1769aa; background:#edf4fa; }
.product-journey a:focus-visible { outline:3px solid #ffca7a; outline-offset:3px; }
[data-theme="dark"] .product-journey { background:#172846; color:#ffffff; border-color:#243b53; }
[data-theme="dark"] .product-journey h2 { color:#ffffff; }
[data-theme="dark"] .product-journey p:not(.product-journey__eyebrow) { color:#9fb3c8; }
[data-theme="dark"] .product-journey__eyebrow { color:#1c9a8b; }
@media (max-width:600px) { .product-journey { width:calc(100% - 32px); margin-top:44px; padding:24px; } .product-journey nav { display:grid; grid-template-columns:1fr 1fr; } .product-journey a { justify-content:center; text-align:center; } }
@media (max-width:360px) { .product-journey nav { grid-template-columns:1fr; } }

/* Índice de secciones de cada ficha: visible y utilizable sin JavaScript. */
.product-overview { width:min(1240px,calc(100% - 48px)); margin:0 auto 40px; padding:20px 24px; border:1px solid #d4e2ee; border-radius:12px; background:#ffffff; color:#102a43; font-family:Inter,'Avenir Next',Arial,sans-serif; }
.v3-page > .product-overview { width:100%; margin:0 0 40px; }
.product-overview__label { display:block; margin-bottom:8px; color:#486581; font-size:11px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.product-overview nav { display:flex; flex-wrap:wrap; gap:4px 12px; }
.product-overview a { display:inline-flex; align-items:center; min-height:44px; color:#1769aa; font-size:14px; font-weight:700; text-decoration:none; }
.product-overview a::after { content:'↗'; margin-left:8px; font-size:12px; }
.product-overview a:hover { text-decoration:underline; text-underline-offset:4px; }
.product-overview a:focus-visible { outline:3px solid #ffca7a; outline-offset:4px; }
[data-theme="dark"] .product-overview { background:#172846; color:#ffffff; border-color:#243b53; }
[data-theme="dark"] .product-overview__label { color:#9fb3c8; }
[data-theme="dark"] .product-overview a { color:#1c9a8b; }
@media (max-width:600px) { .product-overview { width:calc(100% - 32px); padding:16px 18px; } .product-overview nav { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:360px) { .product-overview nav { grid-template-columns:1fr; } }

/* El mismo sistema editorial para Escudo y páginas institucionales. */
body.editorial-system {
  --paper:#ffffff; --surface:#ffffff; --soft:#eef5fa; --surface-2:#eef5fa;
  --ink:#102a43; --muted:#486581; --line:#d4e2ee; --link:#1769aa;
  --hero:#102a43; --hero-2:#1769aa; --product-nav-surface:#eef5fa;
}
html[data-theme="dark"] body.editorial-system {
  --paper:#102a43; --surface:#172846; --soft:#1f3654; --surface-2:#1f3654;
  --ink:#ffffff; --muted:#9fb3c8; --line:#243b53; --link:#1c9a8b;
  --hero:#102a43; --hero-2:#1769aa; --product-nav-surface:#172846;
}
.editorial-system .topline { background:#102a43; }
.editorial-system .topline strong { color:#ffffff; }
.editorial-system .site-header a.nav-cta { background:#1769aa; color:#fff; }
.editorial-system .site-header a.nav-cta:hover { background:#102a43; }
.editorial-system .hero { background:radial-gradient(ellipse at 75% 12%,#1c9a8b30,transparent 42%),linear-gradient(120deg,var(--hero),var(--hero-2)); }
.editorial-system .hero :where(h1) { font-family:Georgia,'Times New Roman',serif; font-weight:400; letter-spacing:-.035em; text-wrap:balance; }
.editorial-system .hero :where(.lead,.eyebrow) { color:#eef5fa; }
.editorial-system .manual-hero-scene-frame,.editorial-system .product-scene { border-radius:4px 48px 4px 4px; }
.editorial-system .hero-inner,.editorial-system .reading-header-split { gap:clamp(28px,5vw,72px); }
.editorial-system .v3-resources .p3-resource-hero h1 { font-family:Georgia,'Times New Roman',serif; font-weight:400; letter-spacing:-.035em; }
@media (prefers-reduced-motion:reduce) { .editorial-system *, .editorial-system *::before, .editorial-system *::after { scroll-behavior:auto !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; } }

/* Resumen editorial reutilizable para las cinco fichas principales. */
.product-brief { box-sizing:border-box; width:min(1240px,calc(100% - 48px)); margin:0 auto clamp(56px,7vw,88px); padding:clamp(28px,4vw,48px); border:1px solid #d4e2ee; border-radius:16px; background:#eef5fa; color:#102a43; font-family:Inter,'Avenir Next',Arial,sans-serif; }
.v3-page > .product-brief { width:100%; margin:0 0 clamp(56px,7vw,88px); }
.product-brief *, .product-brief *::before, .product-brief *::after { box-sizing:border-box; }
.product-brief__eyebrow { margin:0 0 12px; color:#1769aa; font-size:11px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.product-brief__header { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,.8fr); gap:24px 48px; align-items:end; margin-bottom:30px; }
.product-brief__header h2 { max-width:24ch; margin:0; color:#102a43; font:400 clamp(30px,3.5vw,46px)/1.08 Georgia,serif; letter-spacing:-.025em; }
.product-brief__header p { max-width:56ch; margin:0; color:#486581; font-size:15px; line-height:1.65; }
.product-brief__grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.product-brief__item { min-width:0; padding:22px; border:1px solid #d4e2ee; border-radius:10px; background:#ffffff; }
.product-brief__item span { display:block; margin-bottom:16px; color:#1c9a8b; font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.product-brief__item h3 { margin:0 0 8px; color:#102a43; font-size:17px; line-height:1.3; }
.product-brief__item p { margin:0; color:#486581; font-size:14px; line-height:1.6; }
.product-brief__actions { display:flex; flex-wrap:wrap; gap:8px 18px; margin-top:20px; }
.product-brief__actions a { display:inline-flex; align-items:center; min-height:44px; color:#1769aa; font-size:14px; font-weight:700; text-decoration:underline; text-underline-offset:4px; }
.product-brief__actions a:focus-visible { outline:3px solid #ffca7a; outline-offset:4px; }
[data-theme="dark"] .product-brief { color:#ffffff; background:#172846; border-color:#243b53; }
[data-theme="dark"] .product-brief__header h2 { color:#ffffff; }
[data-theme="dark"] .product-brief__header p { color:#9fb3c8; }
[data-theme="dark"] .product-brief__eyebrow,[data-theme="dark"] .product-brief__actions a { color:#1c9a8b; }
@media (max-width:760px) { .product-brief { width:calc(100% - 32px); } .product-brief__header { grid-template-columns:1fr; gap:12px; } .product-brief__grid { grid-template-columns:1fr; } }
.p3-table th, .p3-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
}
.p3-table thead th {
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.p3-table tbody th {
  color: var(--text-main);
  font-weight: 600;
}
.p3-table tbody td {
  color: var(--text-muted);
}
.p3-table tbody tr:hover td {
  background: color-mix(in srgb, var(--color-primary) 6%, transparent);
}
.p3-table td a {
  color: var(--color-primary);
  font-weight: 600;
}

/* Formulario progresivo en recursos */
.p3-optin input[type="email"] {
  width: 100%;
  max-width: 480px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-canvas);
  color: var(--text-main);
  font-size: 15px;
  margin-top: 6px;
  margin-bottom: 14px;
  display: block;
}
.p3-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
  cursor: pointer;
}
.p3-consent input {
  margin-top: 3px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 8px;
  background: var(--color-primary);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all .18s;
  cursor: pointer;
}
.btn:hover {
  background: var(--color-secondary);
  color: #ffffff;
  transform: translateY(-1px);
}
.btn.secondary {
  background: transparent;
  color: var(--text-main);
  border-color: var(--border-strong);
}
.btn.secondary:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}
.p2-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0 14px;
}
.p2-pricing-label {
  display: inline-block;
  font-family: var(--mono, monospace);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 8px;
}
.p2-video-note {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 10px;
}

/* La mejora progresiva no expone el formulario antes de enlazar su controlador. */
.p3-optin form[hidden] { display:none; }
