/* ==========================================================================
   rodriguezricardo.net – site styles
   One stylesheet for every page, in English and Spanish.
   ========================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #1c2430;
  --muted: #4f5b6b;
  --border: #d9dee6;
  --brand: #16365c;          /* deep navy */
  --brand-2: #23558f;
  --accent: #b5482a;         /* warm accent for highlights */
  --link: #1f56a6;
  --link-hover: #133a72;
  --focus: #f0a400;
  --on-brand: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 4px 16px rgba(16, 32, 56, .06);
  --max: 72rem;
  --measure: 46rem;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --surface: #161d27;
    --surface-2: #1d2633;
    --text: #e6eaf0;
    --muted: #a7b1bf;
    --border: #2c3747;
    --brand: #0d2340;
    --brand-2: #8fb6ea;
    --accent: #f08d6e;
    --link: #8fbaf5;
    --link-hover: #c3dafb;
    --shadow: none;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}
img, iframe, video { max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: from-font; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
main:focus { outline: none; }

h1, h2, h3 { line-height: 1.25; color: var(--text); font-weight: 700; }
h1 { font-family: var(--font-serif); font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.5rem); margin: .2em 0 .6em; letter-spacing: -.01em; }
h2 { font-size: 1.4rem; margin: 2.2rem 0 .8rem; padding-bottom: .35rem; border-bottom: 2px solid var(--border); }
h3 { font-size: 1.12rem; margin: 1.6rem 0 .5rem; }
p, ul, ol { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; }
li + li { margin-top: .35rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
strong { font-weight: 650; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1rem; }
@media (min-width: 48rem) { .container { padding: 0 1.5rem; } }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--surface); color: var(--link); padding: .6rem 1rem; border-radius: var(--radius);
  box-shadow: var(--shadow); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ---------- Header ---------- */
.site-header {
  background: var(--brand);
  color: var(--on-brand);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.header-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; min-width: 0; }
.brand:hover { color: inherit; }
.brand-photo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, .6); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-role { font-size: .82rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-tools { display: flex; align-items: center; gap: .5rem; flex: none; }
@media (max-width: 30rem) {
  .brand-photo, .brand-role { display: none; }
  .brand-name { font-size: .98rem; white-space: normal; line-height: 1.2; }
  .nav-toggle { padding: .4rem .6rem; }
  .nav-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

.lang-switch { display: flex; border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px; overflow: hidden; font-size: .85rem; font-weight: 700; }
.lang-switch > * { padding: .3rem .7rem; color: var(--on-brand); text-decoration: none; min-height: 2rem; display: inline-flex; align-items: center; }
.lang-switch .lang-current { background: rgba(255, 255, 255, .95); color: #16365c; }
.lang-switch a:hover { background: rgba(255, 255, 255, .15); color: var(--on-brand); }

.nav-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  font: inherit; font-size: .9rem; font-weight: 600;
  color: var(--on-brand); background: transparent;
  border: 1px solid rgba(255, 255, 255, .45); border-radius: 8px; padding: .4rem .75rem; min-height: 2.5rem; cursor: pointer;
}
.nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; transition: transform .2s;
}
.nav-toggle-icon::before, .nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
.nav-toggle-icon::before { top: -6px; }
.nav-toggle-icon::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after { transform: translateY(-6px) rotate(-45deg); }

/* Navigation: mobile first */
.site-nav { background: var(--brand); border-top: 1px solid rgba(255, 255, 255, .12); }
.js .site-nav { display: none; }
.js .site-nav.is-open { display: block; max-height: calc(100vh - 4rem); overflow-y: auto; }
.nav-list { list-style: none; margin: 0 auto; padding-top: .25rem; padding-bottom: .75rem; }
.nav-list li + li { margin-top: 0; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: .7rem .25rem; min-height: 2.75rem;
  color: var(--on-brand); text-decoration: none; font: inherit; font-weight: 600; font-size: 1rem;
  background: none; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .1); text-align: left; cursor: pointer;
}
.nav-link:hover { color: var(--on-brand); background: rgba(255, 255, 255, .07); }
.sub-toggle::after {
  content: ""; width: .5rem; height: .5rem; margin-left: .5rem; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform .2s;
}
.sub-toggle[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-2px); }
.submenu { list-style: none; margin: 0; padding: .25rem 0 .5rem .75rem; }
.js .submenu { display: none; }
.js .sub-toggle[aria-expanded="true"] + .submenu { display: block; }
.submenu a { display: block; padding: .5rem .5rem; color: #dbe6f5; text-decoration: none; border-radius: 6px; }
.submenu a:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.submenu a[aria-current="page"], .nav-link[aria-current="page"] { color: #fff; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .3em; }
.nav-item.is-active > .nav-link { color: #ffd88a; }

@media (min-width: 64rem) {
  .nav-toggle { display: none; }
  .js .site-nav, .site-nav { display: block; }
  .nav-list { display: flex; flex-wrap: wrap; gap: .1rem; padding-top: 0; padding-bottom: 0; }
  .nav-item { position: relative; }
  .nav-link { width: auto; border: 0; padding: .55rem .8rem; min-height: 2.75rem; font-size: .95rem; border-radius: 6px 6px 0 0; }
  .submenu {
    position: absolute; left: 0; top: 100%; min-width: 15rem; z-index: 60;
    background: var(--surface); padding: .4rem; border-radius: 0 var(--radius) var(--radius) var(--radius);
    box-shadow: 0 10px 30px rgba(10, 20, 40, .2); border: 1px solid var(--border);
  }
  .submenu a { color: var(--text); padding: .45rem .7rem; }
  .submenu a:hover { color: var(--link-hover); background: var(--surface-2); }
  .submenu a[aria-current="page"] { color: var(--link); background: var(--surface-2); }
  .sub-toggle[aria-expanded="true"] { background: var(--surface); color: var(--brand); }
  /* Without JavaScript, open menus on hover/focus */
  html:not(.js) .has-sub:hover > .submenu,
  html:not(.js) .has-sub:focus-within > .submenu { display: block; }
  html:not(.js) .submenu { display: none; }
}
@media (min-width: 64rem) and (prefers-color-scheme: dark) {
  .sub-toggle[aria-expanded="true"] { color: var(--text); }
}

/* ---------- Main content ---------- */
main { display: block; padding: 1.5rem 0 3rem; }
.content > * { max-width: var(--measure); }
.content > .wide, .content > .hero, .content > .card-grid, .content > .embed-grid, .content > .gallery, .content > .people { max-width: none; }
.breadcrumb { font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.breadcrumb ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.breadcrumb li + li { margin-top: 0; }
.breadcrumb li + li::before { content: "›"; margin: 0 .4rem 0 .15rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }

.lead { font-size: 1.15rem; color: var(--muted); }
.note {
  background: var(--surface-2); border-left: 4px solid var(--brand-2); border-radius: 0 var(--radius) var(--radius) 0;
  padding: .8rem 1rem; margin: 1rem 0 1.5rem;
}
.note > :last-child { margin-bottom: 0; }
.highlight { border-left-color: var(--accent); }
.tag {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .25rem;
}

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.card > :last-child { margin-bottom: 0; }
.card h3 { margin-top: 0; }
.card-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); margin-bottom: 1.5rem; }
.card-grid .card { margin: 0; }

/* Lists of publications / items */
.pubs { padding-left: 0; list-style: none; counter-reset: pub; }
.pubs > li {
  position: relative; padding: .8rem 0 .8rem 2.6rem; margin: 0; border-bottom: 1px solid var(--border);
  counter-increment: pub;
}
.pubs > li::before {
  content: counter(pub); position: absolute; left: 0; top: .85rem;
  min-width: 2rem; text-align: right; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums;
}
ol.pubs[reversed] > li { counter-increment: pub -1; }
.items { padding-left: 0; list-style: none; }
.items > li { padding: .7rem 0; margin: 0; border-bottom: 1px solid var(--border); }
.items > li:last-child, .pubs > li:last-child { border-bottom: 0; }
.plain-list { list-style: none; padding: 0; }
.plain-list li + li { margin-top: .25rem; }

/* Definition-style key/value rows (dates, etc.) */
.kv { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
.kv dt { font-weight: 600; color: var(--muted); }
.kv dd { margin: 0; }
@media (max-width: 30rem) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: .4rem; } }

/* Timeline (education / experience) */
.timeline { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.timeline > li { display: grid; grid-template-columns: 1fr; gap: .5rem 1.25rem; padding: 1rem 0; border-bottom: 1px solid var(--border); margin: 0; }
.timeline > li:last-child { border-bottom: 0; }
.timeline .when { font-weight: 700; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.timeline .logo { max-height: 64px; width: auto; margin-top: .4rem; display: block; background: #fff; border-radius: 6px; padding: 4px; }
.timeline p { margin-bottom: .35rem; }
@media (min-width: 40rem) { .timeline > li { grid-template-columns: 10rem 1fr; } }

/* Two-column helper converted from legacy table rows */
.cols { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 1rem; align-items: start; }
@media (min-width: 40rem) { .cols { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); } }
.cols > * { margin: 0; }

/* Media */
figure { margin: 1.25rem 0; }
figcaption { font-size: .9rem; color: var(--muted); margin-top: .4rem; }
.content img { border-radius: 6px; }
.content .hero-photo, .content .person img, .content .testimonial img { border-radius: 50%; }
.gallery { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); margin: 1rem 0 1.5rem; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: auto; display: block; }
.embed { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; margin: 1rem 0 1.5rem; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.embed-grid figure { margin: 0; }
.embed-grid .embed { margin: 0 0 .5rem; }
.float-img { float: right; margin: 0 0 1rem 1.25rem; max-width: 40%; }
@media (max-width: 40rem) { .float-img { float: none; margin: 0 0 1rem; max-width: 100%; } }

/* People (collaborators, references, testimonials) */
.people { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); margin-bottom: 1.5rem; }
.person { display: flex; gap: 1rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.person img { width: 84px; height: 84px; object-fit: cover; border-radius: 50%; flex: none; }
.person h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
.person p { margin: 0 0 .3rem; font-size: .95rem; }
.quote { margin: 0 0 1.25rem; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand-2); border-radius: 0 var(--radius) var(--radius) 0; }
.quote footer { font-weight: 600; color: var(--muted); margin-top: .5rem; }

/* Tables (real data tables only) */
.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; min-height: 2.75rem;
  border-radius: 8px; font-weight: 600; text-decoration: none; border: 1px solid var(--brand-2);
  color: var(--brand-2); background: transparent;
}
.btn:hover { background: var(--surface-2); color: var(--link-hover); }
.btn-primary { background: var(--brand-2); color: #fff; }
.btn-primary:hover { background: var(--link-hover); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0f141b; } .btn-primary:hover { color: #0f141b; background: var(--link-hover); } }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.25rem 0 0; }

/* ---------- Home ---------- */
.hero {
  display: grid; gap: 1.5rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.5);
  padding: 1.5rem; box-shadow: var(--shadow); margin: .5rem 0 2rem;
}
.hero-photo { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 4px solid var(--surface-2); }
.hero h1 { margin: 0 0 .3rem; }
.hero .role { font-size: 1.15rem; font-weight: 600; color: var(--accent); margin: 0 0 .5rem; }
.hero .affil { margin: 0 0 .25rem; color: var(--muted); }
@media (min-width: 48rem) {
  .hero { grid-template-columns: auto 1fr auto; padding: 2rem; }
  .hero-photo { width: 180px; height: 180px; }
}
.hero-logo { width: 110px; height: auto; background: #fff; border-radius: 8px; padding: 6px; }
@media (max-width: 47.99rem) { .hero-logo { display: none; } }

.split { display: grid; gap: 1.5rem; }
@media (min-width: 56rem) { .split { grid-template-columns: 1.6fr 1fr; } .content > .split { max-width: none; } }
.book { display: flex; gap: 1rem; align-items: flex-start; }
.book img { width: 110px; flex: none; box-shadow: var(--shadow); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); gap: .75rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.facts li { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; }
.facts strong { display: block; font-size: 1.35rem; color: var(--brand-2); }

/* ---------- Footer ---------- */
.site-footer { background: #0e2440; color: #d6e0ee; font-size: .95rem; padding: 2.5rem 0 1rem; }
.site-footer h2 { color: #fff; font-size: 1rem; border: 0; margin: 0 0 .6rem; padding: 0; }
.site-footer a { color: #ffffff; }
.site-footer a:hover { color: #ffd88a; }
.footer-grid { display: grid; gap: 1.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.footer-journal { float: left; margin: .2rem .75rem .25rem 0; border-radius: 4px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; border-top: 1px solid rgba(255, 255, 255, .15); margin-top: 2rem; padding-top: 1rem; font-size: .88rem; }
.footer-bottom p { margin: 0; }

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .breadcrumb, .skip-link, .embed { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
  .content > * { max-width: none; }
}

/* Topic chips (research interests) */
.tags-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tags-list li { margin: 0; padding: .3rem .75rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .92rem; }
.content > .card { max-width: var(--measure); }
.muted { color: var(--muted); }

/* Testimonials and reference letters */
.testimonial { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 0 0 1.5rem; }
.testimonial img { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; }
.testimonial blockquote { margin: 0; }
.testimonial blockquote p { margin: 0 0 .75rem; }
.testimonial figcaption { color: var(--muted); font-size: .95rem; }
.testimonial figcaption strong { color: var(--text); }
@media (min-width: 40rem) { .testimonial { grid-template-columns: 96px 1fr; } }
