/* ============================================================
   Info Score — feuille de style éditoriale
   Palette : papier / bordeaux / or
   Police display : Instrument Serif (italique)
   Police corps   : Newsreader
   Police mono    : JetBrains Mono
============================================================ */

:root {
  --paper:         #FAF7F2;
  --ink:           #1A1A1E;
  --ink-muted:     #5A5A5E;
  --rule:          #D9CFC1;
  --bordeaux:      #7A1F2B;
  --bordeaux-soft: #A8404C;
  --gold:          #B68A2E;
  --grade-a:       #3F6E3F;
  --grade-b:       #6B7A3F;
  --grade-c:       #B68A2E;
  --grade-d:       #B7692E;
  --grade-e:       #8E2A1F;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--paper); color: var(--ink); }

body {
  font-family: "Newsreader", Georgia, serif;
  font-size: 17px;
  line-height: 1.55;
  font-feature-settings: "ss01", "ss02", "liga";
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 15% 10%, rgba(122,31,43,0.03) 0%, transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(182,138,46,0.04) 0%, transparent 40%);
}

.display { font-family: "Instrument Serif", "Newsreader", Georgia, serif; font-weight: 400; }
.mono    { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* -------- Masthead -------- */
header.masthead {
  border-bottom: 1px solid var(--rule);
  padding: 22px 36px 20px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  letter-spacing: 0.02em;
}
header.masthead .wordmark {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 28px;
  color: var(--bordeaux);
  text-decoration: none;
}
header.masthead .wordmark em { font-style: normal; color: var(--ink); }
header.masthead nav a {
  color: var(--ink-muted);
  text-decoration: none;
  margin-left: 22px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
header.masthead nav a:hover { color: var(--bordeaux); }

/* -------- Container -------- */
main { max-width: 1180px; margin: 0 auto; padding: 48px 36px 96px; }

/* -------- Hero -------- */
.hero h1 {
  font-family: "Instrument Serif", serif;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 1.02;
  margin: 0 0 8px;
  font-weight: 400;
}
.hero h1 em { color: var(--bordeaux); font-style: italic; }
.hero .kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 14px;
  font-family: "JetBrains Mono", monospace;
}
.hero .lede {
  font-size: 19px;
  line-height: 1.55;
  max-width: 640px;
  color: var(--ink);
  margin: 18px 0 0;
}

/* -------- Rules -------- */
hr.rule       { border: 0; border-top: 1px solid var(--rule); margin: 48px 0; }
hr.rule.thick { border: 0; border-top: 3px double var(--rule); margin: 48px 0; }

/* -------- Cards -------- */
.card {
  background: #FFFFFFCC;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 28px 32px;
}

/* -------- Forms -------- */
label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
  font-family: "JetBrains Mono", monospace;
}
input[type=text], input[type=url], textarea, select {
  width: 100%;
  padding: 12px 14px;
  font-family: "Newsreader", serif;
  font-size: 16px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 2px;
  outline: none;
  transition: border-color 120ms;
}
input:focus, textarea:focus, select:focus { border-color: var(--bordeaux); }
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }

button, .btn {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 20px;
  padding: 12px 28px;
  background: var(--bordeaux);
  color: var(--paper);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 120ms;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--bordeaux-soft); }
button.ghost, .btn.ghost {
  background: transparent;
  color: var(--bordeaux);
  border: 1px solid var(--bordeaux);
}

/* -------- Radio/toggle for source type -------- */
.toggle {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle label {
  margin: 0;
  padding: 8px 18px;
  background: var(--paper);
  color: var(--ink-muted);
  cursor: pointer;
  border-right: 1px solid var(--rule);
  text-transform: inherit;
  letter-spacing: inherit;
  font-family: inherit;
  font-size: inherit;
}
.toggle label:last-child { border-right: 0; }
.toggle input:checked + label { background: var(--bordeaux); color: var(--paper); }

/* -------- Grade badge -------- */
.grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  font-family: "Instrument Serif", serif;
  font-size: 64px;
  line-height: 1;
  color: var(--paper);
  border-radius: 50%;
  font-style: italic;
}
.grade.A { background: var(--grade-a); }
.grade.B { background: var(--grade-b); }
.grade.C { background: var(--grade-c); }
.grade.D { background: var(--grade-d); }
.grade.E { background: var(--grade-e); }

.grade.small { width: 44px; height: 44px; font-size: 28px; }

/* -------- Criterion bars -------- */
.criterion-bar {
  display: grid;
  grid-template-columns: 200px 1fr 60px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  padding: 10px 0;
  border-bottom: 1px dotted var(--rule);
}
.criterion-bar:last-child { border-bottom: 0; }
.criterion-bar .bar-track {
  height: 8px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}
.criterion-bar .bar-fill {
  height: 100%;
  background: var(--bordeaux);
}
.criterion-bar .bar-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  text-align: right;
}

/* -------- Footer -------- */
footer.colophon {
  border-top: 1px solid var(--rule);
  padding: 24px 36px 28px;
  color: var(--ink-muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 24px;
}
footer.colophon a { color: var(--bordeaux); text-decoration: none; }
footer.colophon em { font-family: "Instrument Serif", serif; font-style: italic; }

/* -------- Sélecteur de langue (drapeaux) -------- */
.lang-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.lang-pill {
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 3px;
  opacity: 0.4;
  filter: grayscale(0.5);
  transition: opacity 120ms, filter 120ms, background 120ms;
  user-select: none;
}
.lang-pill:hover {
  opacity: 0.85;
  filter: grayscale(0);
  background: rgba(122, 31, 43, 0.06);
  text-decoration: none;
}
.lang-pill.active {
  opacity: 1;
  filter: grayscale(0);
  outline: 1.5px solid var(--bordeaux);
  outline-offset: 1px;
}
.lang-pill.disabled {
  opacity: 0.22;
  filter: grayscale(1);
  cursor: not-allowed;
}
.lang-pill.disabled:hover {
  background: transparent;
}

/* -------- Helpers -------- */
.muted  { color: var(--ink-muted); }
.tiny   { font-size: 12px; letter-spacing: 0.04em; }
.tag    {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  padding: 2px 8px;
  background: var(--rule);
  color: var(--ink);
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* -------- Hero split: text 50% | pentagon 50% -------- */
.hero.hero-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}
.hero-text { min-width: 0; }
.hero-text h1 { margin-top: 12px; }
.hero-text .lede { max-width: 100%; }
.hero-pentagon {
  /* Reset del centrado autónomo — ahora vive en una columna del grid. */
  margin: 0;
  max-width: none;
}

@media (max-width: 960px) {
  .hero.hero-split {
    grid-template-columns: 1fr;
    gap: 36px;
  }
}

/* -------- Counter / Pentagon -------- */
.counter-section {
  margin: 28px auto 8px;
  max-width: 760px;
  text-align: center;
}
.counter-section .kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.counter-caption {
  margin: 0 auto 24px;
  max-width: 540px;
  font-size: 13px;
  color: var(--ink-muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.5;
}
.counter-caption a {
  color: var(--bordeaux);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.counter-stage {
  position: relative;
  width: 560px;
  height: 560px;
  margin: 0 auto;
}
.counter-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  padding: 18px 24px;
  border-radius: 4px;
  transition: background 220ms ease;
  z-index: 2;
}
.counter-center:hover { background: rgba(122, 31, 43, 0.05); }
.counter-center .counter-number {
  font-family: "Instrument Serif", serif;
  font-size: 88px;
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.counter-center .counter-label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}
.counter-center:hover .counter-label { color: var(--bordeaux); }

.pent-letter {
  position: absolute;
  top: 50%; left: 50%;
  width: 170px;
  text-align: center;
  text-decoration: none;
  /* Posición: cada letra tiene --x/--y inline, calculados sobre
     un radio de 195px desde el centro. */
  transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y)));
}
.pent-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 150px;
  height: 150px;
  margin: 0 auto;
  padding: 14px 12px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--bg, var(--ink));
  color: #FAF7F2;
  /* Cada círculo respira a su propio ritmo — cinco duraciones primas
     entre sí (14/17/19/21/23 s) + delays desfasados, para que nunca
     queden sincronizados. Movimiento ínfimo: 2px de subida y 3 % de
     escala, casi imperceptible salvo a la vista lenta. */
  animation: breathe var(--dur, 18s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.06);
  will-change: transform;
}
.pent-glyph {
  display: block;
  font-family: "Instrument Serif", serif;
  font-size: 44px;
  font-style: italic;
  letter-spacing: 0.02em;
  line-height: 1;
}
.pent-label {
  display: block;
  max-width: 100%;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  color: rgba(250, 247, 242, 0.92);
  word-break: break-word;
  hyphens: auto;
}
.pent-pct {
  display: block;
  margin-top: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.pent-letter:hover .pent-circle {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.pent-letter:hover .pent-pct { color: var(--bordeaux); }

.pent-a .pent-circle { --bg: var(--grade-a); }
.pent-b .pent-circle { --bg: var(--grade-b); }
.pent-c .pent-circle { --bg: var(--grade-c); }
.pent-d .pent-circle { --bg: var(--grade-d); }
.pent-e .pent-circle { --bg: var(--grade-e); }

/* Posiciones desktop (radio 195px) — sobrescritas por media query móvil. */
.pent-a { --x: 0px;    --y: -195px; }
.pent-b { --x: 185px;  --y: -60px;  }
.pent-c { --x: 115px;  --y: 158px;  }
.pent-d { --x: -115px; --y: 158px;  }
.pent-e { --x: -185px; --y: -60px;  }

@keyframes breathe {
  0%, 100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.06);
  }
  50% {
    transform: translateY(-2px) scale(1.025);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
  }
}
@media (prefers-reduced-motion: reduce) {
  .pent-circle { animation: none; }
}

/* -------- Archive -------- */
.archive-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 28px;
}
.archive-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  text-decoration: none;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}
.archive-pill:hover {
  border-color: var(--ink-muted);
  color: var(--ink);
}
.archive-pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.archive-pill-letter {
  font-family: "Instrument Serif", serif;
  font-size: 16px;
  font-style: italic;
}
.archive-pill-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.archive-pill.archive-pill-a:not(.active) .archive-pill-letter { color: var(--grade-a); }
.archive-pill.archive-pill-b:not(.active) .archive-pill-letter { color: var(--grade-b); }
.archive-pill.archive-pill-c:not(.active) .archive-pill-letter { color: var(--grade-c); }
.archive-pill.archive-pill-d:not(.active) .archive-pill-letter { color: var(--grade-d); }
.archive-pill.archive-pill-e:not(.active) .archive-pill-letter { color: var(--grade-e); }

.archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.archive-item + .archive-item {
  border-top: 1px solid var(--rule);
}
.archive-item-link {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 4px;
  text-decoration: none;
  color: var(--ink);
  transition: background 160ms ease;
}
.archive-item-link:hover {
  background: rgba(122, 31, 43, 0.025);
}
.archive-item-grade {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--paper);
  font-family: "Instrument Serif", serif;
  font-size: 20px;
  font-style: italic;
  background: var(--ink);
}
.archive-item-grade.grade-A { background: var(--grade-a); }
.archive-item-grade.grade-B { background: var(--grade-b); }
.archive-item-grade.grade-C { background: var(--grade-c); }
.archive-item-grade.grade-D { background: var(--grade-d); }
.archive-item-grade.grade-E { background: var(--grade-e); }

.archive-item-body { flex: 1; min-width: 0; }
.archive-item-title {
  font-family: "Instrument Serif", serif;
  font-size: 19px;
  line-height: 1.35;
  margin-bottom: 4px;
  /* Truncar a 2 líneas */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.archive-item-url {
  color: var(--ink-muted);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.archive-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.archive-item-meta .sep {
  opacity: 0.4;
}

.archive-empty {
  padding: 28px 0;
  text-align: center;
  font-style: italic;
}
.archive-status {
  text-align: center;
  padding: 32px 0;
}

/* -------- Responsive -------- */
@media (max-width: 720px) {
  header.masthead { padding: 16px 20px; flex-direction: column; align-items: flex-start; gap: 8px; }
  header.masthead nav a { margin: 0 18px 0 0; }
  main { padding: 32px 20px 64px; }
  .grade { width: 72px; height: 72px; font-size: 48px; }
  .grid-two { grid-template-columns: 1fr !important; }
  /* Pentagon: encoge proporcional pero mantiene presencia (círculos ~110px,
     suficientes para que el título quepa dentro en 2-3 líneas pequeñas). */
  .counter-stage { width: 400px; height: 400px; }
  .counter-center .counter-number { font-size: 64px; }
  .counter-center .counter-label { font-size: 12px; }
  .pent-letter { width: 130px; }
  .pent-circle { width: 110px; height: 110px; padding: 10px 8px; gap: 2px; }
  .pent-glyph { font-size: 32px; }
  .pent-label { font-size: 8.5px; letter-spacing: 0.03em; line-height: 1.15; }
  .pent-pct { font-size: 12px; margin-top: 8px; }
  /* Posiciones móviles: radio reducido a 138px; reescritas con CSS variables
     que sobrescriben las inline del template. */
  .pent-a { --x: 0px;    --y: -138px; }
  .pent-b { --x: 131px;  --y: -43px;  }
  .pent-c { --x: 81px;   --y: 112px;  }
  .pent-d { --x: -81px;  --y: 112px;  }
  .pent-e { --x: -131px; --y: -43px;  }
  .counter-caption { font-size: 12px; max-width: 420px; }
  .archive-item-grade { width: 32px; height: 32px; font-size: 18px; }
  .archive-item-title { font-size: 17px; }
}
