/* =============================================================================
   ARIEL ABASOLO — Ingeniero civil
   Paleta tomada de logo.jpg (grafito, azul acero, latón) más blanco.
   Firma visual: las "esquinas de encuadre" (.encuadre) y la placa (.placa).
   ========================================================================== */

:root {
  --grafito-900: #12171d;
  --grafito-800: #1b2229;
  --grafito-700: #2b343d;
  --acero-800: #143d5c;
  --acero-700: #184868;
  --acero-500: #386898;
  --acero-300: #8fb8dc;
  --laton-300: #d4c08e;
  --laton-500: #b89a62;
  --laton-700: #75602f;   /* latón legible sobre blanco */
  --blanco: #ffffff;
  --niebla: #f2f4f6;
  --linea: #dde2e7;
  --texto: #1b2229;
  --texto-suave: #4b5763;
  --error: #a62b1f;
  --whatsapp: #25d366;

  --fuente: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --header-h: 5rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ------------------------------ Base ------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: var(--header-h); -webkit-text-size-adjust: 100%; }
html:not(.lenis) { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--blanco);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
a { color: inherit; }
p { margin: 0 0 1rem; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3 {
  margin: 0 0 1rem;
  font-stretch: 118%;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 1.2rem + 4.2vw, 4.5rem); line-height: 1.04; }
h2 { font-size: clamp(1.85rem, 1.25rem + 2.2vw, 3rem); }
h3 { font-size: 1.3rem; line-height: 1.25; }

:focus-visible { outline: 3px solid var(--laton-500); outline-offset: 3px; }
::selection { background: var(--acero-500); color: var(--blanco); }

.container {
  width: 100%;
  max-width: calc(1200px + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Las entradas laterales no deben generar desplazamiento horizontal.
   "clip" (y no "hidden") para no romper la foto sticky de agrimensura. */
main { overflow-x: clip; }
.section { padding-block: clamp(4.5rem, 9vw, 7.5rem); }
.section--niebla { background: var(--niebla); }
.section--dark { background: var(--grafito-800); color: var(--blanco); }
.section--acero {
  background: linear-gradient(160deg, var(--acero-700), var(--acero-800) 60%, var(--grafito-900));
  color: var(--blanco);
}

.section__head { max-width: 40rem; margin-bottom: clamp(2.5rem, 5vw, 3.75rem); }
.section__head p { margin: 0; color: var(--texto-suave); font-size: 1.15rem; }
.section--dark .section__head p { color: rgb(255 255 255 / 0.74); }

.skip-link {
  position: fixed; top: 1rem; left: 1rem; z-index: 100;
  padding: .6rem 1rem;
  background: var(--blanco); color: var(--texto); font-weight: 600;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.scroll-progress {
  position: fixed; inset: 0 0 auto 0; z-index: 70; height: 4px;
  background: linear-gradient(90deg, var(--acero-500), var(--laton-500));
  transform: scaleX(0); transform-origin: left;
}

/* ------------------------------ Firma: encuadre y placa ------------------------------ */
.encuadre { position: relative; }
.encuadre::after {
  --c: var(--laton-300);
  --l: 28px;   /* largo de cada lado */
  --g: 3px;    /* grosor */
  content: '';
  position: absolute;
  inset: 12px;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(var(--c) 0 0) top left / var(--l) var(--g),
    linear-gradient(var(--c) 0 0) top left / var(--g) var(--l),
    linear-gradient(var(--c) 0 0) top right / var(--l) var(--g),
    linear-gradient(var(--c) 0 0) top right / var(--g) var(--l),
    linear-gradient(var(--c) 0 0) bottom left / var(--l) var(--g),
    linear-gradient(var(--c) 0 0) bottom left / var(--g) var(--l),
    linear-gradient(var(--c) 0 0) bottom right / var(--l) var(--g),
    linear-gradient(var(--c) 0 0) bottom right / var(--g) var(--l);
  background-repeat: no-repeat;
  transition: inset .45s var(--ease);
}
.encuadre:hover::after,
.encuadre:focus-visible::after { inset: 20px; }

.placa {
  position: absolute;
  left: 24px; bottom: 24px;
  z-index: 3;
  max-width: calc(100% - 48px);
  margin: 0;
  padding: .7rem 1.1rem;
  background: var(--blanco);
  color: var(--grafito-800);
  font-size: 1rem;
  font-stretch: 105%;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}
.placa small { display: block; font-size: .82rem; font-weight: 500; color: var(--laton-700); }

/* ------------------------------ Botones y enlaces ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .9rem 1.6rem;
  border: 2px solid transparent;
  border-radius: 3px;
  font: 650 1rem/1.2 var(--fuente);
  text-align: center; text-decoration: none;
  cursor: pointer;
  transition: transform .3s var(--ease), background-color .3s, border-color .3s, box-shadow .3s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: none; }
.btn--sm { padding: .55rem 1.15rem; font-size: .95rem; }
.btn--gold { background: var(--laton-500); color: var(--grafito-900); }
.btn--gold:hover { background: var(--laton-300); box-shadow: 0 12px 28px -12px rgb(184 154 98 / .8); }
.btn--dark { background: var(--grafito-800); color: var(--blanco); }
.btn--dark:hover { background: var(--acero-700); }
.btn--ghost { border-color: rgb(255 255 255 / .5); color: var(--blanco); backdrop-filter: blur(6px); }
.btn--ghost:hover { border-color: var(--blanco); background: rgb(255 255 255 / .12); }
.btn--line { border-color: var(--linea); background: var(--blanco); color: var(--grafito-800); }
.btn--line:hover { border-color: var(--grafito-800); }

.link {
  color: var(--acero-700);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: var(--laton-500);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.link:hover { text-decoration-color: var(--acero-700); }

/* ------------------------------ Header ------------------------------ */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  color: var(--blanco);
  transition: background-color .35s, box-shadow .35s;
}
.header[data-scrolled='true'] {
  background: rgb(18 23 29 / .95);
  box-shadow: 0 8px 30px -18px rgb(0 0 0 / .7);
  backdrop-filter: blur(10px);
}
.header__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: var(--header-h); }

.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand__logo { height: 52px; width: auto; border: 1px solid rgb(212 192 142 / .55); border-radius: 3px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { font-stretch: 115%; font-size: 1.05rem; }
.brand__text span { font-size: .82rem; color: var(--laton-300); }

.nav { display: none; align-items: center; gap: 1.75rem; }
.nav__link {
  position: relative;
  padding-block: .4rem;
  font-size: .96rem; font-weight: 500; text-decoration: none; white-space: nowrap;
  color: rgb(255 255 255 / .88);
}
.nav__link::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--laton-500);
  transform: scaleX(0);
  transition: transform .35s var(--ease);
}
.nav__link:hover, .nav__link[aria-current='true'] { color: var(--blanco); }
.nav__link:hover::after, .nav__link[aria-current='true']::after { transform: scaleX(1); }

.menu-toggle {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 44px; height: 44px; padding: 0;
  border: 0; background: transparent; color: inherit; cursor: pointer;
}
.menu-toggle span { width: 24px; height: 2px; background: currentColor; transition: transform .3s var(--ease), opacity .2s; }
.menu-toggle[aria-expanded='true'] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded='true'] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.mobile-menu {
  display: grid; grid-template-rows: 0fr;
  visibility: hidden;
  background: var(--grafito-900);
  transition: grid-template-rows .4s var(--ease), visibility .4s;
}
.mobile-menu > div { min-height: 0; overflow: hidden; }
.mobile-menu[data-open='true'] { grid-template-rows: 1fr; visibility: visible; }
.mobile-menu__list { display: flex; flex-direction: column; padding-block: .5rem 1.5rem; max-height: calc(100svh - var(--header-h)); overflow-y: auto; }
.mobile-menu__list a:not(.btn) { padding: .8rem 0; border-bottom: 1px solid rgb(255 255 255 / .1); text-decoration: none; }
.mobile-menu__list a[aria-current='true']:not(.btn) { color: var(--laton-300); }
.mobile-menu__list .btn { margin-top: 1rem; }

@media (min-width: 1100px) {
  .nav { display: flex; }
  .menu-toggle, .mobile-menu { display: none; }
}

/* ------------------------------ Hero ------------------------------ */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: flex-end;
  min-height: 100vh; min-height: 100svh;
  padding-block: calc(var(--header-h) + 3rem) clamp(5rem, 12vh, 8rem);
  background: var(--grafito-900);
  color: var(--blanco);
}
.hero__media { position: absolute; inset: 0; z-index: -2; }
.hero__media picture { display: block; width: 100%; height: 100%; }
/* La foto va espejada para que el instrumento quede a la derecha y el texto respire */
.hero__media img { width: 100%; height: 100%; object-fit: cover; object-position: 30% 55%; transform: scaleX(-1); }
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgb(18 23 29 / .75) 0%, rgb(18 23 29 / 0) 30%),
    linear-gradient(90deg, rgb(18 23 29 / .9) 0%, rgb(18 23 29 / .7) 38%, rgb(18 23 29 / .08) 72%),
    linear-gradient(0deg, rgb(18 23 29 / .7) 0%, rgb(18 23 29 / 0) 45%);
}
.hero__frame.encuadre {
  position: absolute;
  inset: calc(var(--header-h) + .25rem) .5rem .5rem;
  pointer-events: none;
}
.hero__frame.encuadre::after { --l: clamp(32px, 6vw, 72px); inset: 6px; }

.hero__content h1 { max-width: 15ch; }
.hero__lead { max-width: 34rem; margin-bottom: 2rem; font-size: clamp(1.08rem, 1rem + .4vw, 1.3rem); color: rgb(255 255 255 / .88); }
.hero__actions { display: flex; flex-wrap: wrap; gap: .9rem; }

.hero__hint {
  position: absolute; left: 50%; bottom: 1.5rem;
  display: none; padding: .5rem; color: rgb(255 255 255 / .7);
  transform: translateX(-50%);
}
.hero__hint svg { width: 24px; height: 24px; animation: bajar 2s var(--ease) infinite; }
@media (min-width: 900px) { .hero__hint { display: block; } }

@keyframes bajar {
  0% { transform: translateY(-4px); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: translateY(12px); opacity: 0; }
}

@media (max-width: 760px) {
  .hero__media img { object-position: 32% center; }
  .hero::before { background: linear-gradient(180deg, rgb(18 23 29 / .7), rgb(18 23 29 / .35) 30%, rgb(18 23 29 / .92) 72%); }
  .hero__actions .btn { flex: 1 1 100%; }
}

/* ------------------------------ Servicios ------------------------------ */
.services { display: grid; gap: 2.5rem 1.75rem; }
@media (min-width: 640px) { .services { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .services { grid-template-columns: repeat(3, 1fr); } }

.service p { margin-block: 1.1rem .75rem; color: var(--texto-suave); }
.service__media { display: block; overflow: hidden; aspect-ratio: 4 / 5; background: var(--grafito-700); text-decoration: none; }
.service__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.service__media:hover img { transform: scale(1.06); }

/* ------------------------------ Sobre mí ------------------------------ */
.about { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 900px) { .about { grid-template-columns: 5fr 7fr; gap: 4.5rem; } }

.about__photo { width: 100%; max-width: 440px; justify-self: center; }
.about__photo img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.about__text p { max-width: 38rem; color: var(--texto-suave); }

.checklist li { position: relative; padding-left: 1.6rem; margin-bottom: .55rem; }
.checklist li::before { content: ''; position: absolute; left: 0; top: .55em; width: 11px; height: 6px; border-left: 2px solid var(--laton-500); border-bottom: 2px solid var(--laton-500); transform: rotate(-45deg); }

/* ------------------------------ Agrimensura ------------------------------ */
.survey { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 900px) {
  .survey { grid-template-columns: 6fr 5fr; gap: 4rem; }
  .survey__media { position: sticky; top: calc(var(--header-h) + 1.5rem); }
}
.survey__media { overflow: hidden; background: var(--grafito-700); }
.survey__media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: opacity .25s; }

.accordion__item { border-bottom: 1px solid var(--linea); }
.accordion__item:first-child { border-top: 1px solid var(--linea); }
.accordion__item h3 { margin: 0; }
.accordion__trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%; padding: 1.35rem 0;
  border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--texto); text-align: left;
  transition: color .3s;
}
.accordion__trigger:hover, .accordion__trigger[aria-expanded='true'] { color: var(--acero-700); }
.accordion__trigger::after {
  content: ''; flex: none; width: 11px; height: 11px; margin-right: 4px;
  border-right: 2px solid var(--laton-500); border-bottom: 2px solid var(--laton-500);
  transform: rotate(45deg);
  transition: transform .35s var(--ease);
}
.accordion__trigger[aria-expanded='true']::after { transform: rotate(225deg); }
.accordion__panel { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .4s var(--ease), visibility .4s; }
.accordion__panel > div { min-height: 0; overflow: hidden; color: var(--texto-suave); }
.accordion__panel > div > :last-child { padding-bottom: 1.25rem; }
.accordion__panel[data-open='true'] { grid-template-rows: 1fr; visibility: visible; }
.accordion__after { margin-top: 2rem; }
.accordion__after p { color: var(--texto-suave); }

/* ------------------------------ Ingeniería civil ------------------------------ */
.feature { display: grid; gap: 2rem; align-items: center; margin-bottom: clamp(3.5rem, 7vw, 5.5rem); }
@media (min-width: 900px) {
  .feature { grid-template-columns: 1fr 1fr; gap: 4.5rem; }
  .feature--reverse .feature__media { order: 2; }
}
.feature__media { overflow: hidden; }
.feature__media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .8s var(--ease); }
.feature__media:hover img { transform: scale(1.05); }
.feature__text h3 { font-size: clamp(1.45rem, 1.15rem + 1vw, 2rem); }
.feature__text p, .feature__text li { color: rgb(255 255 255 / .78); }

.organisms { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.organisms li { padding: .35rem .9rem; border: 1px solid rgb(212 192 142 / .5); border-radius: 3px; font-size: .92rem; font-weight: 600; color: var(--laton-300); }

.more { display: grid; gap: 2rem; padding-top: 3rem; border-top: 1px solid rgb(255 255 255 / .14); }
@media (min-width: 760px) { .more { grid-template-columns: repeat(3, 1fr); gap: 3rem; } }
.more h3 { margin-bottom: .5rem; color: var(--laton-300); font-size: 1.15rem; }
.more p { margin: 0; color: rgb(255 255 255 / .74); }

/* ------------------------------ Obras ------------------------------ */
.works { display: grid; gap: 3rem 1.75rem; }
@media (min-width: 640px) { .works { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .works { grid-template-columns: repeat(3, 1fr); } }

.work__media { overflow: hidden; margin-bottom: 1.1rem; background: var(--grafito-700); }
.work__media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .8s var(--ease); }
.work:hover .work__media img { transform: scale(1.06); }
.work:hover .work__media::after { inset: 20px; }
.work h3 { margin-bottom: .3rem; font-size: 1.15rem; }
.work p { margin: 0; color: var(--texto-suave); font-size: .98rem; }
.work .work__meta { margin-bottom: .5rem; color: var(--laton-700); font-weight: 600; font-size: .9rem; }
.tag { position: absolute; right: 24px; bottom: 24px; z-index: 3; padding: .15rem .55rem; background: rgb(18 23 29 / .75); color: var(--blanco); font-size: .75rem; }

/* ------------------------------ Contacto ------------------------------ */
.contact { display: grid; gap: 3rem; align-items: start; }
@media (min-width: 960px) { .contact { grid-template-columns: 5fr 7fr; gap: 5rem; } }
.contact__info > p { color: rgb(255 255 255 / .8); font-size: 1.15rem; }
.contact__list { margin-top: 2rem; }
.contact__list li { padding: 1rem 0; border-top: 1px solid rgb(255 255 255 / .18); font-weight: 600; overflow-wrap: anywhere; }
.contact__list span { display: block; font-size: .88rem; font-weight: 400; color: var(--laton-300); }
.contact__list a { text-decoration: none; }
.contact__list a:hover { text-decoration: underline; }

.form { padding: clamp(1.25rem, 3.5vw, 2.5rem); background: var(--blanco); color: var(--texto); border-radius: 4px; border-top: 4px solid var(--laton-500); }
.form__row { display: grid; gap: 0 1rem; }
@media (min-width: 560px) { .form__row { grid-template-columns: 1fr 1fr; } }
.field { margin-bottom: 1rem; min-width: 0; }
.field label { display: block; margin-bottom: .3rem; font-size: .92rem; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: .75rem .85rem;
  border: 1px solid #c3cbd3; border-radius: 3px;
  background: var(--blanco); color: inherit;
  font: 400 1rem/1.4 var(--fuente);
}
.field textarea { resize: vertical; min-height: 7rem; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--acero-500); outline: 3px solid rgb(56 104 152 / .25); outline-offset: 0; }
.field [aria-invalid='true'] { border-color: var(--error); }
.field__error { margin: .3rem 0 0; font-size: .86rem; color: var(--error); }
.field__error:empty { display: none; }
.form__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .5rem; }
.form__actions .btn { flex: 1 1 14rem; }
.form__status { margin: 1rem 0 0; font-size: .95rem; color: var(--acero-700); font-weight: 600; }
.form__status:empty { display: none; }

/* ------------------------------ Footer ------------------------------ */
.footer { padding-block: 4rem 6.5rem; background: var(--grafito-900); color: rgb(255 255 255 / .7); font-size: .96rem; }
.footer__grid { display: grid; gap: 2.5rem; padding-bottom: 2.5rem; border-bottom: 1px solid rgb(255 255 255 / .12); }
@media (min-width: 760px) { .footer__grid { grid-template-columns: 2fr 1fr 1.3fr; } }
.footer strong { color: var(--blanco); }
.footer__logo { width: 220px; margin-bottom: 1.25rem; border: 1px solid rgb(212 192 142 / .5); border-radius: 4px; }
.footer h2 { margin-bottom: 1rem; font-size: 1.05rem; color: var(--laton-300); }
.footer li { margin-bottom: .45rem; overflow-wrap: anywhere; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--blanco); text-decoration: underline; }
.footer__legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; padding-top: 1.5rem; font-size: .88rem; }
.footer__legal p { margin: 0; }

/* ------------------------------ Botones flotantes ------------------------------ */
.whatsapp-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60;
  display: grid; place-items: center;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--whatsapp); color: var(--blanco);
  box-shadow: 0 10px 25px -8px rgb(0 0 0 / .45);
  transition: transform .3s var(--ease);
}
.whatsapp-fab:hover { transform: scale(1.08); }
.whatsapp-fab::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 50%; background: var(--whatsapp); animation: pulso 2.5s var(--ease) infinite; }
.whatsapp-fab svg { width: 30px; height: 30px; }

@keyframes pulso {
  0% { transform: scale(1); opacity: .55; }
  70%, 100% { transform: scale(1.65); opacity: 0; }
}

.scroll-top {
  position: fixed; left: 1.25rem; bottom: 1.25rem; z-index: 60;
  display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid rgb(255 255 255 / .2); border-radius: 50%;
  background: rgb(18 23 29 / .85); color: var(--blanco); cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(1rem);
  transition: opacity .3s, transform .3s var(--ease), visibility .3s, background-color .3s;
}
.scroll-top:hover { background: var(--acero-700); }
.scroll-top[data-visible='true'] { opacity: 1; visibility: visible; transform: none; }
.scroll-top svg { width: 20px; height: 20px; }

/* ------------------------------ Animación de entrada ------------------------------
   Solo se oculta si main.js confirmó que puede animar (.anim). */
.anim [data-reveal] { opacity: 0; }

/* ------------------------------ Movimiento reducido ------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html:not(.lenis) { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}
