/* ═══════════════════════════════════════════════════════════
   SABRINA CONTRERAS — PORTAFOLIO
   Paleta: Negro cálido · Rojo tinto
   Estética: Oriental dos tintas + Grunge
   ═══════════════════════════════════════════════════════════ */

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  --black:       #0D0B09;
  --black-warm:  #1C1814;
  --black-card:  #151210;
  --red:         #B02020;
  --red-bright:  #C83030;
  --cream:       #E8DDD0;
  --cream-dim:   #8A7E72;
  --cream-ghost: #2A2520;

  --font-display:   'Bebas Neue', 'Impact', sans-serif;
  --font-editorial: 'Cormorant SC', 'Georgia', serif;
  --font-body:      'IM Fell English', 'Georgia', serif;

  --gap:        3px;
  --pad-x:      clamp(1.5rem, 5vw, 5rem);
  --pad-y:      clamp(5rem, 10vw, 9rem);
  --container:  min(94vw, 1360px);
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--black);
  color: var(--cream);
  font-family: var(--font-body);
  line-height: 1.75;
  overflow-x: hidden;
}

a   { color: inherit; text-decoration: none; }
ul  { list-style: none; }
img { display: block; max-width: 100%; }

/* ── GRAIN OVERLAY ───────────────────────────────────────── */
/* filled by JS canvas — ensures randomness and cross-browser support */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  opacity: 0.045;
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ── NAVIGATION ──────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.6rem var(--pad-x);
  transition: background 0.4s, border-color 0.4s;
}

.nav.scrolled {
  background: rgba(13, 11, 9, 0.93);
  border-bottom: 1px solid var(--cream-ghost);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav-logo {
  font-family: var(--font-editorial);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  transition: color 0.2s;
}
.nav-logo:hover { color: var(--red); }

.nav-links {
  display: flex;
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

.nav-link {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  color: var(--cream-dim);
  transition: color 0.2s;
}
.nav-link:hover,
.nav-link.active { color: var(--cream); }

.nav-toggle { display: none; }

/* ── HERO ────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: clamp(5rem, 12vh, 9rem) var(--pad-x) clamp(3rem, 8vh, 5rem);
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 70% at 75% 50%, rgba(140,25,25,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 40% 50% at 20% 80%, rgba(140,25,25,0.04) 0%, transparent 60%);
  pointer-events: none;
}

/* Vertical label — Japanese layout reference */
.hero-vertical-text {
  position: absolute;
  left: 1.8rem;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.35em;
  color: var(--cream-dim);
  opacity: 0.45;
  white-space: nowrap;
  user-select: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  padding-left: clamp(0rem, 3vw, 3rem);
}

/* Eyebrow line with red dash */
.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.8rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.45em;
  color: var(--red);
}
.hero-eyebrow::before {
  content: '';
  display: block;
  width: 36px;
  height: 1px;
  background: var(--red);
  flex-shrink: 0;
}
.eyebrow-year {
  color: var(--cream-dim);
  border-left: 1px solid var(--cream-ghost);
  padding-left: 1.2rem;
}

/* Title: outline + solid two-tone treatment */
.hero-title {
  display: flex;
  flex-direction: column;
  line-height: 0.86;
  margin-bottom: 2rem;
}

.title-outline {
  font-family: var(--font-display);
  font-size: clamp(5.5rem, 15vw, 15rem);
  -webkit-text-stroke: 1.5px var(--cream);
  color: transparent;
  letter-spacing: -0.015em;
}

.title-solid {
  font-family: var(--font-display);
  font-size: clamp(5.5rem, 15vw, 15rem);
  color: var(--cream);
  letter-spacing: -0.015em;
}

.hero-descriptor {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(0.9rem, 1.2vw, 1.05rem);
  color: var(--cream-dim);
  letter-spacing: 0.06em;
}

.hero-location {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.35em;
  color: var(--red);
  margin-top: 0.6rem;
  opacity: 0.9;
}

/* Ink seal */
.hero-seal {
  position: absolute;
  right: clamp(1.5rem, 6vw, 5.5rem);
  bottom: clamp(3.5rem, 9vh, 6rem);
  width: 76px;
  height: 76px;
  border: 1.5px solid var(--red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.hero-seal::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(140,25,25,0.35);
  border-radius: 50%;
}
.hero-seal span {
  font-family: var(--font-editorial);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--red);
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--cream-dim);
  opacity: 0.45;
  animation: bob 2.8s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { opacity: 0.45; transform: translateX(-50%) translateY(0); }
  50%       { opacity: 0.7;  transform: translateX(-50%) translateY(6px); }
}

/* ── SHARED SECTION LAYOUT ───────────────────────────────── */
.section {
  padding-block: var(--pad-y);
  padding-inline: var(--pad-x);
  max-width: var(--container);
  margin-inline: auto;
}

.section-header {
  display: flex;
  align-items: flex-end;
  gap: 1.2rem;
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}

.section-index {
  font-family: var(--font-display);
  font-size: clamp(5rem, 9vw, 8rem);
  color: var(--cream-ghost);
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
  /* offset to align baseline with title */
  margin-bottom: 0.05em;
}

.section-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-bottom: 0.15em;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--cream);
}

.section-rule {
  display: block;
  width: 52px;
  height: 2px;
  background: var(--red);
}

/* ── PROYECTOS GRID ──────────────────────────────────────── */
.proyectos-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--gap);
}

/* Asymmetric pattern: 4+2 / 3+3 / 2+4 */
.proyecto-card:nth-child(1) { grid-column: span 4; }
.proyecto-card:nth-child(2) { grid-column: span 2; }
.proyecto-card:nth-child(3) { grid-column: span 3; }
.proyecto-card:nth-child(4) { grid-column: span 3; }
.proyecto-card:nth-child(5) { grid-column: span 2; }
.proyecto-card:nth-child(6) { grid-column: span 4; }

.proyecto-card {
  background: var(--black-card);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

/* Red border reveal on hover */
.proyecto-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1.5px solid transparent;
  z-index: 2;
  pointer-events: none;
  transition: border-color 0.3s;
}
.proyecto-card:hover::before { border-color: var(--red); }

.card-visual {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.55s cubic-bezier(0.23, 1, 0.32, 1);
}
.proyecto-card:hover .card-visual { transform: scale(1.04); }

/* Gradient vignette over card */
.card-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(13,11,9,0.75) 0%, transparent 55%);
  pointer-events: none;
  z-index: 1;
}

/* Individual card backgrounds — each a variation in the same palette */
.proyecto-card:nth-child(1) .card-visual { background: #1a1614; border-left: 3px solid var(--red); }
.proyecto-card:nth-child(2) .card-visual { background: #110e0c; }
.proyecto-card:nth-child(3) .card-visual { background: #181410; border-top: 2px solid rgba(140,25,25,.35); }
.proyecto-card:nth-child(4) .card-visual { background: #0f0d0a; }
.proyecto-card:nth-child(5) .card-visual { background: #1c1815; border-right: 2px solid rgba(140,25,25,.25); }
.proyecto-card:nth-child(6) .card-visual { background: #141110; border-bottom: 3px solid var(--red); }

/* Large ghost text as visual placeholder — renders as texture */
.card-bg-text {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 5.5rem);
  line-height: 1;
  letter-spacing: 0.04em;
  color: rgba(232,221,208,0.065);
  text-align: center;
  user-select: none;
  transition: color 0.4s;
  position: relative;
  z-index: 0;
}
.proyecto-card:hover .card-bg-text { color: rgba(140,25,25,0.14); }

/* Card metadata bar */
.card-info {
  padding: 0.9rem 1.1rem;
  border-top: 1px solid rgba(232,221,208,0.055);
  transition: border-color 0.3s;
}
.proyecto-card:hover .card-info { border-top-color: rgba(140,25,25,0.5); }

.card-title {
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 1.4vw, 1.15rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--cream);
  margin-bottom: 0.3rem;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.80rem;
  color: var(--cream-dim);
}

/* ── SOBRE MÍ ────────────────────────────────────────────── */
.bio-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(2.5rem, 7vw, 6rem);
  align-items: start;
}

.bio-quote {
  font-family: var(--font-editorial);
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  font-weight: 300;
  font-style: normal;
  color: var(--cream);
  line-height: 1.6;
  letter-spacing: 0.03em;
  border-left: 1.5px solid var(--red);
  padding-left: 1.6rem;
  margin-bottom: 2rem;
}

/* Small seal under quote */
.bio-seal {
  width: 52px;
  height: 52px;
  border: 1.5px solid var(--red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 1.6rem;
  position: relative;
}
.bio-seal::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(140,25,25,0.3);
  border-radius: 50%;
}
.bio-seal span {
  font-family: var(--font-editorial);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--red);
}

.bio-text {
  font-size: clamp(0.88rem, 1.1vw, 0.98rem);
  color: var(--cream-dim);
  line-height: 1.9;
  margin-bottom: 1.1rem;
}

.bio-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
}

.bio-tag {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  color: var(--cream-dim);
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--cream-ghost);
  transition: border-color 0.2s, color 0.2s;
}
.bio-tag:hover { border-color: var(--red); color: var(--cream); }

/* ── CONTACTO ────────────────────────────────────────────── */
address { font-style: normal; }

.contacto-content {
  padding-left: clamp(0px, calc(var(--pad-x) + 4rem), 9rem);
}

.contacto-opening {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--cream-dim);
  letter-spacing: 0.05em;
  margin-bottom: 0.9rem;
}

.contacto-email {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4.5vw, 4rem);
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--cream);
  margin-bottom: 2.2rem;
  width: fit-content;
  position: relative;
  transition: color 0.25s;
}
.contacto-email::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--red);
  transition: width 0.4s ease;
}
.contacto-email:hover { color: var(--red-bright); }
.contacto-email:hover::after { width: 100%; }

.contacto-social {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
}

.social-link {
  color: var(--cream-dim);
  transition: color 0.2s;
}
.social-link:hover { color: var(--cream); }

.social-dot { color: var(--red); }

/* ── FOOTER ──────────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.8rem var(--pad-x);
  border-top: 1px solid var(--cream-ghost);
  font-family: var(--font-display);
  font-size: 0.67rem;
  letter-spacing: 0.22em;
  color: var(--cream-dim);
}

/* ── RESPONSIVE ──────────────────────────────────────────── */

/* Tablet */
@media (max-width: 900px) {
  :root { --pad-x: 1.5rem; --pad-y: clamp(4rem, 8vw, 6rem); }

  /* Mobile nav */
  .nav-links {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13,11,9,0.97);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    z-index: 190;
  }
  .nav-links.open { display: flex; }
  .nav-links.open .nav-link {
    font-size: 2rem;
    color: var(--cream);
    letter-spacing: 0.2em;
  }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 195;
  }
  .nav-toggle span {
    display: block;
    width: 22px;
    height: 1px;
    background: var(--cream);
    transition: transform 0.3s, opacity 0.3s;
  }
  .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); }

  /* Hero */
  .hero-vertical-text { display: none; }
  .hero-seal { display: none; }

  /* Projects: 2-column grid */
  .proyectos-grid { grid-template-columns: 1fr 1fr; }
  .proyecto-card:nth-child(n) { grid-column: span 1; }
  .proyecto-card:nth-child(1),
  .proyecto-card:nth-child(6) { grid-column: span 2; }

  /* About */
  .bio-layout { grid-template-columns: 1fr; }

  /* Contact */
  .contacto-content { padding-left: 0; }

  /* Footer */
  .footer { flex-direction: column; gap: 0.4rem; text-align: center; }
}

/* Mobile */
@media (max-width: 520px) {
  .proyectos-grid { grid-template-columns: 1fr; }
  .proyecto-card:nth-child(n) { grid-column: span 1; }

  .title-outline,
  .title-solid { font-size: clamp(4rem, 20vw, 6rem); }

  .contacto-email { font-size: clamp(1.2rem, 7vw, 1.8rem); }
}
