/* ============================================================
  TOKENS — carbón, verde agua y ámbar
   ============================================================ */
:root {
  /* Color */
  --bg: #0d1416;
  --bg-raised: #172326;
  --bg-inset: #0a1012;
  --line: #2c3d40;

  --ink: #e5eee8;
  --ink-dim: #a9b9b1;
  --ink-faint: #71847d;

  --title: #f1bd72;
  --accent: #42bda2;
  --accent-2: #9be3ca;
  --warn: #e39a5f;

  /* Tipografía */
  --font-display: "Turret Road", system-ui, sans-serif;
  --font-mono: "Share Tech Mono", "Courier New", monospace;

  /* Escala tipográfica fluida, al estilo del sitio de referencia */
  --title-size: clamp(2.4rem, 3vw + 1.6rem, 4.5rem);
  --subtitle-size: clamp(1.3rem, 1.2vw + 1rem, 2rem);
  --body-size: clamp(1rem, 0.3vw + 0.9rem, 1.15rem);
  --label-size: clamp(0.75rem, 0.2vw + 0.7rem, 0.9rem);

  --rail-w: clamp(13rem, 19vw, 16rem);
  --content-max: 60rem;
  --page-gutter: clamp(1rem, 5vw, 3.5rem);
  --page-block-space: clamp(2.5rem, 8vw, 4rem);
  --radius: 2px;
}

/* ============================================================
   BASE
   ============================================================ */
* {
  box-sizing: border-box;
}

html {
  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-display);
  font-weight: 400;
  font-size: var(--body-size);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 0.5em;
  color: var(--title);
  text-shadow: 0 0 18px rgba(241, 189, 114, 0.16);
}

p {
  margin: 0 0 1.1em;
  max-width: 62ch;
  color: var(--ink-dim);
}

/* ============================================================
   CURSOR PERSONALIZADO (solo en dispositivos con puntero fino)
   ============================================================ */
@media (pointer: fine) {
  body {
    cursor: none;
  }
  a,
  button,
  input,
  textarea {
    cursor: none;
  }

  .custom-cursor {
    width: 0;
    height: 0;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
  }

  .custom-cursor__ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--accent);
    border-radius: 100%;
    transform: translate(-50%, -50%);
    transition:
      width 0.2s,
      height 0.2s,
      filter 0.2s,
      border-radius 0.2s;
  }

  .custom-cursor__dot {
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 5px;
    background: var(--accent-2);
    border-radius: 100%;
    transform: translate(-50%, -50%);
  }

  body.is-hovering-link .custom-cursor__ring {
    width: 34px;
    height: 34px;
    filter: hue-rotate(140deg);
  }
}

/* ============================================================
   SHELL / RAIL DE NAVEGACIÓN
   ============================================================ */
.shell {
  display: flex;
  min-height: 100vh;
}

.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: clamp(1.25rem, 4vw, 2rem) clamp(0.9rem, 2vw, 1.4rem);
  border-right: 1px solid var(--line);
  background: var(--bg-raised);
}

.rail__brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  color: var(--title);
  text-shadow: 0 0 14px rgba(241, 189, 114, 0.22);
  transition:
    letter-spacing 0.3s,
    filter 0.3s;
}

.rail__brand:hover {
  letter-spacing: 0.08em;
  filter: saturate(1.6);
}

.rail__nav {
  display: flex;
  flex-direction: column;
  gap: clamp(0.7rem, 1.5vw, 1.1rem);
  margin-top: clamp(2rem, 6vw, 3.5rem);
  width: 100%;
}

.rail__link {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 0.25vw + 0.78rem, 1.05rem);
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  padding: 0.4rem 0.6rem;
  border-left: 2px solid transparent;
  transition:
    color 0.2s,
    border-color 0.2s,
    text-shadow 0.2s;
  width: 100%;
}

.rail__link:hover {
  color: var(--accent-2);
  text-shadow: 0 0 10px rgba(141, 220, 51, 0.6);
}

.rail__link.is-active {
  color: var(--accent-2);
  border-left-color: var(--accent);
  text-shadow: 0 0 10px rgba(141, 220, 51, 0.55);
}

.rail__meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
}

/* ============================================================
   VISTA / CONTENIDO
   ============================================================ */
.view {
  flex: 1;
  width: min(100%, var(--content-max));
  padding: var(--page-block-space) var(--page-gutter);
}

.view__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--label-size);
  color: var(--warn);
  margin-bottom: 0.9rem;
}

.view h1 {
  font-size: var(--title-size);
}
.view h2 {
  font-size: var(--subtitle-size);
  margin-top: 2.5rem;
}

.view__lede {
  font-size: clamp(1rem, 0.35vw + 0.92rem, 1.1rem);
  color: var(--ink);
  max-width: var(--content-max);
}

.view__status {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-faint);
  padding: 2rem 0;
}

.view__status.is-error {
  color: #e0a45a;
  border-left: 2px solid var(--warn);
  padding-left: 1rem;
}

.view__status.is-error code {
  color: var(--ink);
  background: var(--bg-inset);
  padding: 0.1em 0.4em;
  border-radius: var(--radius);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 800px) {
  .shell {
    flex-direction: column;
  }

  .rail {
    width: 100%;
    height: auto;
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    padding: 1rem var(--page-gutter);
    gap: 0.15rem;
  }

  .rail__brand {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .rail__nav {
    display: contents;
    margin-top: 0;
  }

  .rail__link {
    grid-row: 1;
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 0.4rem 0.1rem;
    text-align: center;
    font-size: clamp(0.58rem, 1.8vw, 0.78rem);
    white-space: nowrap;
  }

  .rail__link:nth-child(1) {
    grid-column: 2;
  }

  .rail__link:nth-child(2) {
    grid-column: 3;
  }

  .rail__link:nth-child(3) {
    grid-column: 4;
  }

  .rail__link:nth-child(4) {
    grid-column: 5;
  }
  .rail__link.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }
  .rail__meta {
    display: none;
  }

  .view {
    width: 100%;
    padding: var(--page-block-space) var(--page-gutter);
  }
}
