:root {
  --black: #0a0a0a;
  --white: #f2f2f2;
  --blue: #3d6bff;
  --red: #ff2e3e;
  --purple: #8b2dff;
  --gray-mid: #1a1a1a;

  --font-mono: 'Space Mono', monospace;
  --font-sans: 'Inter', sans-serif;

  --nav-height: 72px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 8px);
  background-color: var(--black);
  color: var(--white);
}

body {
  font-family: var(--font-sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  position: relative;
}

::selection {
  background-color: var(--purple);
  color: var(--white);
}

/* Subtle Noise Overlay */
.noise-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
}

/* Navigation — mix-blend exclusion para mantenerse legible sobre cualquier fondo */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  min-height: var(--nav-height);
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  z-index: 100;
  pointer-events: none; /* Let clicks pass through empty space */
  mix-blend-mode: exclusion;
}

.nav-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.nav a, .nav .lang-toggle {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  color: var(--white);
  text-decoration: none;
  pointer-events: auto; /* Re-enable clicks */
  padding: 12px 8px;    /* Tap target */
  margin: -12px -8px;
}

.brand {
  font-weight: 700;
}

.nav-symbol {
  font-family: var(--font-mono);
  font-size: 12px;
  opacity: 0.65;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.lang-toggle {
  background: none;
  border: none;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .nav-links a:hover, .lang-toggle:hover {
    color: var(--blue);
  }
}

/* Mobile Nav */
@media (max-width: 639px) {
  .nav {
    padding: 14px 16px;
    --nav-height: 56px;
  }
  .nav a, .nav .lang-toggle {
    font-size: 11px;
  }
  .nav-links {
    gap: 12px;
  }
  .nav-symbol {
    display: none;
  }
}

/* Typography elements */
.label {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
}
.group-label {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

/* ===== HERO ===== */
.hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  text-align: center;
  padding: calc(var(--nav-height) + 16px) 16px 16px;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Entrada escalonada (fade-up) */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.anim-up {
  opacity: 0;
  animation: fade-up 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.anim-d0 { animation-delay: 0.1s; }
.anim-d1 { animation-delay: 0.25s; }

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  margin-bottom: 20px;
}
.eyebrow-order { color: var(--blue); }
.eyebrow-chaos { color: var(--red); }
.eyebrow-x { opacity: 0.5; margin: 0 6px; }

.glitch-wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(48px, 10vw, 140px);
  position: relative;
  line-height: 1.1;
  color: transparent;
}

.glitch-wordmark::before,
.glitch-wordmark::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: var(--white);
  pointer-events: none;
}

.glitch-wordmark.is-glitching::before {
  color: var(--red);
  transform: translateX(-2px);
}

.glitch-wordmark.is-glitching::after {
  color: var(--blue);
  transform: translateX(2px);
}

/* Pequeño salto residual */
.glitch-wordmark.residual-glitch::before {
  transform: translate(2px, 1px);
  color: var(--red);
}
.glitch-wordmark.residual-glitch::after {
  transform: translate(-1px, -1px);
  color: var(--blue);
}

.tagline {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(16px, 2vw, 18px);
  color: var(--white);
  opacity: 0.7;
  max-width: 600px;
  margin-top: 16px;
}

/* Word-by-word reveal del tagline */
@keyframes word-reveal {
  from { opacity: 0; transform: translateY(8px); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.word-reveal {
  opacity: 0;
  display: inline-block;
  margin-right: 0.28em;
  animation: word-reveal 0.4s ease forwards;
}

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  width: 1px;
  height: 40px;
  background-color: transparent;
  display: flex;
  justify-content: center;
}

.pulse-line {
  width: 1px;
  height: 100%;
  background-color: var(--white);
  transform-origin: top;
  animation: pulse-scroll 2s ease-in-out infinite;
}

@keyframes pulse-scroll {
  0% { transform: scaleY(0); }
  50% { transform: scaleY(1); }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ===== ABOUT ===== */
.about {
  padding: 80px 16px;
  max-width: 1200px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.about.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Manifiesto: las 3 palabras de la encuesta */
.manifesto {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(34px, 11vw, 110px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 56px;
}
.manifesto-line {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.manifesto.is-visible .manifesto-line { opacity: 1; transform: translateY(0); }
.manifesto.is-visible .manifesto-line:nth-child(1) { transition-delay: 0s; }
.manifesto.is-visible .manifesto-line:nth-child(2) { transition-delay: 0.14s; }
.manifesto.is-visible .manifesto-line:nth-child(3) { transition-delay: 0.28s; }

.manifesto-chaos {
  color: var(--red);
  position: relative;
}
.manifesto-chaos::before {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  color: var(--blue);
  transform: translateX(-3px);
  z-index: -1;
  opacity: 0.8;
  pointer-events: none;
}

.about-center-text {
  max-width: 800px;
  margin: 0 auto 56px auto;
  text-align: center;
  font-size: 18px;
  opacity: 0.9;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  position: relative;
}

.about-col {
  padding: 40px;
  position: relative;
}

.calm-col {
  border-right: 1px solid var(--blue);
}
.calm-label {
  color: var(--blue);
  margin-bottom: 16px;
}

.chaos-col {
  background-color: rgba(255,255,255,0.01);
  position: relative;
}
.chaos-col::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noise"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noise)"/%3E%3C/svg%3E');
  opacity: 0.04;
  pointer-events: none;
}
.chaos-label {
  color: var(--red);
  margin-bottom: 16px;
}

/* Individual letter rotation spans */
.chaos-text span {
  display: inline-block;
}

.member-role {
  font-size: 14px;
  opacity: 0.7;
  margin-top: 8px;
  max-width: 320px;
}

.member-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 20px;
  position: relative;
  z-index: 1;
}
.member-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--white);
  opacity: 0.75;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 10px 4px; /* Tap target */
  margin: -10px -4px;
}
@media (hover: hover) and (pointer: fine) {
  .calm-col .member-links a:hover { color: var(--blue); opacity: 1; }
  .chaos-col .member-links a:hover { color: var(--red); opacity: 1; }
}

/* ===== PORTFOLIO ===== */
.portfolio {
  padding: 40px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.portfolio-group {
  margin-bottom: 100px;
  position: relative;
  padding: 40px 0;
}

/* Palabra gigante de fondo */
.giant-word-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.giant-word {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(120px, 30vw, 420px);
  line-height: 0.8;
  letter-spacing: -0.04em;
  white-space: nowrap;
  user-select: none;
}
.giant-clean { color: var(--blue); opacity: 0.07; }
.giant-chaos { color: var(--red); opacity: 0.06; }
.giant-mentions { color: var(--purple); opacity: 0.09; }

.group-label {
  color: var(--blue);
}
.chaos-label-text {
  color: var(--red);
}
.mentions-label {
  color: var(--purple);
  opacity: 0.85;
}

.portfolio-card {
  background-color: var(--gray-mid);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  /* Reveal al entrar al viewport (in-view via JS) */
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 0.5s ease, transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.portfolio-card.in-view {
  opacity: 1;
  transform: scale(1);
}

/* Placeholder mientras llegan los assets del drive */
.portfolio-card.is-placeholder::after {
  content: attr(data-slot);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.25em;
  opacity: 0.18;
}

/* Clean Group */
.clean-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  position: relative;
  z-index: 1;
}
.clean-card {
  aspect-ratio: 3 / 4;
  border: 1px solid var(--blue);
}
.card-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px;
  background: linear-gradient(to top, rgba(10,10,10,0.9), transparent);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.card-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}
.card-year {
  font-size: 12px;
  opacity: 0.7;
}

@media (hover: hover) and (pointer: fine) {
  .clean-card.in-view:hover {
    transform: scale(1.02);
  }
  .clean-card:hover .card-overlay {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Touch fallback for mobile */
@media (hover: none), (pointer: coarse) {
  .card-overlay {
    opacity: 1;
    transform: translateY(0);
    background: linear-gradient(to top, rgba(10,10,10,0.9) 0%, rgba(10,10,10,0) 100%);
  }
}

/* Chaos Group */
.chaos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  position: relative;
  z-index: 1;
}
.chaos-card {
  aspect-ratio: 3 / 4;
  border: 1px solid var(--red);
  /* Scatter via custom props (JS) */
  --sx: 0px;
  --sy: 0px;
  --sr: 0deg;
  transform: translate(var(--sx), var(--sy)) rotate(var(--sr)) scale(0.72);
}
.chaos-card.in-view {
  transform: translate(var(--sx), var(--sy)) rotate(var(--sr)) scale(1);
}
.card-glitch-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
}

@media (hover: hover) and (pointer: fine) {
  .chaos-card:hover {
    animation: chaos-shake 0.2s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  }
  /* RGB split effect via pseudo elements */
  .chaos-card:hover .card-glitch-wrapper::before,
  .chaos-card:hover .card-glitch-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.55;
    mix-blend-mode: screen;
    pointer-events: none;
  }
  .chaos-card:hover .card-glitch-wrapper::before {
    background-color: var(--red);
    transform: translateX(-3px);
    z-index: 2;
  }
  .chaos-card:hover .card-glitch-wrapper::after {
    background-color: var(--blue);
    transform: translateX(3px);
    z-index: 2;
  }
}
@keyframes chaos-shake {
  0%, 100% { transform: translate(var(--sx), var(--sy)) rotate(var(--sr)) scale(1); }
  25% { transform: translate(calc(var(--sx) - 3px), var(--sy)) rotate(calc(var(--sr) - 1deg)) scale(1); }
  50% { transform: translate(calc(var(--sx) + 3px), var(--sy)) rotate(calc(var(--sr) + 1deg)) scale(1); }
  75% { transform: translate(calc(var(--sx) - 3px), var(--sy)) rotate(calc(var(--sr) - 1deg)) scale(1); }
}

/* Mentions Group */
.mentions-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 1;
}
.mention-card {
  aspect-ratio: 1 / 1;
  width: 250px;
  flex: 0 0 auto;
  scroll-snap-align: start;
  border: 1px solid rgba(139, 45, 255, 0.4);
}
@media (hover: hover) and (pointer: fine) {
  .mention-card.in-view {
    opacity: 0.8;
  }
  .mention-card.in-view:hover {
    opacity: 1;
  }
}

/* ===== CONTACT ===== */
.contact {
  padding: 120px 16px;
  max-width: 800px;
  margin: 0 auto;
}
.contact-title {
  font-family: var(--font-mono);
  font-size: 40px;
  text-transform: uppercase;
  margin-bottom: 12px;
  text-align: center;
}
.contact-intro {
  text-align: center;
  opacity: 0.7;
  margin-bottom: 48px;
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.glitch-label {
  font-family: var(--font-mono);
  font-size: 14px;
  text-transform: uppercase;
  color: var(--white);
  opacity: 0.7;
  transition: opacity 0.2s;
  position: relative;
}
.glitch-label.is-glitching {
  color: transparent;
}
.glitch-label.is-glitching::before,
.glitch-label.is-glitching::after {
  content: attr(data-text);
  text-transform: uppercase;
  position: absolute;
  top: 0; left: 0;
}
.glitch-label.is-glitching::before {
  color: var(--red);
  transform: translateX(-1px);
}
.glitch-label.is-glitching::after {
  color: var(--blue);
  transform: translateX(1px);
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(242, 242, 242, 0.3);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 16px;
  padding: 8px 0;
  outline: none;
  transition: border-color 0.3s ease;
  border-radius: 0; /* iOS reset */
  appearance: none;
}
.select-wrapper {
  position: relative;
}
.contact-form select {
  width: 100%;
}
.contact-form select option {
  background-color: var(--black);
  color: var(--white);
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  border-bottom-color: var(--blue);
}

.submit-btn {
  background-color: var(--white);
  color: var(--black);
  border: none;
  padding: 16px 32px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  margin-top: 16px;
  transition: background-color 0.3s, color 0.3s, transform 0.3s;
  align-self: flex-start;
  min-height: 44px; /* Touch target size */
}

@media (hover: hover) and (pointer: fine) {
  .submit-btn:hover {
    background-color: var(--red);
    color: var(--white);
    transform: skew(-2deg);
  }
}
@media (hover: none), (pointer: coarse) {
  .submit-btn:active {
    background-color: var(--red);
    color: var(--white);
  }
}

.form-note {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  border-left: 2px solid var(--purple);
  padding: 12px 16px;
  background-color: rgba(242, 242, 242, 0.03);
}
.form-note a {
  color: var(--blue);
}

/* ===== FOOTER ===== */
.footer {
  padding: 40px 32px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(242, 242, 242, 0.1);
}
.footer-left, .footer-right {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--white);
  opacity: 0.5;
  text-decoration: none;
  padding: 10px; /* Touch target */
  margin: -10px;
}

/* ===== BREAKPOINTS & RESPONSIVE ===== */
@media (max-width: 1023px) {
  .clean-grid, .chaos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 639px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .calm-col {
    border-right: none;
    border-bottom: 1px solid var(--blue);
    padding: 0 0 32px 0;
  }
  .chaos-col {
    padding: 32px 0 0 0;
  }
  .manifesto {
    margin-bottom: 40px;
  }

  .clean-grid, .chaos-grid {
    grid-template-columns: 1fr;
  }

  .mention-card {
    width: 60vw;
  }

  .contact {
    padding: 60px 16px;
  }
  .submit-btn {
    align-self: stretch;
  }

  .footer {
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 40px 16px;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .pulse-line {
    animation: none;
    transform: scaleY(1);
  }
  .anim-up, .word-reveal {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  .manifesto-line {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .manifesto-chaos::before {
    display: none !important;
  }
  .portfolio-card {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .about {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  /* El wordmark usa color transparente + pseudos: con motion reducido
     se pinta el texto base directamente y se apagan los pseudos */
  .glitch-wordmark {
    color: var(--white);
  }
  .glitch-wordmark::before,
  .glitch-wordmark::after,
  .glitch-wordmark.is-glitching::before,
  .glitch-wordmark.is-glitching::after,
  .chaos-card:hover,
  .chaos-card:hover .card-glitch-wrapper::before,
  .chaos-card:hover .card-glitch-wrapper::after,
  .glitch-label.is-glitching::before,
  .glitch-label.is-glitching::after {
    animation: none !important;
    transform: none !important;
    color: inherit !important;
    display: none !important;
  }
  .submit-btn:hover {
    transform: none !important;
  }
}
