/* ============ Design tokens ============ */
:root {
  --bg: #0c1f16;
  --bg-check: #0e2419;
  --panel: #11291d;
  --panel-border: #1f4630;
  --text: #d8e8d4;
  --text-dim: #8fae93;
  --accent: #6fdc7f;
  --accent-dark: #2e7d44;
  --gold: #e8b93c;
  --red: #c8412e;
  --tile: 48px;
  --font-pixel: "Press Start 2P", monospace;
  --font-body: "IBM Plex Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  background-image: repeating-conic-gradient(
    var(--bg-check) 0% 25%,
    var(--bg) 0% 50%
  );
  background-size: 32px 32px;
  line-height: 1.6;
}

.pixel {
  image-rendering: pixelated;
}

.flip-x {
  transform: scaleX(-1);
}

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: rgba(10, 26, 18, 0.95);
  border-bottom: 3px solid var(--panel-border);
}

.logo {
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 1px;
}

.logo-mark {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 24px;
}

.site-nav a {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 24px;
  font-family: var(--font-pixel);
  font-size: 9px;
}

.lang-opt {
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}

.lang-opt:hover,
.lang-opt:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.lang-opt.is-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  cursor: default;
}

.lang-sep {
  color: var(--text-dim);
}

/* Nav panel: inline cluster on desktop, full-screen modal on mobile (see media query). */
.nav-panel {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
}

.nav-toggle,
.nav-close {
  display: none;
}

body.no-scroll {
  overflow: hidden;
}

/* ============ Layout ============ */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 72px 0 24px;
}

.section-title {
  font-family: var(--font-pixel);
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-bullet {
  width: 14px;
  height: 14px;
  background: var(--gold);
  box-shadow: 4px 4px 0 var(--accent-dark);
  display: inline-block;
}

.panel {
  background: var(--panel);
  border: 3px solid var(--panel-border);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.35);
}

/* ============ Hero ============ */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 48px;
  /* align-items: center; */
  padding: 72px 0 0;
  min-height: calc(100vh - 140px);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero h1 {
  font-family: var(--font-pixel);
  line-height: 1.55;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero h1 span {
  display: block;
}
.hero h1 .line-1 {
  font-size: 14px;
  color: var(--text);
}
.hero h1 .line-2 {
  font-size: 36px;
  color: var(--accent);
  text-shadow: 4px 4px 0 var(--accent-dark);
  margin: 10px 0;
}
.hero h1 .line-3 {
  font-size: 18px;
  letter-spacing: 0.5px;
  color: var(--gold);
}

.hero-sub {
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 28px;
  max-width: 48ch;
  padding: 22px 26px;
}

.hero-sub strong {
  color: var(--accent);
  font-weight: 600;
}

.hero-hint {
  font-size: 14px;
  color: var(--text-dim);
  border-left: 4px solid var(--gold);
  padding-left: 14px;
  margin: 0;
  max-width: 44ch;
}

.hero-hint strong {
  color: var(--text);
}

.hero-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.icon-inline {
  width: 20px;
  height: 20px;
  vertical-align: -4px;
  margin-right: 6px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.hero-sub-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-pixel);
  font-size: 10px;
  text-decoration: none;
  padding: 14px 20px;
  border: 3px solid;
  cursor: pointer;
  display: inline-block;
  transition: transform 0.08s steps(2);
}

.btn-primary {
  background: var(--accent);
  color: #08160e;
  border-color: var(--accent-dark);
  box-shadow: 4px 4px 0 var(--accent-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--panel-border);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.4);
}

.btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--accent-dark);
}
.btn-ghost:hover {
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}

/* ============ Game ============ */
.hero-game {
  position: relative;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-frame {
  background-image: url("/assets/frame_gold.png");
  background-size: var(--tile) var(--tile);
  image-rendering: pixelated;
  padding: calc(var(--tile) / 2);
  outline: 3px solid #6b4a12;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.45);
  width: calc(var(--tile) * 9);
}

.board {
  position: relative;
  display: grid;
  outline: none;
}

.board:focus-visible {
  box-shadow: 0 0 0 3px var(--accent);
}

.cell {
  width: var(--tile);
  height: var(--tile);
  background-size: var(--tile) var(--tile);
  image-rendering: pixelated;
}

.cell-floor {
  background-image: url("/assets/floor.png");
}
.cell-target {
  background-image: url("/assets/target.png");
}
.cell-wall {
  background-image: url("/assets/wall.png");
}
.cell-void {
  background-image: url("/assets/frame_gold.png");
}

.entity {
  position: absolute;
  width: var(--tile);
  height: var(--tile);
  transition: transform 0.13s steps(4);
  pointer-events: none;
}

.entity img {
  image-rendering: pixelated;
  position: absolute;
  inset: 0;
  margin: auto;
}

.entity-crate img {
  width: var(--tile);
  height: var(--tile);
}

.entity-crate.on-target img {
  filter: brightness(1.25) drop-shadow(0 0 6px rgba(232, 185, 60, 0.8));
}

.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 14px;
  background: #08160e;
  border: 3px solid var(--panel-border);
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--gold);
}

.hud-btn {
  font-family: var(--font-pixel);
  font-size: 9px;
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--panel-border);
  padding: 6px 10px;
  cursor: pointer;
}

.hud-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* d-pad (touch) */
.dpad {
  display: none;
  grid-template-areas: ". up ." "left down right";
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.dpad-up {
  grid-area: up;
}
.dpad-down {
  grid-area: down;
}
.dpad-left {
  grid-area: left;
}
.dpad-right {
  grid-area: right;
}

.dpad-btn {
  width: 56px;
  height: 56px;
  font-size: 18px;
  background: var(--panel);
  color: var(--accent);
  border: 3px solid var(--panel-border);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
  cursor: pointer;
  touch-action: manipulation;
}

.dpad-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

@media (hover: none) and (pointer: coarse) {
  .dpad {
    display: grid;
  }
}

/* win overlay */
.win-overlay[hidden] {
  display: none;
}

.win-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 22, 14, 0.85);
  z-index: 10;
}

.win-card {
  text-align: center;
  padding: 32px 28px;
  background: var(--panel);
  border: 3px solid var(--gold);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
  max-width: 90%;
}

.win-title {
  font-family: var(--font-pixel);
  font-size: 16px;
  color: var(--gold);
  margin-bottom: 12px;
  animation: blink 1s steps(2) infinite;
}

.win-steps {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--accent);
  margin-bottom: 14px;
}

.win-text {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.win-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

@keyframes blink {
  50% {
    opacity: 0.4;
  }
}

/* ============ Sobre mí ============ */
.about-grid {
  display: grid;
  /* grid-template-columns: 1.2fr 1fr;
  gap: 24px; */
  align-items: start;
}

.about-text {
  padding: 28px;
  position: relative;
}

.about-text p + p {
  margin-top: 14px;
}

.about-text em {
  color: var(--gold);
  font-style: normal;
}

.about-avatar {
  width: 48px;
  height: auto;
  float: right;
  margin: 0 0 12px 16px;
}

.about-cards {
  display: grid;
  gap: 16px;
}

.feature-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  padding: 18px 20px;
  align-items: center;
}

.feature-icon {
  width: 48px;
  height: 48px;
  grid-row: 1 / span 2;
  align-self: center;
}

.feature-card h3,
.feature-card p {
  grid-column: 2;
}

.feature-card h3 {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-dim);
}

/* ============ Experiencia ============ */
.experience-item {
  padding: 28px;
}

.experience-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.experience-head h3 {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--accent);
}

.experience-role {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--gold);
}

.experience-period {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
}

.experience-item p {
  color: var(--text-dim);
}

/* ============ Proyectos ============ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.project-card {
  padding: 0 0 20px;
  overflow: hidden;
}

.project-banner {
  position: relative;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  border-bottom: 3px solid var(--panel-border);
}

.project-banner img {
  width: 48px;
  height: 48px;
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.3));
}

.banner-1 {
  background: linear-gradient(135deg, #14283e, #0e1c2c);
}
.banner-2 {
  background: linear-gradient(135deg, #1d3a1d, #122512);
}
.banner-3 {
  background: linear-gradient(135deg, #3a2a14, #241a0c);
}
.banner-4 {
  background: linear-gradient(135deg, #2c1d3a, #1c1226);
}
.banner-5 {
  background: linear-gradient(135deg, #1d2f3a, #122026);
}

.project-origin {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  padding: 3px 8px;
  background: #08160e;
  border: 2px solid var(--panel-border);
  color: var(--accent);
}

.project-card h3 {
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--text);
  padding: 0 20px;
  margin-bottom: 10px;
}

.project-card p {
  font-size: 13px;
  color: var(--text-dim);
  padding: 0 20px;
  margin-bottom: 14px;
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px;
}

.chips li {
  font-size: 11px;
  padding: 3px 10px;
  background: #08160e;
  border: 2px solid var(--panel-border);
  color: var(--accent);
}

/* ============ Stack ============ */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.stack-group {
  padding: 20px 22px;
}

.stack-group h3 {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stack-tag {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--text-dim);
}

.stack-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack-chips li {
  font-size: 11px;
  padding: 3px 10px;
  background: #08160e;
  border: 2px solid var(--panel-border);
  color: var(--accent);
}

/* ============ Contacto ============ */
.contact {
  padding-bottom: 96px;
}

.contact-panel {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 32px;
  flex-wrap: wrap;
}

.contact-sprite {
  width: 56px;
  height: auto;
}

.contact-copy {
  flex: 1;
  min-width: 220px;
}

.contact-copy h2 {
  font-family: var(--font-pixel);
  font-size: 16px;
  color: var(--text);
  margin-bottom: 8px;
}

.contact-copy p {
  color: var(--text-dim);
  font-size: 14px;
}

.contact-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ============ Footer ============ */
.site-footer {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  padding: 18px 24px;
  background: #08160e;
  border-top: 3px solid var(--panel-border);
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--gold);
}

/* ============ Responsive ============ */
@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
    min-height: 0;
    padding-top: 48px;
  }
  .hero-copy {
    text-align: center;
  }
  .hero-sub {
    width: 100%;
    max-width: 48ch;
    margin-left: auto;
    margin-right: auto;
  }
  .hero-hint {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
  }
  .hero-actions {
    width: 100%;
    justify-content: center;
  }
  .hero-sub-actions {
    display: none;
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  :root {
    --tile: 40px;
  }
}

@media (max-width: 560px) {
  main {
    padding: 0 16px;
  }
  .hero h1 .line-1 {
    font-size: 13px;
  }
  .hero h1 .line-2 {
    font-size: 24px;
  }
  .hero h1 .line-3 {
    font-size: 12px;
  }
  .section-title {
    font-size: 16px;
  }
  :root {
    --tile: 34px;
  }
}

@media (max-width: 360px) {
  :root {
    --tile: 30px;
  }
}

/* ============ Mobile nav modal (game-style pause menu) ============ */
@media (max-width: 768px) {
  .site-header {
    padding: 14px 20px;
  }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    margin-left: auto;
    background: var(--panel);
    border: 3px solid var(--panel-border);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.4);
    cursor: pointer;
  }

  .nav-toggle-bar {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--accent);
  }

  .nav-toggle:hover {
    border-color: var(--accent);
  }

  .nav-panel {
    position: fixed;
    inset: 0;
    z-index: 100;
    margin-left: 0;
    flex-direction: column;
    justify-content: center;
    gap: 40px;
    background: rgba(8, 22, 14, 0.94);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.15s steps(3),
      visibility 0.15s;
  }

  .site-header.menu-open .nav-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-close {
    display: block;
    position: absolute;
    top: 20px;
    right: 22px;
    font-family: var(--font-pixel);
    font-size: 14px;
    line-height: 1;
    color: var(--gold);
    background: var(--panel);
    border: 3px solid var(--panel-border);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.4);
    padding: 10px 13px;
    cursor: pointer;
  }

  .nav-close:hover {
    border-color: var(--gold);
    color: var(--text);
  }

  .site-nav {
    flex-direction: column;
    align-items: center;
    gap: 30px;
  }

  .site-nav a {
    font-size: 15px;
    padding: 4px 8px;
  }

  .lang-switch {
    margin-left: 0;
    font-size: 12px;
  }
}
