/* ── tokens: única fuente de color/tipografía para todas las páginas ── */
:root {
  --bg:         #0e0e0e;
  --bg-2:       #222222;
  --bg-3:       #141414;
  --bg-4:       #1a1a1a;
  --border:     #2a2a2a;
  --border-2:   #3a3a3a;
  --border-3:   #4a4a4a;
  --text:       #f0f0f0;
  --sand:       #b4b4b4;
  --muted:      #888888;
  --military:   #4d7a2a;
  --mil-bright: #6db33f;
  --mil-dim:    #1a2612;
  --mil-hover:  #24331a;
  --olive:      #8fba4e;

  --font-body:    "Inter", sans-serif;
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --ease:         cubic-bezier(0.22, 0.8, 0.22, 1);
  --ease-bounce:  cubic-bezier(0.34, 1.56, 0.64, 1);

  /* línea de acento verde (horizontal / vertical) */
  --accent-h: linear-gradient(90deg, transparent, var(--military), var(--mil-bright), var(--military), transparent);
  --accent-v: linear-gradient(180deg, transparent, var(--military), var(--mil-bright), var(--military), transparent);
}

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

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* ── layout ── */
.wrap {
  width: min(660px, 94vw);
  margin: 0 auto;
  padding: 90px 0 70px;
}

/* ── card ── */
.card {
  position: relative;
  background:
    var(--accent-v) left center / 2px 60% no-repeat,
    var(--accent-v) right center / 2px 60% no-repeat,
    var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 124px 36px 44px;
  text-align: center;
  animation: card-in 560ms var(--ease) both, sides-in 800ms var(--ease) 400ms both;
}

/* franjas de acento arriba y abajo */
.card::before,
.card::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent-h);
  animation: accent-in 800ms var(--ease) 400ms both;
}
.card::before { top: 0; }
.card::after  { bottom: 0; }

/* ── avatar ── */
.avatar {
  position: absolute;
  top: -66px;
  left: 50%;
  transform: translateX(-50%);
  width: 132px;
  height: 132px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--bg-2);
  outline: 2px solid var(--military);
  background: var(--bg-3);
}

/* ── eyebrow ── */
.eyebrow {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
  /* la izquierda lleva 3px extra: compensa el tracking sobrante tras la última letra */
  padding: 6px 13px 6px 16px;
  /* capa de "borde": se ve solo en el hairline que deja ::before */
  background: var(--military);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.eyebrow::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: var(--bg-3);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}

.eyebrow span {
  position: relative;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sand);
}

/* ── name ── */
h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 11px;
}

/* ── intro ── */
.intro {
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.7;
  /* reserva las 2 líneas finales para que el tecleado no empuje la tarjeta */
  min-height: 3.4em;
}

.intro.typing::after {
  content: "|";
  color: var(--mil-bright);
  margin-left: 1px;
  animation: blink 0.7s step-end infinite;
}

/* ── selector de idioma ── */
/* mini teclado: placa > bandeja > teclas. Bajo cada tecla hay un degradado
   cónico verde que asoma como borde; la profundidad se hace con bordes. */
.lang-switch {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 0px));
  right: 16px;
  z-index: 40;
  padding: 6px;
  background: var(--border-2);
  border: 1px solid var(--border-3);
  border-bottom-width: 4px;
  border-radius: 12px;
}

.lang-switch-inner {
  display: flex;
  gap: 4px;
  padding: 3px 4px 4px;
  overflow: hidden;
  background: var(--border);
  border-top: 2px solid var(--bg-4);
  border-radius: 6px;
}

.lang-switch .key {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  appearance: none;
  border: 0;
  padding: 2px 2px 4px;
  width: 44px;
  height: 40px;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
}

.lang-switch .key::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%);
  background: conic-gradient(from 180deg, var(--mil-bright), var(--olive), var(--military), var(--mil-dim), var(--military), var(--olive), var(--mil-bright));
  opacity: 0.55;
  transition: opacity 160ms ease;
}

.lang-switch .key-content {
  position: relative;
  top: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--bg);
  border-radius: 5px;
  border-bottom: 3px solid rgba(0, 0, 0, 0.6);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--text);
  user-select: none;
  transition: top 100ms ease-in-out, border-bottom-width 100ms ease-in-out, color 160ms ease;
}

.lang-switch .key:active .key-content {
  top: 0;
  border-bottom-width: 1px;
}

.lang-switch .key:hover::before { opacity: 0.8; }
.lang-switch .key.is-active::before { opacity: 1; }
.lang-switch .key.is-active .key-content { color: var(--mil-bright); }

.lang-switch .key:focus-visible {
  outline: 1px solid var(--mil-bright);
  outline-offset: 2px;
}

/* ── stack ── */
.stack {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 11px;
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--sand);
  animation: fade-slide 600ms var(--ease) 900ms both;
}

.stack li {
  display: flex;
  align-items: center;
  gap: 11px;
}

/* separador en rombo: mismo gesto diagonal que los cortes de .eyebrow */
.stack li:not(:last-child)::after {
  content: "";
  width: 3px;
  height: 3px;
  background: var(--military);
  transform: rotate(45deg);
}

/* ── logo ── */
.brand-logo-wrap {
  display: flex;
  justify-content: center;
  width: 108px;
  margin: 18px auto 0;
  padding: 10px;
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  animation: logo-wrap-in 1100ms var(--ease) 300ms both;
}

.brand-logo {
  display: block;
  width: 86px;
  height: 86px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 16px;
  flex-shrink: 0;
  animation: logo-img-in 600ms var(--ease-bounce) 1000ms both;
}

/* ── links ── */
.links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.links::before {
  content: "";
  height: 1px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, transparent, var(--sand), transparent);
}

.links a {
  position: relative;
  display: flex;
  align-items: center;
  height: 80px;
  padding: 0 22px 0 24px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 180ms ease, background 180ms ease, transform 260ms var(--ease-bounce);
  animation: link-in 380ms var(--ease) backwards;
}

.links a:nth-child(1) { animation-delay: 380ms; }
.links a:nth-child(2) { animation-delay: 500ms; }
.links a:nth-child(3) { animation-delay: 620ms; }
.links a:nth-child(4) { animation-delay: 740ms; }
.links a:nth-child(5) { animation-delay: 860ms; }
.links a:nth-child(6) { animation-delay: 980ms; }

/* barra de acento izquierda */
.links a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  border-radius: 2px;
  background: var(--military);
  transition: top 180ms ease, bottom 180ms ease, background 180ms ease;
}

/* flecha */
.links a::after {
  content: "→";
  font-size: 1.3rem;
  color: var(--border-2);
  flex-shrink: 0;
  transition: color 180ms ease, transform 260ms var(--ease-bounce);
}

.link-icon {
  width: 36px;
  height: 36px;
  margin-right: 14px;
  flex-shrink: 0;
}

.link-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  text-align: left;
}

.link-title {
  font-size: 1rem;
  font-weight: 600;
  transition: color 180ms ease;
}

.link-desc {
  font-size: 0.78rem;
  color: var(--muted);
  transition: color 180ms ease;
}

.links a:hover {
  background: var(--mil-dim);
  border-color: var(--military);
  transform: translateX(8px) scale(1.015);
}
.links a:hover .link-title { color: var(--sand); }
.links a:hover .link-desc  { color: var(--olive); }
.links a:hover::before { top: 0; bottom: 0; background: var(--mil-bright); }
.links a:hover::after  { color: var(--mil-bright); transform: translateX(8px); }

.links a.link-featured {
  background: #566b2f;
  border-color: #566b2f;
}
.links a.link-featured .link-title { color: var(--bg); }
.links a.link-featured .link-desc  { color: var(--bg); opacity: 0.75; }
.links a.link-featured .link-icon  { filter: brightness(0); opacity: 0.85; }
.links a.link-featured::before,
.links a.link-featured:hover::before { background: var(--bg); }
.links a.link-featured::after,
.links a.link-featured:hover::after  { color: var(--bg); }

.links a.link-featured:hover {
  background: #3f4f22;
  border-color: #3f4f22;
}
.links a.link-featured:hover .link-title,
.links a.link-featured:hover .link-desc { color: var(--bg); }

/* ── footer ── */
.footer {
  padding: 14px 14px 32px;
  text-align: center;
  color: var(--border-2);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

/* ── proyectos ── */
.projects-wrap {
  width: min(1120px, 95vw);
  padding-top: 52px;
}

.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  transition: color 180ms ease, transform 260ms var(--ease-bounce);
}

.back-link:hover {
  color: var(--mil-bright);
  transform: translateX(-4px);
}

.projects-card {
  margin-top: 12px;
  padding: 40px 34px 32px;
  text-align: left;
}

.projects-carousel {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  gap: 10px;
  align-items: center;
}

.carousel-viewport {
  min-width: 0;
  overflow: hidden;
}

.project-item {
  display: none;
  min-height: 440px;
  padding: 12px 16px 20px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.project-item.is-active { display: block; }

.project-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.project-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--olive);
  color: var(--bg);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.project-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  color: var(--olive);
}

.project-tech {
  margin-left: auto;
  align-self: flex-start;
  color: var(--mil-bright);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.project-split {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 1px minmax(0, 1.08fr);
  gap: 22px;
  min-height: 315px;
}

/* divisoria vertical entre mockup y texto */
.project-split::before {
  content: "";
  grid-area: 1 / 2;
  background: var(--accent-v);
}

.project-media-column,
.project-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.project-media-column {
  grid-column: 1;
  align-items: center;
}

.project-text { grid-column: 3; }

.project-text p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.project-text p + p { margin-top: 12px; }

/* mockup de ordenador: pantalla + peana (pseudo-elementos) */
.pc-mockup {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(100%, 560px);
  height: 100%;
}

.pc-mockup::before,
.pc-mockup::after {
  content: "";
  margin: 0 auto;
}

.pc-mockup::before {
  order: 1;
  width: 20%;
  min-width: 60px;
  height: 14px;
  background: var(--border-2);
  border-radius: 0 0 8px 8px;
}

.pc-mockup::after {
  order: 2;
  width: 42%;
  min-width: 120px;
  height: 8px;
  background: var(--border-3);
  border-radius: 999px;
}

.pc-frame {
  padding: 10px;
  background: var(--bg-4);
  border: 1px solid var(--border-2);
  border-radius: 14px;
}

.pc-screen {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9.2;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
}

.project-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--bg-3);
  color: var(--olive);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.project-action-light {
  background: var(--mil-dim);
  border-color: var(--military);
}

.project-action:hover {
  transform: translateY(-1px);
  background: var(--bg-4);
  color: var(--text);
}

.project-action-light:hover { background: var(--mil-hover); }

.project-action.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.project-action-icon {
  width: 20px;
  height: 20px;
}

.carousel-arrow {
  width: 56px;
  height: 56px;
  border: 1px solid var(--border-2);
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, color 150ms ease, background 150ms ease;
}

.carousel-arrow:hover {
  transform: scale(1.02);
  border-color: var(--military);
  color: var(--mil-bright);
  background: var(--bg-4);
}

.carousel-counter {
  margin-top: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

/* ── lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* display:flex anula el atributo hidden */
.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(2px);
}

.lightbox-dialog {
  position: relative;
  width: min(100%, 760px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 16px;
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-2);
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  border-color: var(--military);
  color: var(--mil-bright);
}

.lightbox-title {
  margin: 0 36px 14px 0;
  color: var(--olive);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.lightbox-stage img {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  border: 1px solid var(--border-2);
  border-radius: 10px;
}

.lightbox-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 10px;
  text-align: center;
  color: var(--muted);
}

.lightbox-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}

.lightbox-arrow {
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
}

.lightbox-counter {
  min-width: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

/* ── animaciones ── */
@keyframes fade-slide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes link-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

@keyframes accent-in {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes sides-in {
  from { background-size: 2px 0%, 2px 0%, auto; }
  to   { background-size: 2px 60%, 2px 60%, auto; }
}

@keyframes logo-wrap-in {
  from { width: 100%; border-radius: 6px; }
  to   { width: 108px; border-radius: 14px; }
}

@keyframes logo-img-in {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── responsive ── */
@media (max-width: 520px) {
  .wrap { padding-top: 76px; }
  .card { padding: 96px 20px 28px; }
  /* más estrecho: el mismo texto ocupa 3 líneas */
  .intro { min-height: 5.1em; }
  .links a { padding: 0 16px 0 18px; }

  /* el teclado deja de ser fijo: va en el flujo, centrado sobre la tarjeta */
  .lang-switch {
    position: static;
    width: fit-content;
    margin: max(12px, env(safe-area-inset-top, 0px)) auto 0;
    padding: 5px;
  }
  .lang-switch .key { width: 40px; height: 34px; }
  .lang-switch .key-content { font-size: 0.7rem; }

  /* proyectos no tiene avatar que sobresalga: menos hueco bajo el teclado */
  .projects-wrap { width: min(660px, 94vw); padding-top: 26px; }
  .projects-card { padding: 34px 16px 22px; }
  .projects-carousel { grid-template-columns: 1fr; }
  .carousel-arrow { justify-self: center; }
  .project-head { flex-direction: column; align-items: flex-start; }
  .project-tech { margin: 2px 0 0; white-space: normal; }
  .pc-frame { padding: 6px; }
}

/* por debajo de ~860px la columna de texto quedaría estrujada: se apila */
@media (max-width: 860px) {
  .project-split { grid-template-columns: 1fr; gap: 10px; }
  .project-split::before { display: none; }
  .project-media-column,
  .project-text { grid-column: auto; }
}
