/* manueltorressahli.com — tokens and layout.
   Warm paper and the logo's walnut brown for identity; a cold petrol accent so the
   page does not read as the clay-and-cream look everyone now associates with one AI
   company. Literata for reading, IBM Plex Sans for navigation and labels. */

:root {
  --paper: #F7F4EE;
  --paper-2: #EFEAE1;
  --ink: #1C1A17;
  --walnut: #2A160C;
  --muted: #6B655C;
  --rule: #C9C1B2;              /* ≥ 1,6:1 sobre el papel; antes #D9D3C8 a 1,36:1 */
  --rule-soft: rgba(107, 101, 92, 0.4);   /* --muted al 40 %, borde de la píldora */
  --accent: #1F4E6E;
  --accent-2: #2E6E8E;
  --serif: "Literata", "Cambria", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --measure: 44rem;
  --wide: 64rem;
  --gutter: 7rem;               /* columna de fecha + estado */
}

* { box-sizing: border-box; }
html { font-size: 106.25%; }    /* relativo al tamaño elegido en el navegador */
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 0.15em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; height: auto; }

/* skip link */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 20;
  font-family: var(--sans); font-size: 0.9rem;
  background: var(--paper-2); color: var(--ink);
  border: 1px solid var(--rule); padding: 0.6rem 1rem;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: var(--wide); margin: 0 auto; padding: 1.1rem 1.25rem;
}
.brand {
  display: flex; align-items: center; gap: 0.7rem; white-space: nowrap;
  color: var(--walnut); font-family: var(--sans); font-weight: 500; letter-spacing: 0.01em;
}
.brand img { width: 44px; height: 44px; }
.brand:hover { text-decoration: none; }
nav.main { font-family: var(--sans); font-size: 0.92rem; }
nav.main a {
  color: var(--ink); margin-left: 1.1rem; padding-bottom: 0.2rem;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
nav.main a:hover { text-decoration: none; border-color: var(--rule); }
nav.main a.active, nav.main a[aria-current="page"] { border-color: var(--accent); }

/* page frame */
main { max-width: var(--wide); margin: 0 auto; padding: 1rem 1.25rem 4rem; }
.measure { max-width: var(--measure); }
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 600; line-height: 1.2; letter-spacing: -0.005em; }
h1 { font-size: 2.1rem; margin: 1.6rem 0 0.6rem; }
h2 {
  font-size: 1.25rem; margin: 2.4rem 0 0.8rem; padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule); color: var(--walnut);
  max-width: var(--measure);    /* el filete no se prolonga sobre el aire */
}
h3 { font-size: 1.05rem; margin: 1.4rem 0 0.3rem; }
h4 { font-size: 1rem; margin: 1.2rem 0 0.3rem; }
p { margin: 0 0 1rem; max-width: var(--measure); }
.lead { font-size: 1.15rem; line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.kicker { font-family: var(--sans); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
details.legend { margin: 0.4rem 0 1.6rem; max-width: var(--measure); }
details.legend summary { font-family: var(--sans); font-size: 0.9rem; color: var(--accent); cursor: pointer; }
details.legend summary:hover { color: var(--accent-2); }
details.legend p { margin: 0.5rem 0 0; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 2.5rem; align-items: start; margin-top: 1rem; }
.hero img { width: 220px; border-radius: 4px; filter: saturate(0.92); }
.hero h1 { margin-top: 0.6rem; }
.hero .links { font-family: var(--sans); font-size: 0.9rem; max-width: none; }
.hero .links a { margin-right: 1rem; padding: 0.3rem 0; display: inline-block; }

/* research line cards */
.lines { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1rem; align-items: start; }
.line { background: #fff; border: 1px solid var(--rule); border-top: 3px solid var(--accent); padding: 1.1rem 1.2rem 1rem; }
.line h3 { margin-top: 0.2rem; }
.line p { font-size: 0.95rem; margin-bottom: 0.6rem; max-width: var(--measure); }
.line .status { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); }

/* contact */
p.contact-mail { font-family: var(--sans); font-size: 0.95rem; margin-bottom: 0.35rem; }

/* work items */
.item { display: grid; grid-template-columns: var(--gutter) minmax(0, 1fr); gap: 1.25rem; padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.item .when {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem;
  font-family: var(--sans); font-size: 0.85rem; color: var(--muted); padding-top: 0.25rem;
}
.item .when .status {
  display: inline-block; padding: 0.1rem 0.5rem; white-space: nowrap;
  border: 1px solid var(--rule-soft); border-radius: 999px;
  font-size: 0.74rem; color: var(--ink); background: var(--paper-2);
}
.item h3, .item h4 { font-size: 1.15rem; margin: 0 0 0.3rem; }
.item .title-es { font-size: 0.9rem; color: var(--muted); font-style: italic; margin: -0.1rem 0 0.35rem; max-width: var(--measure); }
.item .with { font-size: 0.92rem; color: var(--muted); margin-bottom: 0.5rem; }
.item p.headline { margin-bottom: 0.5rem; max-width: var(--measure); }
.item .artifact { font-family: var(--sans); font-size: 0.88rem; }

/* publications */
ol.pubs { padding-left: 1.6rem; }
ul.pubs.selected { list-style: none; padding-left: 0; }
p.record { margin: 1.6rem 0 0; padding: 0.8rem 1rem; border-left: 3px solid var(--accent); background: var(--paper-2); font-size: 0.95rem; }
ol.pubs li, ul.pubs li { margin-bottom: 0.8rem; padding-left: 0.2rem; max-width: var(--measure); }
ol.pubs .meta, ul.pubs .meta { color: var(--muted); font-size: 0.88rem; }
.meta { overflow-wrap: anywhere; }

/* entries (record) */
.entry { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1.25rem; padding: 0.7rem 0; }
.entry.nodate { display: block; max-width: var(--measure); }   /* sin fecha, sin gutter */
.entry .when { font-family: var(--sans); font-size: 0.85rem; color: var(--accent); padding-top: 0.2rem; }
.entry .title { font-weight: 600; }
.entry .meta { color: var(--muted); }
.entry p { margin: 0.2rem 0 0; font-size: 0.95rem; max-width: var(--measure); }

/* two columns for the long pages */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 3rem; }
aside.side { font-family: var(--sans); font-size: 0.88rem; color: var(--muted); }
aside.side h4 { margin: 1.2rem 0 0.4rem; color: var(--walnut); font-weight: 600; }
aside.side ul { list-style: none; padding: 0; margin: 0; }
aside.side li { margin-bottom: 0.35rem; }

/* footer */
.site-footer { border-top: 1px solid var(--rule); margin-top: 3rem; }
.site-footer .inner {
  max-width: var(--wide); margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem;
  font-family: var(--sans); font-size: 0.85rem; color: var(--muted);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
  gap: 0.15rem 0.6rem; text-align: center;
}
/* El separador cuelga del span ANTERIOR: al envolver queda al final de la línea y
   nunca huérfano al principio de la siguiente. */
.site-footer .inner span:not(:last-child)::after { content: "\00a0·"; color: var(--muted); }
.site-footer a { padding: 0.3rem 0; display: inline-block; }

/* cabecera intermedia: entre 761 y ~1100 px la marca se apila sobre el menú y el
   menú envuelve por ítems completos, nunca partiendo una etiqueta por dentro */
@media (max-width: 1100px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  nav.main { display: flex; flex-wrap: wrap; gap: 0 1.1rem; }
  nav.main a { margin-left: 0; }
}

@media (max-width: 760px) {
  html { font-size: 100%; }
  .hero { grid-template-columns: 1fr; }
  .hero img { width: 160px; }
  .lines { grid-template-columns: 1fr; }
  .item, .entry { grid-template-columns: 1fr; gap: 0.2rem; }
  .item .when { flex-direction: row; align-items: center; gap: 0.5rem; }
  .cols { grid-template-columns: 1fr; }
}
