/* Opción 1 · Terminal
   Todo el sitio usa JetBrains Mono (monoespaciada), igual que el logo.
   Tema oscuro por defecto; el claro se aplica si el sistema lo prefiere o si se elige con el
   botón de la barra superior (que guarda la elección en el atributo data-theme de <html>). */

:root {
  color-scheme: dark;
  --bg: #0e0d0b;
  --bg-2: #15140f;
  --bg-3: #1d1b16;
  --line: #2c2923;
  --text: #ece6da;
  --muted: #a39b8c;
  --dim: #6f695e;
  --accent: #ffb547;
  --accent-hover: #ffc670;
  --accent-soft: rgba(255, 181, 71, 0.55);
  --on-accent: #0e0d0b;
  --green: #8bd17c;
  --green-soft: rgba(139, 209, 124, 0.15);
  --blue: #8cc2ff;
  --glow: rgba(255, 181, 71, 0.09);
  --topbar: rgba(14, 13, 11, 0.85);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --show-sun: block;
  --show-moon: none;
  --font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --max: 1120px;
}

/* El bloque de colores claros se repite: uno sigue al sistema y otro aplica la elección manual. */

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f7f4ee;
    --bg-2: #fffdf9;
    --bg-3: #efebe3;
    --line: #ddd6c9;
    --text: #1b1914;
    --muted: #574f42;
    --dim: #716a5c;
    --accent: #b45309;
    --accent-hover: #92400e;
    --accent-soft: rgba(180, 83, 9, 0.5);
    --on-accent: #fffdf9;
    --green: #2f7d32;
    --green-soft: rgba(47, 125, 50, 0.15);
    --blue: #1f5fa8;
    --glow: rgba(180, 83, 9, 0.07);
    --topbar: rgba(247, 244, 238, 0.85);
    --shadow: 0 30px 60px rgba(60, 45, 20, 0.12);
    --show-sun: none;
    --show-moon: block;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f4ee;
  --bg-2: #fffdf9;
  --bg-3: #efebe3;
  --line: #ddd6c9;
  --text: #1b1914;
  --muted: #574f42;
  --dim: #716a5c;
  --accent: #b45309;
  --accent-hover: #92400e;
  --accent-soft: rgba(180, 83, 9, 0.5);
  --on-accent: #fffdf9;
  --green: #2f7d32;
  --green-soft: rgba(47, 125, 50, 0.15);
  --blue: #1f5fa8;
  --glow: rgba(180, 83, 9, 0.07);
  --topbar: rgba(247, 244, 238, 0.85);
  --shadow: 0 30px 60px rgba(60, 45, 20, 0.12);
  --show-sun: none;
  --show-moon: block;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 85% -10%, var(--glow), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

.wrap {
  width: min(100% - 40px, var(--max));
  margin-inline: auto;
}

.dim {
  color: var(--dim);
}

.ok {
  color: var(--green);
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--on-accent);
  z-index: 100;
}

.skip:focus {
  top: 12px;
}

/* ---------- Logo ---------- */

.logo {
  display: inline-flex;
  align-items: center;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.logo__prompt {
  color: var(--accent);
  margin-right: 1ch;
}

.logo__tld {
  color: var(--muted);
}

.logo__cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.15em;
  margin-left: 0.15em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--topbar);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-height: 68px;
  padding-block: 10px;
}

.logo {
  margin-right: auto;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  font-size: 14px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

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

/* Botón de tema: muestra el sol en el tema oscuro y la luna en el claro. */

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

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

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle__sun {
  display: var(--show-sun);
}

.theme-toggle__moon {
  display: var(--show-moon);
}

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

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
  padding-block: 96px 112px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 28px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green);
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.hero__title {
  margin: 0;
  font-size: clamp(2.1rem, 4.6vw, 3.5rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.hl {
  color: var(--accent);
}

.hero__lead {
  max-width: 58ch;
  margin: 28px 0 36px;
  color: var(--muted);
}

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

.btn {
  display: inline-block;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

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

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

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

/* Ventana de terminal */

.term {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.term__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-3);
  font-size: 12px;
  color: var(--dim);
}

.term__dots {
  display: flex;
  gap: 6px;
}

.term__dots i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #3a362f;
}

.term__dots i:first-child {
  background: #ff6b5f;
}

.term__dots i:nth-child(2) {
  background: var(--accent);
}

.term__dots i:last-child {
  background: var(--green);
}

.term__body {
  margin: 0;
  padding: 22px 22px 26px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.term .line {
  opacity: 0;
  animation: show 0.01s steps(1) forwards;
  animation-delay: calc(var(--i) * 280ms + 200ms);
}

.term .out {
  color: var(--muted);
}

.term b {
  color: var(--blue);
  font-weight: 500;
}

.ps {
  color: var(--accent);
  font-weight: 700;
}

.hash {
  color: var(--accent);
}

.caret {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  vertical-align: text-bottom;
  background: var(--text);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes show {
  to {
    opacity: 1;
  }
}

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

.section {
  padding-block: 96px;
  border-top: 1px solid var(--line);
}

.section__head {
  margin-bottom: 44px;
}

.cmd {
  margin: 0 0 6px;
  color: var(--dim);
  font-size: 14px;
}

.section__title {
  margin: 0;
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.comment {
  margin: 8px 0 0;
  color: var(--dim);
}

/* Apps */

.apps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.app {
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  transition: border-color 0.2s, transform 0.2s;
}

.app:hover {
  border-color: var(--accent-soft);
  transform: translateY(-2px);
}

.app__top {
  display: flex;
  justify-content: space-between;
  color: var(--dim);
  font-size: 12px;
}

.app__name {
  margin: 14px 0 2px;
  color: var(--blue);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.app__tagline {
  margin: 0 0 12px;
  font-weight: 700;
}

.app__desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.app__meta {
  display: grid;
  gap: 4px;
  margin: 0 0 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
}

.app__meta div {
  display: grid;
  grid-template-columns: 12ch 1fr;
}

.app__meta dt {
  color: var(--dim);
}

.app__meta dd {
  margin: 0;
}

.app__meta .dot {
  margin-right: 10px;
  width: 7px;
  height: 7px;
  box-shadow: none;
}

.app__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: auto 0 0;
  font-size: 14px;
}

.app__links a {
  color: var(--accent);
  text-decoration: none;
}

.app__links a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Archivos (sobre mí, stack) */

.about {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}

.file {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  overflow: hidden;
}

.file__bar {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-3);
  font-size: 12px;
  color: var(--muted);
}

.file__body {
  margin: 0;
  padding: 26px;
}

.file__body p {
  margin: 0 0 16px;
  color: var(--muted);
}

.file__body p:last-child {
  margin-bottom: 0;
}

.file__body em {
  color: var(--text);
  font-style: normal;
  font-weight: 700;
}

.md-h {
  margin: 28px 0 10px;
  font-size: 16px;
}

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

.principles {
  list-style: none;
  counter-reset: p;
}

.principles li {
  position: relative;
  padding-left: 4ch;
  margin-bottom: 16px;
  color: var(--muted);
  counter-increment: p;
}

.principles li:last-child {
  margin-bottom: 0;
}

.principles li::before {
  content: counter(p, decimal-leading-zero);
  position: absolute;
  left: 0;
  color: var(--dim);
}

.principles strong {
  display: block;
  color: var(--text);
}

.json {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.9;
  overflow-x: auto;
}

.json .k {
  color: var(--blue);
}

.json .s {
  color: var(--accent);
}

/* Contacto */

.contact__lead {
  max-width: 60ch;
  margin: 14px 0 0;
  color: var(--muted);
}

.flags {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: clamp(15px, 2vw, 19px);
}

.flags li {
  display: grid;
  grid-template-columns: 12ch 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.flag {
  color: var(--dim);
}

.flags a {
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.flags a:hover {
  color: var(--accent);
}

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

.footer {
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 28px;
}

.footer p {
  margin: 0;
}

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

@media (max-width: 900px) {
  .hero,
  .about {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-block: 64px 80px;
    gap: 44px;
  }
}

@media (max-width: 680px) {
  html {
    scroll-padding-top: 104px;
  }

  /* El menú baja a su propia línea y el botón de tema se queda junto al logo. */
  .nav {
    order: 1;
    width: 100%;
  }

  body {
    font-size: 14px;
  }

  .apps {
    grid-template-columns: 1fr;
  }

  .section {
    padding-block: 72px;
  }

  .term__body {
    font-size: 12px;
  }

  .flags li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .term .line {
    opacity: 1;
  }
}
