/* Portfolio — sin fuentes ni recursos externos (privacidad + CSP estricta) */
:root {
  --bg: #0b0f14;
  --bg2: #121923;
  --card: #151d29;
  --line: #243044;
  --text: #e6edf6;
  --muted: #9aa8bb;
  --accent: #3ddc97;
  --accent2: #4cc9f0;
  --radius: 14px;
  --max: 1080px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fb;
    --bg2: #ffffff;
    --card: #ffffff;
    --line: #dbe3ee;
    --text: #0f1722;
    --muted: #536075;
    --accent: #0a9e66;
    --accent2: #0b7fb0;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: #04120b; padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip:focus { left: 8px; }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px max(20px, calc((100% - var(--max)) / 2));
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: -.02em; text-decoration: none; color: var(--text); font-size: 1.15rem; }
.brand .dot { color: var(--accent); }
.nav nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav nav a {
  color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: .95rem;
}
.nav nav a:hover, .nav nav a.active { color: var(--text); background: var(--bg2); }
.nav nav a.btn { color: #04120b; }

/* LAYOUT */
main { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
section { padding: 72px 0 8px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .6em; }
h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
h2::after { content: ""; display: block; width: 48px; height: 4px; margin-top: 10px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.sub { color: var(--muted); margin-top: -.2em; }
.note { color: var(--muted); font-size: .85rem; font-style: italic; }
.two { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }

/* HERO */
.hero { padding-top: 90px; padding-bottom: 20px; }
.eyebrow { font-family: var(--mono); color: var(--accent); font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 680px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0; }
.stats { list-style: none; padding: 0; margin: 36px 0 0; display: flex; gap: 14px; flex-wrap: wrap; }
.stats li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 22px; min-width: 150px; }
.stats strong { display: block; font-size: 1.7rem; color: var(--accent); }
.stats span { color: var(--muted); font-size: .85rem; }

/* BUTTONS */
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px; font-weight: 700; text-decoration: none;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #04120b; border: 0;
  transition: transform .15s ease, filter .15s ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); color: #04120b; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--text); }
.btn.small { padding: 7px 16px; font-size: .9rem; }

/* CARDS */
.grid { display: grid; gap: 20px; }
.two-col { grid-template-columns: repeat(2, 1fr); }
.three-col { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  transition: transform .2s ease, border-color .2s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-3px); }
.card ul { padding-left: 1.1em; margin: 0 0 1em; color: var(--muted); }
.card li { margin-bottom: .35em; }
.tag { font-family: var(--mono); font-size: .75rem; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.more { font-weight: 600; text-decoration: none; }
.chips { list-style: none; padding: 0 !important; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-family: var(--mono); font-size: .78rem; background: var(--bg2); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; margin: 0; color: var(--text); }
.chips.big li { font-size: .9rem; padding: 6px 14px; }
.plain { list-style: none; padding: 0; color: var(--muted); }

/* TIMELINE */
.timeline { list-style: none; margin: 28px 0 0; padding: 0 0 0 26px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 28px 22px; }
.timeline li::before {
  content: ""; position: absolute; left: -35px; top: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg);
}
.timeline li.next::before { background: var(--bg); border: 3px solid var(--accent2); }
.timeline time { font-family: var(--mono); font-size: .8rem; color: var(--accent); }
.timeline h3 { margin: 2px 0 4px; }
.timeline p { color: var(--muted); margin: 0; }

/* CONTACT / FOOTER */
.contact:hover { transform: none; border-color: var(--line); }
footer {
  margin-top: 80px; padding: 28px 20px; border-top: 1px solid var(--line);
  text-align: center; color: var(--muted); font-size: .9rem;
}
footer p { margin: 4px 0; }

/* REVEAL (lo activa main.js; sin JS todo se ve igual) */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media (max-width: 820px) {
  .two, .two-col, .three-col { grid-template-columns: 1fr; }
  .nav { flex-direction: column; align-items: flex-start; gap: 6px; }
  section { padding-top: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
@media print {
  .nav, .cta, footer { display: none; }
  body { background: #fff; color: #000; }
}

/* ---------- Caso de estudio y galería ---------- */
.card.featured { padding: 28px; margin-bottom: 20px; }
.card.featured:hover { transform: none; }
.card.featured h4 { margin: 1.4em 0 .5em; font-size: 1rem; color: var(--accent); }
.hero-fig { margin: 18px 0 24px; }
.hero-fig img { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--line); }
.spaced { margin-top: 20px; }
.spec { width: 100%; border-collapse: collapse; font-size: .92rem; margin-bottom: 1em; }
.spec th, .spec td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec th { color: var(--muted); font-weight: 600; width: 38%; }
.spec td { font-family: var(--mono); font-size: .82rem; word-break: break-word; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 12px; }
.gallery figure { margin: 0; }
.gallery a.gal { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg2); }
.gallery img { width: 100%; height: 190px; object-fit: cover; display: block; transition: transform .3s ease; }
.gallery a.gal:hover img { transform: scale(1.05); }
.gallery figcaption { font-size: .82rem; color: var(--muted); margin-top: 6px; }

/* Visor de imágenes (<dialog>) */
dialog.viewer { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; color: #fff; }
dialog.viewer::backdrop { background: rgba(0, 0, 0, .85); }
.viewer-inner { position: relative; display: grid; gap: 8px; justify-items: center; }
.viewer img { max-width: 94vw; max-height: 84vh; width: auto; height: auto; border-radius: 10px; }
.viewer p { margin: 0; font-size: .95rem; text-align: center; max-width: 80ch; }
.viewer .vbtn { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.65); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.viewer .vbtn:hover { background: rgba(0,0,0,.9); }

@media (max-width: 820px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .gallery img { height: 150px; }
}

/* Tarjetas de presentación */
.biz-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 22px; }
.biz-cards figure { margin: 0; }
.biz-cards a.gal { display: block; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.35); border: 1px solid var(--line); }
.biz-cards img { width: 100%; height: auto; display: block; transition: transform .3s ease; }
.biz-cards a.gal:hover img { transform: scale(1.02); }
.biz-cards figcaption { font-size: .82rem; color: var(--muted); margin-top: 8px; text-align: center; }
@media (max-width: 820px) { .biz-cards { grid-template-columns: 1fr; } }

/* ---------- Celular y pantallas táctiles ---------- */
html { -webkit-text-size-adjust: 100%; }
a, button { touch-action: manipulation; }
h1, h2, .eyebrow { text-wrap: balance; }
p, li { text-wrap: pretty; }

/* Sin efectos "hover" pegados en pantallas táctiles */
@media (hover: none) {
  .card:hover, .btn:hover, .gallery a.gal:hover img, .biz-cards a.gal:hover img { transform: none; }
}

@media (max-width: 820px) {
  html { scroll-padding-top: 64px; }

  /* Menú: una sola fila compacta que se desliza con el dedo */
  .nav { flex-direction: row; align-items: center; gap: 8px; padding: 6px 10px 6px 16px; }
  .brand { font-size: 1rem; white-space: nowrap; flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; }
  .nav nav { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; gap: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav nav::-webkit-scrollbar { display: none; }
  .nav nav a { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; }
  .nav nav a.btn.small { min-height: 40px; padding: 0 16px; margin-left: 4px; }

  section { padding-top: 44px; }
  .hero { padding-top: 36px; }
  h1 { font-size: clamp(1.9rem, 8.2vw, 3rem); }
  .lead { font-size: 1.05rem; }
  .eyebrow { font-size: .74rem; letter-spacing: .05em; }

  .btn { padding: 14px 22px; }
  .cta .btn { flex: 1 1 100%; text-align: center; }

  .stats { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .stats li { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 12px 16px; }
  .stats strong { flex: 0 0 5.6rem; font-size: 1.5rem; }

  .card, .card.featured { padding: 18px; }
  .chips li { font-size: .82rem; }

  /* Tabla de equipos apilada: los modelos ya no se cortan a la mitad */
  .spec, .spec tbody, .spec tr, .spec th, .spec td { display: block; width: 100%; }
  .spec tr { padding: 9px 0; border-bottom: 1px solid var(--line); }
  .spec th, .spec td { border: 0; padding: 0; }
  .spec th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
  .spec td { font-size: .9rem; margin-top: 2px; }

  .gallery { gap: 10px; }
  .gallery figure:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .gallery figure:last-child:nth-child(odd) img { height: 210px; }

  .contact a:not(.btn) { display: inline-block; padding: 10px 0; }
  .contact .btn { display: block; text-align: center; }
  .viewer .vbtn { padding: 12px 18px; }
}
