/* ==========================================================================
   Oscar Canton — portfolio
   Dirección: documento de especificación técnica. Retícula de papel
   milimetrado, secciones numeradas, metadatos en monoespaciada.
   Los tokens de color y espaciado son los mismos que en
   chollogas.ogamlabs.com para que los tres sitios se sientan del mismo
   sistema. No los re-derives: si cambian allí, cámbialos aquí.
   ========================================================================== */

@font-face {
  font-family: "Plex Mono";
  src: url("/assets/fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Plex Mono";
  src: url("/assets/fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --primary: #0A84FF;
  --secondary: #5E5CE6;
  --accent: #FF9F0A;
  --green: #30D158;
  --green-deep: #34C759;

  --bg: #000000;
  --bg-secondary: #1C1C1E;
  --bg-tertiary: #0A0A0C;
  --label: #FFFFFF;
  --label-secondary: rgba(235, 235, 245, 0.7);
  --label-tertiary: rgba(235, 235, 245, 0.5);
  --separator: rgba(84, 84, 88, 0.65);
  --hairline: rgba(235, 235, 245, 0.14);

  --xs: 4px;
  --sm: 8px;
  --md: 16px;
  --lg: 24px;
  --xl: 32px;
  --xxl: 48px;
  --xxxl: 80px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --page: 1080px;
  --rail: 148px;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gradient-text: linear-gradient(135deg, #0A84FF 0%, #30D158 100%);

  /* Jerarquía de movimiento. Cada nivel tiene un uso, no se mezclan:
     micro = hover y foco · componente = tarjeta o menú ·
     sección = cambio de capítulo · wow = una sola vez, en la entrada. */
  --dur-micro: 180ms;
  --dur-component: 300ms;
  --dur-section: 550ms;
  --dur-wow: 750ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  position: relative;
}

/* Papel milimetrado: la retícula del plano, desvanecida hacia abajo. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(235, 235, 245, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(235, 235, 245, 0.03) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 0%, transparent 75%);
}

body > * { position: relative; z-index: 1; }

a {
  color: var(--label);
  text-decoration: none;
  background-image: linear-gradient(var(--primary), var(--primary));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: background-size var(--dur-micro) var(--ease-out);
  padding-bottom: 1px;
}

a:hover { background-size: 100% 2px; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ------------------------------------------------------------- monoespacia */

.mono,
.eyebrow,
.spec-num,
.spec-label,
.chip,
.status,
.lang-switch,
.hero-meta {
  font-family: var(--mono);
  font-feature-settings: "ss01";
}

/* --------------------------------------------------------------- cabecera */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.site-header-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--md) var(--lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--md);
}

.brand {
  font-size: 1rem;
  font-weight: 640;
  letter-spacing: -0.02em;
  background-image: none;
  padding: 0;
  white-space: nowrap;
}

.brand-mark {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lang-switch {
  display: flex;
  gap: var(--xs);
  font-size: 0.75rem;
}

.lang-switch a {
  color: var(--label-tertiary);
  padding: 3px var(--sm);
  border-radius: var(--radius-sm);
  background-image: none;
}

.lang-switch a:hover { color: var(--label); background-color: var(--bg-secondary); }

.lang-switch [aria-current="true"] {
  color: var(--label);
  background-color: var(--bg-secondary);
  font-weight: 500;
}

/* ----------------------------------------------------------------- layout */

main {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--lg);
  counter-reset: spec;
}

/* Sección con raíl: número + etiqueta a la izquierda, contenido a la derecha.
   La asimetría es deliberada — un documento técnico, no una columna centrada. */
.spec {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: var(--xl);
  padding: var(--xxxl) 0;
  border-top: 1px solid var(--hairline);
}

.spec-rail { position: relative; }

.spec-rail-inner {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spec-num {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: 0.06em;
}

.spec-num::before {
  counter-increment: spec;
  content: counter(spec, decimal-leading-zero);
}

.spec-label {
  font-size: 0.75rem;
  color: var(--label-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.spec-body > *:first-child { margin-top: 0; }
.spec-body > *:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------ tipografía */

h1 {
  font-size: clamp(2.5rem, 1.6rem + 4.2vw, 4.5rem);
  font-weight: 680;
  letter-spacing: -0.038em;
  line-height: 1.02;
  margin: 0 0 var(--lg);
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  font-weight: 640;
  letter-spacing: -0.022em;
  line-height: 1.2;
  margin: 0 0 var(--md);
}

h3 {
  font-size: 1.0625rem;
  font-weight: 640;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0 0 var(--md); color: var(--label-secondary); }
p strong { color: var(--label); font-weight: 600; }
p:last-child { margin-bottom: 0; }

.lead {
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.55;
  max-width: 62ch;
}

/* ------------------------------------------------------------------- hero */

.hero {
  padding: var(--xxxl) 0 var(--xxl);
  border-top: 0;
  display: block;
}

.hero-meta {
  font-size: 0.75rem;
  color: var(--label-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 var(--lg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm);
  align-items: center;
}

.hero-meta .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.16);
}

.hero h1 .accent {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* -------------------------------------------------------------- acciones */

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--md);
  margin-top: var(--lg);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sm);
  padding: 11px var(--lg);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  /* La regla global de `a` pinta un subrayado con background-image: aquí no. */
  background-image: none;
  padding-bottom: 11px;
  transition: transform var(--dur-micro) var(--ease-out),
              border-color var(--dur-micro) var(--ease-out),
              opacity var(--dur-micro) var(--ease-out);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background-color: var(--label);
  color: var(--bg);
  border: 1px solid var(--label);
}

.btn-primary:hover { opacity: 0.88; }

.btn-secondary {
  color: var(--label);
  border: 1px solid var(--separator);
}

.btn-secondary:hover { border-color: var(--label-secondary); }

/* ------------------------------------------------------------ stack chips */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm);
  padding: 0;
  margin: var(--lg) 0 0;
  list-style: none;
}

.chip {
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  color: var(--label-secondary);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* --------------------------------------------------------- experiencia */

/* Proyectos de cliente colgando de una guía vertical */
.xp-projects {
  list-style: none;
  padding: 0 0 0 var(--md);
  margin: var(--lg) 0 0;
  border-left: 1px solid var(--hairline);
  display: grid;
  gap: var(--md);
}

.xp-projects li {
  font-size: 0.9375rem;
  color: var(--label-secondary);
  line-height: 1.5;
}

.xp-client {
  color: var(--label);
  font-weight: 600;
}

.xp-projects .mono {
  font-size: 0.6875rem;
  color: var(--label-tertiary);
  letter-spacing: 0.03em;
}

/* ---------------------------------------------------------- tarjetas obra */

.work-list {
  display: grid;
  gap: var(--md);
  padding: 0;
  margin: 0;
  list-style: none;
}

.work-card {
  background: linear-gradient(180deg, rgba(28, 28, 30, 0.5), rgba(10, 10, 12, 0.5));
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--lg);
  transition: border-color var(--dur-component) var(--ease-out),
              transform var(--dur-component) var(--ease-out);
}

.work-card:hover {
  border-color: rgba(10, 132, 255, 0.5);
  transform: translateY(-2px);
}

.work-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--md);
  flex-wrap: wrap;
  margin-bottom: var(--sm);
}

.status {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px var(--sm);
  border-radius: 4px;
  white-space: nowrap;
}

.status-live { color: var(--green-deep); background: rgba(52, 199, 89, 0.14); }
.status-soon { color: var(--accent); background: rgba(255, 159, 10, 0.14); }

/* Cifras destacadas del proyecto */
.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lg);
  margin: var(--md) 0;
  padding: 0;
  list-style: none;
}

.metrics div { display: flex; flex-direction: column; }

.metrics dt {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label-tertiary);
  order: 2;
}

.metrics dd {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 660;
  letter-spacing: -0.02em;
  order: 1;
  line-height: 1.15;
}

/* Bloque de decisión: problema, alternativas, elección y consecuencia.
   Es lo que separa "qué hace la app" de "qué supe resolver". */
.decision {
  margin: var(--md) 0 0;
  padding-left: var(--md);
  border-left: 2px solid rgba(10, 132, 255, 0.35);
}

.decision dt {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label-tertiary);
  margin-bottom: 3px;
}

.decision dd {
  margin: 0 0 var(--md);
  color: var(--label-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.decision dd:last-of-type { margin-bottom: 0; }

.work-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--md);
  margin-top: var(--md);
  font-size: 0.9375rem;
}

/* --------------------------------------------------------------- listados */

.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--md); }

.plain-list li {
  position: relative;
  padding-left: var(--lg);
  color: var(--label-secondary);
}

.plain-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 1px;
  background: var(--primary);
}

.plain-list strong { color: var(--label); font-weight: 600; }

/* ------------------------------------------------------------------ legal */

.legal { font-size: 0.875rem; }

.legal dl {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr;
  gap: var(--xs) var(--md);
  margin: 0;
}

.legal dt { color: var(--label-tertiary); font-family: var(--mono); font-size: 0.75rem; padding-top: 2px; }
.legal dd { margin: 0; color: var(--label-secondary); }

/* -------------------------------------------------------------------- 404 */

.notfound { text-align: center; padding: var(--xxxl) 0; border-top: 0; display: block; }

.notfound-code {
  font-family: var(--mono);
  font-size: 3rem;
  font-weight: 500;
  margin: 0 0 var(--md);
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* -------------------------------------------------------------------- pie */

.site-footer {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--xl) var(--lg) var(--xxl);
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--md);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--label-tertiary);
}

.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--md); }
.site-footer a { color: var(--label-secondary); background-image: none; }
.site-footer a:hover { color: var(--label); }

/* --------------------------------------------------------------- entrada */

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

main > * { animation: rise var(--dur-wow) var(--ease-out) backwards; }
main > *:nth-child(1) { animation-delay: 0.04s; }
main > *:nth-child(2) { animation-delay: 0.12s; }
main > *:nth-child(3) { animation-delay: 0.18s; }
main > *:nth-child(4) { animation-delay: 0.24s; }
main > *:nth-child(n + 5) { animation-delay: 0.3s; }

/* ---------------------------------------------------------------- móviles */

@media (max-width: 860px) {
  :root { --rail: auto; }

  .spec {
    grid-template-columns: 1fr;
    gap: var(--md);
    padding: var(--xxl) 0;
  }

  .spec-rail-inner {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: var(--sm);
  }

  .spec-num::after { content: " ·"; color: var(--label-tertiary); }

  .hero { padding: var(--xxl) 0; }

  .legal dl { grid-template-columns: 1fr; gap: 0; }
  .legal dt { margin-top: var(--sm); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  main > * { animation: none; }
  .work-card,
  .btn,
  a { transition: none; }
  .btn:active { transform: none; }
}
