:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #222222;
  --text-primary: #fcf5ee;
  --text-secondary: #a0a0a0;
  --accent-primary: #dc8f34;
  --accent-hover: #b67323;
  --accent-glow: rgba(220, 143, 52, 0.3);
  --border-color: rgba(255, 255, 255, 0.08);

  --font-main: 'Montserrat', system-ui, -apple-system, sans-serif;

  --spacing-xs: 0.5rem;
  --spacing-sm: 1.5rem;
  --spacing-md: 3rem;
  --spacing-lg: 6rem;
  --spacing-xl: 10rem;

  --radius-sm: 2px;
  --radius-md: 4px;
  --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.35);
  --transition-fast: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-weight: 300;
  line-height: 1.7;
  overflow-x: hidden;
  letter-spacing: 0.01em;
}

a { text-decoration: none; color: inherit; transition: var(--transition-fast); }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 2rem; }
.section { padding: var(--spacing-lg) 0; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

h1, h2, h3, h4 { text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-primary); font-weight: 300; overflow-wrap: break-word; word-break: break-word; }
h1 { font-size: clamp(2rem, 7vw, 4.2rem); font-weight: 200; line-height: 1.15; }
h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); margin-bottom: 1.2rem; position: relative; display: inline-block; }
h2::after { content: ''; position: absolute; bottom: -12px; left: 0; width: 48px; height: 2px; background: var(--accent-primary); }
h3 { font-size: 1.1rem; font-weight: 500; letter-spacing: 0.04em; }
p { color: var(--text-secondary); font-weight: 300; }

/* ===== NAV ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  background: rgba(15, 15, 15, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
}
.nav-content { display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 0.6rem 2rem; flex-wrap: nowrap; }
.nav-logo { font-weight: 700; letter-spacing: 0.1em; font-size: 1.1rem; white-space: nowrap; }
.nav-logo .sep { color: var(--accent-primary); }
.nav-links { display: flex; gap: 2.2rem; align-items: center; }
.nav-link {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--text-secondary); font-weight: 500; position: relative; padding-bottom: 4px;
}
.nav-link:hover, .nav-link.active { color: var(--text-primary); }
.nav-link::after {
  content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 1px;
  background: var(--accent-primary); transition: var(--transition-fast);
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 0.5rem; flex-shrink: 0; }
.hamburger span { width: 22px; height: 2px; background: var(--text-primary); transition: var(--transition-fast); }

/* ===== HERO ===== */
.hero {
  position: relative; min-height: 92vh; display: flex; align-items: flex-end;
  padding-top: 130px; padding-bottom: var(--spacing-lg); overflow: hidden;
}
.hero-bg.img-box {
  position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; min-height: 0;
  background: linear-gradient(160deg, #2a1c0c 0%, #0f0f0f 55%, #0f0f0f 100%);
  background-size: cover; background-position: center;
  align-items: flex-end; justify-content: flex-end;
}
.hero-bg .placeholder-label { opacity: 0.45; text-align: right; padding: 1.5rem; max-width: 220px; }
.hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,15,15,0.35) 0%, rgba(15,15,15,0.55) 55%, #0f0f0f 100%);
}
.hero-content { position: relative; z-index: 2; }
.hero-name { font-size: clamp(1.3rem, 2vw, 1.6rem); letter-spacing: 0.25em; font-weight: 300; margin-top: 1rem; }
.hero-role { color: var(--accent-primary); font-size: 1rem; letter-spacing: 0.05em; margin-top: 0.6rem; }
.hero-scroll { position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); z-index: 2; color: var(--text-secondary); font-size: 0.75rem; letter-spacing: 0.2em; text-align: center; }
.hero-scroll .line { width: 1px; height: 32px; background: var(--text-secondary); margin: 0.6rem auto 0; animation: scrollPulse 2s infinite; }
@keyframes scrollPulse { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ===== ABOUT / SERVICES ===== */
.about-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 4rem; align-items: start; }
.about-bio { color: var(--text-secondary); font-size: 1.05rem; margin-bottom: 2rem; }
.contact-block p { color: var(--text-primary); font-size: 0.95rem; margin-bottom: 0.3rem; }
.contact-block .label { color: var(--text-secondary); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.15em; margin-bottom: 0.6rem; }

.service-item { margin-bottom: 1.6rem; }
.service-tag {
  display: inline-block; background: var(--accent-primary); color: #1a1200;
  font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.7rem 1.4rem; border-radius: var(--radius-sm); margin-bottom: 0.8rem;
}
.service-item p { font-size: 0.95rem; }

/* ===== CARDS / GRID ===== */
.grid { display: grid; gap: 2rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* ===== IMAGE PLACEHOLDER ===== */
.img-box {
  position: relative; width: 100%; border-radius: var(--radius-md); overflow: hidden;
  background: var(--bg-secondary); border: 1px dashed var(--border-color);
  display: flex; align-items: center; justify-content: center; min-height: 220px;
}
.img-box img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.img-box .placeholder-label {
  position: relative; z-index: 1; text-align: center; color: var(--text-secondary);
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; padding: 1rem;
}
.img-box .placeholder-label .icon { font-size: 1.6rem; display: block; margin-bottom: 0.5rem; opacity: 0.6; }
.img-box.has-image .placeholder-label { display: none; }
.img-box.ratio-16-9 { aspect-ratio: 16/9; }
.img-box.ratio-4-3 { aspect-ratio: 4/3; }
.img-box.ratio-1-1 { aspect-ratio: 1/1; }

/* ===== PROJECTS ===== */
.project-block { padding: var(--spacing-md) 0; border-top: 1px solid var(--border-color); }
.project-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2.5rem; gap: 2rem; flex-wrap: wrap; }
.project-number { color: var(--accent-primary); font-size: 0.85rem; letter-spacing: 0.2em; margin-bottom: 0.4rem; display: block; }
.project-meta { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.project-meta .meta-item .label {
  display: inline-block; background: var(--accent-primary); color: #1a1200; font-weight: 700;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.35rem 0.8rem; border-radius: var(--radius-sm); margin-bottom: 0.5rem;
}
.project-meta .meta-item p { font-size: 0.9rem; color: var(--text-primary); }
.project-images { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

.clash-block { margin-top: 3rem; padding: 2.5rem; background: var(--bg-secondary); border-radius: var(--radius-md); }
.clash-title { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; }
.clash-title .arrow { color: var(--accent-primary); font-weight: 700; }
.clash-images { display: grid; grid-template-columns: 0.85fr 1.3fr; gap: 1.5rem; align-items: start; margin-top: 1.5rem; }
.clash-note { }
.clash-note .service-tag { margin-bottom: 1rem; }

/* ===== TECH STACK ===== */
.app-card {
  background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 1.8rem; transition: var(--transition-fast);
}
.app-card:hover { border-color: var(--accent-primary); transform: translateY(-4px); }
.app-card .app-name { font-size: 1.05rem; letter-spacing: 0.05em; margin-bottom: 0.6rem; color: var(--text-primary); }
.app-card p { font-size: 0.88rem; margin-bottom: 1rem; }
.app-card a.app-link { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-primary); font-weight: 600; }
.app-card a.app-link:hover { color: var(--text-primary); }

/* ===== SKILL CHIPS ===== */
.chip-row { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.chip {
  border: 1px solid var(--border-color); color: var(--text-secondary); font-size: 0.82rem;
  padding: 0.6rem 1.2rem; border-radius: 30px; letter-spacing: 0.03em;
}

/* ===== FOOTER / CTA ===== */
.cta-section { position: relative; padding: var(--spacing-lg) 0; overflow: hidden; }
.cta-bg { position: absolute; inset: 0; z-index: 0; background: radial-gradient(circle at 30% 20%, rgba(220,143,52,0.18), transparent 55%), var(--bg-primary); border-top: 1px solid var(--border-color); }
.cta-content { position: relative; z-index: 1; }
.cta-availability { display: inline-block; border-top: 1px solid var(--accent-primary); padding-top: 1rem; margin-top: 2rem; font-size: 0.8rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-primary); font-weight: 600; }
.cta-contacts { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.4rem 2.5rem; }
.cta-contacts a { font-size: 1.05rem; color: var(--text-primary); }
.cta-contacts a:hover { color: var(--accent-primary); }

.footer { padding: 2.5rem 0; border-top: 1px solid var(--border-color); font-size: 0.8rem; color: var(--text-secondary); }
.footer-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }

/* ===== EDIT MODE ===== */
.editable { outline: 1px dashed transparent; transition: outline-color 0.2s, background 0.2s; border-radius: 2px; }
body.edit-mode .editable { outline-color: rgba(220,143,52,0.35); cursor: text; }
body.edit-mode .editable:hover { outline-color: var(--accent-primary); background: rgba(220,143,52,0.06); }
body.edit-mode .editable:focus { outline: 1px solid var(--accent-primary); background: rgba(220,143,52,0.1); }
body.edit-mode .img-box { cursor: pointer; }
body.edit-mode .img-box:hover { outline: 1px solid var(--accent-primary); }
body.edit-mode .img-box::before {
  content: '\2b06  Subir imagen'; position: absolute; top: 8px; right: 8px; z-index: 2;
  background: var(--accent-primary); color: #1a1200; font-size: 0.65rem; font-weight: 700;
  padding: 0.3rem 0.6rem; border-radius: 20px; letter-spacing: 0.05em; text-transform: uppercase;
  opacity: 0; transition: opacity 0.2s;
}
body.edit-mode .img-box:hover::before { opacity: 1; }

.editor-toolbar {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 900;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem;
}
.editor-toolbar .panel {
  display: none; background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 1rem; box-shadow: var(--shadow-sm);
  flex-direction: column; gap: 0.6rem; width: 220px; margin-bottom: 0.5rem;
}
body.edit-mode .editor-toolbar .panel { display: flex; }
.editor-toolbar .panel .status { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.4; }
.tb-btn {
  border: 1px solid var(--border-color); background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 0.78rem; padding: 0.65rem 1rem; border-radius: var(--radius-sm); cursor: pointer;
  letter-spacing: 0.03em; text-align: left; transition: var(--transition-fast);
}
.tb-btn:hover { border-color: var(--accent-primary); }
.tb-btn.danger:hover { border-color: #d1534a; color: #ff8a80; }
.tb-main {
  border: none; background: var(--accent-primary); color: #1a1200; font-weight: 700;
  font-size: 0.85rem; padding: 0.9rem 1.4rem; border-radius: 30px; cursor: pointer;
  box-shadow: var(--shadow-sm); letter-spacing: 0.05em;
}
.tb-main:hover { background: var(--accent-hover); }
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-tertiary); border: 1px solid var(--accent-primary); color: var(--text-primary);
  padding: 0.8rem 1.6rem; border-radius: 30px; font-size: 0.82rem; z-index: 1000;
  opacity: 0; pointer-events: none; transition: all 0.3s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .about-grid, .clash-images { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .project-images { grid-template-columns: 1fr; }

  .hamburger { display: flex; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--bg-secondary); border-top: 1px solid var(--border-color);
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease;
  }
  body.nav-open .nav-links { max-height: 70vh; opacity: 1; overflow-y: auto; }
  .nav-links li { width: 100%; }
  .nav-link { display: block; padding: 1.1rem 2rem; }
  .nav-link::after { display: none; }
  .hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .hamburger.active span:nth-child(2) { opacity: 0; }
  .hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

@media (max-width: 480px) {
  .container { padding: 0 1.25rem; }
  .nav-content { padding: 0.6rem 1.25rem; }
  .nav-logo-full { display: none; }
  .hero { padding-top: 110px; }
  h1 { letter-spacing: 0.03em; }
  .clash-title { flex-wrap: wrap; }
  .project-meta { gap: 1.5rem; }
  .cta-contacts { gap: 0.8rem 1.5rem; }
}
