/* ============================================================
   Portfolio — dirección cinematográfica oscura.
   Tipografía: Instrument Serif (títulos) + Inter (texto).
   Los selectores y clases son los que usan js/app.js y js/reel.js:
   si se renombra alguno, hay que cambiarlo también allá.
   ============================================================ */
:root {
  --bg: #08080a;
  --panel: #111114;
  --panel-2: #17171b;
  --line: rgba(255, 255, 255, .09);
  --text: #f4f2ee;
  --muted: #a3a3ad;
  --accent: #e8c547;
  --radius: 6px;
  --max: 1200px;
  --pad: clamp(20px, 4vw, 48px);
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  counter-reset: sec;
}
/* Grano de película, muy sutil, sobre todo el sitio */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
a { color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent); color: #111; }

section, footer { max-width: var(--max); margin: 0 auto; padding: clamp(72px, 10vw, 128px) var(--pad); }
h1, h2, h3 { margin: 0 0 16px; font-weight: 400; }
h1, h2 { font-family: var(--serif); line-height: .95; letter-spacing: -.02em; }
h1 { font-size: clamp(3.4rem, 11vw, 9rem); }
h2 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h3 { font-family: var(--sans); line-height: 1.3; }

/* Encabezados de sección numerados: 01, 02… */
h2 em, .contact h2 em { font-style: italic; color: var(--accent); }
h2.num { counter-increment: sec; margin-bottom: 40px; max-width: 18ch; text-wrap: balance; }
h2.num::before {
  content: "0" counter(sec); display: block; margin-bottom: 16px;
  font: 500 .72rem/1 var(--sans); letter-spacing: .22em; color: var(--accent);
}

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; width: 100%;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px max(var(--pad), calc((100vw - var(--max)) / 2 + var(--pad)));
  background: linear-gradient(to bottom, rgba(8, 8, 10, .92), rgba(8, 8, 10, .55) 70%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { font: 400 1.4rem/1 var(--serif); letter-spacing: -.01em; text-decoration: none; }
.topbar nav { display: flex; gap: clamp(16px, 3vw, 36px); }
.topbar nav a {
  text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase; padding: 6px 0; position: relative; transition: color .25s;
}
.topbar nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.topbar nav a:hover { color: var(--text); }
.topbar nav a:hover::after { transform: scaleX(1); }
.topbar nav a.nav-cta {
  color: #111; background: var(--accent); padding: 10px 18px; border-radius: 999px; font-weight: 600;
  transition: transform .25s var(--ease), box-shadow .25s;
}
.topbar nav a.nav-cta::after { display: none; }
.topbar nav a.nav-cta:hover { color: #111; transform: translateY(-1px); box-shadow: 0 10px 28px -10px rgba(232, 197, 71, .6); }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.4fr .9fr; gap: clamp(28px, 5vw, 80px); align-items: center;
  min-height: min(94svh, 940px); padding-top: clamp(32px, 5vw, 64px); padding-bottom: clamp(56px, 8vw, 96px);
  position: relative;
}
.hero::before { /* luz cálida de fondo */
  content: ""; position: absolute; z-index: -1; right: -10%; top: 4%; width: 70%; height: 90%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(232, 197, 71, .14), transparent 72%);
}
.eyebrow {
  display: flex; align-items: center; gap: 14px; margin: 0 0 28px;
  color: var(--accent); text-transform: uppercase; letter-spacing: .2em; font-size: .72rem; font-weight: 500;
}
.eyebrow::before { content: ""; width: 40px; height: 1px; background: currentColor; }
.hero h1 { margin-bottom: 28px; text-wrap: balance; }
.lead { color: var(--muted); font-size: clamp(1.05rem, 1.6vw, 1.3rem); max-width: 44ch; margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero .social { margin-top: 28px; }

/* Foto en arco, integrada al fondo */
.hero-frame { position: relative; margin: 0; isolation: isolate; justify-self: end; width: min(100%, 440px); }
.hero-frame::before { /* arco desplazado, solo línea */
  content: ""; position: absolute; inset: 0; z-index: -1; transform: translate(18px, 18px);
  border: 1px solid rgba(232, 197, 71, .55); border-radius: 999px 999px 4px 4px;
}
.hero-photo {
  width: 100%; aspect-ratio: 4/5; object-fit: cover; object-position: 12% 30%;
  border-radius: 999px 999px 4px 4px; background: var(--panel);
  filter: grayscale(.3) contrast(1.08) saturate(.9) brightness(.9);
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
}
.hero-frame::after { /* tinte cálido sobre la foto */
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 999px 999px 4px 4px;
  background: linear-gradient(160deg, rgba(232, 197, 71, .16), transparent 45%), linear-gradient(to top, rgba(8, 8, 10, .55), transparent 40%);
  mix-blend-mode: soft-light;
}
.hero-status {
  position: absolute; left: -28px; bottom: 44px; z-index: 2; display: flex; align-items: center; gap: 10px;
  background: rgba(17, 17, 20, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 999px; padding: 11px 18px 11px 14px;
  font-size: .78rem; font-weight: 500; letter-spacing: .02em; box-shadow: 0 20px 50px -20px #000;
}
.hero-status[hidden] { display: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #5ee08a; box-shadow: 0 0 0 0 rgba(94, 224, 138, .6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 10px rgba(94, 224, 138, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 224, 138, 0); } }

/* ---------- Franja de especialidades ---------- */
.marquee { overflow: hidden; border-block: 1px solid var(--line); background: var(--panel); padding: 20px 0; }
.marquee[hidden] { display: none; }
.marquee-track { display: flex; width: max-content; animation: marquee 38s linear infinite; }
.marquee-group { display: flex; flex-shrink: 0; }
.marquee-group span {
  display: flex; align-items: center; white-space: nowrap; font: 400 clamp(1.4rem, 2.6vw, 2.2rem)/1 var(--serif);
  letter-spacing: -.01em; color: var(--text); opacity: .85;
}
.marquee-group span::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin: 0 clamp(20px, 3vw, 44px); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Links sociales y botón ---------- */
.social { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.social a {
  text-decoration: none; font-size: .78rem; font-weight: 500; letter-spacing: .08em;
  padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; color: var(--text);
  transition: border-color .25s, background .25s, color .25s;
}
.social a:hover { border-color: var(--accent); color: var(--accent); }
.btn {
  display: inline-block; text-decoration: none; font-weight: 600; font-size: .9rem; color: #111; background: var(--accent);
  padding: 15px 28px; border-radius: 999px; border: 1px solid var(--accent); transition: transform .25s var(--ease), box-shadow .25s, background .25s, color .25s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 34px -12px rgba(232, 197, 71, .65); }
.btn-ghost { background: transparent; color: var(--text); border-color: rgba(255, 255, 255, .22); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }

/* ---------- Reel (video principal) ---------- */
.player, .modal-player {
  position: relative; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9), 0 0 0 1px var(--line);
}
.player iframe, .player video, .modal-player iframe, .modal-player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-bottom: 40px; border-bottom: 1px solid var(--line); }
.filters button {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--muted); font: 500 .74rem/1 var(--sans); letter-spacing: .16em; text-transform: uppercase;
  padding: 14px 0; cursor: pointer; transition: color .25s, border-color .25s;
}
.filters button:hover { color: var(--text); }
.filters button.active { color: var(--accent); border-bottom-color: var(--accent); background: none; }

/* ---------- Grilla de trabajos ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: clamp(20px, 2.4vw, 32px) clamp(16px, 2vw, 28px); }
.card {
  background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; cursor: pointer;
  display: flex; flex-direction: column; gap: 16px;
}
.cover-wrap { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--panel); box-shadow: 0 0 0 1px var(--line); }
.card-cover {
  display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--panel-2);
  transition: transform .8s var(--ease), filter .5s;
}
.cover-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(8, 8, 10, .65), transparent 55%); opacity: .55; transition: opacity .4s;
}
.card:hover .card-cover { transform: scale(1.05); }
.card:hover .cover-wrap::after { opacity: 1; }
.card:hover .cover-wrap, .card:focus-visible .cover-wrap { box-shadow: 0 0 0 1px var(--accent); }
.card:focus-visible { outline: none; }
.badge-play {
  position: absolute; right: 14px; bottom: 14px; z-index: 1; background: rgba(8, 8, 10, .7);
  backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: .68rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
}
.card-body { padding: 0 2px; }
.card-body h3 { font: 400 1.5rem/1.15 var(--serif); letter-spacing: -.01em; margin: 0 0 6px; transition: color .25s; }
.card:hover .card-body h3 { color: var(--accent); }
.card-meta { color: var(--muted); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }
.empty { color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag { font-size: .7rem; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; }

/* ---------- Trabajos: tarjetas vacías ---------- */
.card.ghost { cursor: default; }
.card.ghost .card-cover {
  background:
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, .06) 18px 26px) 0 10px / 100% 8px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, .06) 18px 26px) 0 calc(100% - 10px) / 100% 8px no-repeat,
    radial-gradient(70% 90% at 50% 40%, #1d1d22, #101013);
}
.ghost-play {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 50%;
}
.ghost-play::after { content: ""; position: absolute; left: 22px; top: 18px; border-left: 14px solid rgba(255, 255, 255, .45); border-block: 9px solid transparent; }
.card.ghost:hover .card-cover { transform: none; }
.card.ghost:hover .cover-wrap { box-shadow: 0 0 0 1px var(--line); }
.card.ghost:hover .card-body h3 { color: inherit; }
.card.ghost .card-body h3 { opacity: .55; }

/* ---------- Servicios ---------- */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); gap: 1px; }
.service { background: var(--bg); padding: clamp(24px, 3vw, 40px); display: flex; flex-direction: column; gap: 14px; min-height: 280px; transition: background .35s; }
.service:hover { background: var(--panel); }
.service-n, .step-n { font: 500 .72rem/1 var(--sans); letter-spacing: .22em; color: var(--accent); }
.service h3, .step h3 { font: 400 clamp(1.6rem, 2.4vw, 2rem)/1.1 var(--serif); letter-spacing: -.01em; margin: auto 0 0; }
.service p, .step p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.6; }

/* ---------- Proceso ---------- */
.process-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: clamp(20px, 3vw, 40px); counter-reset: none; }
.step { position: relative; padding-top: 28px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.step::before { content: ""; position: absolute; left: 0; top: -1px; width: 48px; height: 1px; background: var(--accent); }
.step h3 { margin: 0; }

/* ---------- Sobre mí y contacto ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); column-gap: clamp(32px, 6vw, 96px); align-items: start; }
.about h2 { grid-column: 1; grid-row: 1 / span 2; }
.about #about-text, .about ul { grid-column: 2; }
.about p { color: var(--text); opacity: .86; font-size: clamp(1.05rem, 1.7vw, 1.3rem); line-height: 1.6; max-width: 58ch; margin: 0 0 1.1em; }
.about ul { list-style: none; margin: 16px 0 0; padding: 0; color: var(--muted); border-top: 1px solid var(--line); }
.about li { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }

.contact {
  max-width: none; text-align: center; border-top: 1px solid var(--line);
  background: radial-gradient(60% 80% at 50% 100%, rgba(232, 197, 71, .13), transparent 70%);
  padding-block: clamp(96px, 14vw, 180px);
}
.contact .eyebrow { justify-content: center; }
.contact .eyebrow::before { display: none; }
.contact h2 { font-size: clamp(2.4rem, 7vw, 6rem); max-width: 16ch; margin: 0 auto 40px; text-wrap: balance; }
.btn-mail {
  display: inline-block; text-decoration: none; font: 400 clamp(1.4rem, 3.6vw, 2.6rem)/1.2 var(--serif); letter-spacing: -.01em;
  border-bottom: 1px solid rgba(255, 255, 255, .25); padding-bottom: 6px; overflow-wrap: anywhere; transition: color .25s, border-color .25s;
}
.btn-mail:hover { color: var(--accent); border-color: var(--accent); }
.contact .social { justify-content: center; margin-top: 40px; }

footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; border-top: 1px solid var(--line); padding-top: 28px; padding-bottom: 36px; }
footer a { text-decoration: none; transition: color .25s; }
footer a:hover { color: var(--accent); }

/* ---------- Ventana de proyecto ---------- */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 4, 6, .82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal-card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  max-width: 1000px; width: 100%; max-height: 92vh; overflow: auto; padding: clamp(16px, 3vw, 32px);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .9); animation: pop .35s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.modal-close {
  position: absolute; top: 12px; right: 14px; z-index: 2; width: 40px; height: 40px; display: grid; place-items: center;
  background: rgba(8, 8, 10, .6); border: 1px solid var(--line); border-radius: 50%;
  color: var(--text); font-size: 1.5rem; cursor: pointer; line-height: 1; transition: border-color .25s, color .25s;
}
.modal-close:hover { border-color: var(--accent); color: var(--accent); }
.modal-info { margin-top: 28px; }
.modal-info h2 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 20px; }
.modal-info p { color: var(--muted); max-width: 64ch; }
.modal-info dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 28px; color: var(--muted); font-size: .9rem; margin: 0 0 20px; padding: 16px 0; border-block: 1px solid var(--line); }
.modal-info dt { color: var(--text); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; padding-top: .2em; }
.modal-info dd { margin: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 28px; }
.gallery img { border-radius: 4px; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }

/* ---------- Aparición suave al scrollear (donde el navegador lo soporta) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(32px); } to { opacity: 1; transform: none; } }
@keyframes fadeup { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.hero-text > *, .hero-frame { animation: fadeup .9s var(--ease) both; }
.hero-text > :nth-child(5) { animation-delay: .32s; }
.hero-text > :nth-child(2) { animation-delay: .08s; }
.hero-text > :nth-child(3) { animation-delay: .16s; }
.hero-text > :nth-child(4) { animation-delay: .24s; }
.hero-frame { animation-delay: .2s; }
@supports (animation-timeline: view()) {
  .reel, #trabajos h2, .filters, .card, .service, .step, .about, h2.num {
    animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 35%;
  }
}

/* ---------- Reel curvo 3D (js/reel.js) ---------- */
.showcase {
  position: relative; max-width: none; margin: 0; padding: 0;
  height: 100vh; height: 100svh; min-height: 520px; overflow: hidden;
  border-block: 1px solid var(--line);
  background:
    radial-gradient(62% 56% at 50% 46%, rgba(255,255,255,.075), transparent 72%),
    radial-gradient(circle, rgba(255,255,255,.07) 1px, transparent 1.4px) 0 0 / 6px 6px,
    var(--bg);
}
.showcase[hidden] { display: none; }
.showcase-title {
  position: absolute; inset: 0; margin: 0; display: grid; place-content: center; text-align: center;
  font-family: var(--serif); font-size: clamp(3rem, 11vw, 11rem); font-weight: 400; letter-spacing: -.03em; line-height: .9;
  color: var(--text); z-index: 1; pointer-events: none; user-select: none;
}
.showcase canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2;
  touch-action: pan-y; cursor: grab; outline: none;
}
.showcase canvas:active { cursor: grabbing; }
.showcase canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.showcase canvas[hidden] { display: none; }
.showcase-hint {
  position: absolute; left: 0; right: 0; bottom: 26px; margin: 0; text-align: center; z-index: 3;
  color: var(--muted); font-size: .7rem; letter-spacing: .22em; text-transform: uppercase; pointer-events: none;
}
.showcase-hint[hidden] { display: none; }
.showcase-fallback {
  list-style: none; margin: 0; padding: 0 24px 72px; position: relative; z-index: 2;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
  max-width: var(--max); margin-inline: auto;
}
.showcase-fallback[hidden] { display: none; }
.showcase-fallback img { width: 100%; aspect-ratio: 1.509; object-fit: cover; border-radius: var(--radius); }
.showcase.is-fallback { height: auto; min-height: 0; padding: 88px 0 0; }
.showcase.is-fallback .showcase-title { position: relative; inset: auto; margin-bottom: 40px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; min-height: 0; align-items: start; }
  .hero-frame { max-width: 340px; justify-self: start; margin-left: 4px; }
  .hero-status { left: 12px; bottom: 28px; }
  .topbar nav a:not(.nav-cta):not([href="#trabajos"]) { display: none; }
  .about { grid-template-columns: 1fr; }
  .about h2, .about #about-text, .about ul { grid-column: 1; grid-row: auto; }
}
@media (max-width: 640px) {
  .showcase-title { font-size: 21vw; padding: 0 12px; text-wrap: balance; line-height: .88; }
  .topbar nav { gap: 14px; }
  .topbar nav a { font-size: .64rem; letter-spacing: .12em; }
  .topbar nav a, .brand { white-space: nowrap; }
  .brand { font-size: 1.15rem; }
  .modal { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
