/* OforTech redesign — shared system */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Instrument+Serif:ital@0;1&display=swap');

/* @supports fallbacks for older browsers (Safari < 15.4, etc.) */
@supports not (background: color-mix(in oklab, white, black)) {
  :root {
    /* color-mix not supported — use direct rgba fallbacks */
  }
  .nav { background: rgba(5, 6, 10, 0.55); }
}
@supports not (text-wrap: balance) {
  .display, .h2 { word-wrap: break-word; }
}
@supports not (aspect-ratio: 1) {
  .work-card::before, .port-card::before, .team-photo::before {
    content: ''; display: block; padding-top: 75%;
  }
}

:root {
  /* Palette — Cinematic (default) */
  --bg-0: #05060a;
  --bg-1: #0a0d18;
  --bg-2: #11162a;
  --line: rgba(220, 235, 255, 0.08);
  --line-strong: rgba(220, 235, 255, 0.16);
  --fg-0: #f4f8ff;
  --fg-1: #cdd6e8;
  --fg-2: #8a93ad;
  --fg-3: #555c75;
  --accent: #1ea3ff;
  --accent-2: #1b5bff;
  --accent-deep: #0a1b6e;
  --accent-glow: rgba(30, 163, 255, 0.45);
  --grad: linear-gradient(135deg, #1ea3ff 0%, #1b5bff 50%, #0a1b6e 100%);

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 22px;
  --r-xl: 32px;

  --pad-x: clamp(24px, 5vw, 96px);
  --section-y: clamp(80px, 12vh, 160px);
}

[data-palette="cosmic"] {
  --bg-0: #050216;
  --bg-1: #0c0728;
  --bg-2: #170c40;
  --accent: #5ec5ff;
  --accent-2: #7c5bff;
  --accent-deep: #2b1188;
  --accent-glow: rgba(124, 91, 255, 0.5);
  --grad: linear-gradient(135deg, #5ec5ff 0%, #7c5bff 50%, #2b1188 100%);
}

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

html, body {
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-feature-settings: 'ss01', 'ss02';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body { min-height: 100vh; overflow-x: hidden; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: var(--bg-0); }

/* ============== TYPE ============== */
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: currentColor;
  display: inline-block;
}
.display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: clamp(48px, 9vw, 144px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.display .it { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; letter-spacing: -0.02em; }
.h2 {
  font-size: clamp(36px, 5.5vw, 80px);
  line-height: 0.96;
  letter-spacing: -0.035em;
  font-weight: 500;
  text-wrap: balance;
}
.h2 .it { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; }
.h3 {
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 500;
}
.lede {
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.45;
  color: var(--fg-1);
  max-width: 56ch;
  text-wrap: pretty;
}
.body {
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg-1);
}
.mono { font-family: 'JetBrains Mono', monospace; }

/* ============== NAV ============== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 12px 20px;
  background: var(--fg-0);
  color: var(--bg-0);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.skip-link:focus { left: 12px; top: 12px; outline: 2px solid var(--accent); }

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--pad-x);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  background: color-mix(in oklab, var(--bg-0) 55%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}
.nav-logo img { width: 28px; height: 28px; object-fit: contain; }
.nav-links {
  display: flex;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.nav-links a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--fg-2);
  transition: color .25s ease, background .25s ease;
  position: relative;
}
.nav-links a:hover { color: var(--fg-0); background: var(--line); }
.nav-links a.active { color: var(--fg-0); }
.nav-links a.active::after {
  content: '';
  position: absolute;
  inset: auto 14px 4px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.nav-cta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--fg-0);
  color: var(--bg-0);
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s ease;
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 30px var(--accent-glow); }

/* Right-side utility cluster */
.nav-utils { display: flex; align-items: center; gap: 8px; }
.util-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 600;
  transition: color .25s, border-color .25s, background .25s;
  background: transparent;
}
.util-btn:hover { color: var(--fg-0); border-color: var(--line-strong); background: var(--line); }
.util-btn svg { width: 15px; height: 15px; }
.lang-toggle { width: auto; padding: 0 12px; }

/* Mobile hamburger */
.nav-toggle {
  display: none;
  width: 40px; height: 40px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  border-radius: 8px;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--fg-0);
  border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--bg-0);
  display: none;
}
.mobile-menu.open { display: flex; }
.mobile-menu-inner {
  padding: 100px var(--pad-x) 40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.mobile-menu a {
  display: block;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--fg-0);
}
.mobile-menu a.active { color: var(--accent); }
.mobile-menu-cta {
  margin-top: 24px;
  padding: 18px 24px !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 999px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 13px !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--fg-0);
  color: var(--bg-0) !important;
}
.mobile-menu-utils {
  display: flex; gap: 12px; margin-top: 20px;
  padding-top: 20px; border-top: 1px solid var(--line);
}
.mobile-menu-utils .util-btn {
  width: auto; padding: 10px 14px; border-radius: 999px;
  display: inline-flex; gap: 8px; align-items: center;
}

/* ============== LAYOUT ============== */
.container { padding-inline: var(--pad-x); }
.section { padding-block: var(--section-y); position: relative; }

/* Final section before footer should breathe */
main > section:last-of-type,
main > .section:last-of-type {
  padding-bottom: clamp(80px, 14vh, 180px);
}
main {
  padding-bottom: 40px;
}
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  margin: 0 var(--pad-x);
}

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  transition: transform .3s cubic-bezier(.2,.7,.2,1), background .3s ease, color .3s ease;
  border: 1px solid var(--line-strong);
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--fg-0); color: var(--bg-0);
  border-color: var(--fg-0);
}
.btn-primary:hover { box-shadow: 0 10px 40px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--fg-0); }
.btn-ghost:hover { background: var(--line); }
.btn-arrow { width: 14px; height: 14px; transition: transform .3s ease; }
.btn:hover .btn-arrow { transform: translate(3px, -3px); }

/* ============== CARDS ============== */
.card {
  background: linear-gradient(180deg, color-mix(in oklab, var(--bg-1) 92%, transparent), color-mix(in oklab, var(--bg-0) 95%, transparent));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: border-color .3s ease, transform .3s ease;
}
.card:hover { border-color: var(--line-strong); }
.card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(600px circle at var(--mx,50%) var(--my,0%), color-mix(in oklab, var(--accent) 18%, transparent), transparent 50%);
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}
.card:hover::before { opacity: 1; }

/* ============== FOOTER ============== */
.footer {
  border-top: 1px solid var(--line);
  padding: 80px var(--pad-x) 40px;
  background: var(--bg-0);
  position: relative;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 60px;
  margin-bottom: 80px;
}
.footer h4 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin-bottom: 20px;
}
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer ul a { color: var(--fg-1); transition: color .2s; font-size: 15px; }
.footer ul a:hover { color: var(--fg-0); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.footer-mark {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: clamp(80px, 18vw, 280px);
  letter-spacing: -0.05em;
  line-height: 0.9;
  margin-bottom: 60px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0.85;
}

/* ============== UTILS ============== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
/* JS-failure fallback: anything still hidden after 1.2s becomes visible */
@keyframes revealFallback { to { opacity: 1; transform: none; } }
.reveal { animation: revealFallback 0.01s linear 1.2s forwards; }
.reveal.in { animation: none; }
/* No-JS fallback */
.no-js .reveal { opacity: 1; transform: none; }

.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0.04;
  z-index: 50;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.scroll-hint {
  position: absolute;
  bottom: 32px; left: var(--pad-x);
  display: flex; align-items: center; gap: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.scroll-hint .line {
  width: 40px; height: 1px; background: currentColor;
  position: relative; overflow: hidden;
}
.scroll-hint .line::after {
  content: ''; position: absolute; inset: 0;
  background: var(--fg-0);
  animation: scrollLine 2.4s ease-in-out infinite;
}
@keyframes scrollLine {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

/* ============== RESPONSIVE ============== */
/* Tablet */
@media (max-width: 1100px) {
  :root {
    --pad-x: clamp(20px, 4vw, 56px);
    --section-y: clamp(64px, 10vh, 120px);
  }
  /* Footer: between 900–1100px the brand column + 3 link columns squeezed
   * to ~150px each — Spanish translations like "Empezar un Proyecto" and
   * "Diseño de Marca y Identidad" wrapped to 2-3 lines. Drop to 2 link
   * columns; brand column spans both. */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}

/* Mobile landscape / small tablet */
@media (max-width: 900px) {
  :root {
    --pad-x: clamp(18px, 4.5vw, 40px);
    --section-y: clamp(56px, 9vh, 96px);
  }
  .nav { padding: 14px var(--pad-x); }
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav-utils { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 56px; }
  .footer { padding: 56px var(--pad-x) 32px; }
  .footer-mark { font-size: clamp(64px, 16vw, 120px); margin-bottom: 40px; }
  .footer-bottom { flex-direction: column; gap: 12px; align-items: flex-start; text-align: left; }
}

/* Mobile portrait */
@media (max-width: 600px) {
  :root {
    --pad-x: 18px;
    --section-y: 56px;
  }
  .display { font-size: clamp(40px, 12vw, 72px); }
  .h2 { font-size: clamp(30px, 8vw, 48px); }
  .h3 { font-size: clamp(20px, 5vw, 26px); }
  .lede { font-size: 16px; }
  .nav-cta span, .nav-cta { font-size: 10px; padding: 8px 12px; gap: 6px; }
  .nav-logo span { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .btn { padding: 12px 18px; font-size: 11px; }
  .card { padding: 22px; border-radius: 16px; }
  .scroll-hint { display: none; }
}

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

/* Print */
@media print {
  .nav, .footer, .hero-canvas, .page-hero-canvas, .grain, [data-parallax] { display: none !important; }
  body { background: #fff; color: #000; }
}
