/* ============================================
   PORTFOLIO — Pablo Rejón Camacho
   Single-column dark · top nav · image cards
   ============================================ */

:root {
  --bg:          #080808;
  --bg-alt:      #0f0f0f;
  --surface:     #161616;
  --surface-2:   #262626;
  --border:      rgba(255, 255, 255, 0.08);
  --border-h:    rgba(255, 0, 79, 0.45);
  --accent:      #ff004f;
  --accent-soft: rgba(255, 0, 79, 0.1);
  --text:        #ffffff;
  --text-2:      #999999;
  --text-3:      #5c5c5c;
  --live:        #4ade80;
  --paused:      #f59e0b;
  --mono:        'DM Mono', monospace;
  --sans:        'Nunito', -apple-system, 'Segoe UI', sans-serif;
  --radius:      12px;
}

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { overflow-x: hidden; line-height: 1.6; }

::-webkit-scrollbar       { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 3px; }

::selection { background: rgba(255, 0, 79, 0.35); color: #fff; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================
   TOP NAV
   ============================================ */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  background: rgba(8, 8, 8, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 900;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand-dot { color: var(--accent); }

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.journey-btn {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 4px 10px;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.25s ease;
  background: transparent;
}
.journey-btn:hover, .journey-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 0, 79, 0.35);
}

.topnav-links {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 28px;
}

.nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
  padding: 4px 0;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transition: right 0.25s ease;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); }
.nav-link.active::after { right: 0; }

#lang-switch {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: all 0.2s;
}
#lang-switch:hover { border-color: var(--border-h); color: var(--accent); }

/* ============================================
   HERO
   ============================================ */
.hero {
  min-height: 92vh;
  display: grid;
  place-items: center;
  padding: 140px 0 80px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  width: 720px; height: 720px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 0, 79, 0.07) 0%, transparent 65%);
  top: -200px; right: -200px;
  pointer-events: none;
}

.hero-inner { position: relative; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
  width: 100%;
}

.hero-art img {
  width: 100%;
  height: auto;
  display: block;
  animation: heroFloat 7s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-14px); }
}

.hero-hello {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 10px;
}

.hero-name {
  font-size: clamp(2.8rem, 7vw, 4.6rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.accent { color: var(--accent); }

.hero-role {
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 20px;
}

.hero-desc {
  max-width: 620px;
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.2;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: #ff2e6b;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 0, 79, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--surface-2);
}
.btn-ghost:hover {
  border-color: var(--border-h);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-live {
  background: transparent;
  color: var(--live);
  border: 1px solid rgba(74, 222, 128, 0.4);
}
.btn-live:hover {
  background: rgba(74, 222, 128, 0.08);
  transform: translateY(-2px);
}

.btn-small {
  padding: 9px 18px;
  font-size: 13px;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
  padding: 96px 0;
  scroll-margin-top: 70px;
}

.section-alt { background: var(--bg-alt); }

.section-title {
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 44px;
  position: relative;
  display: inline-block;
}
.section-title::after {
  content: '';
  position: absolute;
  left: 0; bottom: -10px;
  width: 48px; height: 4px;
  border-radius: 2px;
  background: var(--accent);
}

.subsection-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-2);
  margin: 56px 0 24px;
}

/* ============================================
   ABOUT
   ============================================ */
.about-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 48px;
  align-items: center;
}

.about-art img {
  width: 100%;
  height: auto;
  display: block;
}

.about-text p {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 18px;
}

/* GitHub contributions chart */
.gh-chart {
  display: block;
  margin-top: 12px;
  padding: 16px 16px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}
.gh-chart:hover {
  border-color: var(--border-h);
  transform: translateY(-2px);
}

.gh-chart img {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 10px;
}

.gh-chart-caption {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.03em;
  transition: color 0.2s;
}
.gh-chart:hover .gh-chart-caption { color: var(--accent); }

/* Skills — icon row */
.skills-title {
  font-size: 1.4rem;
  font-weight: 900;
  text-align: center;
  margin: 64px 0 32px;
}

.skills-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px 36px;
}

.skill-icon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: default;
}

.skill-icon img {
  width: 52px;
  height: 52px;
  display: block;
  filter: grayscale(0.85) brightness(0.85);
  transition: filter 0.25s, transform 0.25s;
}

.skill-icon:hover img {
  filter: none;
  transform: translateY(-5px) scale(1.08);
}

.skill-name {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s, transform 0.25s, color 0.25s;
  pointer-events: none;
  white-space: nowrap;
}

.skill-icon:hover .skill-name {
  opacity: 1;
  transform: translateY(0);
  color: var(--text-2);
}

/* ============================================
   EXPERIENCE / TIMELINE
   ============================================ */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tl-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 22px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}
.tl-item:hover {
  background: var(--surface);
  border-color: var(--border);
}

.tl-period {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  padding-top: 4px;
  white-space: nowrap;
}

.tl-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tl-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.tl-company { font-size: 14px; color: var(--text-2); }

.tl-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 14px;
}

.tl-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.ttag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-2);
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}

/* ============================================
   PORTFOLIO — work cards
   ============================================ */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.work-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  margin-top: 22px; /* room for the media poking out above */
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  min-width: 0; /* Prevents Safari auto-expanding grid items bug */
}
.work-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

/* Hover reveal overlays: on the card surface, BEHIND the image (image stays clean) */
.work-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius);
  background: radial-gradient(ellipse 95% 130% at -8% -12%, rgba(255, 46, 107, 0.5) 0%, rgba(255, 0, 79, 0.28) 30%, rgba(255, 0, 79, 0.08) 55%, transparent 75%);
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.work-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.1) 1.5px, transparent 1.5px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1.5px, transparent 1.5px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 110% 150% at -8% -12%, black 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 110% 150% at -8% -12%, black 20%, transparent 75%);
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.work-card:hover::before,
.work-card:hover::after { opacity: 1; }

/* Image and content above the overlays; body is transparent so the
   grid/glow show through around the text, like the reference */
.work-media, .work-body { position: relative; z-index: 2; }

.work-media {
  position: relative;
  width: calc(100% - 24px); /* Explicit width to prevent Safari aspect-ratio rendering bugs */
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
  margin: 12px 12px 0;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.work-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.work-card:hover .work-media img { transform: scale(1.04); }

.work-badge {
  position: absolute;
  top: 14px; right: 14px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 5px;
  color: #fff;
  background: rgba(8, 8, 8, 0.7);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.work-badge--live   { color: var(--live);   border-color: rgba(74, 222, 128, 0.5); }
.work-badge--paused { color: var(--paused); border-color: rgba(245, 158, 11, 0.5); }
.work-badge--completed { color: var(--live); border-color: rgba(74, 222, 128, 0.5); }

.work-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.work-title {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.work-desc {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 12px;
  flex: 1;
}

/* Tech logo row (bottom of card) */
.tech-icons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}

.tech-icons img {
  width: 24px;
  height: 24px;
  display: block;
  transition: transform 0.2s;
}
.tech-icons img:hover { transform: translateY(-3px) scale(1.12); }

.work-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.ppill {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-2);
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}

.work-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── GitHub repo cards (auto-fetched) ── */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.repo-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s;
  min-width: 0; /* Prevents overflow inside grid layouts */
}
.repo-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-h);
}

.repo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.repo-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text);
  transition: color 0.2s;
}
.repo-card:hover .repo-name { color: var(--accent); }

.repo-arrow {
  color: var(--text-3);
  font-size: 14px;
  transition: color 0.2s, transform 0.2s;
}
.repo-card:hover .repo-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.repo-desc, .project-desc {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 14px;
  flex: 1;
}

.repo-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
}

.repo-lang {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
}

/* ============================================
   CONTACTS
   ============================================ */
.contact-wrap { text-align: center; padding: 12px 0 8px; }

.contact-lead {
  font-size: 16px;
  color: var(--text-2);
  margin-bottom: 18px;
}

.contact-email {
  display: inline-block;
  font-size: clamp(1.2rem, 3.4vw, 1.9rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 28px;
  transition: color 0.2s;
}
.contact-email:hover { color: var(--accent); }

.contact-social {
  display: flex;
  justify-content: center;
  gap: 22px;
}

.social-link {
  color: var(--text-2);
  display: flex;
  align-items: center;
  transition: color 0.2s, transform 0.2s;
}
.social-link:hover {
  color: var(--accent);
  transform: translateY(-3px);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  padding: 28px 24px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
}

/* ============================================
   MODALS (video + case study)
   ============================================ */
.vmodal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 24px;
}
.vmodal[hidden] { display: none; }

.vmodal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.vmodal-box {
  position: relative;
  width: min(960px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.vmodal-close {
  position: absolute;
  top: 12px; right: 14px;
  z-index: 2;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 14px;
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.vmodal-close:hover { color: var(--accent); border-color: var(--border-h); }

.vmodal-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 14px;
  padding-right: 48px;
}

.vmodal-frame {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.vmodal-frame iframe { width: 100%; height: 100%; display: block; }

/* Case study modal */
.cs-modal-box {
  position: relative;
  width: min(720px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.cs-modal-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  padding-right: 48px;
}
.cs-modal-title::after {
  content: '';
  display: block;
  width: 42px; height: 4px;
  border-radius: 2px;
  background: var(--accent);
  margin-top: 10px;
}

.cs-section { margin-bottom: 26px; }
.cs-section:last-child { margin-bottom: 4px; }

.cs-heading {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.cs-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cs-list li {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
  padding-left: 18px;
  position: relative;
}
.cs-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 12px;
  top: 3px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .topnav { padding: 14px 20px; }
  .topnav-links { display: none; }

  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-art {
    max-width: 420px;
    margin: 0 auto;
    order: 2;
  }

  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-art {
    max-width: 420px;
    margin: 0 auto;
  }

  .skills-row { gap: 22px 26px; }
  .skill-icon img { width: 44px; height: 44px; }

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

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

  .tl-item { grid-template-columns: 1fr; gap: 6px; padding: 18px 14px; }
  .tl-period { padding-top: 0; }

  .section { padding: 72px 0; }
}

@media (max-width: 640px) {
  .works-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .repo-grid { grid-template-columns: minmax(0, 1fr); }

  .hero { padding-top: 120px; }

  .hero-actions .btn { width: 100%; justify-content: center; }

  .cs-modal-box { padding: 24px 18px; }
}
