/* ==============================================================
   CODESIGN PROJECTS — servicios-iot.html adaptado al sistema
   visual del index / servicios.html.
================================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --text: #1c1a1f;
  --text-soft: #57525c;
  --text-faint: #8b8690;
  --surface: #ffffff;
  --surface-alt: #f6f3ec;
  --line: #e6e0d2;
  --orange: #e2531e;
  --khaki: #a4906a;
  --header-bg: rgba(255, 255, 255, 0.9);

  --font-display: "Space Grotesk", "Helvetica Neue", sans-serif;
  --font-body: "Inter", "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

:root[data-theme="dark"] {
  --text: #f2efe9;
  --text-soft: #c7c2cb;
  --text-faint: #948e9a;
  --surface: #17151b;
  --surface-alt: #221f27;
  --line: rgba(255, 255, 255, 0.12);
  --khaki: #bda87f;
  --header-bg: rgba(23, 21, 27, 0.85);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--surface);
  background-image: radial-gradient(circle, rgba(226, 83, 30, 0.13) 1px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--text);
  line-height: 1.6;
  padding-top: 76px;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: auto; padding: 0 2rem; }
img { max-width: 100%; display: block; }
a { color: inherit; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 1rem;
}

/* ==============================
   HEADER / NAV
============================== */
header {
  position: fixed;
  top: 0; width: 100%; z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.navbar { display: flex; justify-content: space-between; align-items: center; padding: 1.15rem 0; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand-mark { height: 26px; width: auto; }
.brand-mark-dark { display: none; }
:root[data-theme="dark"] .brand-mark-dark { display: block; }
:root[data-theme="dark"] .brand-mark-light { display: none; }

.brand-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--text);
}

.brand-suffix {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--khaki);
  margin-left: 0.15rem;
}

.menu { display: flex; gap: 2.2rem; list-style: none; align-items: center; }

.menu > li > a {
  text-decoration: none;
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  padding: 0.4rem 0;
}

.menu > li > a::after {
  content: "";
  position: absolute;
  bottom: -2px; left: 0;
  width: 0%; height: 1px;
  background: var(--orange);
  transition: width 0.25s ease;
}
.menu > li > a:hover { color: var(--text); }
.menu > li > a:hover::after { width: 100%; }

.menu > li > a.active { color: var(--orange); }
.menu > li > a.active::after { width: 100%; background: var(--orange); }

.menu .btn-nav {
  padding: 0.6rem 1.1rem;
  background: var(--text);
  color: var(--surface);
  border-radius: 2px;
  font-size: 0.8rem;
}
.menu .btn-nav::after { display: none; }
.menu .btn-nav:hover { background: var(--orange); color: #fff; }

.dropdown { position: relative; }

.dropdown-menu {
  list-style: none;
  position: absolute;
  top: 130%; left: 0;
  min-width: 220px;
  padding: 0.4rem 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 16px 32px rgba(28, 26, 31, 0.08);
  opacity: 0; visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s ease;
}
.dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }

.dropdown-menu li a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.82rem;
  color: var(--text-soft);
  text-decoration: none;
}
.dropdown-menu li a:hover { background: var(--surface-alt); color: var(--text); }
.dropdown-menu li a.active { color: var(--orange); background: var(--surface-alt); }
.dropdown-menu i { width: 16px; text-align: center; color: var(--text-faint); }
.dropdown-menu a:hover i { color: var(--orange); }

.menu-toggle { display: none; font-size: 1.4rem; cursor: pointer; color: var(--text); }

/* ==============================
   BOTONES
============================== */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  padding: 0.85rem 1.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: 2px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.btn.primary { background: var(--text); color: var(--surface); }
.btn.primary:hover { background: var(--orange); }
.btn.ghost { border-color: var(--text); color: var(--text); }
.btn.ghost:hover { border-color: var(--orange); color: var(--orange); }

/* ==============================
   HERO GENÉRICO
============================== */
.sub-hero { padding: 7.5rem 0 3rem; text-align: center; }

.sub-hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.3rem, 4.6vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 1.2rem;
}

.sub-hero .lead {
  font-size: 1.08rem;
  color: var(--text-soft);
  max-width: 56ch;
  margin: 0 auto;
}

/* ==============================
   SECTION HEAD
============================== */
.section-head { max-width: 640px; margin-bottom: 2.5rem; }
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  letter-spacing: -0.01em;
}

/* ==============================
   DIAGRAMA
============================== */
.iot-diagram { padding: 4rem 0 3rem; }

.diagram {
  display: flex;
  align-items: stretch;
  gap: 1.5rem;
}

.node {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2rem 1.6rem;
  background: var(--surface-alt);
}

.node-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--orange);
  margin-bottom: 0.8rem;
}

.node h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.node p { font-size: 0.86rem; color: var(--text-soft); }

.arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--khaki);
  flex-shrink: 0;
}

/* ==============================
   CASOS — filas alternadas imagen/texto
============================== */
.iot-cases { padding: 2rem 0 4rem; }

.proj-row {
  display: grid;
  grid-template-columns: minmax(200px, 32%) 1fr;
  gap: 3rem;
  align-items: center;
  padding: 3.2rem 0;
  border-top: 1px solid var(--line);
}
.proj-row:last-child { border-bottom: 1px solid var(--line); }

.proj-row.reverse .proj-media { order: 2; }
.proj-row.reverse .proj-text { order: 1; }
/* al invertir el order, también hay que invertir el ancho de las columnas
   para que la columna angosta (32%) siga correspondiendo a la imagen y
   no al texto, sin importar de qué lado quede visualmente */
.proj-row.reverse { grid-template-columns: 1fr minmax(200px, 32%); }

.proj-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.proj-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(85%) contrast(1.03);
  transition: filter 0.4s ease, transform 0.5s ease;
}
.proj-row:hover .proj-media img { filter: grayscale(0%) contrast(1); transform: scale(1.03); }

/* captura de celular (vertical) — la caja se agranda en vertical (no se
   encoge la imagen) para que el screenshot se vea a buen tamaño */
.proj-media.tall { aspect-ratio: 9 / 16; max-width: 260px; justify-self: center; }
.proj-media img.pos-contain {
  box-sizing: border-box;
  padding: 1.25rem;
  object-fit: contain;
}
.proj-row:hover .proj-media img.pos-contain { transform: none; }

.lightbox-media { cursor: zoom-in; }

/* ==============================
   LIGHTBOX DE MEDIA (imagen o video)
============================== */
.media-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 13, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.media-lightbox-overlay.active { opacity: 1; visibility: visible; }
.media-lightbox-overlay img,
.media-lightbox-overlay video {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.media-lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}
.media-lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }

.proj-text h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.55rem;
  margin-bottom: 0.9rem;
}

.proj-text > p { color: var(--text-soft); margin-bottom: 1.4rem; max-width: 46ch; }

.proj-text ul { list-style: none; }
.proj-text li {
  font-size: 0.88rem;
  color: var(--text-soft);
  padding: 0.3rem 0;
  padding-left: 1.1rem;
  position: relative;
}
.proj-text li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--orange);
}

/* ==============================
   FRASE DESTACADA
============================== */
.value-quote { background: #1c1a1f; padding: 4.5rem 0; text-align: center; }
.value-quote p {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  color: #fff;
  max-width: 44ch;
  margin: 0 auto;
}

/* ==============================
   CTA GENÉRICO
============================== */
.sub-cta { text-align: center; padding: 5rem 0 7rem; }

.sub-cta h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  margin-bottom: 0.8rem;
}
.sub-cta p { color: var(--text-soft); max-width: none; margin: 0 auto 2rem; }

/* ==============================
   FOOTER
============================== */
.footer { background: var(--surface-alt); color: var(--text-soft); padding: 4.5rem 0 2rem; transition: background-color 0.25s ease, color 0.25s ease; }
.footer-grid { display: grid; grid-template-columns: 1.8fr 1fr 1fr 1fr 1fr 1fr; gap: 2rem; }

.footer-brand h3 {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 1rem;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}
.footer-brand p { font-size: 0.85rem; max-width: 30ch; line-height: 1.6; }

.footer-column h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
.footer-column ul { list-style: none; }
.footer-column li { margin-bottom: 0.7rem; }
.footer-column a {
  text-decoration: none;
  color: var(--text-soft);
  font-size: 0.85rem;
  transition: color 0.2s ease;
}
.footer-column a:hover { color: var(--orange); }

.footer-bottom {
  max-width: 1200px;
  margin: 3rem auto 0;
  padding: 0 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.footer-bottom p { font-size: 0.75rem; color: var(--text-faint); }

/* ==============================
   BOTONES FLOTANTES — volver arriba y tema
============================== */
.fab-top,
.fab-theme {
  position: fixed;
  z-index: 500;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(28, 26, 31, 0.14);
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.2s ease, color 0.2s ease, visibility 0.25s, background-color 0.25s ease;
}
.fab-top:hover,
.fab-theme:hover { border-color: var(--orange); color: var(--orange); }

.fab-top {
  right: 2rem;
  bottom: 2rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
}
.fab-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }

.fab-theme {
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
}

.theme-icon-dark, .theme-icon-light { display: none; }
:root:not([data-theme="dark"]) .theme-icon-dark { display: block; }
:root[data-theme="dark"] .theme-icon-light { display: block; }

@media (max-width: 768px) {
  .fab-top { right: 1.2rem; bottom: 1.2rem; width: 40px; height: 40px; }
  .fab-theme { left: 1.2rem; width: 40px; height: 40px; }
}


/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 900px) {
  .diagram { flex-direction: column; }
  .arrow { transform: rotate(90deg); padding: 0.4rem 0; }
  .proj-row { grid-template-columns: 1fr; gap: 1.6rem; }
  .proj-row.reverse .proj-media,
  .proj-row.reverse .proj-text { order: initial; }
}

@media (max-width: 768px) {
  body { padding-top: 68px; }
  .sub-hero { padding: 5.5rem 0 2.5rem; }
  .iot-diagram { padding: 3rem 0 2rem; }
  .iot-cases { padding: 1rem 0 3rem; }

  .menu {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    position: absolute;
    top: 68px; left: 0; width: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 2rem 1.5rem;
  }
  .menu.active { display: flex; }
  .menu > li { width: 100%; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
  .menu .dropdown-menu { position: static; opacity: 1; visibility: visible; transform: none; border: none; box-shadow: none; padding-left: 1rem; display: none; }
  .menu .dropdown:hover .dropdown-menu { display: block; }
  .menu-toggle { display: block; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: span 2; }
}
