/* =============================================================
   1. Tokens
   ============================================================= */
@property --mesh-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --mesh-x     { syntax: "<percentage>"; inherits: false; initial-value: 30%; }
@property --mesh-y     { syntax: "<percentage>"; inherits: false; initial-value: 40%; }

:root {
  --bg:        #0a0a0a;
  --bg-2:      #121212;
  --bg-3:      #1a1a1a;
  --ink:       #f4f2ee;
  --ink-soft:  #d8d5cd;
  --ink-mute:  #8a8681;
  --accent:    #f4f2ee;
  --line:      rgba(244, 242, 238, 0.12);
  --line-soft: rgba(244, 242, 238, 0.07);

  --serif: "Fraunces", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:     cubic-bezier(0.7, 0, 0.84, 0);
  --ease-soft:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --nav-h: 84px;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  tab-size: 2;
  overflow-x: clip;
  scroll-behavior: smooth;
  background: var(--bg);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.05; letter-spacing: -0.01em; font-weight: 500; }
ul { list-style: none; padding: 0; }
::selection { background: var(--ink); color: var(--bg); }

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

/* =============================================================
   3. Utilities
   ============================================================= */
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 9999;
  padding: .7rem 1.1rem; background: var(--ink); color: var(--bg);
  border-radius: 4px; font-weight: 600; font-size: .85rem;
}
.skip-link:focus { top: 1rem; }

.container {
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}
.container-wide { max-width: 1440px; }
.container-narrow { max-width: 720px; }

.kicker {
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 1.1rem;
}

.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.4rem);
  margin-bottom: 1.4rem;
  max-width: 16ch;
}
.section-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--ink-soft);
}
.section-lede {
  font-size: clamp(1.02rem, 1.6vw, 1.2rem);
  color: var(--ink-soft);
  max-width: 62ch;
  font-weight: 300;
}

.section { position: relative; padding-block: clamp(4.5rem, 9vw, 8rem); background: var(--bg); scroll-margin-top: var(--nav-h); }
#top { scroll-margin-top: 0; }

.text-link {
  display: inline-block;
  margin-top: 1.4rem;
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: .2rem;
  transition: border-color .4s var(--ease-out), opacity .4s var(--ease-out);
}
.text-link:hover { border-color: var(--ink); }

/* =============================================================
   4. Reveal / split-text
   ============================================================= */
[data-reveal], .reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity .9s var(--ease-soft), transform .9s var(--ease-soft);
}
[data-reveal].is-revealed, .reveal.is-revealed {
  opacity: 1;
  transform: none;
}
/* ⚠️ defensive: split-text children handle their own opacity — parent must stay visible */
.reveal[data-split] { opacity: 1; transform: none; }

.split-word, .split-char {
  display: inline-block;
  will-change: transform, opacity;
}

[data-reveal-mask] {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.2s var(--ease-soft);
}
[data-reveal-mask].is-revealed { clip-path: inset(0); }

/* =============================================================
   6. Buttons
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .95rem 1.7rem;
  font-size: .92rem; font-weight: 600; letter-spacing: .01em;
  border-radius: 999px;
  transition: transform .5s var(--ease-soft), box-shadow .5s var(--ease-soft), background-color .35s var(--ease-out), color .35s var(--ease-out);
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink); color: var(--bg);
  box-shadow: 0 1px 0 rgba(0,0,0,.4);
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px -12px rgba(244,242,238,.28);
}
.btn-ghost {
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink); transform: translateY(-3px); }
.btn-large { padding: 1.25rem 2.4rem; font-size: 1rem; }
.btn-icon { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

.has-magnetic { display: inline-flex; position: relative; isolation: isolate; }
.magnetic-inner {
  display: inline-flex; align-items: center; justify-content: center; gap: inherit;
  will-change: transform;
  transition: transform .8s var(--ease-soft);
}

/* =============================================================
   7. Nav
   ============================================================= */
.nav {
  position: fixed; top: 0; inset-inline: 0; z-index: 200;
  height: var(--nav-h);
  transition: background-color .5s var(--ease-out), border-color .5s var(--ease-out), backdrop-filter .5s var(--ease-out);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(10,10,10,.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-color: var(--line-soft);
}
.nav-inner {
  height: 100%;
  max-width: 1440px; margin-inline: auto; padding-inline: 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 2rem;
}
.nav-logo img { height: 26px; width: auto; }
.nav-links { display: none; align-items: center; gap: 2.1rem; }
.nav-link {
  position: relative; padding: .25rem 0;
  font-size: .88rem; font-weight: 500; color: var(--ink-soft);
  transition: color .3s var(--ease-out);
}
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform .45s var(--ease-out);
}
.nav-link:hover { color: var(--ink); }
.nav-link:hover::after { transform: scaleX(1); transform-origin: left; }
.btn-nav { display: none; }

.nav-burger {
  display: grid; place-items: center; gap: 5px; width: 40px; height: 40px;
}
.nav-burger span {
  display: block; width: 20px; height: 1px; background: var(--ink);
  transition: transform .4s var(--ease-out), opacity .4s var(--ease-out);
}
.nav-burger[aria-expanded="true"] span:first-child { transform: translateY(3px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:last-child { transform: translateY(-3px) rotate(-45deg); }

.nav-mobile {
  position: fixed; inset: 0; z-index: 190;
  background: var(--bg);
  display: grid; place-items: center;
  clip-path: inset(0 0 100% 0);
  transition: clip-path .65s var(--ease-soft);
}
.nav-mobile.is-open { clip-path: inset(0); }
.nav-mobile nav { display: flex; flex-direction: column; gap: 1.6rem; text-align: center; }
.nav-mobile-link { font-family: var(--serif); font-size: 2rem; color: var(--ink); }

.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 201;
  background: transparent; pointer-events: none;
}
.scroll-progress span {
  display: block; height: 100%; background: var(--ink);
  transform-origin: 0 0; transform: scaleX(0);
}

/* =============================================================
   8. Splash
   ============================================================= */
.splash {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg);
  display: grid; place-items: center;
  pointer-events: auto;
  transition: opacity .9s var(--ease-out), clip-path 1s var(--ease-soft);
  animation: splashSafety .01s 4.5s forwards;
}
.splash.is-out { opacity: 0; pointer-events: none; clip-path: inset(0 0 100% 0); }
@keyframes splashSafety { to { opacity: 0; pointer-events: none; clip-path: inset(0 0 100% 0); } }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 1.4rem; }
.splash-logo { width: 200px; height: auto; opacity: 0; animation: splashFade .9s var(--ease-out) .15s forwards; }
.splash-pulse {
  width: 160px; height: auto; opacity: 0;
  animation: splashFade .9s var(--ease-out) .4s forwards;
}
.splash-pulse path { fill: none; stroke: var(--ink-mute); stroke-width: 1.4; stroke-dasharray: 300; stroke-dashoffset: 300; animation: pulseDraw 1.6s var(--ease-soft) .5s forwards; }
@keyframes splashFade { to { opacity: 1; } }
@keyframes pulseDraw { to { stroke-dashoffset: 0; } }

/* =============================================================
   9. Hero
   ============================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-top: var(--nav-h);
  overflow: clip;
  isolation: isolate;
}
.hero-bg { position: absolute; inset: 0; z-index: -2; }
.hero-bg img {
  width: 100%; height: 100%; object-fit: cover; object-position: 65% 30%;
  transform: scale(1.05);
}
@keyframes ambientZoom {
  0%, 100% { transform: scale(1.05) translate3d(0,0,0); }
  50% { transform: scale(1.14) translate3d(-1%, -1%, 0); }
}
.hero-bg img.ambient-on { animation: ambientZoom 30s ease-in-out infinite; }
.hero-bg-tint {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10,10,10,.55) 0%, rgba(10,10,10,.72) 55%, rgba(10,10,10,.94) 100%),
    linear-gradient(90deg, rgba(10,10,10,.75) 0%, rgba(10,10,10,.3) 50%, rgba(10,10,10,.6) 100%);
}
.has-grain::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  pointer-events: none; opacity: .15; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
}

.hero-mesh {
  position: absolute; inset: -10%; z-index: -1;
  background:
    radial-gradient(45% 40% at var(--mesh-x) var(--mesh-y), rgba(244,242,238,.16), transparent 65%),
    conic-gradient(from var(--mesh-angle), rgba(244,242,238,.08), transparent 30%, rgba(244,242,238,.05), transparent 70%);
  filter: blur(90px) saturate(120%);
  opacity: .8;
  mix-blend-mode: screen;
  animation: meshShift 24s linear infinite;
}
@keyframes meshShift {
  0%   { --mesh-angle: 0deg;   --mesh-x: 25%; --mesh-y: 30%; }
  50%  { --mesh-angle: 180deg; --mesh-x: 75%; --mesh-y: 65%; }
  100% { --mesh-angle: 360deg; --mesh-x: 25%; --mesh-y: 30%; }
}
.hero-mesh-contact { position: absolute; inset: 0; opacity: .5; }

.hero-inner {
  position: relative; z-index: 1;
  max-width: 900px; padding-inline: 1.5rem;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.hero-kicker {
  font-size: .8rem; letter-spacing: .24em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 1.6rem;
}
.hero-pulse { width: 180px; height: auto; margin-bottom: 1.6rem; opacity: .55; }
.hero-pulse path { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.hero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 8vw, 5.6rem);
  line-height: .98;
  text-wrap: balance;
  max-width: 16ch;
  margin-inline: auto;
}
.hero-title em { font-style: italic; font-weight: 400; color: var(--ink-soft); }
.hero-sub {
  margin-top: 1.8rem;
  font-size: clamp(1.02rem, 1.6vw, 1.18rem);
  color: var(--ink-soft);
  font-weight: 300;
  max-width: 52ch;
}
.hero-actions { margin-top: 2.6rem; display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

.hero-scroll-cue {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  z-index: 1;
}
.hero-scroll-cue span {
  display: block; width: 1px; height: 46px;
  background: linear-gradient(180deg, var(--ink-mute), transparent);
  animation: cueMove 2.4s ease-in-out infinite;
}
@keyframes cueMove { 0%,100% { opacity: .3; } 50% { opacity: 1; } }

/* =============================================================
   10. Pillars (sedación)
   ============================================================= */
.pillars {
  margin-top: 3.4rem;
  display: grid; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.pillar {
  background: var(--bg);
  padding: 2.4rem 1.8rem;
}
.pillar-num {
  display: block; font-family: var(--serif); font-style: italic;
  font-size: 1.3rem; color: var(--ink-mute); margin-bottom: 1rem;
}
.pillar h3 { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; margin-bottom: .8rem; }
.pillar p { color: var(--ink-soft); font-size: .96rem; font-weight: 300; }

/* =============================================================
   11. Miguel bio
   ============================================================= */
.miguel-grid {
  display: grid;
  gap: 3rem;
}
.miguel-figure {
  overflow: clip;
  border: 1px solid var(--line);
}
.miguel-figure img {
  width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/5;
  filter: grayscale(.25) contrast(1.05);
  transition: transform 1.2s var(--ease-soft);
}
.miguel-figure:hover img { transform: scale(1.04); }
.miguel-text p { color: var(--ink-soft); font-weight: 300; margin-bottom: 1.1rem; max-width: 56ch; }
.miguel-tags {
  display: flex; flex-wrap: wrap; gap: .6rem .8rem;
  margin-top: 1.6rem; margin-bottom: .4rem;
}
.miguel-tags li {
  font-size: .78rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-mute);
  border: 1px solid var(--line); border-radius: 999px;
  padding: .45rem .95rem;
}

/* =============================================================
   12. Showcase (pinned horizontal portfolio)
   ============================================================= */
.showcase { overflow: clip; }
.showcase.is-pinned { overflow: visible; }
.showcase-track {
  display: flex; gap: 1.4rem;
  margin-top: 3rem;
  padding-inline: 1.5rem;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 1.5rem;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 1024px) {
  .showcase-track { overflow-x: visible; will-change: transform; }
}
.work-card {
  flex: 0 0 auto;
  width: min(78vw, 340px);
  scroll-snap-align: start;
}
.work-img {
  aspect-ratio: 3/4;
  overflow: clip;
  border: 1px solid var(--line);
  position: relative;
}
.work-img img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(.35) contrast(1.08) brightness(.98);
  transition: transform 1s var(--ease-soft), filter .6s var(--ease-out);
}
.work-card:hover .work-img img { transform: scale(1.08); filter: grayscale(.1) contrast(1.1) brightness(1.02); }
.work-tag {
  margin-top: 1rem;
  font-size: .82rem;
  color: var(--ink-mute);
  letter-spacing: .02em;
}

/* =============================================================
   13. Process
   ============================================================= */
.process-list {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
}
.process-item {
  display: grid; grid-template-columns: auto 1fr;
  gap: 1.6rem;
  padding-block: 2rem;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.process-num {
  font-family: var(--serif); font-style: italic; font-size: 1.6rem; color: var(--ink-mute);
}
.process-item h3 { font-family: var(--serif); font-size: 1.4rem; font-weight: 500; margin-bottom: .6rem; }
.process-item p { color: var(--ink-soft); font-weight: 300; max-width: 60ch; }

/* =============================================================
   14. FAQ
   ============================================================= */
.faq-list { margin-top: 2.6rem; border-top: 1px solid var(--line); }
.faq-item {
  border-bottom: 1px solid var(--line);
  padding-block: 1.5rem;
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-family: var(--serif); font-size: 1.15rem; font-weight: 500;
  color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-family: var(--sans); font-size: 1.4rem; font-weight: 300; color: var(--ink-mute);
  transition: transform .4s var(--ease-out);
  flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p {
  margin-top: 1rem; color: var(--ink-soft); font-weight: 300; max-width: 65ch;
}

/* =============================================================
   15. Contact
   ============================================================= */
.section-contacto { position: relative; overflow: clip; isolation: isolate; }
.contact-grid {
  margin-top: 3.4rem;
  display: grid; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.contact-card { background: var(--bg); padding: 1.8rem; }
.contact-card h3 { font-family: var(--serif); font-size: 1.1rem; font-weight: 500; margin-bottom: .6rem; }
.contact-card p { color: var(--ink-soft); font-size: .92rem; font-weight: 300; }

/* =============================================================
   16. Footer
   ============================================================= */
.footer { background: var(--bg-2); border-top: 1px solid var(--line); padding-top: 4rem; }
.footer-grid {
  display: grid; gap: 2.4rem;
  padding-bottom: 3rem;
}
.footer-brand img { height: 24px; margin-bottom: .8rem; }
.footer-brand p { color: var(--ink-mute); font-size: .88rem; }
.footer-links { display: flex; flex-direction: column; gap: .7rem; }
.footer-links a { color: var(--ink-soft); font-size: .9rem; transition: color .3s; }
.footer-links a:hover { color: var(--ink); }
.footer-contact { display: flex; flex-direction: column; gap: .7rem; }
.footer-contact a { color: var(--ink-soft); font-size: .9rem; transition: color .3s; }
.footer-contact a:hover { color: var(--ink); }
.footer-contact p { color: var(--ink-mute); font-size: .85rem; margin-top: .3rem; }
.footer-bottom { border-top: 1px solid var(--line); padding-block: 1.6rem; }
.footer-bottom p { color: var(--ink-mute); font-size: .8rem; }

/* =============================================================
   17. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .pillars { grid-template-columns: repeat(3, 1fr); }
  .contact-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 720px) {
  .miguel-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-wrap: nowrap; }
}

@media (min-width: 960px) {
  .miguel-grid { grid-template-columns: 0.85fr 1fr; align-items: center; }
  .footer-grid { grid-template-columns: 1.2fr 1fr 1.2fr; }
  .process-item { grid-template-columns: 120px 1fr; }
}

@media (min-width: 1024px) {
  .nav-links { display: flex; }
  .btn-nav { display: inline-flex; }
  .nav-burger { display: none; }

  .showcase-track { padding-inline: 0; margin-left: 1.5rem; }
  .work-card { width: 320px; }
}

@media (min-width: 1280px) {
  .work-card { width: 360px; }
}

/* =============================================================
   18. Reduced motion — only genuinely intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .hero-bg img.ambient-on { animation: none; }
  .hero-scroll-cue span { animation: none; }
  /* Do NOT disable: reveals, tilt, mesh gradient, hover states, splash fade */
}
