/* =========================================================================
   INRED — Institute for Research and Education in Digital Technologies
   Design system. Light + dark themes via [data-theme]. Mobile-first.

   Palette : deep teal ink, cool surfaces, cyan signal, warm accent
   Type    : Space Grotesk (display) / Inter (body) / IBM Plex Mono (labels)
   Signature: monospaced section tags  //01 — RESEARCH  + hairline node rules
   ========================================================================= */

/* ---------- Tokens: light ---------- */
:root {
  --ink:        #06243A;
  --ink-2:      #0C3149;
  --surface:    #FFFFFF;
  --surface-2:  #F4F7FA;
  --surface-3:  #E8EEF3;
  --line:       #D7E0E8;
  --text:       #16242E;
  --text-muted: #586672;
  --accent:     #1FA8D8;   /* cyan signal */
  --accent-ink: #0A6E94;
  --warm:       #FF5A1F;   /* used very sparingly */
  --on-accent:  #FFFFFF;
  --hero-text:  #FFFFFF;

  --radius:     14px;
  --radius-sm:  9px;
  --maxw:       1280px;
  --gap:        clamp(1rem, 2vw, 1.6rem);

  --shadow:     0 1px 2px rgba(6,36,58,.06), 0 10px 30px rgba(6,36,58,.07);
  --shadow-lg:  0 24px 60px rgba(6,36,58,.16);

  --ff-display: "Space Grotesk", system-ui, sans-serif;
  --ff-body:    "Inter", system-ui, sans-serif;
  --ff-mono:    "IBM Plex Mono", ui-monospace, monospace;

  /* Editable font sizes (overridable from the admin → Vzhled) */
  --fs-h1:   clamp(2rem, 5vw, 3.4rem);
  --fs-h2:   clamp(1.7rem, 3.4vw, 2.5rem);
  --fs-h3:   clamp(1.2rem, 2vw, 1.45rem);
  --fs-body: clamp(1.12rem, 1.02rem + 0.4vw, 1.28rem);
  --fs-eyebrow:      .76rem;
  --fs-hero-sub:     1.1rem;
  --fs-nav:          .92rem;
  --fs-news-title:   1.12rem;
  --fs-news-text:    .92rem;
  --fs-project-title: 1.25rem;
  --fs-person-name:  .95rem;
  --fs-person-role:  .82rem;
  --fs-btn:          .95rem;
  --fs-footer-h:     1rem;
}

/* ---------- Tokens: dark ---------- */
[data-theme="dark"] {
  --ink:        #050F18;
  --ink-2:      #0A1A28;
  --surface:    #0B1822;
  --surface-2:  #0F2230;
  --surface-3:  #15303F;
  --line:       #23404F;
  --text:       #E7EFF5;
  --text-muted: #93A7B4;
  --accent:     #34C0EA;
  --accent-ink: #8FDCF5;
  --warm:       #FF7A47;
  --on-accent:  #04161F;
  --hero-text:  #EFF6FB;

  --shadow:     0 1px 2px rgba(0,0,0,.3), 0 12px 34px rgba(0,0,0,.45);
  --shadow-lg:  0 28px 70px rgba(0,0,0,.6);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  font-family: var(--ff-body);
  background: var(--surface);
  color: var(--text);
  line-height: 1.7;
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s ease, color .35s ease;
}

img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { width: min(100% - 3rem, var(--maxw)); margin-inline: auto; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--on-accent);
  padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--ff-display); line-height: 1.12; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); margin-bottom: .5rem; }
p { margin-bottom: 1.15rem; }
strong { font-weight: 600; }

.eyebrow {
  font-family: var(--ff-mono);
  font-size: var(--fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .9rem;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--accent);
  display: inline-block;
}

/* =========================================================================
   Header / navigation
   ========================================================================= */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; gap: 1rem;
  height: 64px;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--ff-display); font-weight: 600;
  color: var(--text); text-decoration: none;
}
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--ink));
  display: grid; place-items: center;
  color: #fff; font-family: var(--ff-mono); font-size: .9rem; font-weight: 700;
  flex: none;
}
.brand-text {
  font-size: .78rem; font-weight: 600; line-height: 1.25;
  max-width: 30ch; color: var(--text);
}
.brand-logo { height: 34px; width: auto; flex: none; border-radius: 6px; }

.nav-links {
  display: flex; gap: .25rem; list-style: none;
  margin-left: auto; align-items: center; flex-wrap: wrap;
}
.nav-links a {
  color: var(--text); text-decoration: none;
  font-size: var(--fs-nav); padding: .45rem .6rem; border-radius: 8px;
  transition: background .2s, color .2s;
}
.nav-links a:hover { background: var(--surface-2); color: var(--accent-ink); }

/* ---- Dropdown submenus ---- */
.has-submenu { position: relative; }
.submenu-toggle {
  display: inline-flex; align-items: center; gap: .3rem;
  background: none; border: 0; cursor: pointer;
  color: var(--text); font: inherit; font-size: .92rem;
  padding: .45rem .6rem; border-radius: 8px;
  transition: background .2s, color .2s;
}
.submenu-toggle:hover, .has-submenu:hover .submenu-toggle,
.has-submenu:focus-within .submenu-toggle { background: var(--surface-2); color: var(--accent-ink); }
.submenu-toggle .caret { font-size: .7rem; transition: transform .2s; }
.has-submenu:hover .caret, .has-submenu.open .caret { transform: rotate(180deg); }
.submenu {
  list-style: none; position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 190px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: .35rem;
  display: none; z-index: 60;
}
.has-submenu:hover .submenu, .has-submenu:focus-within .submenu,
.has-submenu.open .submenu { display: block; }
.submenu li { display: block; }
.submenu a { display: block; white-space: nowrap; }

.nav-tools { display: flex; align-items: center; gap: .4rem; }

.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); border-radius: 999px;
  padding: .35rem .6rem; font-size: .82rem; cursor: pointer;
  font-family: var(--ff-mono); letter-spacing: .03em;
  transition: border-color .2s, background .2s, color .2s;
}
.pill:hover { border-color: var(--accent); color: var(--accent-ink); }
.lang-toggle a { color: var(--text-muted); padding: 0 .15rem; }
.lang-toggle a.active { color: var(--accent-ink); font-weight: 700; }

.burger {
  display: none; background: none; border: 1px solid var(--line);
  border-radius: 8px; width: 42px; height: 38px; cursor: pointer;
  color: var(--text); font-size: 1.2rem;
}

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
  position: relative; overflow: hidden;
  background: radial-gradient(120% 120% at 80% -10%, var(--ink-2) 0%, var(--ink) 55%);
  color: var(--hero-text);
  padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem);
}
.hero::before { /* coordinate grid — the digital/scan signature */
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--accent) 14%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 14%, transparent) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(120% 90% at 70% 0%, #000 30%, transparent 75%);
  opacity: .55;
}
.hero .wrap { position: relative; text-align: center; }
.hero.has-video { background: var(--ink); }
/* Background video + legibility overlay */
.hero-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0; border: 0;
  filter: brightness(0.62);
}
.hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,0.66), rgba(0,0,0,0.80));
}
.hero.has-video::before { opacity: .16; z-index: 1; }
.hero.has-video .wrap { z-index: 2; }
/* Centered content */
.hero-logo { max-width: 360px; margin: 0 auto 1.8rem; filter: brightness(0) invert(1); opacity: .96; }
.hero h1 {
  font-size: var(--fs-h1); max-width: 22ch;
  margin: 0 auto .8rem; color: #fff;
}
.hero .sub { color: color-mix(in srgb, var(--hero-text) 82%, transparent); font-size: var(--fs-hero-sub); max-width: 52ch; margin: 0 auto; }
.hero-tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.8rem; justify-content: center; }
.hero-tags span {
  font-family: var(--ff-mono); font-size: .76rem; letter-spacing: .06em;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  color: color-mix(in srgb, var(--hero-text) 92%, transparent);
  padding: .3rem .7rem; border-radius: 999px;
}

/* =========================================================================
   Sections
   ========================================================================= */
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; border-bottom: 1px solid var(--line); }
.section:nth-of-type(even) { background: var(--surface-2); }
.section-head { max-width: none; margin-bottom: 2rem; }
.section-body { max-width: none; }
.section-body p { color: var(--text); }
.section-body a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.section.accent-deep { background: var(--ink); color: var(--hero-text); border-color: var(--ink-2); }
.section.accent-deep h2, .section.accent-deep h3 { color: #fff; }
.section.accent-deep .section-body p,
.section.accent-deep .section-body { color: color-mix(in srgb, var(--hero-text) 86%, transparent); }
.section.accent-deep .eyebrow,
.section.accent-deep .eyebrow { color: var(--accent); }
.section.accent-deep strong { color: var(--accent); }
.section.accent-deep a { color: #fff; }

/* Custom per-section background color — auto text contrast */
.section.sec-bg-dark { color: var(--hero-text); }
.section.sec-bg-dark h2, .section.sec-bg-dark h3 { color: #fff; }
.section.sec-bg-dark .section-body,
.section.sec-bg-dark .section-body p { color: color-mix(in srgb, #fff 88%, transparent); }
.section.sec-bg-dark .eyebrow { color: var(--accent); }
.section.sec-bg-dark strong { color: var(--accent); }
.section.sec-bg-dark a { color: #fff; }
.section.sec-bg-light,
.section.sec-bg-light h2, .section.sec-bg-light h3,
.section.sec-bg-light .section-body,
.section.sec-bg-light .section-body p { color: var(--ink); }
.section.sec-bg-light strong { color: inherit; }

/* =========================================================================
   Team grid
   ========================================================================= */
.people {
  display: grid; gap: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  margin-top: 1.5rem;
}
.person {
  text-align: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem 1rem; box-shadow: var(--shadow);
}
.section:nth-of-type(even) .person { background: var(--surface); }
.person img {
  width: 92px; height: 92px; border-radius: 50%; object-fit: cover;
  margin: 0 auto .8rem; border: 2px solid var(--surface-3);
}
.person .name { font-weight: 600; font-size: var(--fs-person-name); }
.person .role { color: var(--text-muted); font-size: var(--fs-person-role); margin-top: .15rem; }
.person .rg { margin-top: .55rem; }
.person .rg a { display: inline-block; line-height: 0; transition: transform .15s; }
.person .rg a:hover { transform: translateY(-2px); }
.person .rg img { width: 26px; height: 26px; border: 0; display: block; }
/* The ResearchGate icon is a dark circle — invert it in dark mode so it stays readable. */
[data-theme="dark"] .person .rg img { filter: invert(1); }
.people-flat { columns: 2; column-gap: 2rem; max-width: 640px; margin-top: 1rem; }
.people-flat div { break-inside: avoid; color: var(--text-muted); padding: .15rem 0; }
.people-flat a { color: var(--text); text-decoration: none; }
.people-flat a:hover { color: var(--accent-ink); text-decoration: underline; }

/* Clickable person card → profile */
.person-hit {
  display: block; color: inherit; text-decoration: none;
  border-radius: var(--radius-sm); transition: transform .15s;
}
.person-hit:hover { text-decoration: none; transform: translateY(-2px); }
.person-hit:hover .name { color: var(--accent-ink); }
.person:has(.person-hit) { cursor: pointer; }

/* =========================================================================
   Centered headings + justified body (block) text
   ========================================================================= */
.section-head { text-align: center; }
.section-head .eyebrow { display: inline-block; }
.section-body, .project-body, .article-body, .profile-bio,
.news-card .body p, .perex {
  text-align: justify;
  -webkit-hyphens: auto; hyphens: auto;
}
.research-table td, .pub .cite, .people-flat, .gallery { text-align: left; hyphens: manual; }
.section-body h3, .project h3 { text-align: left; }

/* =========================================================================
   Projects (structured)
   ========================================================================= */
.projects { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 2.2rem; }
.project { border-top: 1px solid var(--line); padding-top: 1.6rem; }
.project:first-child { border-top: 0; padding-top: 0; }
.project h3 { font-family: var(--ff-display); font-size: var(--fs-project-title); display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; }
.project-period {
  font-family: var(--ff-mono); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--on-accent); background: var(--accent); padding: .15rem .55rem; border-radius: 999px;
}
.project-body { margin: .6rem 0 .8rem; color: var(--text); }
.project .gallery { margin-top: 1rem; }

/* =========================================================================
   Media coverage list
   ========================================================================= */
.media-list { list-style: none; display: flex; flex-direction: column; gap: 0; margin: 1.2rem auto 0; max-width: 820px; }
.media-item { padding: 1.4rem 0; border-top: 1px solid var(--line); }
.media-item:first-child { border-top: 0; }
.media-meta { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin-bottom: .3rem; }
.media-outlet {
  font-family: var(--ff-mono); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--on-accent); background: var(--accent); padding: .12rem .55rem; border-radius: 999px;
}
.media-date { font-family: var(--ff-mono); font-size: .8rem; color: var(--text-muted); }
.media-title { font-family: var(--ff-display); font-size: clamp(1.3rem, 2.4vw, 1.6rem); font-weight: 600; line-height: 1.28; margin: .15rem 0 0; }
.media-title a { color: var(--text); text-decoration: none; }
.media-title a:hover { color: var(--accent-ink); text-decoration: underline; }
.media-perex { color: var(--text-muted); font-size: .98rem; line-height: 1.6; margin-top: .45rem; max-width: 70ch; }

/* =========================================================================
   Staff profile page
   ========================================================================= */
.profile { display: grid; grid-template-columns: 260px 1fr; gap: 2.4rem; margin-top: 1.4rem; align-items: start; }
.profile-aside { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 1.4rem; }
.profile-photo {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius);
  box-shadow: var(--shadow); background: var(--surface-3);
}
.profile-photo.placeholder {
  display: grid; place-items: center; font-family: var(--ff-display); font-size: 4rem;
  font-weight: 700; color: var(--accent); background: var(--surface-2);
}
.profile-block .eyebrow { display: block; margin-bottom: .5rem; }
.profile-contact, .profile-links { list-style: none; display: flex; flex-direction: column; gap: .45rem; font-size: .92rem; }
.profile-contact a, .profile-links a { color: var(--accent-ink); word-break: break-word; }
.profile-name { font-family: var(--ff-display); font-size: clamp(1.7rem, 3.5vw, 2.5rem); margin: .35rem 0 .3rem; line-height: 1.15; }
.profile-role { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 1.6rem; }
.profile-section { margin-bottom: 1.8rem; }
.profile-section h2 { font-family: var(--ff-display); font-size: 1.2rem; margin-bottom: .6rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
.profile-bio p { margin-bottom: 1rem; }

@media (max-width: 760px) {
  .profile { grid-template-columns: 1fr; gap: 1.4rem; }
  .profile-aside { position: static; flex-direction: column; }
  .profile-photo { max-width: 220px; }
}

/* =========================================================================
   Publications
   ========================================================================= */
.pub-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.4rem; align-items: center; }
.pub-toolbar .filter {
  font-family: var(--ff-mono); font-size: .8rem; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); border-radius: 999px;
  padding: .3rem .8rem; cursor: pointer;
}
.pub-toolbar .filter.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.pub-list { display: grid; gap: .9rem; }
.pub {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 1rem 1.1rem; box-shadow: var(--shadow);
}
.pub .meta { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; flex-wrap: wrap; }
.pub .year { font-family: var(--ff-mono); font-size: .8rem; color: var(--accent-ink); font-weight: 600; }
.pub .quartiles { display: inline-flex; gap: .25rem; }
.pub .q {
  font-family: var(--ff-mono); font-size: .68rem; font-weight: 700;
  background: var(--surface-3); color: var(--text); border-radius: 5px;
  padding: .08rem .4rem; text-transform: uppercase;
}
.pub .q.q1 { background: #1FA8D8; color: #fff; }
.pub .q.q2 { background: #59c4e6; color: #04222e; }
.pub .q.q3 { background: #9bd6ea; color: #04222e; }
.pub .q.q4 { background: #cfe9f3; color: #04222e; }
.pub .cite { font-size: .95rem; line-height: 1.5; }
.pub .cite a { color: var(--accent-ink); }

.collapsible { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s ease; }
.collapsible.open { grid-template-rows: 1fr; }
.collapsible > div { overflow: hidden; }

/* =========================================================================
   News
   ========================================================================= */
.news-grid {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 1.3rem;
  margin-top: 1.5rem;
}
.news-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s;
  flex: 0 1 300px; max-width: 340px;
}
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.news-card .thumb { aspect-ratio: 16/9; background: var(--surface-3); overflow: hidden; }
.news-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-card .body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.news-card .date { font-family: var(--ff-mono); font-size: .76rem; color: var(--accent-ink); }
.news-card h3 { font-size: var(--fs-news-title); }
.news-card p { color: var(--text-muted); font-size: var(--fs-news-text); margin: 0; }
.news-card a.more { margin-top: auto; font-weight: 600; font-size: .9rem; }

.article { max-width: 760px; margin: 0 auto; }
.article .cover { border-radius: var(--radius); margin: 1.2rem 0 1.6rem; box-shadow: var(--shadow); }
.article .date { font-family: var(--ff-mono); color: var(--accent-ink); font-size: .85rem; }
.article-body p { margin-bottom: 1.1rem; }

/* =========================================================================
   Gallery / lightbox
   ========================================================================= */
.gallery { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.4rem 0; }
.gallery img {
  height: 130px; width: auto; border-radius: var(--radius-sm);
  cursor: zoom-in; object-fit: cover; box-shadow: var(--shadow);
  transition: transform .2s;
}
.gallery img:hover { transform: scale(1.03); }
.lightbox {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: rgba(3,12,18,.86); place-items: center; padding: 2rem; cursor: zoom-out;
}
.lightbox.open { display: grid; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 10px; box-shadow: var(--shadow-lg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--accent); color: var(--on-accent);
  border: 0; border-radius: 999px; padding: .65rem 1.3rem;
  font-weight: 600; font-size: var(--fs-btn); cursor: pointer; text-decoration: none;
  transition: transform .15s, filter .2s;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--accent-ink); border: 1px solid var(--line); }

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  background: var(--ink); color: color-mix(in srgb, var(--hero-text) 80%, transparent);
  padding: 2.6rem 0; font-size: .92rem;
}
.site-footer a { color: var(--accent); }
.site-footer .cols { display: grid; gap: 1.5rem; grid-template-columns: 2fr 1fr 1fr; }
.site-footer h4 { font-family: var(--ff-display); color: #fff; margin-bottom: .6rem; font-size: var(--fs-footer-h); }
.site-footer .fine { margin-top: 2rem; border-top: 1px solid var(--ink-2); padding-top: 1.2rem; color: color-mix(in srgb, var(--hero-text) 55%, transparent); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .25s;
  font-size: 1.1rem;
}
.to-top.show { opacity: 1; pointer-events: auto; }

/* =========================================================================
   Research table
   ========================================================================= */
.research-table-wrap {
  margin: 1.6rem 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); background: var(--surface);
}
.research-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.research-table {
  width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 640px;
}
.research-table thead th {
  background: var(--ink); color: var(--hero-text);
  font-family: var(--ff-mono); font-weight: 500;
  font-size: .74rem; letter-spacing: .04em; text-transform: uppercase;
  text-align: left; padding: .8rem 1rem; white-space: nowrap;
  position: sticky; top: 0;
}
.research-table tbody td {
  padding: .75rem 1rem; border-top: 1px solid var(--line);
  vertical-align: top; color: var(--text);
}
.research-table tbody tr:nth-child(even) td { background: var(--surface-2); }
.research-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.research-table td a { color: var(--accent-ink); font-weight: 600; }
.research-table .num { font-family: var(--ff-mono); color: var(--text-muted); white-space: nowrap; }
.research-table .muted, .muted { color: var(--text-muted); }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 900px) {
  .site-footer .cols { grid-template-columns: 1fr; }
  .burger { display: inline-grid; place-items: center; }
  .nav-links {
    position: fixed; inset: 64px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: .5rem 1.2rem 1rem; box-shadow: var(--shadow-lg);
    transform: translateY(-130%); transition: transform .3s ease;
    max-height: calc(100vh - 64px); overflow: auto;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: .8rem .4rem; border-bottom: 1px solid var(--line); }
  .nav-links a:last-child { border-bottom: 0; }
  .nav-tools { margin-left: auto; }

  /* Submenus become inline accordions in the mobile menu */
  .has-submenu { width: 100%; }
  .submenu-toggle {
    width: 100%; justify-content: space-between;
    padding: .8rem .4rem; border-bottom: 1px solid var(--line); border-radius: 0;
  }
  .submenu {
    position: static; display: none; box-shadow: none; border: 0; border-radius: 0;
    min-width: 0; padding: 0 0 .4rem .8rem; background: transparent;
  }
  .has-submenu.open .submenu { display: block; }
  .has-submenu:hover .submenu { display: none; } /* hover shouldn't open on touch */
  .has-submenu.open .submenu { display: block; }
  .submenu a { padding: .6rem .4rem; }
}

@media (max-width: 540px) {
  .brand-text { font-size: .68rem; max-width: 16ch; line-height: 1.2; }
  .people { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .people-flat { columns: 1; }
  .gallery img { height: 96px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Scroll-reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Version label in the footer */
.site-footer .version { font-family: var(--ff-mono); opacity: .7; font-size: .85em; }

/* Section featured image — responsive, adapts to size */
.section-featured { margin: 0 0 1.6rem; text-align: center; }
.section-featured img { border-radius: 14px; display: block; }

/* Full width: whole image shown, no vertical crop, no outline */
.section-featured.size-full img {
  width: 100%; height: auto; margin-inline: auto;
}

/* Percentage widths of the content column, centered, whole image (no crop) */
.section-featured.size-large img,
.section-featured.size-medium img,
.section-featured.size-small img {
  height: auto; margin-inline: auto; border: 0; border-radius: 0;
}
.section-featured.size-large img  { width: 80%; }
.section-featured.size-medium img { width: 60%; }
.section-featured.size-small img  { width: 42%; }

/* On phones the image always spans the full width */
@media (max-width: 700px) {
  .section-featured.size-large img,
  .section-featured.size-medium img,
  .section-featured.size-small img { width: 100%; }
}

/* News cover image (small intro image) */
.news-card .news-media { display: block; overflow: hidden; background: var(--surface-3); border-bottom: 1px solid var(--line); }
.news-card .news-media img { width: 100%; height: auto; display: block; transition: transform .3s; }
.news-card.has-media:hover .news-media img { transform: scale(1.03); }
.article-cover { margin: 1rem 0 1.4rem; }
.article-cover img { width: 100%; height: auto; border-radius: 14px; display: block; border: 1px solid var(--line); }

/* Divider between the projects intro text and the list */
.section-divider { border: 0; border-top: 1px solid var(--line); margin: 2rem 0 0; }

/* Project thumbnail (left of the title), uniform size */
.project-head { display: flex; align-items: flex-start; gap: 1rem; }
.project-thumb {
  width: 72px; height: 72px; flex: none; object-fit: contain;
  border-radius: 10px; background: var(--surface-3); padding: 4px;
}
.project-head h3 { margin: 0; }
@media (max-width: 560px) {
  .project-thumb { width: 56px; height: 56px; }
}

/* Gadget box — bounded space for a small abstract animation */
.inred-gadget {
  position: relative; width: 100%; min-height: 120px;
  border-radius: 14px; overflow: hidden; margin: 1.4rem 0;
  background: var(--surface-2, transparent);
}
.inred-gadget canvas { position: absolute; inset: 0; }

/* Downloadable file link with a standardized download icon */
.file-dl {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .5rem .85rem; margin: .15rem .25rem .15rem 0;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--accent-ink);
  text-decoration: none; font-weight: 600; line-height: 1.2;
  transition: background .15s, border-color .15s, transform .15s;
}
.file-dl:hover { background: var(--surface-3); border-color: var(--accent); transform: translateY(-1px); }
.file-dl::before {
  content: ""; width: 20px; height: 20px; flex: none;
  background: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%231FA8D8'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M14%202v5a1%201%200%200%200%201%201h5'/%3E%3Cpath%20d='M6%202h8l6%206v12a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2V4a2%202%200%200%201%202-2z'/%3E%3Cpath%20d='M12%2011v6'/%3E%3Cpath%20d='m9%2014%203%203%203-3'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ===== On-site chatbot widget ===== */
.inred-chat { position: fixed; right: 18px; bottom: 18px; z-index: 900; font-family: var(--ff-body); }
.inred-chat-launcher {
  width: 76px; height: 76px; border: 0; background: transparent; cursor: pointer; padding: 0;
  border-radius: 50%; transition: transform .2s; filter: drop-shadow(0 6px 16px rgba(6,36,58,.28));
}
.inred-chat-launcher img { width: 100%; height: 100%; object-fit: contain; display: block; }
.inred-chat-launcher:hover { transform: scale(1.08); }
.inred-chat.open .inred-chat-launcher { transform: scale(.9); opacity: .85; }

.inred-chat-panel {
  position: fixed; right: 18px; bottom: 104px; width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 140px)); background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden; animation: chatpop .18s ease;
}
.inred-chat.open .inred-chat-panel { display: flex; }
@keyframes chatpop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.inred-chat-head {
  display: flex; align-items: center; gap: .55rem; padding: .7rem .9rem;
  background: var(--ink); color: #fff; font-weight: 600;
}
.inred-chat-headava { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #fff; }
.inred-chat-headtitle { flex: 1; font-size: .95rem; }
.inred-chat-close { background: transparent; border: 0; color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer; opacity: .8; }
.inred-chat-close:hover { opacity: 1; }

.inred-chat-msgs { flex: 1; overflow-y: auto; padding: 1rem .9rem; display: flex; flex-direction: column; gap: .7rem; background: var(--surface-2); }
.inred-chat-msg { display: flex; gap: .5rem; align-items: flex-end; max-width: 100%; }
.inred-chat-msg .ava { width: 30px; height: 30px; border-radius: 50%; flex: none; object-fit: cover; background: var(--surface-3); }
.inred-chat-msg .bub { padding: .6rem .8rem; border-radius: 14px; font-size: .9rem; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.inred-chat-msg.bot .bub { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.inred-chat-msg.bot.error .bub { background: #fdecec; border-color: #f0b4b4; color: #a12020; }
.inred-chat-msg.user { justify-content: flex-end; }
.inred-chat-msg.user .bub { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.inred-chat-msg .bub a { color: inherit; font-weight: 700; text-decoration: underline; }
.inred-chat-msg.bot .bub a { color: var(--accent-ink); }

.inred-chat-msg.typing .bub { display: inline-flex; gap: 4px; }
.inred-chat-msg.typing .bub span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: chatdot 1s infinite; }
.inred-chat-msg.typing .bub span:nth-child(2) { animation-delay: .15s; }
.inred-chat-msg.typing .bub span:nth-child(3) { animation-delay: .3s; }
@keyframes chatdot { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.inred-chat-form { display: flex; gap: .5rem; padding: .7rem .8rem; border-top: 1px solid var(--line); background: var(--surface); }
.inred-chat-form input { flex: 1; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; font-size: .9rem; }
.inred-chat-form input:focus { outline: none; border-color: var(--accent); }
.inred-chat-form button { border: 0; background: var(--accent); color: #fff; border-radius: 10px; width: 42px; cursor: pointer; font-size: 1rem; }
.inred-chat-form button:hover { background: var(--accent-ink); }
@media (max-width: 480px) {
  .inred-chat-launcher { width: 64px; height: 64px; }
  .inred-chat-panel { right: 10px; bottom: 84px; }
}

/* Media coverage year selector */
.media-toolbar { display: flex; align-items: center; gap: .6rem; margin: 0 auto 1.4rem; max-width: 820px; }
.media-toolbar label { font-family: var(--ff-mono); font-size: .8rem; color: var(--text-muted); letter-spacing: .04em; }
.media-year-select {
  font: inherit; font-size: .95rem; padding: .5rem 2rem .5rem .8rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer;
  appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
}
.media-year-select:focus { outline: none; border-color: var(--accent); }

/* Section image: light/dark variants (only swap when a dark image is provided) */
.section-featured .sec-img-dark { display: none; }
[data-theme="dark"] .section-featured.has-dark .sec-img-light { display: none; }
[data-theme="dark"] .section-featured.has-dark .sec-img-dark  { display: block; }

/* Media coverage: center the list column + top image */
.media-wrap { max-width: 760px; margin: 0 auto; }
.media-top-image { max-width: 760px; margin: 0 auto 2rem; text-align: center; }
.media-top-image img { max-width: 100%; height: auto; border-radius: 14px; display: block; margin: 0 auto; }
.media-top-image .sec-img-dark { display: none; }
[data-theme="dark"] .media-top-image.has-dark .sec-img-light { display: none; }
[data-theme="dark"] .media-top-image.has-dark .sec-img-dark  { display: block; }
