/* JAVIER FORTES — PORTFOLIO
   Diseñado sobre la referencia INICIO.jpg (1649 x 2048 px).
   Ajustes visuales principales: variables CSS al inicio.
*/
:root {
  --background: #ededed;
  --foreground: #080808;
  --link-underline-thickness: 1px;
  --reel-color: #3c3c3c;
  --gutter: clamp(14px, 1.2735vw, 28px);
  --wordmark-size: clamp(29px, 2.97vw, 56px);
  --menu-toggle-height: 38px;
  --header-top-padding: calc(var(--gutter) - 6px);
  --header-row-height: max(var(--wordmark-size), var(--menu-toggle-height));
  --header-height: calc(var(--header-top-padding) + var(--header-row-height));
  --type-small: clamp(10px, .912vw, 17px);
  --type-nav: clamp(13px, 1.255vw, 22px);
  font-family: 'Archivo', Arial, Helvetica, sans-serif;
  color: var(--foreground);
  background: var(--background);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 16px); }
body { margin: 0; padding-top: var(--header-height); background: var(--background); }
body, button, a { -webkit-tap-highlight-color: transparent; }
button, a { color: inherit; }
a { text-decoration: none; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
.skip-link { position: absolute; inset: 8px auto auto 8px; padding: 8px; background: white; transform: translateY(-150%); z-index: 99; }
.skip-link:focus { transform: none; }

.page-shell { padding-inline: var(--gutter); }
@media (forced-colors: none) {
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .header-backdrop > span {
      position: fixed;
      inset: 0 0 auto;
      height: calc(var(--header-height) + var(--blur-offset));
      z-index: 3;
      pointer-events: none;
      -webkit-backdrop-filter: blur(var(--blur-radius));
      backdrop-filter: blur(var(--blur-radius));
      -webkit-mask-image: linear-gradient(#000 calc(100% - 18px), transparent);
      mask-image: linear-gradient(#000 calc(100% - 18px), transparent);
    }
    .header-backdrop > :nth-child(1) { --blur-offset: 36px; --blur-radius: 1px; }
    .header-backdrop > :nth-child(2) { --blur-offset: 18px; --blur-radius: 2px; }
    .header-backdrop > :nth-child(3) { --blur-offset: 0px; --blur-radius: 3.75px; }
    .header-backdrop > :nth-child(4) { --blur-offset: -18px; --blur-radius: 6px; }
  }
}
.site-header {
  position: absolute;
  inset: 0 0 auto;
  height: var(--header-height);
  padding: var(--header-top-padding) var(--gutter) 0;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.header-menu {
  --menu-width: 38px;
  --menu-vertical-offset: -4px;
  --menu-center: calc(var(--header-top-padding) + var(--header-row-height) / 2 + var(--menu-vertical-offset));
  display: contents;
}
.site-header .wordmark, .site-header .menu-toggle { pointer-events: auto; }
@media (forced-colors: none) {
  @supports (mix-blend-mode: difference) {
    .site-header .wordmark, .menu-toggle { color: white; mix-blend-mode: difference; }
  }
}
.wordmark {
  position: relative;
  z-index: 4;
  transform: translateX(-2px);
  display: block;
  font-weight: 400;
  font-size: calc(var(--wordmark-size) * .9);
  line-height: var(--wordmark-size);
  letter-spacing: -.048em;
  white-space: nowrap;
}
.home .wordmark-a { letter-spacing: -.073em; }
.home .wordmark-prefix, .home .wordmark-core, .home .wordmark-suffix { display: inline-block; }
.home .wordmark.is-compacting {
  --wordmark-delay: 2s;
  --wordmark-fade-duration: .5s;
}
.home .wordmark.is-compacting .wordmark-prefix,
.home .wordmark.is-compacting .wordmark-suffix {
  animation: wordmark-fade var(--wordmark-fade-duration) ease-out var(--wordmark-delay) forwards;
}
.home .wordmark.is-compacting .wordmark-core {
  animation: wordmark-slide .85s cubic-bezier(.65, 0, .25, 1) calc(var(--wordmark-delay) + var(--wordmark-fade-duration)) forwards;
}
@keyframes wordmark-fade {
  to { opacity: 0; }
}
@keyframes wordmark-slide {
  to { transform: translateX(calc(-1 * var(--wordmark-prefix-width))); }
}
.site-nav {
  position: fixed;
  top: var(--menu-center);
  right: calc(var(--gutter) + var(--menu-width) - 5px + 20px);
  z-index: 4;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: clamp(22px, 2.35vw, 45px);
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear .4s;
}
.site-nav.is-open { visibility: visible; pointer-events: auto; transition-delay: 0s; }
.site-nav a {
  color: var(--nav-ink, var(--foreground));
  font-size: var(--type-nav);
  line-height: 1.1;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(12px);
  transition: opacity .3s ease, transform .4s cubic-bezier(.22, 1, .36, 1), color .3s ease;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--nav-hover-ink, #bbb); }
.site-nav a:focus-visible { outline-color: var(--nav-ink, var(--foreground)); }
@media (forced-colors: none) {
  @supports (mix-blend-mode: exclusion) {
    .site-nav {
      --nav-ink: white;
      --nav-hover-ink: #3b3b3b;
      mix-blend-mode: exclusion;
    }
  }
}
.site-nav.is-open a { opacity: 1; transform: translateX(0); }
.site-nav.is-open a:nth-child(2) { transition-delay: .05s, .05s, 0s; }
.site-nav.is-open a:nth-child(3) { transition-delay: .1s, .1s, 0s; }
.menu-toggle { display: flex; width: var(--menu-width); height: var(--menu-toggle-height); background: transparent; border: 0; cursor: pointer; padding: 3px 5px; flex-direction: column; justify-content: center; gap: 5px; position: fixed; top: var(--menu-center); right: calc(var(--gutter) - 5px); transform: translateY(-50%); z-index: 5; }
.menu-toggle span { display: block; height: 1px; width: 100%; transition: transform .3s ease, opacity .2s ease; }
.menu-toggle[aria-expanded='true'] span:first-child { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded='true'] span:nth-child(2) { opacity: 0; transform: scaleX(.5); }
.menu-toggle[aria-expanded='true'] span:last-child { transform: translateY(-6px) rotate(-45deg); }

/* Page-load choreography: a fixed mask reveals each line without shifting layout. */
.entry-mask { display: block; overflow: hidden; }
.entry-text, .scroll-entry-text { display: block; }
.intro-contact .entry-mask, .intro-contact .entry-text { display: block; }
.menu-toggle span::before {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
  transform-origin: left center;
}
@media (prefers-reduced-motion: no-preference) {
  .entry-text, .is-revealing .scroll-entry-text {
    animation: entry-rise .95s cubic-bezier(.22, 1, .36, 1) both;
    animation-delay: var(--entry-delay, .08s);
  }
  .is-reveal-pending .scroll-entry-text { transform: translateY(115%); }
  .is-image-pending { opacity: 0; }
  .is-image-entering { animation: image-entry .65s cubic-bezier(.22, 1, .36, 1); }
  .intro-role { --entry-delay: .22s; }
  .intro-services { --entry-delay: .32s; }
  .intro-contact { --entry-delay: .42s; }
  .intro-item .entry-mask + .entry-mask .entry-text {
    animation-delay: calc(var(--entry-delay) + .08s);
  }
  .menu-toggle span::before {
    animation: entry-draw .65s cubic-bezier(.22, 1, .36, 1) .14s both;
  }
  .menu-toggle span:nth-child(2)::before { animation-delay: .22s; }
  .menu-toggle span:nth-child(3)::before { animation-delay: .3s; }
  /* Opening the menu during the entrance immediately reveals its close icon. */
  .menu-toggle[aria-expanded='true'] span::before { animation: none; }
}
@keyframes entry-rise {
  from { transform: translateY(115%); }
  to { transform: translateY(0); }
}
@keyframes image-entry {
  from { opacity: 0; translate: 0 16px; }
  to { opacity: 1; translate: 0 0; }
}
@keyframes entry-draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.intro {
  display: flex;
  align-items: flex-start;
  column-gap: clamp(24.2px, 2.75vw, 49.5px);
  margin-top: 21.14vw;
  min-height: 2.5em;
}
.intro, .latest-projects-heading {
  font-size: calc(var(--type-small) * 1.1);
  line-height: 1.26;
  font-weight: 400;
}
.intro-item { flex: none; white-space: nowrap; }
.intro-role { min-width: 5.7em; }
.intro-contact { white-space: nowrap; transition: color .25s ease; }
.intro-contact:hover, .intro-contact:focus-visible { color: #ccc; }
.intro-contact span, .site-nav a,
.footer-bottom a, .about-details a,
.text-link, .subpage main > a {
  position: relative;
  display: inline-block;
}
.subpage main > a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.12em;
  height: var(--link-underline-thickness);
  background: currentColor;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .55s cubic-bezier(.45, 0, .2, 1);
}
.subpage main > a:hover::after,
.subpage main > a:focus-visible::after { transform: scaleX(1); }
.reel { margin-top: clamp(18px, 1.75vw, 32px); scroll-margin-top: 20px; }
.reel-preview {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: clamp(5px, .5vw, 9px);
  background: var(--reel-color);
  cursor: pointer;
  overflow: hidden;
}
.reel video {
  display: block;
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: var(--reel-color);
  border-radius: clamp(5px, .5vw, 9px);
  overflow: hidden;
}
/* Route wheel and click events through the preview button, avoiding the
   native video's input handling while scrolling over the reel. */
.reel-preview video { pointer-events: none; }
@media (width > 640px) {
  .reel-preview video { background: var(--reel-color) url("/assets/reel-poster.jpg") center / cover no-repeat; }
}
.reel-play {
  position: absolute;
  inset: auto auto clamp(10px, 2vw, 20px) clamp(10px, 2vw, 20px);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 2px;
  background: var(--background);
  color: var(--foreground);
  font-size: 12px;
  pointer-events: none;
}
.reel-play svg { width: 14px; height: 14px; fill: currentColor; }
.reel-preview:focus-visible .reel-play { display: inline-flex; }
@media (hover: none), (pointer: coarse) {
  .reel-play { display: inline-flex; }
}
body:has(.reel-dialog[open]) { overflow: hidden; }
.reel-dialog {
  width: min(94vw, 1600px);
  max-width: none;
  max-height: 94vh;
  max-height: 94dvh;
  padding: 0;
  border: 0;
  background: #141414;
  color: var(--background);
  overflow: auto;
}
.reel-dialog::backdrop { background: rgb(0 0 0 / .88); }
.reel-dialog-content { padding: 52px 0 0; }
.reel-close {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 22px;
  cursor: pointer;
}
.reel-dialog video {
  display: block;
  width: 100%;
  max-height: calc(94vh - 52px);
  max-height: calc(94dvh - 52px);
  object-fit: contain;
}
.reel-error { margin: 0; padding: 20px; font-size: 14px; line-height: 1.5; }
.reel-error a { text-decoration: underline; }

.site-footer {
  --footer-muted: #aaa;
  margin-block-start: clamp(72px, 9vw, 168px);
  padding: clamp(64px, 7.7vw, 170px) calc(var(--gutter) + 5px) clamp(32px, 4.7vw, 105px);
  background: var(--background);
}
.footer-nav {
  display: flex;
  align-items: baseline;
  gap: 5vw;
  padding-bottom: clamp(70px, 13.5vw, 300px);
  font-size: clamp(18px, 1.81vw, 40px);
  font-weight: 400;
  line-height: 1.1;
}
.footer-nav > a {
  white-space: nowrap;
  transition: color .3s ease;
}
.footer-nav > .footer-email { margin-inline-start: auto; }
.footer-nav > a:focus-visible { outline-color: var(--foreground); }
@media (hover: hover) {
  .footer-nav > a:hover { color: var(--footer-muted); }
}
.footer-bottom {
  border-top: 1px solid var(--foreground);
  padding-top: clamp(12px, 1.2vw, 26px);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  font-size: clamp(11px, 1.02vw, 23px);
  line-height: 1.3;
}
.footer-bottom-left, .footer-bottom-right { display: flex; flex-wrap: wrap; align-items: baseline; }
.footer-bottom-left { gap: 0 clamp(16px, 3.7vw, 82px); }
.footer-bottom-right { gap: 0 clamp(16px, 3.45vw, 76px); }
.footer-address { overflow-wrap: anywhere; }
.footer-address-short { display: none; }
.footer-bottom a, .text-link { white-space: nowrap; }
.text-link { background: none; border: 0; padding: 0; font-size: inherit; cursor: pointer; }
.footer-bottom a, .footer-bottom .text-link { transition: color .25s ease; }
.footer-bottom a:hover,
.footer-bottom a:focus-visible,
.footer-bottom .text-link:hover,
.footer-bottom .text-link:focus-visible { color: #ccc; }

@media (max-width: 760px) {
  .site-footer { padding-inline: var(--gutter); }
  .footer-nav {
    display: grid;
    grid-template-columns: repeat(3, max-content);
    gap: 4px clamp(12px, 4vw, 30px);
    font-size: clamp(16px, 4vw, 24px);
  }
  .footer-nav > .footer-email {
    grid-column: 1 / -1;
    justify-self: start;
    margin-inline-start: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .footer-nav > a, .footer-bottom a, .footer-bottom .text-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  .site-footer { padding-block-end: 12px; }
  .home .site-footer {
    margin-block-start: 36px;
    padding-block-start: 48px;
  }
  .footer-nav {
    gap: 0 clamp(21px, calc(10vw - 7px), 51px);
    padding-bottom: clamp(40px, calc(7.5vw + 4px), 52px);
  }
  .footer-nav > .footer-email {
    align-items: flex-start;
    padding-block-start: 2px;
    font-weight: 700;
  }
  .footer-bottom { padding-top: 9px; }
  .footer-bottom-left { display: none; }
  .footer-bottom-right {
    width: 100%;
    column-gap: clamp(6px, 2vw, 12px);
  }
  .footer-bottom-right > a { align-items: flex-start; }
  .footer-bottom-right > span { margin-inline-start: auto; white-space: nowrap; }
}

@media (640px < width <= 1024px), (640px < width <= 1366px) and (pointer: coarse) {
  .site-header .wordmark { top: -6px; transform: translateX(-3px); }
  .header-menu { --menu-vertical-offset: -10px; }
  .footer-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
  }
  .footer-bottom-left { display: grid; justify-items: start; }
  .footer-bottom-right { flex-wrap: nowrap; white-space: nowrap; }
  .footer-address-long { display: none; }
  .footer-address-short { display: inline; }
}

.info-dialog {
  background: var(--background);
  border: 1px solid var(--foreground);
  color: var(--foreground);
  padding: 25px;
  width: min(90vw, 480px);
  box-shadow: 0 12px 45px rgb(0 0 0 / .08);
}
.info-dialog::backdrop { background: rgb(0 0 0 / .3); }
.dialog-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-top p { margin: 0; font-size: 13px; }
.dialog-top button { flex: none; min-width: 44px; min-height: 44px; margin: -12px -12px 0 0; font-size: 20px; background: transparent; border: 0; cursor: pointer; }
.dialog-message { font-size: 15px; line-height: 1.4; margin: 40px 0 0; }

@media (max-width: 1024px), (max-width: 1366px) and (pointer: coarse) {
  :root {
    --gutter: clamp(16px, 2.4vw, 24px);
    --wordmark-size: clamp(24px, 4.4vw, 34px);
    --menu-toggle-height: 44px;
    --type-small: 12px;
    --type-nav: 15px;
    --section-offset: clamp(76px, 13vw, 132px);
  }
  .header-menu { --menu-width: 44px; }
  .menu-toggle { padding-inline: 8px; right: calc(var(--gutter) - 8px); }
  .site-nav a { display: inline-flex; align-items: center; min-height: 44px; }
  .intro { margin-top: clamp(100px, 21vw, 215px); }
  .intro, .latest-projects-heading { line-height: 1.35; }
  .reel-play {
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    justify-content: center;
    width: 80px;
    height: 80px;
    padding: 0;
    border-radius: 50%;
    background: rgb(64 64 64 / .42);
    -webkit-backdrop-filter: blur(7px);
    backdrop-filter: blur(7px);
    color: #fff;
    text-shadow: 0 1px 2px rgb(0 0 0 / .22);
    font-size: 10px;
    font-weight: 500;
  }
  .reel-play svg { display: none; }
}

@media (640px < width <= 1024px), (640px < width <= 1366px) and (pointer: coarse) {
  .reel-play { width: 88px; height: 88px; font-size: 11px; }
}

@media (max-width: 640px) {
  :root {
    --wordmark-size: clamp(32px, 5.6vw, 40px);
    --header-top-padding: calc(var(--gutter) - 10px);
  }
  .header-menu { --menu-vertical-offset: 0px; }
  .site-header .wordmark { transition: opacity .15s ease, visibility 0s linear; }
  .site-header:has(.menu-toggle[aria-expanded='true']) .wordmark {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition-delay: 0s, .15s;
  }
  .site-nav {
    --type-nav: clamp(14px, 3.9vw, 16px);
    gap: clamp(14px, 4.5vw, 24px);
    word-spacing: .06em;
  }
  .intro {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    margin-top: clamp(100px, 23svh, 180px);
    column-gap: calc(clamp(13px, 4.2vw, 26px) + 6px);
    row-gap: .65em;
  }
  .intro, .latest-projects-heading { font-size: clamp(10px, 3.5vw, 18px); }
  .intro-role { min-width: 0; }
  .intro-services { white-space: normal; }
  .intro-contact { display: none; }
  .reel { margin-top: 20px; }
  .reel-preview { background: var(--reel-color) url("/assets/reel-poster.jpg") center / cover no-repeat; }
  .reel-preview video { aspect-ratio: 4 / 5; opacity: 0; }
  .reel-preview.is-preview-playing video { opacity: 1; }
  .reel-dialog {
    width: 100%;
    height: 100%;
    max-height: none;
    margin: 0;
  }
  .reel-dialog-content {
    display: grid;
    align-content: center;
    min-height: 100%;
    padding: 52px 0;
  }
  .reel-dialog video {
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 104px);
    max-height: calc(100dvh - 104px);
  }
}

@media (max-width: 1024px) and (max-height: 480px) {
  :root { --section-offset: 64px; }
  .intro { margin-top: 66px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .home .wordmark.is-compacting { --wordmark-fade-duration: .01ms; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
