/* ---------------------------------------------------------------
   Tokens
   ---------------------------------------------------------------
   Palette keeps the "blockout" concept from the 3D production
   pass — rough blocking before detail — now in a dark navy/blue
   range, with a single blue accent standing in for a selected/
   highlighted piece of geometry.
------------------------------------------------------------------ */
:root {
  --bg: #0A0F1F;
  --bg-panel: #121A30;
  --bg-panel-alt: #1A2440;
  --fg: #E7ECF7;
  --fg-muted: #8B96B8;
  --line: #263055;
  --accent: #2F7DFF;
  --accent-dim: #1E57C7;

  --font-display: "Big Shoulders Display", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --maxw: 1180px;
  --gap: 1.5rem;
}

/* ---------------------------------------------------------------
   Reset & base
------------------------------------------------------------------ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.95;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

ul { list-style: none; margin: 0; padding: 0; }

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

section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 5rem 2rem;
}

.section__head {
  max-width: 46ch;
  margin-bottom: 2.5rem;
}

.section__head h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  margin-bottom: 0.6rem;
}

.section__head p {
  color: var(--fg-muted);
}

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

/* ---------------------------------------------------------------
   Nav
------------------------------------------------------------------ */
.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.nav__mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.nav__email:hover { color: var(--fg); }

.nav__divider {
  width: 1px;
  height: 14px;
  background: var(--line);
}

.nav__social {
  display: flex;
  gap: 1.1rem;
}

.nav__social a:hover { color: var(--fg); }

/* ---------------------------------------------------------------
   Hero
------------------------------------------------------------------ */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
  padding-top: 4.5rem;
  padding-bottom: 4.5rem;
}

.hero__text {
  animation: rise 0.7s ease-out both;
}

.hero__text h1 {
  font-size: clamp(3rem, 7vw, 5.5rem);
}

.hero__role {
  margin-top: 1.25rem;
  max-width: 42ch;
  font-size: 1.15rem;
  color: var(--fg);
}

.hero__meta {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.hero__actions {
  margin-top: 2.25rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-dim); }

.btn--ghost {
  border-color: var(--line);
  color: var(--fg);
}
.btn--ghost:hover { border-color: var(--fg-muted); }

/* --- hero minigame column --- */
.hero__viewport {
  animation: rise 0.7s ease-out 0.1s both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------
   Credits strip
------------------------------------------------------------------ */
.credits__row {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  /* Extra room around the cards so the hover zoom isn't clipped by the
     scroll area; the negative margins cancel it so the layout is unchanged. */
  padding: 1.5rem 1rem 2rem;
  margin: -1.5rem -1rem -1.5rem;
  scrollbar-width: thin;
}

.credit-card {
  flex: 0 0 190px;
}

.credit-card__art {
  aspect-ratio: 2 / 3;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.credit-card__placeholder {
  font-family: var(--font-mono);
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.credit-card h3 {
  margin-top: 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.credit-card .meta {
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-muted);
}

/* ---------------------------------------------------------------
   Portfolio masonry
------------------------------------------------------------------ */
.masonry {
  columns: 3 260px;
  column-gap: var(--gap);
}

.tile {
  margin: 0 0 var(--gap);
  break-inside: avoid;
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
}

.tile--accent {
  border-color: var(--accent-dim);
}

.tile figcaption {
  width: 100%;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tile:hover figcaption,
.tile:focus-within figcaption {
  opacity: 1;
  transform: translateY(0);
}

.tile__title {
  font-weight: 600;
  font-size: 0.95rem;
}

.tile__category {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
}

/* ---------------------------------------------------------------
   Footer
------------------------------------------------------------------ */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
  align-items: flex-start;
}

.footer__mark {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-family: var(--font-display);
}

.footer__mark strong { font-size: 1.1rem; }
.footer__mark span { font-family: var(--font-body); color: var(--fg-muted); font-size: 0.9rem; }

.footer__links {
  display: flex;
  gap: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-muted);
}
.footer__links a:hover { color: var(--fg); }

.footer__copy {
  width: 100%;
  margin-top: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* ---------------------------------------------------------------
   Responsive
------------------------------------------------------------------ */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 3rem;
  }
  .hero__viewport { max-width: 420px; }
  .masonry { columns: 2 200px; }
}

@media (max-width: 560px) {
  section { padding: 3.5rem 1.25rem; }
  .nav { padding: 1.25rem 1.25rem; }
  .masonry { columns: 1; }
  .footer { padding: 2.5rem 1.25rem 3rem; }
}

/* ---------------------------------------------------------------
   Eyebrow label (small tag above a section heading)
------------------------------------------------------------------ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* ---------------------------------------------------------------
   Nav section menu
------------------------------------------------------------------ */
.nav__menu {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
  flex-wrap: wrap;
}
.nav__menu a:hover { color: var(--fg); }

/* ---------------------------------------------------------------
   Project cards (shared by Featured + All Projects)
------------------------------------------------------------------ */
.project-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.project-card__media {
  aspect-ratio: 16 / 10;
  background: var(--bg-panel-alt);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}

.project-card__placeholder {
  font-family: var(--font-mono);
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.project-card__body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-card__body .meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.project-card__body h3 {
  font-size: 1.3rem;
}

.project-card__desc {
  color: var(--fg-muted);
  font-size: 0.92rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.chips li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  border: 1px solid var(--line);
  padding: 0.2rem 0.55rem;
}

.project-card__link {
  margin-top: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  align-self: flex-start;
}
.project-card__link:hover { color: var(--fg); }

/* --- Featured grid: fewer, larger cards --- */
.featured__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

/* --- All projects: filter bar + responsive grid --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--line);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.filter-btn:hover { color: var(--fg); }

.filter-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.project-card.is-hidden { display: none; }

/* ---------------------------------------------------------------
   Experience timeline
------------------------------------------------------------------ */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}

.timeline__row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.5rem;
  padding: 1.75rem 0 1.75rem 1.75rem;
  position: relative;
}

.timeline__row::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 2.1rem;
  width: 9px;
  height: 9px;
  background: var(--accent);
}

.timeline__date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.timeline__content h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.timeline__content .meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-top: 0.2rem;
}

.timeline__desc {
  margin-top: 0.5rem;
  color: var(--fg-muted);
  font-size: 0.92rem;
  max-width: 60ch;
}

/* ---------------------------------------------------------------
   Skills
------------------------------------------------------------------ */
.skills__groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

.skills__group h3 {
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ---------------------------------------------------------------
   Closing CTA
------------------------------------------------------------------ */
.cta {
  text-align: center;
  padding-top: 6rem;
  padding-bottom: 6rem;
}

.cta h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.cta p {
  margin-top: 1rem;
  color: var(--fg-muted);
}

.cta__actions {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.cta__social {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-muted);
}
.cta__social a:hover { color: var(--fg); }

/* ---------------------------------------------------------------
   Responsive additions for the new sections
------------------------------------------------------------------ */
@media (max-width: 900px) {
  .nav__menu { display: none; }
  .featured__grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .timeline__row { grid-template-columns: 1fr; gap: 0.4rem; }
}

@media (max-width: 560px) {
  .project-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------
   Most recent works: clickable cards + detail overlay
------------------------------------------------------------------ */
.credit-card {
  position: relative;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.credit-card__art { transition: border-color 0.15s ease, box-shadow 0.25s ease; }

.credit-card h3 { margin-top: 0.75rem; }
.credit-card h3 .credit-card__open { margin: 0; }

.credit-card__open {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease;
}

/* Stretch the button so the whole card (image + text) is clickable */
.credit-card__open::after {
  content: "";
  position: absolute;
  inset: 0;
}

.credit-card:hover .credit-card__art { border-color: var(--accent); }
.credit-card:hover .credit-card__open { color: var(--accent); }

/* Zoom the whole card on hover (mouse devices only) or keyboard focus */
@media (hover: hover) {
  .credit-card:hover { transform: scale(1.1); z-index: 2; }
  .credit-card:hover .credit-card__art { box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45); }
}
.credit-card:has(.credit-card__open:focus-visible) { transform: scale(1.1); z-index: 2; }

/* "View more →" label that shows the card can be opened */
.credit-card__more {
  display: inline-block;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}
.credit-card__arrow {
  display: inline-block;
  transition: transform 0.25s ease;
}
.credit-card:hover .credit-card__arrow { transform: translateX(5px); }

.credit-card__open:focus-visible { outline: none; }
.credit-card:has(.credit-card__open:focus-visible) .credit-card__art {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

body.modal-open { overflow: hidden; }

.credit-modal {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 1.5rem;
  border: 0;
  background: transparent;
  color: var(--fg);
  overflow-y: auto;
}

.credit-modal[open] {
  display: flex;
}

.credit-modal::backdrop {
  background: rgba(5, 8, 18, 0.8);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.credit-modal.is-open::backdrop { opacity: 1; }

.credit-modal__panel {
  position: relative;
  margin: auto;
  width: min(1100px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.credit-modal.is-open .credit-modal__panel {
  opacity: 1;
  transform: none;
}

.credit-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--fg);
  background: rgba(10, 15, 31, 0.75);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.credit-modal__close:hover { border-color: var(--accent); color: var(--accent); }

.credit-modal__media {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
}

.credit-modal__body {
  padding: 2.5rem 3rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.credit-modal__body .meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.credit-modal__body h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

/* Long text: readable line length, headings, lists and inline images */
.credit-modal__text {
  max-width: 70ch;
  color: var(--fg-muted);
  font-size: 1.02rem;
  line-height: 1.75;
}
.credit-modal__text > * + * { margin-top: 1rem; }
.credit-modal__text h3,
.credit-modal__text h4 {
  font-family: var(--font-display);
  color: var(--fg);
  line-height: 1.1;
  margin-top: 2rem;
}
.credit-modal__text h3 { font-size: 1.6rem; }
.credit-modal__text h4 { font-size: 1.25rem; }
.credit-modal__text strong { color: var(--fg); font-weight: 600; }
.credit-modal__text ul,
.credit-modal__text ol { padding-left: 1.25rem; }
.credit-modal__text ul { list-style: disc; }
.credit-modal__text li + li { margin-top: 0.3rem; }
.credit-modal__text a { color: var(--accent); text-decoration: underline; }
.credit-modal__text img {
  width: 100%;
  border: 1px solid var(--line);
}
/* Images written inside the description can break out to full width */
.credit-modal__text p:has(> img) { max-width: none; }

/* Image gallery: 2 columns, any number of images; add `wide: true` for full-width */
.credit-modal__gallery {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.credit-modal__gallery figure { margin: 0; }
.credit-modal__gallery figure.is-wide { grid-column: 1 / -1; }
.credit-modal__gallery img {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-panel-alt);
}
.credit-modal__gallery figcaption {
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.credit-modal .btn { align-self: flex-start; margin-top: 0.5rem; }

@media (max-width: 900px) {
  .credit-modal__body { padding: 1.75rem 1.5rem 2rem; }
}

@media (max-width: 560px) {
  .credit-modal { padding: 0.5rem; }
  .credit-modal__body { padding: 1.25rem 1rem 1.5rem; }
  .credit-modal__gallery { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------
   Language switch (EN / ES)
------------------------------------------------------------------ */
.lang-switch {
  display: flex;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.lang-switch a {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--fg-muted);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.lang-switch a:hover { color: var(--fg); border-color: var(--fg-muted); }

.lang-switch a[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
