/* ============ Joel Cervantes Portfolio — modern minimal ============ */

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --ink: #141412;
  --ink-soft: #4a4a45;
  --ink-faint: #8a8a83;
  --line: #e8e8e3;
  --accent: #b4432a;
  --radius: 14px;
  --maxw: 1160px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 250, 248, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.brand {
  font-family: var(--font-display); font-weight: 600; font-size: 1.25rem;
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
}
.site-nav { display: flex; gap: 32px; }
.site-nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; font-weight: 500;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--accent); }
.menu-toggle {
  display: none; background: none; border: none; cursor: pointer;
  flex-direction: column; gap: 5px; padding: 8px;
}
.menu-toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform 0.25s, opacity 0.25s; }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 72px; }
.hero-kicker {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 20px;
}
.hero-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  line-height: 1.08; letter-spacing: -0.02em; margin-bottom: 24px;
}
.hero-sub { max-width: 620px; color: var(--ink-soft); font-size: 1.1rem; margin-bottom: 36px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 64px; }
.btn {
  display: inline-block; padding: 14px 30px; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; text-decoration: none; transition: transform 0.15s, background 0.2s, color 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { border: 1px solid var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; }

.hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
  border-top: 1px solid var(--line); padding-top: 36px; max-width: 640px;
}
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-family: var(--font-display); font-size: 2rem; font-weight: 600; }
.stat-label { color: var(--ink-faint); font-size: 0.85rem; }

/* ---------- Sections ---------- */
section { padding: 72px 0; }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head h2 {
  font-family: var(--font-display); font-weight: 500; letter-spacing: -0.015em;
  font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 12px;
}
.section-head p { color: var(--ink-soft); }

/* ---------- Work ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 36px; }
.filter-btn {
  padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); font-size: 0.88rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s; font-family: var(--font-body);
}
.filter-btn:hover { border-color: var(--ink); color: var(--ink); }
.filter-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.work-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
}
.work-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform 0.25s, box-shadow 0.25s, opacity 0.3s;
}
.work-item:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(20, 20, 18, 0.10); }
.work-item.hidden { display: none; }
.work-thumb {
  display: block; width: 100%; border: none; background: #fff; cursor: zoom-in; padding: 0;
}
.work-thumb img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 0.4s;
}
.work-item:hover .work-thumb img { transform: scale(1.03); }
.work-item figcaption { padding: 18px 20px 20px; }
.work-item figcaption h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.01em; }
.work-item figcaption p { font-size: 0.85rem; color: var(--ink-faint); }

/* Empty state (e.g. Video filter before videos are added) */
.empty-state {
  grid-column: 1 / -1; text-align: center; color: var(--ink-faint);
  padding: 48px 0; font-size: 0.95rem;
}
.empty-state[hidden] { display: none; }

/* Video thumbnails */
.work-thumb video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.work-thumb { position: relative; }
.play-badge {
  position: absolute; top: 12px; right: 12px;
  background: rgba(15, 15, 13, 0.8); color: #fff;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em;
  padding: 6px 12px; border-radius: 999px; pointer-events: none;
}

/* ---------- About ---------- */
.about { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.about-grid { display: grid; gap: 48px; }
.about-lead { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.5; margin-bottom: 18px; letter-spacing: -0.01em; }
.about-main p { color: var(--ink-soft); max-width: 760px; }
.about-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; }
.about-block h3 {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 18px;
}
.about-block ul { list-style: none; display: grid; gap: 14px; }
.about-block li { font-size: 0.93rem; color: var(--ink-soft); padding-left: 18px; position: relative; }
.about-block li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.about-block li strong { color: var(--ink); font-weight: 600; }

/* ---------- Contact ---------- */
.contact-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.contact-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 26px; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; gap: 8px; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
a.contact-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(20, 20, 18, 0.08); border-color: var(--accent); }
.contact-label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.contact-value { font-size: 1.05rem; font-weight: 600; word-break: break-all; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-inner p { color: var(--ink-faint); font-size: 0.85rem; }
.back-top { color: var(--ink-soft); text-decoration: none; font-size: 0.88rem; font-weight: 500; }
.back-top:hover { color: var(--accent); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 15, 13, 0.92);
  display: flex; align-items: center; justify-content: center; padding: 32px;
  animation: fadeIn 0.25s ease;
}
.lightbox[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox-figure { max-width: 1000px; width: 100%; text-align: center; }
.lightbox-figure img {
  max-width: 100%; max-height: 76vh; margin: 0 auto; border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5); object-fit: contain;
}
.lightbox-figure video {
  max-width: 100%; max-height: 76vh; margin: 0 auto; border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5); background: #000;
}
.lightbox-figure video[hidden], .lightbox-figure img[hidden] { display: none; }
.lightbox-figure figcaption { margin-top: 18px; color: #fff; }
.lightbox-figure h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 500; margin-bottom: 6px; }
.lightbox-figure p { color: rgba(255, 255, 255, 0.65); font-size: 0.92rem; }
.lightbox-close {
  position: absolute; top: 20px; right: 24px;
  background: none; border: none; color: #fff; font-size: 2.4rem; line-height: 1;
  cursor: pointer; opacity: 0.7; transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .work-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .contact-cards { grid-template-columns: 1fr; }
  .about-cols { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hero { padding: 64px 0 52px; }
  section { padding: 52px 0; }
  .work-grid { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
  .stat-num { font-size: 1.5rem; }
  .stat-label { font-size: 0.75rem; }
  .hero-actions .btn { flex: 1; text-align: center; }

  /* Mobile nav */
  .menu-toggle { display: flex; }
  .menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-toggle.open span:nth-child(2) { opacity: 0; }
  .menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .site-nav {
    position: absolute; top: 68px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    flex-direction: column; gap: 0; padding: 8px 24px 16px;
    display: none;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 0; border-top: 1px solid var(--line); font-size: 1rem; }
}
