/* ═══════════════════════════════════════════════════════════════
   UniProy — general.css
   Design system: tokens, reset, base, utilities
   Breakpoints: 480 · 640 · 768 · 992 · 1200
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────────────── */
:root {
  --font-heading: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Open Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 26px;
  --radius-xl: 30px;

  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.07);
  --shadow-md:   0 16px 48px rgba(15, 23, 42, 0.11);
  --shadow-lg:   0 28px 80px rgba(15, 23, 42, 0.15);

  --transition-fast: 0.16s ease;
  --transition-base: 0.26s ease;

  /* Breakpoints (referencia, también vivos como --bp-*) */
  --bp-xs: 480px;   /* phones small */
  --bp-sm: 640px;   /* phones large */
  --bp-md: 768px;   /* iPad portrait */
  --bp-lg: 992px;   /* iPad landscape, laptops pequeñas */
  --bp-xl: 1200px;  /* laptops/desktops */

  /* Spacing escalable */
  --gap-xs: clamp(.5rem, 1.4vw, .75rem);
  --gap-sm: clamp(.75rem, 1.8vw, 1rem);
  --gap-md: clamp(1rem, 2.4vw, 1.5rem);
  --gap-lg: clamp(1.5rem, 3.4vw, 2rem);
  --gap-xl: clamp(2rem, 4.8vw, 3rem);

  /* Container max-width responsive */
  --container-pad: clamp(16px, 3vw, 32px);

  /* Touch target mínimo (Apple HIG = 44 / Android = 48) */
  --tap-min: 44px;

  /* Safe-area iOS notch */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
}

html[data-theme="light"] {
  --bg:           #f4f6fb;
  --bg-2:         #ffffff;
  --bg-soft:      #edf1f7;
  --text:         #0f172a;
  --text-soft:    #334155;
  --text-muted:   #64748b;
  --border:       rgba(15, 23, 42, 0.09);
  --border-strong:rgba(15, 23, 42, 0.15);
  --card:         rgba(255, 255, 255, 0.80);
  --card-solid:   #ffffff;
  --glass:        rgba(255, 255, 255, 0.62);

  --brand:        #00594e;
  --brand-2:      #0a7a6b;
  --gold:         #b5a160;
  --blue:         #2563eb;
  --green:        #0f766e;
  --violet:       #7c3aed;
  --dark-chip:    #0f172a;

  --hero-grad-1:  rgba(0, 89, 78, 0.15);
  --hero-grad-2:  rgba(181, 161, 96, 0.13);
  --hero-grad-3:  rgba(37, 99, 235, 0.11);
}

html[data-theme="dark"] {
  --bg:           #07111c;
  --bg-2:         #0b1624;
  --bg-soft:      #0d1a2b;
  --text:         #e5eef8;
  --text-soft:    #c6d4e3;
  --text-muted:   #94a3b8;
  --border:       rgba(148, 163, 184, 0.15);
  --border-strong:rgba(148, 163, 184, 0.22);
  --card:         rgba(11, 22, 36, 0.76);
  --card-solid:   #0d1a2b;
  --glass:        rgba(11, 22, 36, 0.58);

  --brand:        #35b5a1;
  --brand-2:      #4fddc6;
  --gold:         #d6be73;
  --blue:         #60a5fa;
  --green:        #34d399;
  --violet:       #a78bfa;
  --dark-chip:    #e5eef8;

  --hero-grad-1:  rgba(53, 181, 161, 0.17);
  --hero-grad-2:  rgba(214, 190, 115, 0.13);
  --hero-grad-3:  rgba(96, 165, 250, 0.13);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  margin: 0;
  /* Evita el desbordamiento horizontal en mobile cuando un elemento
     tiene un margen/padding negativo o un contenido que excede el viewport */
  min-width: 0;
  /* Respeta el notch / dynamic island en iOS al borde inferior/superior */
  padding-bottom: var(--safe-bottom);
}

img, svg, video, canvas { max-width: 100%; display: block; height: auto; }
a { text-decoration: none; }
button { outline: none; }

/* Inputs: en iOS, font-size < 16px provoca auto-zoom al focar.
   En desktops vuelve a tamaño normal vía media query abajo. */
input, select, textarea {
  font-size: 16px;
  font-family: inherit;
}

/* Foco accesible y visible (sin perder el reset de outline en mouse) */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Buttons y .btn deben tener al menos 44x44 de tap target */
button, .btn, [role="button"], a.btn-brand, a.btn-outline-pro, a.btn-ghost {
  min-height: var(--tap-min);
}

main, section, header, footer {
  position: relative;
  z-index: 1;
}

/* ── Background decoration ─────────────────────────────────────── */
.bg-shell {
  position: fixed;
  inset: 0;
  z-index: -5;
  pointer-events: none;
  background:
    radial-gradient(900px 600px at 8% 8%,   var(--hero-grad-1), transparent 60%),
    radial-gradient(900px 600px at 96% 10%,  var(--hero-grad-2), transparent 58%),
    radial-gradient(600px 420px at 50% 100%, var(--hero-grad-3), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 60%, var(--bg) 100%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -4;
  opacity: 0.12;
  pointer-events: none;
  background-image:
    linear-gradient(to right,  rgba(100,116,139,0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(100,116,139,0.10) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(circle at 50% 25%, rgba(0,0,0,1), rgba(0,0,0,.22) 65%, transparent 82%);
}

.blob {
  position: fixed;
  border-radius: 999px;
  filter: blur(72px);
  pointer-events: none;
  z-index: -6;
  opacity: 0.22;
}
.blob-a {
  width: 540px; height: 540px;
  top: -160px; left: -160px;
  background: radial-gradient(circle at 30% 30%, var(--brand), transparent 68%);
}
.blob-b {
  width: 500px; height: 500px;
  top: 8%; right: -160px;
  background: radial-gradient(circle at 35% 35%, var(--gold), transparent 68%);
}
.blob-c {
  width: 460px; height: 460px;
  bottom: -160px; left: 42%;
  background: radial-gradient(circle at 35% 35%, var(--blue), transparent 68%);
}

/* ── Spacing ───────────────────────────────────────────────────── */
.section-space {
  padding: clamp(52px, 8vw, 88px) 0;
}

.section-soft {
  background: linear-gradient(180deg, transparent 0%, rgba(127,127,127,0.04) 50%, transparent 100%);
}

/* ── Section typography ────────────────────────────────────────── */
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: clamp(.76rem, 1.8vw, .84rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--brand);
  margin-bottom: 10px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.section-head.centered {
  justify-content: center;
  text-align: center;
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.65rem, 3vw, 2.75rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0 0 10px;
}

.section-text {
  font-size: clamp(.92rem, 2vw, 1rem);
  line-height: 1.8;
  color: var(--text-muted);
  max-width: 72ch;
  margin: 0;
}

.text-muted { color: var(--text-muted) !important; }

/* ── Brand link ────────────────────────────────────────────────── */
.link-brand {
  color: var(--brand);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}
.link-brand:hover { color: var(--brand-2); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn-brand,
.btn-outline-pro,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .48rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: .9rem;
  padding: .82rem 1.25rem;
  min-height: 44px;
  white-space: nowrap;
  transition:
    transform    var(--transition-fast),
    box-shadow   var(--transition-fast),
    background   var(--transition-fast),
    color        var(--transition-fast),
    border-color var(--transition-fast);
}

.btn-brand {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: 1px solid transparent;
  color: #fff;
  box-shadow: 0 10px 26px rgba(0, 89, 78, 0.20);
}
.btn-brand:hover, .btn-brand:focus-visible {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(0, 89, 78, 0.26);
}

.btn-outline-pro {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-outline-pro:hover, .btn-outline-pro:focus-visible {
  border-color: var(--brand);
  color: var(--brand);
  background: rgba(0, 89, 78, 0.05);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover, .btn-ghost:focus-visible {
  transform: translateY(-1px);
  background: rgba(127,127,127,0.06);
  border-color: var(--border-strong);
}

/* ── Pills & Chips ─────────────────────────────────────────────── */
.pill,
.chip {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  border-radius: 999px;
  line-height: 1;
  white-space: nowrap;
}

.pill {
  padding: .66rem .94rem;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--text-soft);
  font-size: .86rem;
  font-weight: 600;
}

.chip {
  padding: .4rem .68rem;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.12);
  color: var(--text-soft);
  font-size: .76rem;
  font-weight: 700;
}

a.chip { text-decoration: none; color: inherit; }

/* ── Mini label ────────────────────────────────────────────────── */
.mini-label {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-muted);
  font-weight: 800;
}

/* ── Reveal animation ──────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .5s ease, transform .5s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ── Scroll-to-top ─────────────────────────────────────────────── */
.scroll-top {
  position: fixed;
  right: clamp(12px, 3vw, 18px);
  bottom: clamp(12px, 3vw, 18px);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(12px);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.scroll-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-top:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* ══════════════════════════════════════════════════════════════════
   Utilidades responsive globales
   Sólo se aplican cuando se les usa explícitamente en el HTML.
   ══════════════════════════════════════════════════════════════════ */

/* Visibilidad por breakpoint
   .hide-xs / .show-xs / .hide-sm / .show-sm / .hide-md / .show-md / .hide-lg
   "hide" oculta a partir de ese ancho hacia ARRIBA.
   "show" muestra solo a partir de ese ancho hacia ARRIBA. */
.hide-xs { display: none !important; }
@media (min-width: 480px)  { .hide-xs  { display: revert !important; } .show-xs  { display: none !important; } }
@media (min-width: 640px)  { .hide-sm  { display: none !important; }   .show-sm  { display: revert !important; } }
@media (min-width: 768px)  { .hide-md  { display: none !important; }   .show-md  { display: revert !important; } }
@media (min-width: 992px)  { .hide-lg  { display: none !important; }   .show-lg  { display: revert !important; } }
@media (min-width: 1200px) { .hide-xl  { display: none !important; }   .show-xl  { display: revert !important; } }

/* Solo desktop / solo mobile — atajos comunes */
.only-desktop { display: revert; }
.only-mobile  { display: none; }
@media (max-width: 767.98px) {
  .only-desktop { display: none !important; }
  .only-mobile  { display: revert !important; }
}

/* Container responsive — usa el padding y max-width tokenizados */
.container-pro {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: max(var(--container-pad), var(--safe-left));
  padding-right: max(var(--container-pad), var(--safe-right));
}
.container-narrow { max-width: 920px; }
.container-wide   { max-width: 1440px; }

/* Tabla con scroll horizontal en móvil sin perder estilos */
.tbl-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.tbl-scroll::-webkit-scrollbar { height: 8px; }
.tbl-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
.tbl-scroll table {
  min-width: max-content;
}

/* Scroll horizontal con snap (para steppers, tabs y grupos de chips
   que no caben en mobile) */
.hscroll {
  display: flex;
  gap: var(--gap-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 4px 2px;
  margin: 0 calc(var(--container-pad) * -1);
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * {
  scroll-snap-align: start;
  flex: 0 0 auto;
}

/* Grid auto-fit responsive: el ancho mínimo de cada columna se controla
   con --col-min (default 260px). */
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--col-min, 260px), 1fr));
  gap: var(--gap-md);
}
.grid-auto.tight { gap: var(--gap-sm); }

/* Stack: hijos en columna con gap consistente */
.stack       { display: flex; flex-direction: column; gap: var(--gap-md); }
.stack.tight { gap: var(--gap-sm); }
.stack.loose { gap: var(--gap-lg); }

/* Cluster: hijos en fila con wrap natural y gap */
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-sm);
  align-items: center;
}
.cluster.center  { justify-content: center; }
.cluster.between { justify-content: space-between; }
.cluster.end     { justify-content: flex-end; }

/* En mobile, un .cluster.stack-on-mobile pasa a columna */
@media (max-width: 639.98px) {
  .cluster.stack-on-mobile { flex-direction: column; align-items: stretch; }
  .cluster.stack-on-mobile > * { width: 100%; }
}

/* Botones full-width en mobile */
@media (max-width: 479.98px) {
  .btn-block-xs { width: 100%; }
}

/* Tipografía responsive aplicada como utility */
.t-h1 { font-family: var(--font-heading); font-weight: 800; font-size: clamp(1.65rem, 3vw, 2.75rem); line-height: 1.1; letter-spacing: -.03em; }
.t-h2 { font-family: var(--font-heading); font-weight: 700; font-size: clamp(1.35rem, 2.4vw, 1.85rem); line-height: 1.2; letter-spacing: -.02em; }
.t-h3 { font-family: var(--font-heading); font-weight: 700; font-size: clamp(1.1rem,  1.8vw, 1.3rem);  line-height: 1.25; }
.t-lead  { font-size: clamp(.98rem, 1.6vw, 1.08rem); line-height: 1.7; color: var(--text-soft); }
.t-small { font-size: clamp(.82rem, 1.4vw, .9rem); }

/* No-overflow guards comunes (útil cuando hijos largos rompen el grid) */
.min-w-0   { min-width: 0; }
.no-shrink { flex-shrink: 0; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════
   Responsive — overrides de componentes base
   ══════════════════════════════════════════════════════════════════ */

/* Desktop: inputs vuelven a 14–15px (no hay riesgo de zoom iOS) */
@media (min-width: 992px) {
  input, select, textarea { font-size: 0.95rem; }
}

@media (max-width: 1199.98px) {
  .section-head { gap: 12px; }
}

@media (max-width: 991.98px) {
  .section-space { padding: clamp(44px, 7vw, 72px) 0; }
  .section-head { align-items: flex-start; }
}

@media (max-width: 767.98px) {
  .section-space { padding: clamp(36px, 6vw, 56px) 0; }
  .section-title { line-height: 1.12; }
  .blob { filter: blur(54px); opacity: 0.18; }
  .blob-a, .blob-b, .blob-c { width: 300px; height: 300px; }
  .bg-grid { background-size: 48px 48px; opacity: 0.10; }
  .section-head {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 18px;
  }
}

@media (max-width: 639.98px) {
  .pill { padding: .54rem .82rem; font-size: .82rem; }
  .chip { padding: .34rem .58rem; font-size: .72rem; }
  .scroll-top { width: 42px; height: 42px; }
}

@media (max-width: 479.98px) {
  .section-space { padding: 32px 0; }
  .btn-brand, .btn-outline-pro, .btn-ghost {
    font-size: .86rem;
    padding: .72rem 1.1rem;
  }
  /* En xs el max-width 100% para evitar overflow en cards con textos
     largos (ej: títulos de proyectos) */
  .section-text { max-width: 100%; }
}

/* ─── Title truncation ───────────────────────────────────────────── */
.trunc-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.trunc-title.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
}
.trunc-btn {
  display: inline-block;
  margin-top: .25rem;
  background: none;
  border: none;
  padding: 0;
  font-size: .72rem;
  font-weight: 600;
  color: var(--brand, #1a73e8);
  cursor: pointer;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.trunc-btn:hover { opacity: .75; }

/* Reduce motion: respetar preferencia del usuario */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* Print: minimal, ocultar UI accesoria */
@media print {
  .scroll-top, .blob, .bg-grid, .bg-shell { display: none !important; }
  body { background: #fff; color: #000; }
}
