/* =========================================================
   MediaCare website – main stylesheet
   Colours, fonts and spacing are set as variables in :root,
   so the whole look can be adjusted in one place.
   ========================================================= */

@font-face {
  font-family: "MediaCare Sans";
  src: url("../fonts/mcsans-regular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "MediaCare Sans";
  src: url("../fonts/mcsans-italic.woff") format("woff");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "MediaCare Sans";
  src: url("../fonts/mcsans-bold.woff") format("woff");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --indigo: #3b2a9e;          /* brand colour from the mockup */
  --indigo-strong: #2a1d78;   /* hover / pressed */
  --accent-text: #3b2a9e;     /* indigo used for text on the page background */
  --ink: #1d1838;             /* body text */
  --ink-soft: #4a4566;        /* secondary text */
  --paper: #ffffff;           /* page background */
  --surface: #f5f3fc;         /* tinted panels */
  --lavender: #eeebfa;        /* study bands, tags */
  --line: #d9d4f0;            /* rules and borders */
  --evidence: #0b6e5f;        /* "supported by evidence" verdict */
  --myth: #a3214f;            /* "myth" verdict */
  --logo-plate: #ffffff;

  --font: "MediaCare Sans", "Lato", "Carlito", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --measure: 66ch;
  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius-s: 6px;
  --radius-l: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --indigo: #5544c8;
    --indigo-strong: #6a5ad6;
    --accent-text: #b4a9ff;
    --ink: #ecebf7;
    --ink-soft: #b9b5d3;
    --paper: #141127;
    --surface: #1d1938;
    --lavender: #262046;
    --line: #3a3363;
    --evidence: #5fd0b9;
    --myth: #f28bb0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --indigo: #5544c8;
  --indigo-strong: #6a5ad6;
  --accent-text: #b4a9ff;
  --ink: #ecebf7;
  --ink-soft: #b9b5d3;
  --paper: #141127;
  --surface: #1d1938;
  --lavender: #262046;
  --line: #3a3363;
  --evidence: #5fd0b9;
  --myth: #f28bb0;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); color: var(--accent-text); }
h3 { font-size: 1.3rem; }
p, ul, ol { margin: 0 0 1em; }
.prose { max-width: var(--measure); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.35em; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--indigo); color: #fff; padding: 0.6rem 1rem; border-radius: var(--radius-s);
}
.skip-link:focus { top: 1rem; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.wordmark {
  font-weight: 700; font-size: 1.35rem; color: var(--accent-text);
  text-decoration: none; letter-spacing: -0.015em;
}
.nav-toggle {
  display: none; font: inherit; font-size: 1rem; font-weight: 700;
  color: var(--accent-text); background: transparent;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 0.35rem 1rem; cursor: pointer;
}
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.site-nav a {
  display: block; padding: 0.4rem 0.75rem; border-radius: 999px;
  color: var(--ink-soft); text-decoration: none; font-size: 1rem;
}
.site-nav a:hover { color: var(--ink); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--accent-text); font-weight: 700; background: var(--lavender); }

@media (max-width: 860px) {
  .js .nav-toggle { display: inline-block; }
  .js .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--paper); border-bottom: 1px solid var(--line); padding: 0.5rem var(--gutter) 1rem; }
  .js .site-nav.is-open { display: block; }
  .js .site-nav ul { flex-direction: column; }
  .js .site-nav a { padding: 0.7rem 0.75rem; font-size: 1.1rem; }
  .site-header .wrap { flex-wrap: wrap; }
}

/* ---------- Sections ---------- */
main { display: block; }
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section--tint { background: var(--surface); }

/* Page title for inner pages: indigo heading with rule, as in the mockup */
.page-head { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(1.5rem, 3vw, 2.5rem); }
.page-head h1 {
  font-size: clamp(2.4rem, 5.5vw, 3.6rem); color: var(--accent-text);
  padding-bottom: 0.35em; border-bottom: 3px solid var(--indigo); max-width: 22ch; margin-bottom: 0.6em;
}
.lead { font-size: clamp(1.2rem, 2vw, 1.35rem); color: var(--ink-soft); max-width: 58ch; }

.subnav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; padding: 0; list-style: none; }
.subnav a {
  display: inline-block; padding: 0.4rem 0.9rem; background: var(--lavender);
  border-radius: 999px; text-decoration: none; font-size: 1rem; color: var(--ink);
}
.subnav a:hover { background: var(--line); color: var(--accent-text); }

/* Text + image split */
.split { display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.split--flip > :first-child { order: 2; }
.split figure { margin: 0; position: sticky; top: 6rem; }
.split figure img { border-radius: var(--radius-l); width: 100%; height: auto; }
@media (max-width: 820px) {
  .split { grid-template-columns: 1fr; }
  .split--flip > :first-child { order: 0; }
  .split figure { position: static; }
}
.block + .block { margin-top: 2.25rem; }
.block h3 { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.9rem;
  padding: 0.6rem 1.3rem; border-radius: 999px; font: inherit; font-weight: 700; font-size: 1.05rem;
  text-decoration: none; cursor: pointer; border: 2px solid var(--indigo);
}
.btn--primary { background: var(--indigo); color: #fff; }
.btn--primary:hover { background: var(--indigo-strong); border-color: var(--indigo-strong); }
.btn--ghost { background: transparent; color: var(--accent-text); }
.btn--ghost:hover { background: var(--lavender); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

/* ---------- Home hero ---------- */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(4rem, 8vw, 7rem); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.hero h1 {
  font-size: clamp(3.6rem, 10vw, 7.25rem); line-height: 0.92; letter-spacing: -0.035em;
  color: var(--accent-text); margin: 0 0 0.25em;
}
.hero .tagline { font-size: clamp(1.35rem, 2.6vw, 1.8rem); line-height: 1.3; margin: 0 0 1.1rem; max-width: 30ch; }
.hero .tagline + .rule { width: 100%; max-width: 34rem; height: 3px; background: var(--indigo); border: 0; margin: 0 0 1.25rem; }
.hero .intro { color: var(--ink-soft); max-width: 56ch; }
.hero-media img { width: 100%; max-width: 560px; margin-inline: auto; }
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-media img { max-width: 420px; }
}

/* ---------- Studies (a real sequence, so numbered) ---------- */
.studies { list-style: none; margin: 0; padding: 0; counter-reset: study; }
.study { position: relative; padding-left: clamp(0rem, 4vw, 3.5rem); }
.study + .study { margin-top: 2.5rem; }
@media (min-width: 640px) {

  .study__dot {
    position: absolute; left: 0; top: 0.5rem; width: 2.3rem; height: 2.3rem; border-radius: 50%;
    background: var(--indigo); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 1.05rem;
  }
}
@media (max-width: 639px) { .study__dot { display: none; } .study { padding-left: 0; } }
.study__band {
  background: var(--indigo); color: #fff; border-radius: var(--radius-l);
  padding: 1.1rem 1.4rem;
}
.study__band small { display: block; font-size: 0.95rem; opacity: 0.85; margin-bottom: 0.15rem; }
.study__band h3, .study__band h2 { margin: 0; font-size: clamp(1.25rem, 2.4vw, 1.5rem); color: #fff; }
.study__body { padding: 1.1rem 0.25rem 0; }
.study__body p { margin: 0; max-width: var(--measure); }
.study__body .study__link { display: inline-block; margin-top: 0.75rem; font-weight: 700; }

.callout {
  margin-top: 2.5rem; padding: 1.4rem 1.5rem; border-radius: var(--radius-l);
  background: var(--lavender); max-width: 50rem;
}
.callout p:last-child { margin-bottom: 0; }

/* ---------- Topics / tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 1rem 0 0; }
.tags li { background: var(--lavender); color: var(--ink); border-radius: 999px; padding: 0.3rem 0.9rem; font-size: 1rem; }

.objectives { counter-reset: obj; list-style: none; padding: 0; margin: 1.25rem 0 0; max-width: var(--measure); }
.objectives li { counter-increment: obj; position: relative; padding-left: 3rem; margin-bottom: 1.1rem; }
.objectives li::before {
  content: counter(obj); position: absolute; left: 0; top: 0.05rem; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--lavender); color: var(--accent-text); font-weight: 700; display: grid; place-items: center; font-size: 1rem;
}

/* ---------- Team ---------- */
.institution + .institution { margin-top: clamp(3rem, 6vw, 4.5rem); }
.institution__head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem;
  margin-bottom: 1.75rem;
}
.institution__head h3 { font-size: clamp(1.35rem, 2.6vw, 1.65rem); color: var(--accent-text); margin: 0 0 0.2rem; }
.institution__head p { margin: 0; color: var(--ink-soft); font-size: 1rem; max-width: 52ch; }
.logos { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: stretch; }
.logo-plate { display: flex; align-items: center; justify-content: center; background: var(--logo-plate); border-radius: var(--radius-s); padding: 0.4rem 0.5rem; }
.logo-plate img { height: 4.5rem; width: auto; max-width: 15rem; object-fit: contain; }
@media (max-width: 600px) { .logo-plate img { height: 3.75rem; max-width: 11rem; } }
.person { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: 1.5rem 2rem; align-items: start; }
.person + .person { margin-top: 2.25rem; }
.person img { width: 10.5rem; height: 10.5rem; border-radius: var(--radius-s); object-fit: cover; }
.person h4 { font-size: 1.35rem; margin: 0 0 0.15rem; }
.person .role { color: var(--ink-soft); margin: 0 0 0.25rem; font-size: 1.02rem; }
.person .email { display: inline-block; margin-bottom: 0.75rem; font-size: 1.02rem; }
.person p.bio { max-width: var(--measure); margin: 0; }
@media (max-width: 600px) {
  .person { grid-template-columns: 1fr; }
  .person img { width: 9rem; height: 9rem; }
}

/* ---------- Partner logos on home ---------- */
.logo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; list-style: none; padding: 0; margin: 1.75rem 0 0; }
.logo-grid li {
  display: flex; align-items: center; justify-content: center; height: 8.5rem; padding: 1rem 1.25rem;
  background: var(--logo-plate); border-radius: var(--radius-l);
}
.logo-grid img { max-height: 5.5rem; max-width: 100%; width: auto; height: auto; object-fit: contain; }

/* ---------- News ---------- */
.news { list-style: none; padding: 0; margin: 0; }
.news-item { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 0.5rem 2rem; padding: 1.75rem 0; }
.news-item + .news-item { margin-top: 1rem; }
.news-date { font-weight: 700; color: var(--accent-text); line-height: 1.3; }
.news-date .day { display: block; font-size: 2.3rem; line-height: 1; letter-spacing: -0.02em; }
.news-item h3 { font-size: clamp(1.25rem, 2.4vw, 1.5rem); margin-bottom: 0.35rem; }
.news-meta { color: var(--ink-soft); font-size: 1rem; margin-bottom: 0.9rem; }
.badge { display: inline-block; font-size: 0.9rem; font-weight: 700; padding: 0.1rem 0.65rem; border-radius: 999px; background: var(--indigo); color: #fff; margin-bottom: 0.6rem; }
.news-item .prose p:last-child { margin-bottom: 0; }
@media (max-width: 600px) { .news-item { grid-template-columns: 1fr; } .news-date .day { display: inline; font-size: 1.1rem; } }

.empty-state { background: var(--surface); border-radius: var(--radius-l); padding: 1.5rem; color: var(--ink-soft); max-width: 50rem; }
.empty-state p:last-child { margin: 0; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.25rem; list-style: none; padding: 0; margin: 0 0 2rem; max-width: 50rem; }
.contact-card { padding: 0; }
.contact-card h2 { margin-bottom: 0.2rem; font-size: 1.25rem; color: var(--ink); }
.contact-card p { margin: 0 0 0.6rem; color: var(--ink-soft); font-size: 1rem; }
.contact-card a { font-weight: 700; word-break: break-word; }
address { font-style: normal; color: var(--ink-soft); max-width: 50ch; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); padding: 2.5rem 0 calc(2.5rem + env(safe-area-inset-bottom, 0px)); font-size: 0.98rem; color: var(--ink-soft); }
.funding { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.25rem; align-items: start; max-width: 56rem; }
.eu-emblem { display: flex; flex-direction: column; gap: 0.4rem; color: var(--ink); font-weight: 700; font-size: 0.95rem; line-height: 1.2; width: 7.5rem; }
.eu-emblem svg { width: 6rem; height: 4rem; display: block; }
.funding p { margin: 0 0 0.6rem; }
.funding .disclaimer { font-size: 0.88rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; padding: 0; margin: 1.75rem 0 0; }
.footer-links a { color: var(--ink-soft); }
@media (max-width: 520px) { .funding { grid-template-columns: 1fr; } }

/* ---------- Utilities ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt-0 { margin-top: 0; }

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

@media print {
  .site-header, .nav-toggle, .skip-link { display: none !important; }
  body { font-size: 11pt; }
}

/* Compact studies row on the home page */
.studies--row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin-top: 2rem; }
.studies--row .study { padding-left: 0; display: flex; flex-direction: column; }
.studies--row .study + .study { margin-top: 0; }
.studies--row .study::before, .studies--row .study__dot { display: none; }
.studies--row .study__band { flex: 0 0 auto; min-height: 7.75rem; }
.studies--row .study__body { flex: 1 1 auto; }
@media (max-width: 860px) { .studies--row { grid-template-columns: 1fr; } .studies--row .study__band { min-height: 0; } }
.studies-more { margin-top: 1.5rem; font-weight: 700; }

/* Less double spacing directly under a page title */
.page-head + .section { padding-top: clamp(1rem, 3vw, 2rem); }


/* Event poster inside a news item */
.news-figure { margin: 0 0 1.1rem; max-width: 26rem; }
.news-figure a, .news-figure img { display: block; border-radius: var(--radius-l); }
.news-figure img { width: 100%; height: auto; }

.section--tint .empty-state { background: var(--paper); }

/* ---------- Justified text ----------
   Paragraphs and list items are justified; automatic hyphenation
   (uses lang="en" on each page) keeps word spacing even, especially on phones.
   The big tagline on the home page stays left-aligned. */
main p, main li, .site-footer .funding p {
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}
.hero .tagline, .tags li, .subnav li, .contact-card p, .person .role, .news-meta { text-align: left; -webkit-hyphens: manual; hyphens: manual; }

/* Hero image caption (the app is not yet available) */
.hero-media { margin: 0; }
.hero-media figcaption { margin-top: 0.75rem; text-align: center; font-size: 0.95rem; color: var(--ink-soft); }

/* "For families" questions and answers */
.faq { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.25rem; margin-top: 1.75rem; }
.faq-item { background: var(--surface); border-radius: var(--radius-l); padding: 1.4rem 1.5rem; }
.faq-item h3 { font-size: 1.2rem; color: var(--accent-text); margin-bottom: 0.4rem; }
.faq-item p { margin: 0; text-align: left; -webkit-hyphens: manual; hyphens: manual; }

/* Extra space under the role when a person has no email link */
.person .role + .bio { margin-top: 0.6rem; }
.person h4 + .bio { margin-top: 0.6rem; }
