/* ============================================================
   Experimental Psycholinguistics Lab — v2 "scanpath" design
   The site is styled like an eye-tracking experiment:
   fixations (warm red), saccades (blue), heat (yellow).
   ============================================================ */

:root {
  --paper: #F3F0E8;
  --ink: #15171C;
  --muted: #5E626B;
  --line: rgba(21, 23, 28, .14);
  --panel: #FFFFFF;
  --fix: #F0442A;      /* fixation */
  --sacc: #2D5BFF;     /* saccade  */
  --heat: #FFC21A;     /* heatmap  */
  --deep: #15171C;     /* contrast blocks */
  --on-deep: #F3F0E8;
  --pub-text: var(--ink);
  --pub-bold: var(--ink);

  --display: "Arial Black", "Segoe UI Black", "Helvetica Neue", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --max: 1180px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #0F1115; --ink: #ECE9E1; --muted: #9BA0AA; --line: rgba(236, 233, 225, .14);
    --panel: #171A20; --fix: #FF6A4D; --sacc: #7D96FF; --heat: #FFD04D;
    --deep: #1C2029; --on-deep: #ECE9E1; --pub-text: #B9BEC6; --pub-bold: #FFFFFF;
  }
}
:root[data-theme="dark"] {
  --paper: #0F1115; --ink: #ECE9E1; --muted: #9BA0AA; --line: rgba(236, 233, 225, .14);
  --panel: #171A20; --fix: #FF6A4D; --sacc: #7D96FF; --heat: #FFD04D;
  --deep: #1C2029; --on-deep: #ECE9E1; --pub-text: #B9BEC6; --pub-bold: #FFFFFF;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.6 var(--serif);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }
.mono { font-family: var(--mono); font-size: .78rem; letter-spacing: .02em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- top recording strip ---------- */
.strip {
  background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
}
.strip .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 30px; }
.rec { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--fix); animation: blink 1.6s infinite; flex: none; }
@keyframes blink { 50% { opacity: .2; } }
.gaze-toggle {
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer;
  background: none; border: 1px solid color-mix(in srgb, var(--paper) 35%, transparent); border-radius: 99px; padding: .15rem .6rem; white-space: nowrap;
}
.gaze-toggle:hover { border-color: var(--heat); color: var(--heat); }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; min-height: 68px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: .7rem; text-decoration: none; font-family: var(--sans); font-weight: 800; line-height: 1.05; font-size: .95rem; letter-spacing: -.01em; }
.logo-mark { width: 30px; height: 30px; flex: none; }
.logo-mark circle.iris { fill: var(--fix); }
.menu { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1.3rem; font-family: var(--sans); font-size: .92rem; }
.menu a { text-decoration: none; color: var(--muted); position: relative; padding: .2rem 0; }
.menu a:hover, .menu a.active { color: var(--ink); }
.menu a.active::after, .menu a:hover::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 6px; height: 6px; border-radius: 50%; background: var(--fix); transform: translateX(-50%);
}
.menu a.pill { color: var(--paper); background: var(--ink); padding: .4rem .9rem; border-radius: 99px; font-weight: 600; }
.menu a.pill:hover { background: var(--fix); color: #fff; }
.menu a.pill::after { display: none; }
.theme-toggle {
  width: 2.1rem; height: 2.1rem; display: inline-grid; place-items: center; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted);
}
.theme-toggle:hover { color: var(--fix); border-color: var(--fix); }
.theme-toggle svg { width: 1rem; height: 1rem; }
/* Language switch: EN / ES, the current language carries a fixation dot */
.menu a.lang {
  display: inline-flex; align-items: center; gap: .55rem; height: 2.1rem; padding: 0 .75rem;
  border: 1px solid var(--line); border-radius: 99px;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; color: var(--muted);
}
.menu a.lang::after { display: none; }
.menu a.lang .on { color: var(--ink); display: inline-flex; align-items: center; gap: .3rem; }
.menu a.lang .on::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--fix); }
.menu a.lang:hover { border-color: var(--fix); color: var(--fix); }
.menu a.lang:hover .on { color: var(--ink); }

/* ---------- shared bits ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem; margin: 0 0 1rem;
  font-family: var(--mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.eyebrow::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--fix); }
.display { font-family: var(--display); font-weight: 900; letter-spacing: -.035em; line-height: .95; margin: 0; }
h2.display { font-size: clamp(2.2rem, 5vw, 4rem); margin-bottom: 1.5rem; }
section.block { padding: 6rem 0; border-bottom: 1px solid var(--line); }
.more { font-family: var(--sans); font-weight: 600; text-decoration: none; display: inline-flex; gap: .5rem; align-items: center; border-bottom: 2px solid var(--fix); padding-bottom: .1rem; }
.more:hover { color: var(--fix); }

/* ---------- HERO: stimulus + scanpath ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px; background-position: -1px -1px;
}
.hero .wrap { padding-top: 5.5rem; padding-bottom: 5rem; }
.stage { position: relative; }
.stimulus { font-size: clamp(2.3rem, 9.4vw, 8rem); position: relative; z-index: 1; }
.stimulus .w { display: inline-block; }
.scanpath { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
.scanpath .sc { stroke: var(--sacc); stroke-width: 2; fill: none; stroke-linecap: round; }
.scanpath .fx { fill: color-mix(in srgb, var(--fix) 28%, transparent); stroke: var(--fix); stroke-width: 2; }
.scanpath .fx-n { font-family: var(--mono); font-size: 11px; fill: var(--ink); text-anchor: middle; dominant-baseline: central; font-weight: 700; }
.scanpath .cal { fill: none; stroke: var(--sacc); stroke-width: 2; }
.scanpath .cal-dot { fill: var(--sacc); }
.scanpath g { transition: opacity .6s ease; }
.hero-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1.5rem; margin-top: 2.5rem; }
.tagline { font-family: var(--serif); font-style: italic; font-size: clamp(1.25rem, 2.3vw, 1.75rem); max-width: 34rem; margin: 0; line-height: 1.35; }
.readout {
  font-family: var(--mono); font-size: .75rem; color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; min-width: 17rem; line-height: 1.7;
}
.readout b { color: var(--fix); font-weight: 700; }

/* ---------- VISUAL WORLD navigation ---------- */
.vwp-head { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: end; margin-bottom: 2rem; }
.utterance { font-family: var(--serif); font-size: clamp(1.4rem, 3vw, 2.2rem); margin: 0; min-height: 1.5em; }
.utterance .u-word { opacity: 0; display: inline-block; transform: translateY(.3em); transition: opacity .2s, transform .2s; margin-right: .28em; }
.utterance .u-word.on { opacity: 1; transform: none; }
.utterance .u-word.verb { color: var(--sacc); }
.utterance .u-word.noun { color: var(--fix); }
.vwp-note { font-family: var(--mono); font-size: .75rem; color: var(--muted); max-width: 19rem; margin: 0; }
.vwp-note::before { content: "↳ "; color: var(--sacc); }
.vwp { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.q {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 15rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 1.5rem 1.6rem;
  text-decoration: none; transition: border-color .25s, transform .25s, box-shadow .25s; overflow: hidden;
}
.q svg.ico { width: 72px; height: 72px; stroke: var(--ink); stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.q svg.ico .accent { stroke: var(--fix); }
.q .q-label { font-family: var(--display); font-weight: 900; font-size: clamp(1.6rem, 3.2vw, 2.6rem); letter-spacing: -.03em; line-height: 1; }
/* Spanish labels are longer (Investigación, Publicaciones): let them shrink a bit more */
:lang(es) .q .q-label { font-size: clamp(1.1rem, 2.9vw, 2.4rem); overflow-wrap: anywhere; }
@media (max-width: 600px) { :lang(es) .q .q-label { font-size: 5vw; } }
.q .q-meta { font-family: var(--mono); font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.q .q-top { display: flex; justify-content: space-between; align-items: start; }
.q:hover, .q.looked { border-color: var(--fix); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fix) 22%, transparent); }
.q:hover { transform: translateY(-3px); }
.q.looked::after {
  content: ""; position: absolute; inset: auto -20% -60% auto; width: 70%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--heat) 55%, transparent), transparent 65%); pointer-events: none;
}
.vwp-cross {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3;
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--line); font-family: var(--mono); font-size: 1.3rem; color: var(--muted); pointer-events: none;
}
.gaze-dot {
  position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; z-index: 4; pointer-events: none;
  border-radius: 50%; background: color-mix(in srgb, var(--fix) 35%, transparent); border: 2px solid var(--fix);
  transition: left .18s cubic-bezier(.2,.8,.2,1), top .18s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--fix) 12%, transparent);
}

/* ---------- TRIALS (recent publications) ---------- */
.trials-head { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.trial {
  position: relative; background: var(--deep); color: var(--on-deep); border-radius: 22px; padding: clamp(1.75rem, 4vw, 3.5rem);
  min-height: 19rem; display: grid; align-items: center; overflow: hidden;
}
.trial-meta { position: absolute; top: 1.1rem; left: 1.5rem; right: 1.5rem; display: flex; justify-content: space-between; font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.trial-fix { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 3rem; font-weight: 300; opacity: 0; transition: opacity .15s; pointer-events: none; }
.trial.isi .trial-fix { opacity: 1; }
.trial-item { margin: 1.2rem 0 0; font-family: var(--serif); font-size: clamp(1.1rem, 2.1vw, 1.55rem); line-height: 1.45; transition: opacity .25s; max-width: 60rem; }
.trial.isi .trial-item { opacity: 0; }
.trial-item b { color: var(--heat); font-weight: 700; }
.trial-item em { opacity: .85; }
.trial-bar { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--fix); }
.trial-ctrl { display: flex; gap: .5rem; }
.trial-ctrl button {
  width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  cursor: pointer; font-family: var(--mono); font-size: 1rem;
}
.trial-ctrl button:hover { border-color: var(--fix); color: var(--fix); }

/* ---------- CONTACT block ---------- */
.contact { background: var(--fix); color: #fff; }
.contact .wrap { padding-top: 5rem; padding-bottom: 5rem; display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; align-items: end; }
.contact .display { font-size: clamp(2.6rem, 7vw, 6rem); }
.contact .eyebrow { color: rgba(255,255,255,.85); }
.contact .eyebrow::before { border-color: #fff; }
.contact address { font-style: normal; font-size: 1.1rem; line-height: 1.7; }
.contact a { color: #fff; }
.contact .btn {
  display: inline-block; margin-top: 1.2rem; background: #fff; color: var(--fix); text-decoration: none; font-family: var(--sans); font-weight: 700;
  padding: .75rem 1.3rem; border-radius: 99px;
}
.contact .btn:hover { background: var(--ink); color: #fff; }

/* ---------- footer ---------- */
.foot { padding: 1.6rem 0 2.2rem; font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.foot .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- inner page heads ---------- */
.page-head { padding: 4.5rem 0 3rem; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(3rem, 9vw, 7.5rem); }
.page-head .meta { margin-top: 1.25rem; color: var(--muted); }
.crumb { font-family: var(--mono); font-size: .78rem; text-decoration: none; color: var(--muted); display: inline-block; margin-bottom: 1.5rem; }
.crumb:hover { color: var(--fix); }

/* ---------- PEOPLE: areas of interest ---------- */
.aois { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; padding: 3.5rem 0 5rem; }
.aoi { position: relative; text-decoration: none; display: flex; flex-direction: column; gap: .35rem; padding: 1rem; border: 1.5px dashed var(--line); border-radius: 6px; transition: border-color .2s; }
.aoi:hover, .aoi:focus-visible { border-color: var(--fix); outline: none; }
.aoi-tag { position: absolute; top: -.7rem; left: .8rem; background: var(--paper); padding: 0 .4rem; font-family: var(--mono); font-size: .7rem; color: var(--muted); letter-spacing: .08em; }
.aoi:hover .aoi-tag { color: var(--fix); }
.aoi-img { aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: var(--line); position: relative; margin-bottom: .6rem; }
.aoi-img img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); transition: filter .35s, transform .5s; }
.aoi:hover .aoi-img img, .aoi:focus-visible .aoi-img img { filter: none; transform: scale(1.03); }
.aoi-name { font-family: var(--display); font-weight: 900; font-size: 1.55rem; letter-spacing: -.02em; line-height: 1.05; }
.aoi-role { font-family: var(--sans); color: var(--muted); font-size: .95rem; }
.dwell { font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-top: .3rem; }
.dwell b { color: var(--fix); }

/* ---------- PROFILE ---------- */
.profile { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: 3.5rem; padding: 3.5rem 0 4rem; align-items: start; }
.profile .aoi { cursor: default; }
.profile .aoi-img img { filter: none; }
.profile h1 { font-size: clamp(2.6rem, 6vw, 5rem); margin-bottom: 1rem; }
.profile .role { font-family: var(--sans); color: var(--muted); line-height: 1.55; margin: 0 0 1.5rem; }
.profile .bio { font-size: 1.15rem; line-height: 1.65; margin: 0 0 1.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips a, .chip {
  font-family: var(--sans); font-size: .88rem; text-decoration: none; border: 1px solid var(--line); border-radius: 99px; padding: .35rem .85rem; background: var(--panel); color: var(--ink); cursor: pointer;
}
.chips a:hover, .chip:hover { border-color: var(--fix); color: var(--fix); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.profile-pubs { padding: 3rem 0 5rem; border-top: 1px solid var(--line); }

/* ---------- PUBLICATIONS ---------- */
.pubs { padding-left: 1.4rem; margin: 0; }
.pubs li { margin-bottom: 1rem; color: var(--pub-text); line-height: 1.55; }
.pubs li::marker { font-family: var(--mono); font-size: .8em; color: var(--muted); }
.pubs b { font-weight: 700; color: var(--pub-bold); }
.pub-tools { position: sticky; top: 68px; z-index: 20; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); padding: .9rem 0; }
.pub-tools .wrap { display: flex; gap: .6rem 1rem; align-items: center; flex-wrap: wrap; }
.pub-tools input {
  font: inherit; font-family: var(--sans); font-size: .92rem; padding: .4rem .9rem; border-radius: 99px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); min-width: 15rem; flex: 1 1 15rem; max-width: 24rem;
}
.pub-tools input:focus { outline: 2px solid var(--fix); outline-offset: 1px; }
.pub-count { font-family: var(--mono); font-size: .75rem; color: var(--muted); margin-left: auto; }
.year-group { display: grid; grid-template-columns: 11rem 1fr; gap: 2rem; padding: 2.5rem 0; border-bottom: 1px solid var(--line); }
.year-group h3.year {
  margin: 0; font-family: var(--display); font-weight: 900; font-size: 3.6rem; letter-spacing: -.04em; line-height: 1;
  color: transparent; -webkit-text-stroke: 1.5px var(--ink); position: sticky; top: 140px; align-self: start;
}
.year-group[data-year="Preprints"] h3.year { font-size: 1.6rem; -webkit-text-stroke: 0; color: var(--muted); font-family: var(--mono); letter-spacing: .05em; text-transform: uppercase; }
.year-group.hidden, .pubs li.hidden { display: none; }
.no-match { padding: 3rem 0; font-family: var(--mono); color: var(--muted); }

/* ---------- UNDER CONSTRUCTION ---------- */
.prep { padding: 5rem 0 6rem; display: grid; place-items: center; text-align: center; gap: 1.4rem; }
.prep-cross { font-family: var(--mono); font-size: 4.5rem; line-height: 1; color: var(--ink); animation: blink 1.4s steps(1) infinite; }
.prep-title { font-family: var(--display); font-weight: 900; font-size: clamp(1.8rem, 4vw, 2.8rem); letter-spacing: -.03em; margin: 0; }
.prep-bar { width: min(26rem, 80vw); height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.prep-bar span { display: block; height: 100%; width: 35%; background: var(--fix); border-radius: 99px; animation: load 2.4s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-110%); } 100% { transform: translateX(310%); } }
.prep .mono { color: var(--muted); }

/* ---------- gaze trail canvas ---------- */
#gaze-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .top { position: relative; }           /* two-row header shouldn't eat the screen */
  .pub-tools { top: 0; }
  .contact .wrap { grid-template-columns: 1fr; }
  .aois { grid-template-columns: repeat(2, 1fr); }
  .profile { grid-template-columns: 1fr; gap: 2rem; }
  .profile .aoi { max-width: 320px; }
  .vwp-head { grid-template-columns: 1fr; }
  .year-group { grid-template-columns: 1fr; gap: 1rem; }
  .year-group h3.year { position: static; font-size: 2.6rem; }
}
@media (max-width: 640px) {
  .strip .hide-sm { display: none; }
  .top .wrap { min-height: 0; padding-top: .7rem; padding-bottom: .7rem; }
  .menu { gap: .3rem .95rem; font-size: .88rem; }
  .hero .wrap { padding-top: 3.5rem; padding-bottom: 3rem; }
  section.block { padding: 4rem 0; }
  .q { min-height: 10.5rem; padding: 1.1rem; border-radius: 14px; }
  .q svg.ico { width: 48px; height: 48px; }
  .vwp { gap: .6rem; }
  .aois { grid-template-columns: 1fr; max-width: 360px; }
  .readout { min-width: 0; width: 100%; }
  .pub-tools { top: 0; position: relative; }
}
