/* ============================================================
   Portafolio — Jose Gerardo Martinez Moran
   Tema "ficha tecnica": rejilla de reglas finas, mono para
   metadatos, un solo acento. Claro y oscuro con los mismos tokens.
   ============================================================ */

:root {
  --bg: #F4F3EE;
  --panel: #FAF9F5;
  --chip: #EAE8E0;
  --ink: #17181A;
  --soft: #464641;
  --muted: #64635C;
  --faint: #8A897F;
  --rule: #CFCDC3;
  --rule2: #E2E0D8;
  --accent: #9E3A17;
  --on-accent: #F7F6F2;
  --inv-bg: #17181A;
  --inv-ink: #E7E5DE;
  --inv-soft: #A5A399;
  --inv-rule: #35363A;

  --pad: 4.5rem;
  --container: 90rem; /* 1440px: el ancho con el que se diseño la retícula */
  --measure: 42rem;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #15171A;
  --panel: #1B1E22;
  --chip: #23262B;
  --ink: #EDEBE4;
  --soft: #C2C0B8;
  --muted: #97968D;
  --faint: #7A7970;
  --rule: #313539;
  --rule2: #26292E;
  --accent: #F0904F;
  --on-accent: #15171A;
  --inv-bg: #0E1013;
  --inv-ink: #E7E5DE;
  --inv-soft: #97968D;
  --inv-rule: #2A2D32;
}

/* Sin JS: se respeta la preferencia del sistema. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171A;
    --panel: #1B1E22;
    --chip: #23262B;
    --ink: #EDEBE4;
    --soft: #C2C0B8;
    --muted: #97968D;
    --faint: #7A7970;
    --rule: #313539;
    --rule2: #26292E;
    --accent: #F0904F;
    --on-accent: #15171A;
    --inv-bg: #0E1013;
    --inv-ink: #E7E5DE;
    --inv-soft: #97968D;
    --inv-rule: #2A2D32;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; text-wrap: pretty; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; height: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 0.75rem 1rem;
  font-family: var(--font-mono); font-size: 0.75rem;
}
.skip-link:focus { left: 0; }

/* ---------- Barra superior ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
}
/* Todo el sitio comparte el mismo ancho maximo y la misma reticula. */
.topbar__inner, .hero__inner, .section__inner, .case__inner, .footer__inner {
  max-width: var(--container); margin-inline: auto;
}

.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; padding: 0 var(--pad); min-height: 62px;
}
.topbar__brand {
  font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 600; color: var(--ink);
}
.topbar__brand:hover { text-decoration: none; color: var(--accent); }
.topbar__nav { display: flex; flex-wrap: wrap; gap: 1.5rem; font-size: 0.75rem; letter-spacing: 0.06em; }
.topbar__nav a { color: var(--soft); }
.topbar__nav a:hover { color: var(--ink); }
.topbar__tools { display: flex; align-items: center; gap: 0.75rem; font-size: 0.75rem; }
.topbar__lang { color: var(--muted); letter-spacing: 0.1em; padding: 0.4rem 0.35rem; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: none; border: 1px solid var(--rule); color: var(--ink);
  font-family: var(--font-mono); font-size: 0.75rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.4rem 0.7rem; cursor: pointer; min-height: 32px;
}
.theme-toggle:hover { border-color: var(--ink); }

/* El envoltorio no existe en escritorio: sus hijos siguen siendo hijos
   directos del flex de .topbar__inner. En movil se vuelve el panel plegable. */
.topbar__menu { display: contents; }

/* La barra es sticky: sin este margen el salto por ancla deja el titulo
   de la seccion escondido debajo de ella. */
.section[id], .footer[id] { scroll-margin-top: 4.5rem; }

.topbar__burger {
  display: none; align-items: center; gap: 0.5rem;
  background: none; border: 1px solid var(--rule); color: var(--ink);
  font-family: var(--font-mono); font-size: 0.75rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.4rem 0.7rem; min-height: 34px; cursor: pointer;
}
.topbar__burger:hover { border-color: var(--ink); }
/* Tres barras dibujadas con la propia caja y sus bordes: sin SVG ni iconos. */
.topbar__bars {
  width: 14px; height: 9px;
  border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  position: relative;
}
.topbar__bars::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  border-top: 1.5px solid currentColor;
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem; padding: 0.8rem 1.35rem; min-height: 44px;
  font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  font-family: var(--font-mono); text-align: center;
}
.btn:hover { text-decoration: none; }
.btn--solid { background: var(--ink); color: var(--bg); }
.btn--solid:hover { background: var(--accent); color: var(--on-accent); }
.btn--outline { border: 1px solid var(--ink); color: var(--ink); }
.btn--outline:hover { background: var(--ink); color: var(--bg); }
.btn--accent { background: var(--accent); color: var(--on-accent); }
.btn--accent:hover { filter: brightness(1.08); }
.topbar__tools .btn { padding: 0.4rem 0.75rem; min-height: 32px; }

.link { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- Hero ---------- */

.hero { border-bottom: 1px solid var(--rule); }
.hero__inner {
  display: grid; grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 4rem; align-items: start;
  padding: 4.75rem var(--pad) 4rem;
}
.hero__eyebrow {
  font-size: 0.8125rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1.5rem;
}
.hero__title {
  font-size: clamp(2.25rem, 4.4vw, 3.75rem); line-height: 1.05;
  letter-spacing: -0.03em; max-width: 54rem; margin-bottom: 1.4rem;
}
.hero__lede {
  font-size: 1.1875rem; line-height: 1.6; color: var(--soft);
  max-width: var(--measure); margin-bottom: 1.9rem;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; }
.hero__link { font-size: 0.8125rem; letter-spacing: 0.06em; color: var(--soft); }
/* El margen superior alinea el bloque con la primera linea del titular
   (salta la altura del eyebrow), en vez de dejarlo caido al fondo. */
.hero__side {
  font-size: 0.8125rem; line-height: 2; color: var(--soft);
  border-left: 1px solid var(--rule); padding-left: 1.5rem;
  margin-top: 3.1rem;
}
.hero__sideTitle {
  font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.5rem;
}
.hero__side .is-accent { color: var(--accent); }
.hero__sideMeta { color: var(--muted); padding-top: 0.75rem; }

/* ---------- Secciones ---------- */

.section__inner { padding: 3.5rem var(--pad) 1.5rem; }
.section__head {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: 1rem;
  border-bottom: 2px solid var(--ink); padding-bottom: 0.65rem;
}
.section__title { font-size: 0.8125rem; letter-spacing: 0.18em; text-transform: uppercase; }
.section__note { font-size: 0.8125rem; color: var(--muted); }

/* ---------- Proyectos ---------- */

.proj {
  display: grid; grid-template-columns: 11rem minmax(0, 1fr) 13rem;
  gap: 2.5rem; padding: 2rem 0; border-bottom: 1px solid var(--rule);
  align-items: start;
}
.proj__meta { font-size: 0.8125rem; line-height: 1.9; color: var(--muted); }
.proj__period { color: var(--ink); }
.proj__title {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem;
  font-size: 1.875rem; margin-bottom: 0.5rem;
}
.proj__title a { color: var(--ink); }
.proj__title a:hover { color: var(--accent); text-decoration: none; }
.proj__summary { font-size: 1.0625rem; line-height: 1.6; color: var(--soft); max-width: var(--measure); }
.proj__stack {
  font-size: 0.8125rem; line-height: 1.8; letter-spacing: 0.04em;
  color: var(--muted); text-transform: uppercase; padding-top: 1rem;
}
.proj__actions { display: flex; flex-direction: column; gap: 0.5rem; }

.tag {
  font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--ink); color: var(--bg); padding: 0.2rem 0.45rem;
}
.note {
  font-size: 0.8125rem; line-height: 1.7; color: var(--muted);
  border: 1px solid var(--rule); background: var(--chip); padding: 0.85rem 1rem;
}
.note__label {
  display: block; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--soft); margin-bottom: 0.3rem;
}

.metrics { display: flex; flex-wrap: wrap; gap: 2rem; margin: 1rem 0 0; padding: 0.9rem 0; border-top: 1px solid var(--rule2); border-bottom: 1px solid var(--rule2); max-width: var(--measure); }
.metrics--wide { max-width: none; }
.metrics__item { display: flex; flex-direction: column-reverse; }
.metrics__value { margin: 0; font-size: 1.625rem; font-weight: 600; letter-spacing: -0.02em; }
.metrics__label { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ---------- Capturas ---------- */

/* Captura de un proyecto con sitio publico. Marco de regla fina, como el
   resto de la ficha; el pie va en mono y dice cuando se tomo. */
.shot { margin: 1.25rem 0 0; max-width: var(--measure); }
.shot a { display: block; }
.shot img {
  display: block; width: 100%; aspect-ratio: 16 / 10;
  object-fit: cover; object-position: top;
  border: 1px solid var(--rule); background: var(--panel);
}
.shot a:hover img, .shot a:focus-visible img { border-color: var(--accent); }
.shot figcaption {
  font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.6;
  color: var(--muted); padding-top: 0.5rem;
}
.shot--wide { max-width: none; margin-top: 2.25rem; }

/* Codigo en linea dentro de los casos de estudio (texto entre `acentos graves`). */
code {
  font-family: var(--font-mono); font-size: 0.875em;
  background: var(--chip); padding: 0.1em 0.35em;
}

/* ---------- Tarjetas (pruebas tecnicas) ---------- */

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; padding: 1.75rem 0 0; }
.card { border: 1px solid var(--rule); background: var(--panel); padding: 1.6rem; display: flex; flex-direction: column; gap: 0.7rem; }
.card__eyebrow { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.card__title { font-size: 1.4375rem; }
.card__title a { color: var(--ink); }
.card__title a:hover { color: var(--accent); text-decoration: none; }
.card__body { font-size: 0.9375rem; line-height: 1.6; color: var(--soft); }
.card__stack { font-size: 0.8125rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

/* ---------- Filas (experiencia, formacion) ---------- */

.row {
  display: grid; grid-template-columns: 11rem minmax(0, 1fr) 13rem;
  gap: 2.5rem; padding: 1.25rem 0; border-bottom: 1px solid var(--rule2);
  align-items: baseline;
}
.row__meta { font-size: 0.8125rem; color: var(--muted); }
.row__title { font-size: 1.0625rem; margin-bottom: 0.25rem; }
.row__text { font-size: 0.9375rem; line-height: 1.55; color: var(--soft); max-width: var(--measure); }
.row__stack { font-size: 0.8125rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding-top: 0.5rem; }
.row__aside { font-size: 0.8125rem; color: var(--muted); text-align: right; }

/* Puestos antiguos: el parrafo queda plegado para que la lista se lea de un vistazo. */
.row__details { padding-top: 0.35rem; }
.row__details summary {
  display: inline-block; cursor: pointer; list-style: none;
  font-family: var(--font-mono); font-size: 0.75rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
  padding: 0.35rem 0;
}
.row__details summary::-webkit-details-marker { display: none; }
.row__details summary::before { content: "+ "; }
.row__details[open] summary::before { content: "− "; }
.row__details summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.row__details .row__text { padding-top: 0.25rem; }

/* ---------- Tecnologias ---------- */

.techgroup {
  display: grid; grid-template-columns: 15rem minmax(0, 1fr);
  gap: 0.9rem 2.5rem; padding: 1.15rem 0; border-bottom: 1px solid var(--rule2);
  align-items: start;
}
.techgroup__label { font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; }
.techgroup__label.is-muted { color: var(--muted); }
.techgroup__label.is-accent { color: var(--accent); }
.techgroup__note { font-size: 0.9375rem; line-height: 1.6; color: var(--soft); padding-top: 0.35rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { font-size: 0.8125rem; padding: 0.4rem 0.7rem; background: var(--chip); color: var(--ink); }
.chip.is-muted { background: none; border: 1px solid var(--rule); color: var(--soft); }
.chip.is-accent { background: none; border: 1px solid var(--accent); color: var(--accent); }

/* ---------- Caso de estudio ---------- */

.case__inner { padding: 3.5rem var(--pad) 4rem; max-width: 64rem; }
.case__eyebrow { font-size: 0.8125rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }
.case__title { font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.08; margin-bottom: 1rem; }
.case__lede { font-size: 1.1875rem; line-height: 1.6; color: var(--soft); max-width: var(--measure); }
.case__facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem 2rem; margin: 1.75rem 0 1.5rem; padding: 1.1rem 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-size: 0.8125rem;
}
.case__facts dt { color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.75rem; margin-bottom: 0.3rem; }
.case__facts dd { margin: 0; color: var(--soft); line-height: 1.6; }
.case__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-start; }
.case__actions .note { max-width: 30rem; }
.case__block { padding: 2.25rem 0 0; }
.case__blockTitle {
  font-size: 0.8125rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem; margin-bottom: 1rem;
}
.case__block p { font-size: 1.0625rem; line-height: 1.7; color: var(--soft); max-width: var(--measure); }
.case__block--limits p { color: var(--muted); }
.decisions { counter-reset: dec; display: flex; flex-direction: column; gap: 1.5rem; }
.decision { position: relative; padding-left: 3rem; }
.decision::before {
  counter-increment: dec; content: counter(dec, decimal-leading-zero);
  position: absolute; left: 0; top: 0.15rem;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent);
}
.decision__title { font-size: 1.125rem; margin-bottom: 0.4rem; }
.case__nav {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 1rem 2rem; margin-top: 2.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
}
.case__next { text-align: right; }
.case__nextLabel { display: block; color: var(--muted); }
.case__nextTitle {
  font-family: var(--font-sans); font-size: 1.125rem; font-weight: 600;
  letter-spacing: -0.01em; text-transform: none;
}

/* ---------- Pie ---------- */

.footer { background: var(--inv-bg); color: var(--inv-ink); margin-top: 2.5rem; }
.footer__inner { padding: 3.5rem var(--pad) 2.5rem; }
.footer__grid {
  display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 3rem; padding-bottom: 2.5rem; border-bottom: 1px solid var(--inv-rule);
}
.footer__title { font-size: 2rem; margin-bottom: 0.75rem; }
.footer__lede { font-size: 1rem; line-height: 1.6; color: var(--inv-soft); max-width: 24rem; margin-bottom: 1.25rem; }
.footer__col { font-size: 0.8125rem; line-height: 2.1; }
.footer__col a { color: var(--inv-ink); }
.footer__col--muted { color: var(--inv-soft); }
.footer__colTitle { color: var(--inv-soft); letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.75rem; margin-bottom: 0.5rem; }
.footer__bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
  padding-top: 1.25rem; font-size: 0.8125rem; color: var(--inv-soft);
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  :root { --pad: 2.5rem; }
  .hero__inner { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; align-items: start; }
  .hero__side { border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 1.25rem; margin-top: 0; }
  .proj, .row { grid-template-columns: 9rem minmax(0, 1fr); }
  .proj__actions, .row__aside { grid-column: 2; }
  .row__aside { text-align: left; }
  .proj__actions { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  :root { --pad: 1.25rem; }
  .topbar__inner { flex-wrap: wrap; gap: 0.75rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
  .topbar__burger { display: inline-flex; }

  /* Sin JS el menu se queda desplegado: nadie se queda sin navegacion. */
  .topbar__menu {
    display: flex; order: 3; width: 100%;
    flex-direction: column; align-items: flex-start; gap: 1rem;
  }
  .js .topbar__menu { display: none; }
  .js .topbar__menu[data-open] { display: flex; }
  .topbar__menu[data-open] { border-top: 1px solid var(--rule); padding-top: 1rem; padding-bottom: 0.5rem; }

  .topbar__nav {
    width: 100%; flex-direction: column; flex-wrap: nowrap; gap: 0;
    font-size: 0.8125rem;
  }
  .topbar__nav a { display: block; width: 100%; padding: 0.7rem 0; color: var(--ink); }
  .topbar__nav a + a { border-top: 1px solid var(--rule); }

  .topbar__tools { width: 100%; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.25rem; }
  .topbar__tools .topbar__lang { border: 1px solid var(--rule); padding: 0.4rem 0.6rem; min-height: 34px; display: inline-flex; align-items: center; }
  .topbar__tools .theme-toggle, .topbar__tools .btn { min-height: 34px; }
  .hero__inner { padding-top: 3rem; }
  .proj, .row, .techgroup { grid-template-columns: minmax(0, 1fr); gap: 0.9rem; }
  .proj__actions, .row__aside { grid-column: auto; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .footer__grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .case__inner { padding-top: 2.5rem; }
  .decision { padding-left: 2.25rem; }
}

@media print {
  .topbar, .skip-link, .case__nav { display: none; }
  body { background: #fff; color: #000; }
}
