/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg:       #0f0d0a;
  --bg-2:     #171310;
  --bg-3:     #211a14;
  --cream:    #f0e9da;
  --cream-2:  #d9cbb0;
  --cream-3:  #8a7a63;
  --accent:   #b08a4e;
  --accent-2: #8c6c38;
  --line:     rgba(240, 233, 218, 0.12);

  --serif: "EB Garamond", "Cormorant Garamond", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --ease-crearte: cubic-bezier(0.16, 1, 0.3, 1);
  --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;
  --container: 1200px;
}

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

body {
  font-family: var(--sans);
  font-size: 16px; line-height: 1.65;
  background: var(--bg); color: var(--cream);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  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.08; letter-spacing: -0.01em; font-family: var(--serif); font-weight: 500; color: var(--cream); }
em { font-style: italic; color: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: var(--container); margin-inline: auto; padding-inline: 1.5rem; }
@media (min-width: 720px) { .container { padding-inline: 2.5rem; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.skip-link {
  position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem;
  background: var(--cream); color: var(--bg); z-index: 9999; border-radius: 6px; font-weight: 600;
  transition: top .3s var(--ease-crearte);
}
.skip-link:focus { top: 1rem; }

.kicker {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); display: inline-flex; align-items: center; gap: .5rem;
}
.kicker::before { content: ""; width: 20px; height: 1px; background: var(--accent); display: inline-block; }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease-crearte), transform .9s var(--ease-crearte); }
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-split] { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
.no-js .curtain-panel { transform: none !important; display: none; }
.no-js .micro-intro { display: none; }

/* =============================================================
   4. Nav
   ============================================================= */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 500; height: var(--nav-h);
  display: flex; align-items: center;
  background: transparent;
  transition: background .5s var(--ease-crearte), box-shadow .5s var(--ease-crearte), height .4s var(--ease-crearte);
}
.nav.is-solid {
  background: rgba(15, 13, 10, 0.9);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 1px 0 var(--line);
  height: 68px;
}
.nav-inner { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { font-family: var(--serif); font-size: 1.3rem; font-style: italic; letter-spacing: -0.01em; }
.nav-brand .amp { color: var(--accent); }
.nav-links { display: none; align-items: center; gap: 2.2rem; }
.nav-link { font-size: .88rem; font-weight: 500; position: relative; letter-spacing: .01em; }
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: -4px;
  width: 100%; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: right;
  transition: transform .4s var(--ease-crearte);
}
.nav-link:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-right { display: flex; align-items: center; gap: .7rem; }

.nav-portfolio-link {
  display: flex; align-items: center; gap: .35rem;
  font-size: .74rem; font-weight: 600; color: var(--cream-3);
  padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 100px;
  opacity: .75;
  transition: opacity .3s var(--ease-crearte), border-color .3s var(--ease-crearte), color .3s var(--ease-crearte);
}
.nav-portfolio-link:hover { opacity: 1; border-color: var(--accent); color: var(--accent); }
.nav-portfolio-link svg { width: 12px; height: 12px; flex-shrink: 0; }
.nav-portfolio-text { display: none; }
@media (min-width: 540px) { .nav-portfolio-text { display: inline; } }

.nav-right .nav-cta {
  display: none;
}
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .9rem 1.7rem; font-size: .88rem; font-weight: 600; border-radius: 2px;
  transition: transform .5s var(--ease-crearte), background .3s var(--ease-crearte), color .3s var(--ease-crearte), border-color .3s var(--ease-crearte);
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--cream); }
.btn-ghost { border: 1px solid var(--line); color: var(--cream); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Mobile nav — native <details>, funciona sin JS */
.nav-mobile { position: relative; }
.nav-toggle { display: flex; flex-direction: column; gap: 5px; padding: .5rem; list-style: none; cursor: pointer; }
.nav-toggle::-webkit-details-marker { display: none; }
.nav-toggle span { width: 22px; height: 1.5px; background: var(--cream); transition: transform .3s var(--ease-crearte); }
.nav-mobile[open] .nav-toggle span:nth-child(1) { transform: translateY(3.25px) rotate(45deg); }
.nav-mobile[open] .nav-toggle span:nth-child(2) { transform: translateY(-3.25px) rotate(-45deg); }
.mobile-menu-panel { display: none; }
.nav-mobile[open] .mobile-menu-panel {
  position: fixed; inset: 0; z-index: 490; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem;
}
.mobile-menu-panel a { font-family: var(--serif); font-size: 2rem; font-style: italic; }

@media (min-width: 960px) {
  .nav-links { display: flex; }
  .nav-right .nav-cta { display: inline-flex; }
  .nav-mobile { display: none; }
}

/* =============================================================
   5. Cursor / grain / micro-intro / progress
   ============================================================= */
.cursor { display: none; position: fixed; top: 0; left: 0; z-index: 800; pointer-events: none; }
.cursor.is-ready { display: block; }
.cursor-dot { position: fixed; top: 0; left: 0; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; pointer-events: none; z-index: 801; transform: translate(-50%,-50%); }
.cursor-ring {
  position: fixed; top: 0; left: 0; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--cream); pointer-events: none; z-index: 800; transform: translate(-50%,-50%);
  mix-blend-mode: difference;
  transition: width .3s var(--ease-crearte), height .3s var(--ease-crearte);
}
.cursor-ring.is-hover { width: 58px; height: 58px; }
@media (hover: none), (pointer: coarse) { .cursor, .cursor-dot, .cursor-ring { display: none; } }

.grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.micro-intro { position: fixed; inset: 0; z-index: 900; background: var(--bg); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.micro-intro-line { width: 1px; height: 40%; background: var(--accent); transform: scaleY(0); transform-origin: center; }

.progress-bar { position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 700; pointer-events: none; }
.progress-bar-fill { height: 100%; width: 0%; background: var(--accent); transform-origin: left; }

/* =============================================================
   6. Hero — split-screen cortina + tipografía de confianza
   ============================================================= */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; text-align: center;
  padding-top: var(--nav-h);
}
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.7) brightness(.55); }
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,13,10,.55) 0%, rgba(15,13,10,.75) 55%, var(--bg) 100%);
}
.hero-halo {
  position: absolute; inset: -20% -10% -30% -10%; z-index: 1;
  background: radial-gradient(45% 40% at 50% 40%, rgba(176, 138, 78, .16), transparent 70%);
  filter: blur(60px);
}
.curtain { position: absolute; inset: 0; z-index: 5; display: flex; pointer-events: none; }
.curtain-panel { flex: 1; background: var(--bg-2); }
.hero-content { position: relative; max-width: 780px; padding-inline: 1.5rem; }
.hero-title { font-size: clamp(2.4rem, 6.6vw, 5.4rem); font-style: italic; max-width: 15ch; margin-inline: auto; }
.hero-title .plain { font-style: normal; color: var(--cream); }
.hero-sub { max-width: 46ch; margin: 1.8rem auto 0; font-size: 1.02rem; color: var(--cream-3); }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 2.2rem; }

/* =============================================================
   6b. Socios
   ============================================================= */
.socios { padding-block: 5rem; border-top: 1px solid var(--line); }
.socios-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; max-width: 640px; margin-inline: auto; }
.socio-card { display: flex; align-items: center; gap: 1.2rem; }
.socio-card img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; filter: grayscale(.3); }
.socio-card h3 { font-size: 1.15rem; font-style: italic; }
.socio-card p { color: var(--cream-3); font-size: .85rem; margin-top: .2rem; }

@media (min-width: 640px) { .socios-grid { grid-template-columns: 1fr 1fr; } }

/* =============================================================
   7. Trayectoria — timeline vertical con nodo
   ============================================================= */
.trayectoria { padding-block: 7rem; border-top: 1px solid var(--line); }
.trayectoria-head { max-width: 46ch; margin-bottom: 4rem; }
.trayectoria-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); margin-top: .8rem; }
.trayectoria-body { display: block; }
.timeline { position: relative; padding-left: 2.4rem; }
.timeline-line {
  position: absolute; left: 5px; top: 0; bottom: 0; width: 1px;
  background: var(--line);
}
.timeline-progress {
  position: absolute; left: 5px; top: 0; width: 1px; height: 0%;
  background: var(--accent);
  transform-origin: top;
}
.timeline-item { position: relative; padding-bottom: 3.4rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-node {
  position: absolute; left: -2.4rem; top: 6px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--bg); border: 1px solid var(--cream-3);
  transition: background .4s var(--ease-crearte), border-color .4s var(--ease-crearte);
}
.timeline-item.is-lit .timeline-node { background: var(--accent); border-color: var(--accent); }
.timeline-year { font-family: var(--mono); font-size: .82rem; color: var(--accent); }
.timeline-item h3 { font-size: 1.3rem; margin: .5rem 0 .6rem; }
.timeline-item p { color: var(--cream-3); max-width: 56ch; font-size: .95rem; }

.timeline-photo {
  width: 100%; height: 190px; object-fit: cover; border-radius: 2px;
  margin-bottom: 1.2rem; filter: grayscale(.15) brightness(.82) saturate(1.05);
}

/* Panel de foto sticky que acompaña la línea de tiempo en desktop */
.trayectoria-media { display: none; }
.trayectoria-media-frame {
  position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 2px;
}
.trayectoria-media-frame::after {
  content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none;
}
.trayectoria-media-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.06);
  filter: grayscale(.1) brightness(.8) saturate(1.05);
  transition: opacity 1.1s var(--ease-crearte), transform 5s linear;
}
.trayectoria-media-img.is-active { opacity: 1; transform: scale(1); }

@media (min-width: 960px) {
  .trayectoria-body { display: grid; grid-template-columns: 1.15fr .85fr; gap: 4.5rem; align-items: start; }
  .timeline-photo { display: none; }
  .trayectoria-media { display: block; position: sticky; top: calc(var(--nav-h) + 3rem); }
}

/* =============================================================
   8. Áreas de práctica — lista editorial con número de fondo
   ============================================================= */
.areas { padding-block: 7rem; border-top: 1px solid var(--line); }
.areas-head { max-width: 46ch; margin-bottom: 3rem; }
.areas-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); margin-top: .8rem; }
.area-row {
  position: relative; border-top: 1px solid var(--line);
  padding-block: 2.2rem; overflow: hidden;
}
.area-row:last-child { border-bottom: 1px solid var(--line); }
.area-bignum {
  position: absolute; right: 0; top: 50%; z-index: 0;
  font-family: var(--serif); font-size: 8rem; font-weight: 500;
  color: var(--cream); opacity: .04;
  transform: translateY(-50%);
  pointer-events: none;
  line-height: 1;
}
.area-row-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr; gap: .6rem; }
.area-row h3 { font-size: 1.5rem; }
.area-row p { color: var(--cream-3); max-width: 52ch; font-size: .95rem; }

.area-photo {
  position: relative; z-index: 1; width: 100%; height: 170px; object-fit: cover; border-radius: 2px;
  margin-bottom: 1.2rem; filter: grayscale(.15) brightness(.82) saturate(1.05);
}

.areas-body { display: block; }
/* Panel de foto sticky que acompaña la lista de áreas en desktop */
.areas-media { display: none; }
.areas-media-frame {
  position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 2px;
}
.areas-media-frame::after {
  content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none;
}
.areas-media-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.06);
  filter: grayscale(.1) brightness(.8) saturate(1.05);
  transition: opacity 1.1s var(--ease-crearte), transform 5s linear;
}
.areas-media-img.is-active { opacity: 1; transform: scale(1); }

@media (min-width: 720px) { .area-row-inner { grid-template-columns: 1fr 1.4fr; align-items: center; gap: 2.4rem; } }

@media (min-width: 960px) {
  .areas-body { display: grid; grid-template-columns: 1.3fr .7fr; gap: 4.5rem; align-items: start; }
  .area-photo { display: none; }
  .areas-media { display: block; position: sticky; top: calc(var(--nav-h) + 3rem); }
}

/* =============================================================
   9. Resultados — stats con count-up
   ============================================================= */
.resultados { padding-block: 6rem; border-top: 1px solid var(--line); background: var(--bg-2); }
.resultados-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2.4rem; }
.resultado-item { text-align: center; }
.resultado-value {
  font-family: var(--serif); font-style: italic; font-size: clamp(2.2rem, 5vw, 3.6rem); color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.resultado-label { font-family: var(--mono); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cream-3); margin-top: .5rem; }

@media (min-width: 720px) { .resultados-grid { grid-template-columns: repeat(4, 1fr); } }

/* =============================================================
   9b. Corte de sección — foto con parallax
   ============================================================= */
.seccion-corte {
  position: relative; min-height: 68vh; display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-top: 1px solid var(--line);
}
.seccion-corte-bg { position: absolute; inset: -32% 0; z-index: 0; overflow: hidden; }
.seccion-corte-bg img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.8) brightness(.62); will-change: transform; }
.seccion-corte-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(15,13,10,.4) 0%, rgba(15,13,10,.12) 45%, rgba(15,13,10,.65) 100%);
}
.seccion-corte-content { position: relative; z-index: 2; text-align: center; padding-block: 3rem; }
.seccion-corte-quote {
  font-family: var(--serif); font-style: italic; color: var(--cream);
  font-size: clamp(1.6rem, 4.2vw, 2.8rem); max-width: 18ch; margin-inline: auto;
  text-shadow: 0 4px 30px rgba(15,13,10,.85), 0 1px 6px rgba(15,13,10,.9);
}

/* =============================================================
   10. Testimonios — texto resaltado en scroll (karaoke)
   ============================================================= */
.testimonios { padding-block: 8rem; border-top: 1px solid var(--line); }
.testimonios-head { max-width: 46ch; margin-bottom: 5rem; }
.testimonios-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); margin-top: .8rem; }
.testimonio-block { margin-bottom: 6rem; }
.testimonio-block:last-child { margin-bottom: 0; }
.testimonio-quote {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.3rem, 2.8vw, 2rem); line-height: 1.5; max-width: 70ch;
}
.testimonio-quote .word { color: var(--cream-3); transition: color .2s linear; }
.testimonio-quote .word.is-lit { color: var(--cream); }
.testimonio-meta { margin-top: 1.6rem; display: flex; align-items: center; gap: .7rem; font-family: var(--mono); font-size: .8rem; color: var(--accent); }
.testimonio-meta span { color: var(--cream-3); }
.testimonio-meta img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; filter: grayscale(.3); }

/* =============================================================
   11. CTA final — botón con trazo SVG
   ============================================================= */
.cta-final { padding-block: 8rem; text-align: center; border-top: 1px solid var(--line); }
.cta-final h2 { font-size: clamp(2.1rem, 5vw, 3.4rem); max-width: 18ch; margin-inline: auto; font-style: italic; }
.cta-final p { max-width: 50ch; margin: 1.4rem auto 2.6rem; color: var(--cream-3); }
.btn-draw {
  position: relative; display: inline-flex; padding: 1.15rem 2.6rem;
  font-weight: 600; color: var(--cream); font-size: .92rem;
}
.btn-draw svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.btn-draw rect {
  fill: none; stroke: var(--accent); stroke-width: 1;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  vector-effect: non-scaling-stroke;
}
.btn-draw span { position: relative; z-index: 1; }

/* =============================================================
   12. Contacto
   ============================================================= */
.contacto { padding-block: 6rem 7rem; border-top: 1px solid var(--line); }
.contacto-grid { display: grid; gap: 3rem; grid-template-columns: 1fr; }
.contacto-info h3 { font-size: 1.5rem; margin-bottom: 1rem; font-style: italic; }
.contacto-info dl { display: flex; flex-direction: column; gap: .9rem; margin-top: 1.4rem; }
.contacto-info dt { font-family: var(--mono); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cream-3); }
.contacto-info dd { font-size: 1rem; }

.form-field { position: relative; margin-bottom: 1.2rem; }
.form-field input, .form-field textarea {
  width: 100%; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 2px;
  background: var(--bg-2); color: var(--cream); font-family: var(--sans); font-size: .95rem;
  transition: border-color .3s var(--ease-crearte);
}
.form-field input:focus, .form-field textarea:focus { border-color: var(--accent); outline: none; }
.form-field textarea { min-height: 120px; resize: vertical; }
.contact-form .btn-primary { width: 100%; justify-content: center; margin-top: .5rem; }
.form-success { display: none; text-align: center; padding: 2rem; }
.form-success.is-visible { display: block; }
.form-success svg { width: 32px; height: 32px; color: var(--accent); margin-inline: auto 1rem; }

@media (min-width: 960px) { .contacto-grid { grid-template-columns: .8fr 1.2fr; gap: 5rem; } }

/* =============================================================
   13. Footer
   ============================================================= */
.footer { padding-block: 3rem 2rem; border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-direction: column; gap: 1.2rem; }
.footer-brand { font-family: var(--serif); font-style: italic; font-size: 1.2rem; }
.footer-bottom { display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; justify-content: space-between; font-size: .8rem; color: var(--cream-3); }

.credit-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 500; color: var(--cream-2);
  padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 100px;
  transition: border-color .3s var(--ease-crearte), color .3s var(--ease-crearte);
}
.credit-badge svg { width: 12px; height: 12px; transition: transform .35s var(--ease-crearte); }
.credit-badge:hover { border-color: var(--accent); color: var(--accent); }
.credit-badge:hover svg { transform: translate(3px, -3px); }

@media (min-width: 720px) { .footer-bottom { flex-direction: row; align-items: center; } }

/* =============================================================
   14. Responsive base
   ============================================================= */
@media (min-width: 1280px) { .container { padding-inline: 3rem; } }

/* =============================================================
   15. Reduced motion — solo lo intrusivo
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .micro-intro { display: none; }
}
