/* ============================================================
   NOTES — Cuaderno de campo editorial
   Carga DESPUÉS de homepage-white.css y tokens.css.
   Todo está bajo .notes-page / .note-page para no tocar el resto.

   MAPEO DE TOKENS: si tu tokens.css ya define navy / electric /
   coral, reemplaza los valores de --wn-* por tus variables, p. ej.
   --wn-electric: var(--color-electric);
   ============================================================ */

.notes-page, .note-page {
  /* Mapeado a tokens.css (Clinical Blueprint). Fallbacks por si la página
     se abre sin tokens.css. */
  --wn-paper: var(--bg, #FFFFFF);
  --wn-ink: var(--ink, #0B0E2A);
  --wn-meta: var(--ink-2, #2A2F50);        /* metadatos, etiquetas, fichas */
  --wn-ink-deep: var(--ink-deep, #0B0E2A); /* bloques de código */
  --wn-on-dark: var(--on-dark, #F5F2EA);
  --wn-electric: var(--blue, #0033E5);
  --wn-coral: var(--coral, #FF3D2E);
  --wn-mist: var(--surface, #FAF8F3);
  --wn-hairline: var(--rule-soft, rgba(11, 14, 42, 0.16));
  --wn-serif: var(--serif, 'DM Serif Display', Georgia, serif);
  --wn-sans: var(--sans, 'Space Grotesk', system-ui, sans-serif);
  --wn-mono: var(--mono, 'JetBrains Mono', ui-monospace, monospace);
  --wn-hand: var(--script, 'Caveat', cursive);
  --wn-ease: var(--ease, ease);
  --wn-t-fast: var(--t-fast, 0.22s);
  --wn-t-base: var(--t-base, 0.45s);
}

/* ---------- utilidades compartidas ---------- */

.wn-eyebrow {
  font-family: var(--wn-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wn-meta);
  opacity: 0.7;
}

.wn-wrap {
  width: min(1080px, 100% - 2.5rem);
  margin-inline: auto;
}

/* ============================================================
   ÍNDICE — notes.html
   ============================================================ */

.notes-hero {
  padding: clamp(6.5rem, 14vh, 9rem) 0 clamp(2rem, 5vh, 3.5rem);
  border-bottom: 1px solid var(--wn-hairline);
}

.notes-hero__titlewrap {
  position: relative;
  display: inline-block;
  margin-top: 0.75rem;
}

.notes-hero h1 {
  font-family: var(--wn-serif);
  font-weight: 400;
  font-size: clamp(3rem, 11vw, 6.5rem);
  line-height: 0.95;
  color: var(--wn-ink);
  margin: 0;
}

/* La única licencia manuscrita de la página: la anotación al margen */
.notes-hero__annotation {
  font-family: var(--wn-hand);
  font-size: clamp(1.2rem, 3.4vw, 1.7rem);
  color: var(--wn-electric);
  transform: rotate(-2.5deg);
  display: inline-block;
  margin: 0.5rem 0 0 clamp(0.25rem, 4vw, 3rem);
}

.notes-hero__annotation::after {
  content: "";
  display: block;
  width: 70%;
  height: 2px;
  margin-top: 2px;
  background: var(--wn-coral);
  border-radius: 2px;
  transform: rotate(1.5deg);
}

.notes-hero__intro {
  font-family: var(--wn-sans);
  font-weight: 300;
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  line-height: 1.6;
  color: var(--wn-ink);
  max-width: 46ch;
  margin-top: 1.5rem;
}

/* ---------- filtros de categoría ---------- */

.notes-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.25rem 0;
}

.notes-filters button {
  font-family: var(--wn-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wn-meta);
  background: transparent;
  border: 1px solid var(--wn-hairline);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: border-color var(--wn-t-fast) var(--wn-ease), color var(--wn-t-fast) var(--wn-ease), background var(--wn-t-fast) var(--wn-ease);
}

.notes-filters button:hover { border-color: var(--wn-electric); color: var(--wn-electric); }

.notes-filters button[aria-pressed="true"] {
  background: var(--wn-ink);
  border-color: var(--wn-ink);
  color: var(--wn-on-dark);
}

.notes-filters button:focus-visible,
.notes-ledger a:focus-visible,
.note-article a:focus-visible {
  outline: 2px solid var(--wn-electric);
  outline-offset: 3px;
}

/* ---------- libro de entradas (ledger) ---------- */

.notes-ledger {
  list-style: none;
  margin: 0;
  padding: 0 0 clamp(3rem, 8vh, 6rem);
}

.notes-entry {
  border-bottom: 1px solid var(--wn-hairline);
}

.notes-entry > a {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1.75rem 0;
  text-decoration: none;
  color: inherit;
}

/* lámina (imagen de portada): ligeramente desaturada en reposo */
.notes-entry__plate {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--wn-hairline);
  background: var(--wn-mist);
  aspect-ratio: 16 / 7;
}

.notes-entry__plate img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.35);
  transition: filter var(--wn-t-base) var(--wn-ease), transform var(--wn-t-base) var(--wn-ease);
}

.notes-entry > a:hover .notes-entry__plate img {
  filter: saturate(1);
  transform: scale(1.025);
}

.notes-entry__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1rem;
  font-family: var(--wn-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wn-meta);
}

.notes-entry__num { color: var(--wn-coral); }

.notes-entry h2 {
  font-family: var(--wn-serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  line-height: 1.12;
  margin: 0;
  color: var(--wn-ink);
  text-decoration: underline transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  transition: text-decoration-color var(--wn-t-fast) var(--wn-ease);
}

.notes-entry > a:hover h2 { text-decoration-color: var(--wn-electric); }

.notes-entry p {
  font-family: var(--wn-sans);
  font-weight: 300;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--wn-ink);
  margin: 0;
  max-width: 60ch;
}

.notes-entry__tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.notes-entry__tags span {
  font-family: var(--wn-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--wn-hairline);
  padding: 0.22rem 0.55rem;
  color: var(--wn-meta);
}

/* entrada destacada: lámina grande y borde navy */
.notes-entry--featured > a { padding: 2.25rem 0; }
.notes-entry--featured .notes-entry__plate { aspect-ratio: 16 / 8; border-color: var(--wn-ink); }
.notes-entry--featured h2 { font-size: clamp(1.9rem, 6.5vw, 3rem); }

/* desktop: meta-rail a la izquierda, lámina a la derecha */
@media (min-width: 760px) {
  .notes-entry > a {
    grid-template-columns: 120px 1fr 220px;
    grid-template-areas: "meta body plate";
    gap: 1.25rem 2rem;
    align-items: start;
  }
  .notes-entry__meta { grid-area: meta; flex-direction: column; gap: 0.45rem; }
  .notes-entry__body { grid-area: body; display: grid; gap: 0.6rem; }
  .notes-entry__plate { grid-area: plate; aspect-ratio: 4 / 3; }
  .notes-entry--featured > a {
    grid-template-columns: 120px 1fr;
    grid-template-areas: "meta plate" "meta body";
  }
  .notes-entry--featured .notes-entry__plate { aspect-ratio: 16 / 6; }
}

@media (max-width: 759px) {
  .notes-entry__body { display: grid; gap: 0.55rem; }
}

/* mensajes de estado (sin configurar / vacío / error) */
.notes-state {
  font-family: var(--wn-sans);
  font-weight: 300;
  line-height: 1.6;
  border: 1px dashed var(--wn-hairline);
  padding: 1.5rem;
  margin: 2rem 0 4rem;
  max-width: 60ch;
}

.notes-state .wn-eyebrow { display: block; margin-bottom: 0.5rem; }

/* ============================================================
   ARTÍCULO — note.html
   ============================================================ */

.note-article { padding-top: clamp(6.5rem, 14vh, 8.5rem); }

.note-article__head { padding-bottom: clamp(1.5rem, 4vh, 2.5rem); }

.note-article__rail {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--wn-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--wn-hairline);
}

.note-article__rail a { color: var(--wn-electric); text-decoration: none; }
.note-article__rail a:hover { text-decoration: underline; text-underline-offset: 4px; }
.note-article__rail .wn-tagline { opacity: 0.55; color: var(--wn-meta); text-align: right; }

/* etiqueta de espécimen: ficha de metadatos en mono dentro de caja hairline */
.note-specimen {
  display: inline-grid;
  grid-auto-flow: row;
  gap: 0.3rem;
  margin: 2rem 0 1.5rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--wn-hairline);
  font-family: var(--wn-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wn-meta);
  position: relative;
}

.note-specimen::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 10px;
  height: 10px;
  background: var(--wn-coral);
}

.note-specimen b { font-weight: 400; opacity: 0.55; margin-right: 0.5rem; }

@media (min-width: 600px) {
  .note-specimen { grid-auto-flow: column; gap: 1.75rem; }
}

.note-article h1 {
  font-family: var(--wn-serif);
  font-weight: 400;
  font-size: clamp(2.1rem, 7vw, 4rem);
  line-height: 1.05;
  color: var(--wn-ink);
  margin: 0 0 1rem;
  max-width: 18ch;
}

.note-article__summary {
  font-family: var(--wn-sans);
  font-weight: 300;
  font-size: clamp(1.05rem, 2.6vw, 1.25rem);
  line-height: 1.55;
  color: var(--wn-ink);
  max-width: 52ch;
  margin: 0;
}

/* portada como lámina inaugural */
.note-cover {
  margin: clamp(1.75rem, 5vh, 2.75rem) 0 0;
  border: 1px solid var(--wn-hairline);
  overflow: hidden;
}

.note-cover img { width: 100%; display: block; }

/* ---------- cuerpo ---------- */

.note-content {
  max-width: 68ch;
  margin: clamp(2rem, 6vh, 3.5rem) auto clamp(4rem, 10vh, 6rem);
  font-family: var(--wn-sans);
  font-weight: 300;
  font-size: clamp(1rem, 2.4vw, 1.1rem);
  line-height: 1.75;
  color: var(--wn-ink);
  counter-reset: fig;
}

.note-content p { margin: 0 0 1.4em; }

.note-content h2, .note-content h3, .note-content h4 {
  font-family: var(--wn-serif);
  font-weight: 400;
  line-height: 1.15;
  color: var(--wn-ink);
  margin: 2.2em 0 0.6em;
}

.note-content h2 { font-size: clamp(1.5rem, 4.5vw, 2rem); }
.note-content h3 { font-size: clamp(1.3rem, 4vw, 1.6rem); }
.note-content h4 { font-size: clamp(1.1rem, 3.4vw, 1.3rem); }

.note-content a { color: var(--wn-electric); text-underline-offset: 3px; }
.note-content strong { font-weight: 600; }

.note-content ul, .note-content ol { padding-left: 1.3rem; margin: 0 0 1.4em; }
.note-content li { margin-bottom: 0.5em; }
.note-content li::marker { color: var(--wn-coral); font-family: var(--wn-mono); font-size: 0.85em; }

.note-content blockquote {
  margin: 1.8em 0;
  padding: 0.25em 0 0.25em 1.25rem;
  border-left: 2px solid var(--wn-electric);
  font-family: var(--wn-serif);
  font-style: italic;
  font-size: 1.15em;
  line-height: 1.5;
}

/* callout de Notion = nota de laboratorio */
.note-content .note-callout {
  margin: 1.8em 0;
  padding: 1rem 1.2rem;
  background: var(--wn-mist);
  border-left: 3px solid var(--wn-coral);
}

.note-content .note-callout::before {
  content: "Nota";
  display: block;
  font-family: var(--wn-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wn-meta);
  margin-bottom: 0.4rem;
}

.lang-en .note-content .note-callout::before { content: "Note"; }

.note-content hr {
  border: 0;
  height: 1px;
  background: var(--wn-hairline);
  margin: 2.5em 0;
}

/* ---------- LA FIRMA: sistema de figuras numeradas ---------- */

.note-content figure {
  counter-increment: fig;
  margin-block: 2.2em;
  /* en desktop la figura "respira" más ancha que la columna de texto */
  margin-inline: clamp(-3.5rem, -5vw, 0rem);
}

@media (max-width: 760px) {
  .note-content figure { margin-inline: 0; }
}

.note-content figure img {
  width: 100%;
  display: block;
  border: 1px solid var(--wn-hairline);
}

.note-content figcaption {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  margin-top: 0.55rem;
  font-family: var(--wn-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--wn-meta);
}

.note-content figcaption::before {
  content: "Fig. " counter(fig, decimal-leading-zero);
  flex: none;
  color: var(--wn-paper);
  background: var(--wn-coral);
  padding: 0.15rem 0.45rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.note-content pre {
  background: var(--wn-ink-deep);
  color: var(--wn-on-dark);
  font-family: var(--wn-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin: 1.8em 0;
}

.note-content code {
  font-family: var(--wn-mono);
  font-size: 0.88em;
}

.note-content p code, .note-content li code {
  background: var(--wn-mist);
  padding: 0.1em 0.35em;
  color: var(--wn-meta);
}

/* cierre de entrada */
.note-end {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 3rem;
  font-family: var(--wn-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wn-meta);
  opacity: 0.7;
}

.note-end::before { content: ""; width: 10px; height: 10px; background: var(--wn-coral); flex: none; }

/* entrada en carga / error */
.note-content .notes-state { margin: 0; }

/* ---------- movimiento con criterio ---------- */

@media (prefers-reduced-motion: reduce) {
  .notes-entry__plate img,
  .notes-entry h2,
  .notes-filters button {
    transition: none;
  }
}
