/* ===================================================================
   OCURIUM — Technical / industrial editorial direction
   Display: Space Grotesk (400, tight -3% tracking, scale-led, no italics)
   Body/labels: JetBrains Mono
   Palette: near-black / off-white / single warm brass accent
   =================================================================== */

:root {
  --bg: #fafaf9;
  --fg: #1a1a1a;
  --fg-dim: #666666;
  --line: rgba(26, 26, 26, 0.12);
  --accent: #2a4bdb; /* Luminous Blue — WGSN/Coloro Colour of the Year 2027 */
  --accent-rgb: 42, 75, 219;
  --grotesk: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --tracking-display: -0.03em;
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

/* Keeps anchor-jump targets from landing right under the fixed topbar */
section[id] { scroll-margin-top: 6rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Fixed, full-viewport WebGL canvas — lives behind the entire page and
   keeps animating as the user scrolls past the hero, not just inside it. */
#hero-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

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

h1, h2, h3 {
  font-family: var(--grotesk);
  font-weight: 400;
  letter-spacing: var(--tracking-display);
  line-height: 0.98;
  margin: 0;
}

.tag {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
  margin: 0 0 1.5rem;
  text-transform: none;
}

/* ---------------- topbar ---------------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--grotesk);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: var(--tracking-display);
}

.mark__icon {
  width: 3.1rem;
  height: auto;
  display: block;
}

.topbar__nav {
  display: flex;
  gap: clamp(1.75rem, 3.4vw, 2.75rem);
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.topbar__nav a {
  opacity: 0.85;
  padding: 0.4rem 0.7rem;
  margin: -0.4rem -0.7rem;
  transition: opacity 0.2s var(--ease), background 0.06s linear, color 0.06s linear;
  cursor: pointer;
}
.topbar__nav a.is-lit {
  opacity: 1;
  isolation: isolate;
  mix-blend-mode: normal;
  background: #000000;
  color: #ffffff;
}

/* ---------------- scroll-driven cinematic sequence ---------------- */

.sequence {
  position: relative;
  height: 400vh;
  z-index: 1;
}

.sequence__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.sequence__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(250,250,249,0.2) 0%, rgba(250,250,249,0.05) 32%, rgba(250,250,249,0.1) 68%, rgba(250,250,249,0.3) 100%);
  pointer-events: none;
}

.sequence__intro {
  position: absolute;
  left: clamp(1.25rem, 6vw, 5rem);
  right: clamp(1.25rem, 6vw, 5rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  transition: opacity 0.5s var(--ease);
}

.sequence__title {
  font-size: clamp(2.2rem, 6.4vw, 4.6rem);
  color: var(--fg);
  max-width: 26ch;
}

.sequence__scenes {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scene {
  position: absolute;
  max-width: 44rem;
  padding: 0 1.5rem;
  text-align: left;
  font-family: var(--grotesk);
  font-size: clamp(1.5rem, 3.8vw, 2.6rem);
  letter-spacing: var(--tracking-display);
  line-height: 1.18;
  color: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6), 0 1px 4px rgba(0, 0, 0, 0.65);
}

.scene.is-active { opacity: 1; }

/* Each word animates independently with a staggered delay (set inline via JS)
   so the line assembles left-to-right instead of fading in as one flat block. */
.scene .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em) scale(0.98);
  filter: blur(3px);
  transition: opacity 0.55s var(--ease), transform 0.6s var(--ease), filter 0.6s var(--ease);
}

.scene.is-active .word {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* ---------------- shared section layout ---------------- */

.capacidades, .trabajo, .contacto {
  position: relative;
  z-index: 1;
  padding: clamp(5rem, 12vw, 9rem) clamp(1.25rem, 6vw, 5rem);
  background: rgba(255, 255, 255, 0.7);
}

/* Ease into the first post-hero section's lighter overlay instead of a
   hard seam right where the hero ends. */
.capacidades {
  background: rgba(255, 255, 255, 0.8);
}

.section-head { max-width: 46rem; margin-bottom: clamp(3rem, 6vw, 5rem); }
.section-head--sub { margin-top: clamp(3rem, 6vw, 5rem); margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.section-head--sub h2 { font-size: clamp(1.6rem, 3.1vw, 2.15rem); }

.section-head h2, .contacto h2 {
  font-size: clamp(2.3rem, 5.4vw, 3.7rem);
}

/* ---------------- dataset (capacidades) ---------------- */

.dataset {
  border-top: 1px solid var(--line);
}

.dataset__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 1.5rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), background 0.4s var(--ease), padding 0.4s var(--ease);
}

.dataset__row.reveal {
  opacity: 0;
  transform: translateY(16px);
}
.dataset__row.reveal.is-visible { opacity: 1; transform: translateY(0); }

.dataset__row:hover {
  background: rgba(var(--accent-rgb), 0.06);
  padding-left: 1rem;
  padding-right: 1rem;
  margin: 0 -1rem;
}
.dataset__row:hover .dataset__title { color: var(--accent); }
.dataset__title { transition: color 0.3s var(--ease); }

.dataset__title {
  font-family: var(--grotesk);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  letter-spacing: var(--tracking-display);
}

.dataset__desc {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--fg-dim);
  line-height: 1.5;
}

/* ---------------- trabajo / proyectos ---------------- */

.trabajo__lista {
  border-top: 1px solid var(--line);
}

.proyecto {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: baseline;
  gap: 1.5rem;
  padding: 2rem 1rem;
  margin: 0 -1rem;
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(16px);
  cursor: pointer;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), background 0.3s var(--ease);
}

.proyecto.is-visible { opacity: 1; transform: translateY(0); }

.proyecto:hover {
  background: rgba(var(--accent-rgb), 0.06);
}
.proyecto:hover .proyecto__nombre { color: var(--accent); }

.proyecto__nombre {
  font-family: var(--grotesk);
  font-size: clamp(1.3rem, 3vw, 2rem);
  letter-spacing: var(--tracking-display);
  transition: color 0.3s var(--ease);
}

.proyecto__meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--fg-dim);
  white-space: nowrap;
  text-transform: uppercase;
}

.proyecto__desc {
  grid-column: 1 / -1;
  max-width: 42rem;
  font-family: var(--mono);
  color: var(--fg-dim);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-top: 0.25rem;
}

.proyecto__detalle {
  grid-column: 1 / -1;
  display: grid;
  gap: 1.25rem;
  margin: 1.5rem 0 0;
  max-width: 46rem;
}
.proyecto__detalle dt {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.proyecto__detalle dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--fg-dim);
}

/* ---------------- proyecto modal ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 1.25rem;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s var(--ease), visibility 0s linear 0.3s;
}
.modal.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.3s var(--ease);
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(250, 250, 249, 0.92);
  backdrop-filter: blur(3px);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 42rem;
  max-height: 88vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  padding: clamp(2rem, 5vw, 3.5rem);
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease);
}
.modal.is-open .modal__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal__close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: none;
  border: 1px solid var(--line);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.9rem;
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.modal__close:hover {
  background: var(--fg);
  color: var(--bg);
}

.modal__body h3 {
  font-family: var(--grotesk);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  letter-spacing: var(--tracking-display);
  margin-bottom: 1rem;
  padding-right: 2rem;
}

.modal__body .proyecto__meta {
  display: inline-block;
  margin: 0 1.25rem 0.5rem 0;
}

.modal__body .proyecto__desc {
  margin-top: 1rem;
}

/* ---------------- contacto ---------------- */

.contacto {
  text-align: left;
  min-height: 70vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
  border-top: 1px solid var(--line);
}

.contacto__intro {
  max-width: 26rem;
}

.contacto__form {
  width: 100%;
  max-width: 34rem;
  display: grid;
  gap: 1.5rem;
}

.contacto__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.field { display: grid; gap: 0.5rem; }

.field label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.field input,
.field textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.92rem;
  padding: 0.6rem 0;
  resize: vertical;
  transition: border-color 0.3s var(--ease);
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.contacto__status {
  min-height: 1em;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin: 0;
}

.contacto__cta {
  margin-top: 0.5rem;
  width: fit-content;
  cursor: pointer;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 0.9rem 1.6rem;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.contacto__cta span { color: var(--accent); transition: color 0.3s var(--ease); }
.contacto__cta:hover { background: var(--fg); color: var(--bg); }
.contacto__cta:hover span { color: var(--bg); }

/* ---------------- footer ---------------- */

.footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  padding: 2rem clamp(1.25rem, 6vw, 5rem) 3rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-dim);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

/* ---------------- generic scroll reveal ---------------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------- responsive ---------------- */

@media (max-width: 560px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 1rem;
  }
  .topbar__nav { gap: 0.6rem 1.5rem; font-size: 0.78rem; flex-wrap: wrap; }
  .topbar__nav a { padding: 0.3rem 0.4rem; margin: -0.3rem -0.4rem; }
}

@media (max-width: 860px) {
  .sequence { height: 260vh; }
  .sequence__intro { text-align: left; }

  .scene { font-size: clamp(1.2rem, 5.5vw, 1.6rem); max-width: 88%; }

  .contacto {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  .contacto__intro, .contacto__form { max-width: none; }
  .contacto__row { grid-template-columns: 1fr; gap: 1.5rem; }

  .dataset__row {
    grid-template-columns: 1fr;
    row-gap: 0.5rem;
  }

  .proyecto {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .proyecto__meta { white-space: normal; }

  .footer { flex-direction: column; gap: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .scene, .reveal, .proyecto, .dataset__row {
    transition: opacity 0.4s linear !important;
    transform: none !important;
    clip-path: none !important;
  }
}
