/* ============================================================
   Jorge Bárcena — Minimalist Portfolio
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --white: #FFFFFF;
  --off-white: #F7F7F6;
  --black: #0C0C0C;
  --dark: #1A1A1A;
  --gray: #777777;
  --light-gray: #E5E5E4;
  --accent: #043ea2;

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  --max-width: 1100px;
  --nav-height: 68px;
  --section-pad: clamp(2rem, 0vw, 0rem);

  --ease: 0.3s ease;
  --ease-slow: 0.6s ease;
}

@media (max-width: 768px) {
  :root {
    --section-pad: clamp(1rem, 0vw, 0rem);
  }
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--white);
  color: var(--dark);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

/* ========================
   LAYOUT
   ======================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

/* ========================
   NAVIGATION
   ======================== */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  transition: background var(--ease), box-shadow var(--ease);
}

#nav.scrolled {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--light-gray);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--black);
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2.25rem;
  align-items: center;
}

.nav-links a {
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray);
  transition: color var(--ease);
  position: relative;
  padding-bottom: 2px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--black);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links .disabled {
  color: var(--light-gray) !important;
  pointer-events: none;
  cursor: default;
}

.nav-links .disabled::after {
  display: none;
}

.nav-icons {
  display: flex;
  gap: 1.1rem;
  list-style: none;
  align-items: center;
}

.nav-icons a {
  color: var(--gray);
  font-size: 1rem;
  transition: color var(--ease);
  line-height: 1;
}

.nav-icons a:hover {
  color: var(--black);
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  background: none;
  border: none;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 1px;
  background: var(--black);
  transition: all var(--ease);
  transform-origin: center;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-toggle.open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile nav */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease);
}

.nav-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.nav-mobile {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(300px, 80vw);
  height: 100vh;
  background: var(--white);
  z-index: 99;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2.5rem;
  border-left: 1px solid var(--light-gray);
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-mobile.open {
  right: 0;
}

.nav-mobile .nav-links {
  flex-direction: column;
  align-items: flex-start;
  gap: 1.75rem;
}

.nav-mobile .nav-links a {
  font-size: 0.9rem;
  letter-spacing: 0.18em;
}

.nav-mobile .nav-icons {
  margin-top: 2.5rem;
}

/* ========================
   HERO
   ======================== */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--nav-height) 2rem 6rem;
  position: relative;
  background:
    linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.8)),
    url('../../images/banner.png') center/cover no-repeat;
  color: var(--white);
}

@media (max-width: 768px) {
  #hero {
    background:
      linear-gradient(rgba(0,0,0,.2), rgba(0,0,0,.8)),
      url('../../images/banner_mob.png') center/cover no-repeat;
  }
}

.hero-eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 2rem;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(4.5rem, 13vw, 9.5rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 0.92;
  color: var(--black);
  margin-bottom: 2.5rem;
}

.hero-line {
  width: 44px;
  height: 1px;
  background: var(--light-gray);
  margin: 0 auto 2rem;
}

.hero-subtitle {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gray);
  font-weight: 400;
}

.hero-scroll {
  position: absolute;
  bottom: 10vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  color: var(--gray);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--ease);
}

.hero-scroll:hover {
  color: var(--black);
}

.scroll-line {
  width: 1px;
  height: 44px;
  background: var(--light-gray);
  position: relative;
  overflow: hidden;
}

.scroll-line::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--accent);
  animation: lineDown 2.2s ease infinite;
}

@keyframes lineDown {
  0%   { top: -100%; }
  100% { top: 100%; }
}

/* ========================
   SECTIONS
   ======================== */
.section {
  padding: var(--section-pad) 0;
}

.section--bg {
  background: var(--off-white);
}

.section-header {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-rule {
  width: 36px;
  height: 1px;
  background: var(--accent);
  margin-bottom: 1.25rem;
}

.section-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.85rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--black);
}

.section-intro {
  margin-top: 1rem;
  font-size: 0.975rem;
  color: var(--gray);
  max-width: 540px;
  line-height: 1.7;
}

/* ========================
   BIO
   ======================== */
.bio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(3rem, 6vw, 6rem);
  align-items: start;
}

.bio-text p {
  font-size: 1.0125rem;
  line-height: 1.82;
  color: var(--dark);
  margin-bottom: 1.4rem;
}

.bio-text p:last-child {
  margin-bottom: 0;
}

.bio-text strong {
  color: var(--black);
  font-weight: 500;
}

.bio-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 3px;
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
}

.bio-photos img:first-child {
  grid-column: 1 / -1;
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
}

.bio-photos img:not(:first-child) {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
}

.bio-photos img {
  transition: filter var(--ease-slow);
  filter: grayscale(15%);
}

.bio-photos img:hover {
  filter: grayscale(0%);
}

/* ========================
   WORKS (CARDS)
   ======================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  border-top: 1px solid var(--light-gray);
  border-left: 1px solid var(--light-gray);
}

.work-card {
  background: var(--white);
  border-right: 1px solid var(--light-gray);
  border-bottom: 1px solid var(--light-gray);
  overflow: hidden;
  transition: background var(--ease);
}

.work-card:hover {
  background: var(--off-white);
}

.work-card:hover .card-img img {
  transform: scale(1.04);
  filter: grayscale(0%);
}

.card-img {
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(25%);
  transition: transform 0.55s ease, filter 0.55s ease;
}

.card-body {
  padding: 1.5rem;
}

.card-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.63rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: var(--gray);
}

.card-status .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.card-status.active {
  color: #5a9a5a;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--black);
  margin-bottom: 0.65rem;
  line-height: 1.2;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--gray);
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.card-btn {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--black);
  background: none;
  border: none;
  border-bottom: 1px solid var(--black);
  padding-bottom: 2px;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}

.card-btn:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ========================
   GALLERY
   ======================== */
.gallery-track-wrap {
  position: relative;
}

.gallery-track {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-item {
  flex: 0 0 calc(33.333% - 2px); /* 3 imágenes por fila */
  scroll-snap-align: start;
  overflow: hidden;
  position: relative;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 2 / 3; /* Equivalente a 1200x1800 */
  object-fit: cover;
  filter: grayscale(20%);
  transition: transform 0.5s ease, filter 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.03);
  filter: grayscale(0%);
}

.scene-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2.5rem 1.25rem 1rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.45));
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 300;
  opacity: 0;
  transition: opacity var(--ease);
}

.gallery-item:hover .gallery-caption {
  opacity: 1;
}

.gallery-controls {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.25rem;
  justify-content: flex-end;
}

.gallery-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--light-gray);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
  font-size: 1.1rem;
  color: var(--dark);
  line-height: 1;
}

.gallery-btn:hover {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}

.gallery-btn:disabled {
  opacity: 0.28;
  pointer-events: none;
}

/* ========================
   CONTACT
   ======================== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(3rem, 6vw, 6rem);
  align-items: start;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.contact-info-item h4 {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 0.45rem;
  font-weight: 500;
}

.contact-info-item a,
.contact-info-item p {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--dark);
  transition: color var(--ease);
  line-height: 1.4;
}

.contact-info-item a:hover {
  color: var(--accent);
}

.social-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}

.social-links a {
  font-size: 1.15rem;
  color: var(--gray);
  transition: color var(--ease);
  line-height: 1;
}

.social-links a:hover {
  color: var(--black);
}

/* Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-field label {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gray);
  font-weight: 500;
}

.form-field input,
.form-field textarea {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--dark);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--light-gray);
  padding: 0.65rem 0;
  outline: none;
  transition: border-color var(--ease);
  resize: none;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.form-field input:focus,
.form-field textarea:focus {
  border-bottom-color: var(--black);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--light-gray);
}

.form-submit {
  align-self: flex-start;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--white);
  background: #008dd6;
  border: 1px solid var(--white);
  padding: 0.85rem 2.5rem;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}

.form-submit:hover:not(:disabled) {
  border-color: #008dd6;
  background: transparent;
  color: #008dd6;
}

.form-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================
   MODAL
   ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--white);
  max-width: 680px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  padding: clamp(2rem, 5vw, 3rem);
  transform: translateY(16px);
  transition: transform 0.3s ease;
}

.modal-overlay.open .modal-box {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--gray);
  transition: color var(--ease);
  padding: 0.25rem;
}

.modal-close:hover {
  color: var(--black);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 300;
  color: var(--black);
  margin-bottom: 1.5rem;
  padding-right: 2rem;
}

.modal-img-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-bottom: 1.5rem;
}

.modal-img-grid img {
  width: 100%;
  object-fit: cover;
}

.modal-img-grid img:only-child {
  grid-column: 1 / -1;
}

.modal-text {
  font-size: 0.95rem;
  color: var(--gray);
  line-height: 1.72;
}

/* ========================
   TOAST
   ======================== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--black);
  color: var(--white);
  padding: 0.9rem 1.5rem;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  z-index: 9999;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  max-width: 300px;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: #b94040;
}

/* ========================
   FOOTER
   ======================== */
footer {
  padding: 2rem clamp(1.25rem, 4vw, 2.5rem);
  border-top: 1px solid var(--light-gray);
  text-align: center;
}

footer p {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--light-gray);
}

/* ========================
   ANIMATIONS
   ======================== */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-up.hero-scroll {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-up.hero-scroll.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-up:nth-child(2) { transition-delay: 0.1s; }
.fade-up:nth-child(3) { transition-delay: 0.2s; }
.fade-up:nth-child(4) { transition-delay: 0.3s; }
.fade-up:nth-child(5) { transition-delay: 0.4s; }
.fade-up:nth-child(6) { transition-delay: 0.5s; }
.fade-up:nth-child(7) { transition-delay: 0.6s; }

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 860px) {
  #nav .nav-links,
  #nav .nav-icons {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .bio-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .bio-photos {
    position: static;
  }

  .gallery-item {
    flex: 0 0 100%; /* 1 foto por ronda */
  }

  .gallery-item img {
    aspect-ratio: 2 / 3; /* mantiene el formato vertical */
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 560px) {
  .hero-name {
    font-size: clamp(3.5rem, 16vw, 5rem);
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .bio-photos {
    grid-template-columns: 1fr;
  }

  .bio-photos img:first-child {
    grid-column: auto;
    aspect-ratio: 4 / 3;
  }

  .bio-photos img:not(:first-child) {
    display: none;
  }

  .modal-img-grid {
    grid-template-columns: 1fr;
  }

  .gallery-item {
    flex: 0 0 100%; /* 1 foto por ronda */
  }

  .gallery-item img {
    aspect-ratio: 2 / 3; /* mantiene el formato vertical */
  }

  .toast {
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}
