/* =========================================================
   Juan Villalobos Emonet — Personal Website
   Editorial · Architectural · Refined
   ========================================================= */

:root {
  /* Color palette — warm, architectural */
  --bg:           #F6F2EC;       /* warm cream */
  --bg-alt:       #EFE9E0;       /* soft paper */
  --ink:          #14110F;       /* deep ink */
  --ink-soft:     #2A2520;
  --muted:        #6B6258;       /* warm gray */
  --line:         #D9D1C4;
  --accent:       #B5552E;       /* terracotta */
  --accent-soft:  #C9744F;
  --white:        #FFFFFF;

  /* Typography */
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans:  'Inter Tight', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;

  /* Spacing */
  --container: 1240px;
  --pad: clamp(1.25rem, 4vw, 2.5rem);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.25s var(--ease), opacity 0.25s var(--ease);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul { list-style: none; }

/* ========== TYPOGRAPHY ========== */
.mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1.25rem;
}

.muted { color: var(--muted); font-weight: 400; }

em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
}

strong { font-weight: 600; color: var(--ink); }

/* ========== LAYOUT ========== */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.section {
  padding-top: clamp(4rem, 10vw, 8rem);
  padding-bottom: clamp(4rem, 10vw, 8rem);
}

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

.section__head--split {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.section__num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
  position: relative;
  padding-left: 1.75rem;
}

.section__num::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 1.25rem;
  height: 1px;
  background: var(--accent);
}

.section__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.25rem, 5.5vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--ink);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 999px;
  transition: all 0.3s var(--ease);
  cursor: pointer;
}

.btn--primary {
  background: var(--ink);
  color: var(--bg);
}
.btn--primary:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.btn--dark {
  background: var(--ink);
  color: var(--bg);
}
.btn--dark:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.btn--dark svg { transition: transform 0.3s var(--ease); }
.btn--dark:hover svg { transform: translateX(3px); }

/* ========== NAVIGATION ========== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 0;
  transition: background 0.4s var(--ease), backdrop-filter 0.4s var(--ease), padding 0.3s var(--ease);
}

.nav.scrolled {
  background: rgba(246, 242, 236, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0;
}

.nav__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav__brand {
  font-family: var(--serif);
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: var(--white);
  transition: color 0.4s var(--ease);
}

.nav.scrolled .nav__brand { color: var(--ink); }

.nav__brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  font-family: var(--mono);
  font-weight: 500;
}

.nav__links {
  display: flex;
  gap: 2.25rem;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--white);
  transition: color 0.4s var(--ease);
}

.nav.scrolled .nav__links { color: var(--ink); }

.nav__links a {
  position: relative;
  padding: 0.25rem 0;
}
.nav__links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.3s var(--ease);
}
.nav__links a:hover::after { width: 100%; }

.nav__cta {
  background: var(--white);
  color: var(--ink);
}
.nav.scrolled .nav__cta { background: var(--ink); color: var(--bg); }
.nav__cta:hover { background: var(--accent) !important; color: var(--white) !important; }

.nav__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
}
.nav__burger span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--white);
  transition: all 0.3s var(--ease);
}
.nav.scrolled .nav__burger span { background: var(--ink); }

.nav__mobile {
  display: none;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem var(--pad);
  background: var(--bg);
  border-top: 1px solid var(--line);
  font-size: 1rem;
}

/* ========== HERO ========== */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: flex-end;
  padding: 8rem 0 4rem;
  overflow: hidden;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: heroZoom 12s ease-out forwards;
}

@keyframes heroZoom {
  from { transform: scale(1.08); }
  to   { transform: scale(1); }
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.55) 100%),
    linear-gradient(to right, rgba(20,17,15,0.4) 0%, rgba(20,17,15,0) 60%);
}

.hero__content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad);
  color: var(--white);
}

.hero__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: 1.75rem;
  max-width: 14ch;
  animation: rise 1s var(--ease) 0.1s both;
}

.hero__subtitle {
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.5;
  font-weight: 300;
  max-width: 56ch;
  color: rgba(255, 255, 255, 0.92);
  animation: rise 1s var(--ease) 0.3s both;
}

.hero__meta {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.85);
  animation: rise 1s var(--ease) 0.5s both;
}

.hero__meta-label {
  color: rgba(255, 255, 255, 0.55);
  margin-right: 0.4rem;
}

.dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  display: inline-block;
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  right: var(--pad);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  animation: rise 1s var(--ease) 0.7s both, bob 2.5s ease-in-out 1.5s infinite;
}

.hero__scroll:hover { color: var(--white); }

@keyframes rise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* ========== ABOUT ========== */
.about__grid {
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}

.about__text { font-size: 1.02rem; }

.about__text .lead {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.about__text p {
  margin-bottom: 1.25rem;
  color: var(--ink-soft);
  max-width: 60ch;
}

.about__cta { margin-top: 1.5rem; }

.about__portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--bg-alt);
  border-radius: 4px;
  overflow: hidden;
}

.about__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease);
}

.about__portrait:hover img { transform: scale(1.03); }

.about__portrait figcaption {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: rgba(20, 17, 15, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
}

.about__portrait figcaption .mono { color: rgba(255, 255, 255, 0.9); }

/* ========== PROJECTS ========== */
.projects { background: var(--bg-alt); }

.project {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  margin-bottom: clamp(4rem, 8vw, 6rem);
}

.project:last-child { margin-bottom: 0; }

.project--reverse .project__media { order: 2; }

.project__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line);
  position: relative;
}

.project__media::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(20, 17, 15, 0.05);
  border-radius: 4px;
  pointer-events: none;
}

.project__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s var(--ease);
}

.project:hover .project__media img { transform: scale(1.04); }

.project__index {
  display: block;
  margin-bottom: 1rem;
  color: var(--accent);
}

.project__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin-bottom: 1.25rem;
  color: var(--ink);
}

.project__body p {
  color: var(--ink-soft);
  margin-bottom: 1rem;
  max-width: 56ch;
}

.project__highlight {
  padding: 1rem 1.25rem;
  border-left: 2px solid var(--accent);
  background: rgba(181, 85, 46, 0.05);
  border-radius: 0 4px 4px 0;
  margin-top: 1.25rem !important;
  font-size: 0.95rem;
}

.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.project__tags li {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* ========== SERVICES ========== */
.services__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.service-card {
  padding: 2.25rem 2rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  transition: background 0.4s var(--ease);
  position: relative;
  min-height: 260px;
  display: flex;
  flex-direction: column;
}

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

.service-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.4s var(--ease);
}

.service-card:hover::after { width: 100%; }

.service-card__num {
  color: var(--accent);
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.service-card h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1.25;
  margin-bottom: 0.85rem;
  color: var(--ink);
}

.service-card p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ========== IVECA ========== */
.iveca {
  background: var(--ink);
  color: var(--bg);
}

.iveca .section__num { color: var(--accent-soft); }
.iveca .section__num::before { background: var(--accent-soft); }
.iveca .section__title { color: var(--bg); }

.iveca__grid {
  display: grid;
  grid-template-columns: 1.5fr auto;
  gap: 3rem;
  align-items: end;
}

.iveca__lead {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  line-height: 1.3;
  color: rgba(246, 242, 236, 0.92);
  max-width: 30ch;
  letter-spacing: -0.005em;
}

.iveca__lead strong {
  color: var(--bg);
  font-weight: 600;
  font-family: var(--sans);
  font-size: 0.85em;
  letter-spacing: 0.01em;
}

.iveca__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.95rem 1.5rem;
  border: 1px solid rgba(246, 242, 236, 0.25);
  border-radius: 999px;
  font-size: 0.92rem;
  white-space: nowrap;
  transition: all 0.3s var(--ease);
}

.iveca__link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

.iveca__link svg { transition: transform 0.3s var(--ease); }
.iveca__link:hover svg { transform: translate(2px, -2px); }

/* ========== CONTACT ========== */
.contact__grid {
  display: grid;
  grid-template-columns: 0.95fr 1fr;
  gap: clamp(2.5rem, 6vw, 5rem);
}

.contact__intro .section__title em { display: inline-block; }

.contact__lead {
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 38ch;
}

.contact__details {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.contact__details li {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: baseline;
  gap: 1rem;
}

.contact__label { color: var(--muted); }

.contact__details a:hover { color: var(--accent); }

.contact__form {
  background: var(--white);
  padding: clamp(1.75rem, 3vw, 2.75rem);
  border-radius: 6px;
  border: 1px solid var(--line);
}

.field {
  margin-bottom: 1.4rem;
}

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: var(--sans);
  font-size: 0.98rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--white);
}

.field textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--sans);
}

.contact__submit {
  width: 100%;
  justify-content: center;
  padding: 1rem;
  margin-top: 0.5rem;
}

.hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.form__status {
  margin-top: 1rem;
  font-size: 0.9rem;
  min-height: 1.2em;
  text-align: center;
}

.form__status.success { color: #2D6A4F; }
.form__status.error   { color: #B5552E; }

/* ========== FOOTER ========== */
.footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer__name {
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: -0.005em;
}

.footer__role {
  margin-top: 0.25rem;
  font-size: 0.75rem;
}

/* ========== REVEAL ON SCROLL ========== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 960px) {
  .nav__links, .nav__cta { display: none; }
  .nav__burger { display: flex; }
  .nav__mobile.open { display: flex; }

  .about__grid {
    grid-template-columns: 1fr;
  }
  .about__portrait { max-width: 480px; }

  .project,
  .project--reverse {
    grid-template-columns: 1fr;
  }
  .project--reverse .project__media { order: 0; }

  .services__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .iveca__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
  }

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

@media (max-width: 600px) {
  .hero { min-height: 88vh; padding-bottom: 3rem; }
  .hero__scroll { display: none; }

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

  .service-card { min-height: auto; padding: 1.75rem 1.5rem; }

  .contact__details li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .footer__inner { flex-direction: column; align-items: flex-start; }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
