/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg:       #F1EDE6;
  --bg-2:     #E7E0D3;
  --ink:      #211D18;
  --ink-soft: #55504A;
  --mute:     #8C8478;
  --line:     rgba(33, 29, 24, 0.14);

  --accent:   #9C6B3E;
  --accent-2: #3C4A3E;
  --accent-on-dark: #D9A868;

  --display: "Archivo", var(--sans);
  --mono: "Space Mono", ui-monospace, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --ease-crearte: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --nav-h: 84px;
  --container: 1240px;
}

/* =============================================================
   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(--ink);
  -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%; }
button, select { 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-family: var(--display); font-weight: 700; color: var(--ink); }
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(--ink); 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: .78rem; letter-spacing: .04em;
  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(28px); transition: opacity .9s var(--ease-crearte), transform .9s var(--ease-crearte); }
.reveal.is-visible { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
.no-js .micro-intro { display: none; }
.no-js .mosaic-pieces { display: none; }
.no-js .proyecto-panel { flex: 1 1 260px !important; }

/* =============================================================
   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(241, 237, 230, 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(--display); font-size: 1.4rem; font-weight: 800; letter-spacing: .04em; }
.nav-links { display: none; align-items: center; gap: 2.2rem; }
.nav-link { font-size: .9rem; font-weight: 500; position: relative; }
.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(--mute);
  padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 100px;
  opacity: .8;
  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; }

.nav:not(.is-solid) .nav-brand,
.nav:not(.is-solid) .nav-link { color: var(--bg); text-shadow: 0 1px 10px rgba(0,0,0,.35); }
.nav:not(.is-solid) .nav-portfolio-link { color: rgba(241,237,230,.85); border-color: rgba(241,237,230,.4); }
.nav:not(.is-solid) .nav-portfolio-link:hover { color: var(--accent-on-dark); border-color: var(--accent-on-dark); }
.nav:not(.is-solid) .nav-toggle span { background: var(--bg); }

.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(--ink); 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(--display); font-size: 2rem; font-weight: 700; }

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

/* =============================================================
   5. Components
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .95rem 1.8rem; font-size: .88rem; font-weight: 600;
  border-radius: 3px;
  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(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }

.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; }

/* Custom cursor — con modo "preview" para la galería */
.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: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--ink); pointer-events: none; z-index: 800; transform: translate(-50%,-50%);
  display: flex; align-items: center; justify-content: center;
  transition: width .35s var(--ease-crearte), height .35s var(--ease-crearte), background .35s var(--ease-crearte), border-color .35s var(--ease-crearte);
}
.cursor-ring.is-hover { width: 60px; height: 60px; background: rgba(156, 107, 62, .12); }
.cursor-ring.is-preview { width: 120px; height: 120px; background: var(--ink); border-color: transparent; }
.cursor-label { display: none; font-family: var(--mono); font-size: .7rem; color: var(--bg); text-transform: uppercase; text-align: center; padding-inline: .5rem; letter-spacing: .03em; }
.cursor-ring.is-preview .cursor-label { display: block; }
@media (hover: none), (pointer: coarse) { .cursor, .cursor-dot, .cursor-ring { display: none; } }

.grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: .035; mix-blend-mode: multiply;
  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; }

/* =============================================================
   6. Hero — zoom-through al empezar a scrollear
   ============================================================= */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: flex-end;
  padding-top: var(--nav-h);
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; z-index: -2; will-change: transform; overflow: hidden; }
.hero-video { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(15,13,10,.5) 0%, rgba(15,13,10,.3) 35%, rgba(15,13,10,.8) 78%, var(--bg) 100%);
}
.hero-content { position: relative; z-index: 1; width: 100%; padding-block: 3rem 4.5rem; }
.hero-content .kicker { color: rgba(241,237,230,.92); text-shadow: 0 1px 12px rgba(0,0,0,.4); }
.hero-content .kicker::before { background: var(--accent-on-dark); }
.hero-title {
  font-size: clamp(2.6rem, 6.2vw, 5.2rem); max-width: 16ch;
  color: var(--bg); text-shadow: 0 2px 24px rgba(0,0,0,.4);
}
.hero-title em { color: var(--accent-on-dark); }
.hero-sub {
  max-width: 44ch; margin-top: 1.6rem; font-size: 1.05rem;
  color: rgba(241,237,230,.85); text-shadow: 0 1px 14px rgba(0,0,0,.35);
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }
.hero-actions .btn-ghost { border-color: rgba(241,237,230,.55); color: var(--bg); }
.hero-actions .btn-ghost:hover { border-color: var(--bg); background: rgba(241,237,230,.12); }

/* =============================================================
   7. Nosotros — mosaico que se arma + solapa la sección anterior
   ============================================================= */
.nosotros { padding-block: 7rem; }
.nosotros-grid { display: grid; grid-template-columns: 1fr; gap: 3rem; }
.nosotros-copy { max-width: 58ch; }
.nosotros-text { font-size: 1.1rem; color: var(--ink-soft); margin-top: 1.4rem; }
.nosotros-text:first-of-type { margin-top: 1.6rem; }
.nosotros-sign { margin-top: 1.6rem; font-family: var(--mono); font-size: .85rem; color: var(--accent); }

.nosotros-mosaic { position: relative; max-width: 420px; }
.mosaic-fill { width: 100%; border-radius: 8px; object-fit: cover; }
.mosaic-pieces { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: 3px; border-radius: 8px; overflow: hidden; }
.mosaic-piece { background: var(--ink); }
.mosaic-piece.is-b { background: var(--accent); }

@media (min-width: 900px) { .nosotros-grid { grid-template-columns: 1.1fr .9fr; align-items: center; gap: 4rem; } }

/* =============================================================
   8. Proyectos — acordeón horizontal
   ============================================================= */
.proyectos { padding-block: 6rem; }
.proyectos-head { max-width: 46ch; margin-bottom: 3rem; }
.proyectos-head h2 { font-size: clamp(1.9rem, 3.8vw, 2.9rem); margin-top: .8rem; }
.proyectos-acordeon {
  display: flex; flex-direction: column; gap: .5rem;
  height: auto; padding-inline: 1.5rem;
}
.proyecto-panel {
  position: relative; border-radius: 12px; overflow: hidden; cursor: pointer;
  height: 140px;
  transition: height .6s var(--ease-crearte);
}
.proyecto-panel.is-open { height: 60vh; min-height: 420px; }
.proyecto-bg { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto !important; border-radius: 0; object-fit: cover; will-change: transform; }
.proyecto-panel::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(33,29,24,.05) 40%, rgba(33,29,24,.75) 100%);
}
.proyecto-info { position: absolute; left: 1.6rem; bottom: 1.4rem; z-index: 2; color: var(--bg); }
.proyecto-num { font-family: var(--mono); font-size: .8rem; color: var(--bg); opacity: .8; }
.proyecto-info h3 { color: var(--bg); font-size: 1.4rem; margin-top: .3rem; }
.proyecto-meta { display: block; margin-top: .3rem; font-family: var(--mono); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: rgba(241,237,230,.8); }

@media (min-width: 860px) {
  .proyectos-acordeon { flex-direction: row; height: 62vh; min-height: 460px; }
  .proyecto-panel { flex: 1; height: 100%; transition: flex-grow .6s var(--ease-crearte); }
  .proyecto-panel.is-open { flex-grow: 5; height: 100%; min-height: 0; }
}

/* =============================================================
   9. Galería — cursor con preview flotante
   ============================================================= */
.galeria { padding-block: 6rem; }
.galeria-head { max-width: 46ch; margin-bottom: 3rem; }
.galeria-head h2 { font-size: clamp(1.9rem, 3.8vw, 2.9rem); margin-top: .8rem; }
.galeria-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.galeria-item { border-radius: 12px; overflow: hidden; will-change: transform, opacity; }
.galeria-item img { width: 100%; aspect-ratio: 1/1; object-fit: cover; }

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

/* =============================================================
   10. Testimonios — stack 3D rotativo
   ============================================================= */
.testimonios { padding-block: 7rem; background: var(--bg-2); }
.testimonios-grid { display: flex; flex-direction: column; gap: 3rem; align-items: center; }
.testimonios-head { max-width: 46ch; text-align: center; }
.testimonios-head h2 { font-size: clamp(1.9rem, 3.8vw, 2.9rem); margin-top: .8rem; }
.testimonios-stack { position: relative; width: 100%; max-width: 560px; height: 300px; perspective: 1400px; }
.testimonio-card {
  position: absolute; inset: 0; margin: auto; width: 100%; height: fit-content;
  background: var(--bg); border-radius: 20px; padding: 2.4rem;
  box-shadow: 0 30px 60px -30px rgba(33,29,24,.25);
  backface-visibility: hidden;
}
.testimonio-card p { font-size: 1.2rem; line-height: 1.5; color: var(--ink); }
.testimonio-name { display: block; margin-top: 1.4rem; font-family: var(--mono); font-size: .78rem; color: var(--accent); }
.testimonios-controls { display: flex; gap: .8rem; }
.testimonios-arrow {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: background .3s var(--ease-crearte), border-color .3s var(--ease-crearte), color .3s var(--ease-crearte), transform .3s var(--ease-bounce);
}
.testimonios-arrow svg { width: 20px; height: 20px; }
.testimonios-arrow:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: scale(1.08); }
.testimonios-arrow:active { transform: scale(.94); }

/* =============================================================
   11. Contacto — fondo que responde al mouse (spotlight)
   ============================================================= */
.contacto {
  position: relative; overflow: hidden;
  background: var(--ink); color: var(--bg);
  padding-block: 7rem;
}
.contacto-spotlight {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(600px circle at var(--x, 50%) var(--y, 30%), rgba(156, 107, 62, .3), transparent 60%);
}
.contacto-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr; gap: 3rem; }
.contacto-info h2 { color: var(--bg); font-size: clamp(2rem, 4.4vw, 3.2rem); margin-top: .8rem; }
.contacto-lead { margin-top: 1.2rem; color: rgba(241,237,230,.75); max-width: 40ch; }
.contacto-info dl { display: flex; flex-direction: column; gap: .9rem; margin-top: 2rem; }
.contacto-info dt { font-family: var(--mono); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: rgba(241,237,230,.5); }
.contacto-info dd { font-size: 1rem; color: var(--bg); }

.form-field { margin-bottom: 1.2rem; }
.form-field input, .form-field select {
  width: 100%; padding: .9rem 1rem; border: 1px solid rgba(241,237,230,.2); border-radius: 3px;
  background: rgba(241,237,230,.06); color: var(--bg); font-family: var(--sans); font-size: .95rem;
  transition: border-color .3s var(--ease-crearte);
}
.form-field select { color: rgba(241,237,230,.7); }
.form-field input::placeholder { color: rgba(241,237,230,.45); }
.form-field input:focus, .form-field select:focus { border-color: var(--accent); outline: none; }
.contact-form .btn-primary { width: 100%; justify-content: center; margin-top: .5rem; background: var(--accent); }
.contact-form .btn-primary:hover { background: var(--bg); color: var(--ink); }
.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; }
.form-success p { color: rgba(241,237,230,.75); }

@media (min-width: 960px) { .contacto-grid { grid-template-columns: .9fr 1.1fr; gap: 5rem; align-items: start; } }

/* =============================================================
   12. 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(--display); font-size: 1.3rem; font-weight: 800; }
.footer-bottom { display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; justify-content: space-between; font-size: .8rem; color: var(--mute); }

.credit-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .82rem; font-weight: 500; color: var(--ink-soft);
  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; } }

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

/* =============================================================
   14. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .micro-intro { display: none; }
}
