/* IT Patagonia — tokens de marca (ver skill it-patagonia-brand/references/identidad-visual.md) */

@font-face {
  font-family: 'Acumin Pro';
  src: url('fonts/AcuminPro-Light.otf') format('opentype');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Acumin Pro';
  src: url('fonts/AcuminPro-Regular.otf') format('opentype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Acumin Pro';
  src: url('fonts/AcuminPro-Semibold.otf') format('opentype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Acumin Pro';
  src: url('fonts/AcuminPro-Bold.otf') format('opentype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Acumin Pro';
  src: url('fonts/AcuminPro-Black.otf') format('opentype');
  font-weight: 900;
  font-display: swap;
}

:root {
  --brand-primary: #084BFA;
  --brand-secondary: #1AD0FB;
  --brand-tertiary: #2CEECC;
  --brand-gradient: linear-gradient(135deg, #084BFA 0%, #1AD0FB 100%);

  --accent-magenta: #FF00BF;
  --accent-orange: #FF6A00;

  --neutral-0: #FFFFFF;
  --neutral-100: #D9D9D6;
  --neutral-400: #888B8D;
  --neutral-700: #53565A;
  --neutral-900: #000000;

  --font-primary: 'Acumin Pro', 'Encode Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;

  --bg-page: #F4F6FB;
  --surface-alt: #FBFBFA;
  --highlight-grad: linear-gradient(180deg, #FFFFFF 0%, #EEF3FF 100%);
  --card-radius: 14px;
  --card-shadow: 0 4px 18px rgba(8, 75, 250, 0.08);
  --hover-glow: 0 14px 32px rgba(8, 75, 250, 0.22);
}

/* ---------- Modo noche ---------- */
html.theme-dark {
  --neutral-0: #151A2E;
  --neutral-100: #262C45;
  --neutral-400: #6B718C;
  --neutral-700: #AEB4C7;
  --neutral-900: #F2F4FA;

  --bg-page: #0B0E1A;
  --surface-alt: #10152B;
  --highlight-grad: linear-gradient(180deg, #151A2E 0%, #1B2340 100%);
  --card-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  --hover-glow: 0 0 0 1px rgba(26, 208, 251, 0.5), 0 14px 36px rgba(26, 208, 251, 0.35);
}

* { box-sizing: border-box; }

html { background: var(--bg-page); }

body {
  margin: 0;
  font-family: var(--font-primary);
  background: var(--bg-page);
  color: var(--neutral-900);
  transition: background .2s ease, color .2s ease;
}

.page {
  max-width: none;
  margin: 0;
  padding: 26px 0 80px;
}

/* ---------- Barra flotante (pantalla completa / modo día-noche) ---------- */

.view-toolbar {
  position: fixed;
  top: 26px;
  right: 32px;
  display: flex;
  gap: 10px;
  z-index: 900;
}

.toolbar-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--neutral-100);
  background: var(--neutral-0);
  color: var(--neutral-700);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.toolbar-btn:hover {
  background: var(--brand-primary);
  color: #fff;
  transform: translateY(-2px);
}

.toolbar-btn svg { width: 20px; height: 20px; }

/* ---------- Section headings ---------- */

.diagram-section {
  padding: 0 48px;
  margin-bottom: 72px;
}

.title-badge {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--databricks-red);
  margin-bottom: 2px;
}

.diagram-section h1 {
  font-weight: 300;
  font-size: 34px;
  margin: 0 0 4px;
  color: var(--neutral-900);
}

.diagram-section h1 b { font-weight: 700; color: var(--brand-primary); }

.diagram-section .subtitle {
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--neutral-700);
  margin: 0 0 36px;
  max-width: 860px;
}

/* ---------- Flow diagram ---------- */

.flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
  min-width: 0;
}

/* Clon invisible de un box: ocupa exactamente el mismo espacio responsivo
   que el real (mismas clases/contenido) para poder centrar otra fila contra
   el ancho que le queda al box de al lado, sin valores fijos en píxeles. */
.flow-twin {
  display: flex;
  align-items: center;
  visibility: hidden;
  pointer-events: none;
}

.flow-node {
  background: var(--neutral-0);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(8,75,250,0.08);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  width: 260px;
  gap: 10px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
}

.flow-node:hover {
  transform: translateY(-5px) scale(1.045);
  box-shadow: var(--hover-glow);
  z-index: 4;
}

.flow-node.compact { width: 235px; padding: 18px 18px; }

.flow-node .node-title {
  font-weight: 700;
  font-size: 21px;
  color: var(--neutral-900);
  line-height: 1.3;
}

.flow-node .node-desc {
  font-weight: 400;
  font-size: 16px;
  color: var(--neutral-700);
  line-height: 1.45;
}

.flow-node.highlight {
  border: 1.5px solid var(--brand-primary);
  background: var(--highlight-grad);
}

.flow-node.external {
  border: 1.5px dashed var(--neutral-400);
  background: var(--surface-alt);
}

.flow-node .node-badge {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand-primary);
  background: rgba(8,75,250,0.08);
  padding: 4px 10px;
  border-radius: 20px;
}

.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  flex-shrink: 0;
  position: relative;
  color: var(--brand-primary);
}

.flow-arrow svg { width: 36px; height: 16px; }

.flow-arrow .arrow-label {
  position: absolute;
  top: -22px;
  font-size: 10px;
  font-weight: 600;
  color: var(--neutral-700);
  white-space: nowrap;
}

.flow-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: center;
}

.flow-branch {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* vertical connector used inside a branch column */
.branch-track {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}

/* ---------- Icon slot (logos de producto) ---------- */

.icon-slot {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.icon-slot img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.icon-slot .icon-fallback {
  font-size: 9px;
  font-weight: 700;
  color: var(--brand-primary);
  text-align: center;
  line-height: 1.2;
  padding: 2px;
}

/* Placa blanca fija detrás de logos oscuros (p.ej. Facturante, CLI) para que
   no pierdan contraste en modo noche. */
.icon-chip {
  background: #fff;
  border-radius: 10px;
  padding: 6px;
}

/* Ícono SVG recoloreado vía mask (para íconos con currentColor/fill fijo) */
.icon-mask {
  width: 60px;
  height: 60px;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* ---------- Contenedor "productos Databricks" ---------- */

:root { --databricks-red: #FF3621; }

.databricks-container {
  position: relative;
  border: 2px solid var(--brand-primary);
  border-radius: 18px;
  background: rgba(8, 75, 250, 0.04);
  padding: 30px 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.databricks-container .container-label,
.lakehouse-shell .container-label {
  position: absolute;
  top: -15px;
  left: 22px;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 18px;
  border-radius: 20px;
  display: flex;
  align-items: center;
}

.databricks-container .container-label { background: var(--databricks-red); }
.lakehouse-shell .container-label { background: var(--brand-primary); }

.databricks-container .container-label img {
  height: 25px;
  width: auto;
  object-fit: contain;
}

.db-core-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  min-width: 0;
}

.db-apps-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--neutral-700);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.db-apps-divider::before,
.db-apps-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(8, 75, 250, 0.2);
}

.db-apps-row {
  display: flex;
  gap: 16px;
  flex-wrap: nowrap;
  justify-content: center;
}

/* Las tarjetas de Observabilidad nunca desbordan ni pasan a otra fila:
   se achican en conjunto para seguir entrando en pantallas angostas (notebook). */
.db-apps-row .flow-node {
  width: auto;
  flex: 1 1 0;
  min-width: 0;
}

.flow-node.app-node {
  border: 1px dashed rgba(8, 75, 250, 0.35);
  background: var(--neutral-0);
}

/* ---------- Legend ---------- */

.legend {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--neutral-100);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--neutral-700);
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.legend-swatch.solid { background: var(--neutral-0); border: 1.5px solid var(--brand-primary); }
.legend-swatch.dashed { background: var(--surface-alt); border: 1.5px dashed var(--neutral-400); }

/* ---------- Instructions banner (solo para edición, no imprimir/exportar) ---------- */

.howto {
  margin: 0 48px 48px;
  padding: 16px 20px;
  background: #FFF8E1;
  border: 1px solid #E6A700;
  border-radius: 10px;
  font-size: 13px;
  color: #6B5200;
  line-height: 1.5;
}

.howto b { color: #4a3800; }
.howto code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

@media print {
  .howto { display: none; }
  body { background: #fff; }
}

/* ---------- Láminas de apoyo (soporte visual para el expositor) ---------- */

.support-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-primary);
  background: rgba(8,75,250,0.08);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 18px;
}

.flow-node.xl { width: 230px; padding: 26px 22px; gap: 14px; }
.flow-node.xl .node-title { font-size: 19px; }
.flow-node.xl .node-desc { font-size: 15px; }
.flow-node.xl .node-example {
  font-size: 13px;
  font-style: italic;
  color: var(--neutral-400);
  line-height: 1.4;
  margin-top: 2px;
}

.icon-slot.xl { width: 84px; height: 84px; }
.icon-slot.xl img { width: 76px; height: 76px; }
.icon-slot.xl svg { width: 60px; height: 60px; }

.flow-arrow.xl { width: 56px; }
.flow-arrow.xl svg { width: 46px; height: 20px; }

/* Tarjeta de tabla (diagrama ER simplificado) */
.er-table {
  background: var(--neutral-0);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  border: 1.5px solid var(--brand-primary);
  padding: 18px 20px;
  width: 220px;
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease;
}
.er-table:hover { transform: translateY(-4px) scale(1.03); box-shadow: var(--hover-glow); }

.er-table .er-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--brand-primary);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--neutral-100);
}

.er-field {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--neutral-700);
  line-height: 1.8;
  white-space: nowrap;
}

.er-field.pk::before { content: "🔑 "; }
.er-field.fk { color: var(--neutral-400); font-style: italic; }
.er-field.fk::before { content: "↪ "; }

/* Lakehouse: grid de tablas Delta */
.delta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  padding: 20px;
}

.delta-table-chip {
  background: var(--neutral-0);
  border: 1.5px solid var(--neutral-100);
  border-left: 4px solid var(--brand-primary);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.delta-table-chip:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(8,75,250,0.15); }
.delta-table-chip .dt-name { font-weight: 700; font-family: 'Courier New', monospace; color: var(--neutral-900); display:block; margin-bottom: 4px; }
.delta-table-chip .dt-desc { color: var(--neutral-700); font-size: 12px; }

.lakehouse-shell {
  border: 2px solid var(--brand-primary);
  border-radius: 20px;
  background: rgba(8,75,250,0.04);
  position: relative;
  padding-top: 10px;
}

/* ---------- Modal de detalle por componente ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 30, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--neutral-0);
  border-radius: 18px;
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 40px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  position: relative;
  transform: translateY(14px) scale(.97);
  transition: transform .2s ease;
  cursor: default;
}

.modal-overlay.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--neutral-100);
  color: var(--neutral-700);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
}

.modal-close:hover {
  background: var(--brand-primary);
  color: #fff;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 30px;
}

.modal-icon-slot {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-badge {
  display: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand-primary);
  background: rgba(8,75,250,0.08);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.modal-title {
  font-weight: 700;
  font-size: 26px;
  color: var(--neutral-900);
  line-height: 1.25;
}

.modal-subtitle {
  font-size: 16px;
  color: var(--neutral-700);
  margin-top: 4px;
}

.modal-body {
  margin-top: 24px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--neutral-700);
}

.modal-body code {
  background: rgba(8,75,250,0.08);
  color: var(--brand-primary);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 15px;
}

.modal-screenshot {
  margin-top: 22px;
  border: 1.5px dashed rgba(8,75,250,0.35);
  border-radius: 12px;
  background: rgba(8,75,250,0.04);
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-screenshot img {
  width: 100%;
  display: block;
  cursor: zoom-in;
  transition: transform .2s ease, filter .2s ease;
}

.modal-screenshot img:hover {
  transform: scale(1.025);
  filter: brightness(1.04);
}

.modal-shot-placeholder {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-primary);
  text-align: center;
  padding: 24px;
}

/* ---------- Lightbox (zoom de capturas) ---------- */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 14, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  overflow: hidden;
}

.lightbox-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img-wrap {
  max-width: 92vw;
  max-height: 86vh;
  overflow: hidden;
  cursor: zoom-in;
}

.lightbox-img-wrap img {
  display: block;
  max-width: 92vw;
  max-height: 86vh;
  transform-origin: center center;
  transition: transform .12s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-img-wrap.dragging img { transition: none; }

.lightbox-close {
  position: absolute;
  top: 22px;
  right: 28px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease;
}

.lightbox-close:hover { background: var(--brand-primary); }

.lightbox-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  white-space: nowrap;
}
