/* ==========================================================================
   DESIGN TOKENS
   ========================================================================== */
:root {
  --bg: #050505;
  --surface: #0a0a0a;
  --surface-2: #0f0f0f;
  --border: #1e1e1e;
  --border-soft: #161616;
  --text: #f2f2f0;
  --text-dim: #a3a39d;
  --text-mute: #6a6a65;
  --accent: #E8792A;
  --accent-text: #1a0f05;
  --accent-dim: #2a1a0d;

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --gutter: clamp(24px, 6vw, 90px);
  --content-max: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   FRAME MARKS — marco fijo tipo canvas de diseño
   ========================================================================== */
.frame-marks {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}
.fm {
  position: absolute;
  width: 16px;
  height: 16px;
}
.fm::before, .fm::after {
  content: '';
  position: absolute;
  background: var(--accent);
  opacity: 0.55;
}
.fm::before { width: 16px; height: 1px; top: 7.5px; left: 0; }
.fm::after { width: 1px; height: 16px; left: 7.5px; top: 0; }
.fm-tl { top: 18px; left: 18px; }
.fm-tr { top: 18px; right: 18px; }
.fm-bl { bottom: 18px; left: 18px; }
.fm-br { bottom: 18px; right: 18px; }
@media (max-width: 640px) {
  .frame-marks { display: none; }
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}

.mark-lockup { display: flex; align-items: center; }
.mark-lockup svg { width: 37px; height: 37px; }

.site-nav {
  display: flex;
  gap: 34px;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-dim);
}
.site-nav a:hover { color: var(--accent); }

.lang-toggle {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-mute);
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 7px 11px;
  cursor: pointer;
}
.lang-toggle .active { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 12px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 9px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-dim);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 780px) {
  .nav-toggle { display: flex; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 4px var(--gutter) 14px;
    background: rgba(5, 5, 5, 0.97);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .site-nav.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .site-nav a {
    padding: 15px 2px;
    font-size: 16px;
    color: var(--text);
    border-bottom: 1px solid var(--border-soft);
  }
  .site-nav a:last-child { border-bottom: none; }
}

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  position: relative;
  min-height: calc(100vh - 73px);
  display: flex;
  align-items: center;
  padding: 0 var(--gutter);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url('../assets/fondo_hero.png') center / cover no-repeat;
  opacity: 0.3;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to bottom, rgba(5,5,5,0.4) 0%, rgba(5,5,5,0.68) 55%, var(--bg) 100%),
    radial-gradient(ellipse at 30% 40%, rgba(5,5,5,0.1) 0%, rgba(5,5,5,0.7) 80%);
}

.grid-guide {
  position: absolute;
  top: 0; bottom: 0;
  left: clamp(24px, 12vw, 200px);
  width: 1px;
  background: var(--border-soft);
  z-index: 2;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 60px 0;
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
  display: flex;
  justify-content: space-between;
  margin-bottom: clamp(40px, 8vw, 72px);
}
.mono-label .mark { color: var(--accent); font-weight: 500; }

.hero-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(52px, 10vw, 110px);
  line-height: 0.95;
  letter-spacing: -0.01em;
}
.hero-name .last {
  display: block;
  margin-left: clamp(40px, 9vw, 120px);
  color: var(--accent);
  font-style: italic;
  font-weight: 400;
}

.role-line {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  margin: 28px 0 36px;
  padding-left: clamp(40px, 9vw, 120px);
}

.hero-sub {
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.7;
  color: var(--text-dim);
  max-width: 720px;
  padding-left: clamp(40px, 9vw, 120px);
  margin-bottom: 44px;
  text-wrap: pretty;
}
.byta-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease, background-color 0.2s ease;
  border-radius: 3px;
}
.byta-link:hover,
.byta-link:focus-visible {
  color: #C6FF00;
  text-shadow: 0 0 14px rgba(198, 255, 0, 0.65);
  background-color: rgba(198, 255, 0, 0.12);
  outline: none;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 32px;
  padding-left: clamp(40px, 9vw, 120px);
  margin-bottom: 56px;
}

.btn-cta {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent);
  padding: 13px 26px;
  border-radius: 2px;
  transition: transform 0.15s ease;
}
.btn-cta:hover { transform: translateY(-2px); }

.btn-link {
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--text-mute);
  padding-bottom: 2px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-link:hover { color: var(--accent); border-color: var(--accent); }

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  padding-left: clamp(40px, 9vw, 120px);
  border-top: 1px solid var(--border-soft);
  padding-top: 20px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
  padding: 0 16px;
  border-left: 1px solid var(--border);
}
.tag:first-child { padding-left: 0; border-left: none; }
.tag.hl { color: var(--accent); }

@media (max-width: 640px) {
  .grid-guide { display: none; }
  .hero-name .last, .role-line, .hero-sub, .hero-actions, .hero-tags {
    margin-left: 0;
    padding-left: 0;
  }
}

/* ==========================================================================
   SECTIONS — shared
   ========================================================================== */
.section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(80px, 12vw, 140px) var(--gutter) 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: clamp(40px, 6vw, 64px);
}
.section-index {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(32px, 4vw, 44px);
}

/* scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   PROYECTOS — bento grid
   ========================================================================== */
.bento {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
a.card:hover { border-color: var(--accent); transform: translateY(-3px); }

.card-featured { grid-column: span 2; }

.card-thumb {
  height: 200px;
  position: relative;
  background: linear-gradient(135deg, #141414, #0d0d0d);
}
.byta-thumb,
.boda-thumb,
.charanga-thumb {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.byta-thumb { background-image: linear-gradient(180deg, rgba(5,5,5,0.1), rgba(5,5,5,0.5)), url('../assets/byta_final.png'); background-position: center 60%; }
.boda-thumb { background-image: linear-gradient(180deg, rgba(5,5,5,0.1), rgba(5,5,5,0.5)), url('../assets/boda.png'); background-position: center 25%; }
.charanga-thumb { background-image: linear-gradient(180deg, rgba(5,5,5,0.1), rgba(5,5,5,0.5)), url('../assets/charanga.png'); opacity: 0.6; }

.card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px;
}

.card-body { padding: 24px; }

.card-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  display: block;
  margin-bottom: 10px;
}
.card-tag.muted { color: var(--text-mute); }

.card-body h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  margin-bottom: 10px;
}

.card-body p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 18px;
}

.card-stack { display: flex; gap: 8px; }
.card-stack .tag { border: none; padding: 4px 10px; background: var(--surface-2); border-radius: 3px; }

.card-progress { opacity: 0.82; }
a.card-progress:hover { opacity: 1; }

@media (max-width: 900px) {
  .bento { grid-template-columns: 1fr; }
  .card-featured { grid-column: span 1; }
}

/* ==========================================================================
   SOBRE MÍ
   ========================================================================== */
.sobre-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  align-items: start;
}

.photo-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--surface);
  border: 1px solid var(--border);
}
.photo-frame__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.corner-tick { position: absolute; width: 18px; height: 18px; }
.corner-tick::before, .corner-tick::after { content: ''; position: absolute; background: var(--accent); }
.corner-tick::before { width: 18px; height: 2px; top: 8px; }
.corner-tick::after { width: 2px; height: 18px; left: 8px; }
.ct-tl { top: -1px; left: -1px; }
.ct-br { bottom: -1px; right: -1px; }

.sobre-copy p {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-dim);
  margin-bottom: 22px;
  max-width: 620px;
}

@media (max-width: 760px) {
  .sobre-grid { grid-template-columns: 1fr; }
  .photo-frame { max-width: 220px; }
}

/* ==========================================================================
   STACK
   ========================================================================== */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}
.stack-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  display: block;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.stack-col li {
  font-size: 15px;
  color: var(--text-dim);
  padding: 8px 0;
}

@media (max-width: 700px) {
  .stack-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* ==========================================================================
   CONTACTO
   ========================================================================== */
.contacto {
  padding-bottom: clamp(100px, 14vw, 160px);
}
.contacto-inner { text-align: left; }
.contacto-inner .section-index {
  display: block;
  margin-bottom: 18px;
}
.contacto-inner h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 64px);
  margin-bottom: 18px;
}
.contacto-inner p {
  font-size: 17px;
  color: var(--text-dim);
  margin-bottom: 32px;
}
.contacto-email {
  font-family: var(--font-mono);
  font-size: clamp(20px, 3vw, 28px);
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 4px;
  display: inline-block;
  margin-bottom: 40px;
}
.contacto-links {
  display: flex;
  gap: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}
.contacto-links a:hover { color: var(--accent); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px var(--gutter);
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
}
.footer-left { display: flex; align-items: center; gap: 14px; }

/* ==========================================================================
   MÓVIL
   ========================================================================== */
@media (max-width: 640px) {
  .section { padding-top: clamp(64px, 16vw, 96px); }
  .section-head { gap: 12px; margin-bottom: 36px; }

  /* hero */
  .hero { min-height: calc(100svh - 74px); }
  .hero-inner { padding: 36px 0 48px; }
  .mono-label {
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    margin-bottom: 32px;
  }
  .hero-name { font-size: clamp(44px, 15vw, 68px); }
  .role-line {
    font-size: 12px;
    margin: 18px 0 26px;
    overflow-wrap: anywhere;
  }
  .hero-sub {
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 32px;
    overflow-wrap: break-word;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 40px;
  }
  .btn-cta { text-align: center; padding: 15px 24px; }
  .btn-link { align-self: flex-start; }
  .hero-tags { row-gap: 10px; padding-top: 18px; }

  /* proyectos */
  .card-thumb { height: 172px; }
  .card-body { padding: 20px; }
  .card-body h3 { font-size: 22px; }

  /* sobre mí */
  .sobre-grid { gap: 32px; }
  .photo-frame { max-width: 200px; }
  .sobre-copy p { font-size: 16px; line-height: 1.75; }

  /* contacto */
  .contacto-inner h2 { font-size: clamp(34px, 10vw, 46px); }
  .contacto-email {
    font-size: 16px;
    word-break: break-all;
    margin-bottom: 32px;
  }
  .contacto-links { gap: 22px; }

  /* footer */
  .site-footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 24px var(--gutter);
  }
  .footer-left { flex-direction: column; gap: 8px; }
}

/* ==========================================================================
   CASE STUDY  (proyectos/*.html)
   ========================================================================== */
.cs-hero {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(56px, 11vw, 116px) var(--gutter) clamp(36px, 6vw, 60px);
  border-bottom: 1px solid var(--border-soft);
}
.cs-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 20px;
}
.cs-eyebrow.muted { color: var(--text-mute); }
.cs-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
}
.cs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 26px;
}
.cs-meta .sep { color: var(--text-mute); }
.cs-tags {
  display: flex;
  flex-wrap: wrap;
  row-gap: 8px;
  margin-bottom: 26px;
}
.cs-links { display: flex; flex-wrap: wrap; gap: 24px; }

/* primer bloque tras el header del proyecto: menos aire arriba */
.cs-hero + .section { padding-top: clamp(44px, 7vw, 76px); }
/* secciones de texto: cabecera algo más ceñida al cuerpo */
.cs-hero ~ .section .section-head { margin-bottom: clamp(24px, 3.5vw, 36px); }

.cs-body { max-width: 680px; }
.cs-body p {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.cs-body p:last-child { margin-bottom: 0; }
.cs-body strong { color: var(--text); font-weight: 500; }

.cs-note {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
  margin: -12px 0 30px;
}

ol.cs-decisions {
  list-style: none;
  max-width: 760px;
  counter-reset: dec;
}
.cs-decisions li {
  position: relative;
  padding: 0 0 26px 54px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border-soft);
}
.cs-decisions li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.cs-decisions li::before {
  counter-increment: dec;
  content: counter(dec, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 3px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.cs-decisions li p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-dim);
}
.cs-decisions li strong { color: var(--text); font-weight: 500; }

.cs-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.cs-shot {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-mute);
  text-align: center;
}

.cs-foot-nav {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(64px, 10vw, 120px) var(--gutter);
  font-family: var(--font-mono);
  font-size: 13px;
}
.cs-foot-nav a { color: var(--text-dim); }
.cs-foot-nav a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .cs-gallery-grid { grid-template-columns: 1fr; }
  .cs-decisions li { padding-left: 42px; }
  .cs-body p { font-size: 16px; }
  .cs-title { font-size: clamp(38px, 11vw, 56px); }
}
