/* =========================================================
   EMERGENT Lebanon — main stylesheet
   Colours and fonts are defined once below (":root").
   ========================================================= */

:root {
  --ink: #0f2a3d;          /* deep navy – headings, header */
  --ink-2: #33495a;        /* body text */
  --muted: #64788a;
  --teal: #12877f;         /* primary accent */
  --teal-dark: #0b6560;
  --teal-light: #5fd3c6;
  --teal-wash: #e7f4f2;
  --coral: #e4572e;        /* alert / highlight */
  --coral-wash: #fdeee9;
  --sand: #f6f4ef;         /* alternate section background */
  --line: #dfe5e8;
  --white: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 42, 61, .06), 0 8px 24px rgba(15, 42, 61, .06);
  --max: 1160px;
  --font-head: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--teal-dark); text-underline-offset: 3px; }
a:hover { color: var(--coral); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); line-height: 1.2; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(2.1rem, 4.4vw, 3.3rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.container { width: min(var(--max), 100% - 2.5rem); margin-inline: auto; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; }
:focus-visible { outline: 3px solid var(--teal-light); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.brand img { width: 42px; height: 42px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 800; letter-spacing: .08em; font-size: 1.05rem; }
.brand-sub { font-size: .7rem; letter-spacing: .32em; color: var(--teal); font-weight: 600; }
.nav ul { list-style: none; display: flex; gap: .2rem; margin: 0; padding: 0; align-items: center; }
.nav a {
  display: block; padding: .5rem .75rem; border-radius: 8px;
  text-decoration: none; color: var(--ink-2); font-size: .93rem; font-weight: 500;
}
.nav a:hover { background: var(--teal-wash); color: var(--teal-dark); }
.nav a[aria-current="page"] { color: var(--teal-dark); background: var(--teal-wash); font-weight: 600; }
.nav .nav-cta a { background: var(--ink); color: #fff; }
.nav .nav-cta a:hover { background: var(--teal-dark); color: #fff; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; cursor: pointer; color: var(--ink); }
@media (max-width: 1140px) {
  .nav-toggle { display: inline-flex; }
  .nav { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); display: none; }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; align-items: stretch; padding: .75rem 1.25rem 1.25rem; }
  .nav a { padding: .75rem .9rem; }
}

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.3rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
  text-decoration: none; border: 2px solid transparent; transition: .15s ease; cursor: pointer;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); color: #fff; }
.btn-ghost { border-color: rgba(255,255,255,.5); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn-outline { border-color: var(--teal); color: var(--teal-dark); }
.btn-outline:hover { background: var(--teal-wash); color: var(--teal-dark); }
.chip {
  display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .04em;
  padding: .2rem .65rem; border-radius: 999px; background: var(--teal-wash); color: var(--teal-dark);
}
.chip.coral { background: var(--coral-wash); color: #b23c18; }
.chip.ink { background: #e8edf1; color: var(--ink); }
.eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--teal); margin-bottom: .6rem; display: block; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(95, 211, 198, .18), transparent 60%),
    linear-gradient(160deg, #0f2a3d 0%, #123a50 60%, #0e4a55 100%);
  color: #d7e4ea; padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(3rem, 7vw, 5.5rem);
  overflow: hidden;
}
.hero h1 { color: #fff; }
.hero .eyebrow { color: var(--teal-light); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.hero-lead { font-size: 1.15rem; max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
.acronym { font-size: .9rem; color: #9fb6c2; margin-top: 1.4rem; max-width: 40em; }
.acronym b { color: var(--teal-light); font-weight: 700; }
.hero-chart {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px; padding: 1.3rem 1.3rem 1rem;
}
.hero-chart-head { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; color: #9fb6c2; margin-bottom: .6rem; }
.hero-chart-head .alert-pill { background: rgba(228,87,46,.18); color: #ffb39c; padding: .2rem .6rem; border-radius: 999px; font-weight: 600; }
.hero-chart svg .bar { fill: rgba(95, 211, 198, .45); transform-origin: bottom; transform-box: fill-box; animation: grow .8s ease both; }
.hero-chart svg .bar.alert { fill: var(--coral); }
.hero-chart svg .baseline { stroke: #9fb6c2; stroke-dasharray: 4 4; stroke-width: 1.2; fill: none; }
.hero-chart svg .threshold { stroke: #ffb39c; stroke-dasharray: 2 5; stroke-width: 1.4; fill: none; }
.hero-chart-legend { display: flex; gap: 1.2rem; font-size: .75rem; color: #9fb6c2; margin-top: .5rem; flex-wrap: wrap; }
.hero-chart-legend span::before { content: ""; display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: .4rem; background: #9fb6c2; }
.hero-chart-legend span.t::before { background: #ffb39c; }
.hero-chart-legend span.a::before { background: var(--coral); height: 8px; width: 8px; border-radius: 2px; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .hero-chart svg .bar { animation: none; } }
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; } }

/* Page hero (inner pages) */
.page-hero { background: linear-gradient(160deg, #0f2a3d, #123a50); color: #c9d8e0; padding: 3.5rem 0 3rem; }
.page-hero h1 { color: #fff; margin-bottom: .35em; }
.page-hero p { max-width: 46em; font-size: 1.08rem; margin: 0; }
.page-hero .eyebrow { color: var(--teal-light); }
.breadcrumb { font-size: .82rem; margin-bottom: 1rem; color: #9fb6c2; }
.breadcrumb a { color: #9fb6c2; }

/* ---------- Sections ---------- */
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section.alt { background: var(--sand); }
.section-head { max-width: 46em; margin-bottom: 2.4rem; }
.section-head.center { text-align: center; margin-inline: auto; }
.lead { font-size: 1.1rem; }
.grid { display: grid; gap: 1.4rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
@media (max-width: 880px) { .split { grid-template-columns: 1fr; gap: 2rem; } }

.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem; box-shadow: var(--shadow); height: 100%;
}
.card h3 { margin-bottom: .4em; }
.card p:last-child { margin-bottom: 0; }
.icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--teal-wash); color: var(--teal-dark); margin-bottom: 1rem;
}
.icon svg { width: 24px; height: 24px; }
.icon.coral { background: var(--coral-wash); color: var(--coral); }

/* Stats band */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: -2.5rem; position: relative; z-index: 2; }
.stat { background: #fff; border-radius: var(--radius); padding: 1.3rem 1.4rem; box-shadow: var(--shadow); border: 1px solid var(--line); }
.stat b { display: block; font-family: var(--font-head); font-size: 2rem; color: var(--ink); line-height: 1.1; }
.stat span { font-size: .88rem; color: var(--muted); }
@media (max-width: 880px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* Pipeline / steps */
.pipeline { counter-reset: step; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }
.pipeline li { list-style: none; position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.1rem; }
.pipeline li::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); color: #fff; font-weight: 700; font-size: .9rem; margin-bottom: .8rem;
}
.pipeline li h4 { font-family: var(--font-body); font-size: 1rem; margin-bottom: .3em; }
.pipeline li p { font-size: .9rem; margin: 0; }
.pipeline { padding: 0; margin: 0; }
@media (max-width: 960px) { .pipeline { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .pipeline { grid-template-columns: 1fr; } }

/* Lists */
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { position: relative; padding-left: 2rem; margin-bottom: .8rem; }
.check-list li::before {
  content: ""; position: absolute; left: 0; top: .35em; width: 1.2rem; height: 1.2rem; border-radius: 50%;
  background: var(--teal-wash) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b6560' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center/70% no-repeat;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag-cloud .chip { font-size: .85rem; padding: .35rem .8rem; }

/* Callout */
.callout { border-left: 4px solid var(--teal); background: var(--teal-wash); padding: 1.2rem 1.4rem; border-radius: 0 var(--radius) var(--radius) 0; }
.callout.coral { border-color: var(--coral); background: var(--coral-wash); }
.note { font-size: .85rem; color: var(--muted); }

/* Team */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.2rem; }
.person { display: flex; gap: .9rem; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.avatar {
  flex: none; width: 58px; height: 58px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--teal); font-size: 1.05rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person b { color: var(--ink); display: block; line-height: 1.3; }
.person small { color: var(--muted); display: block; line-height: 1.35; font-size: .82rem; }
.person .role { color: var(--teal-dark); font-weight: 600; font-size: .8rem; }
.rg-link {
  display: inline-flex; align-items: center; gap: .35rem; margin-top: .45rem;
  font-size: .78rem; font-weight: 600; text-decoration: none; color: #00a98f;
  border: 1px solid var(--line); border-radius: 6px; padding: .15rem .5rem .15rem .2rem;
}
.rg-link:hover { border-color: #00ccbb; color: #008a75; }
.rg-badge {
  display: inline-grid; place-items: center; width: 20px; height: 18px; border-radius: 3px;
  background: #00ccbb; color: #fff; font-size: .58rem; font-weight: 800; line-height: 1; letter-spacing: -.02em;
}
.team-group h3 { margin: 2rem 0 1rem; font-size: 1.1rem; font-family: var(--font-body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* Partners */
.partners { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.partner { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; background: #fff; text-decoration: none; color: var(--ink-2); display: block; }
.partner b { color: var(--ink); display: block; font-size: .98rem; line-height: 1.3; }
.partner small { color: var(--muted); font-size: .8rem; }
.partner:hover { border-color: var(--teal); }
.partner img { max-height: 48px; width: auto; margin-bottom: .6rem; }

/* Publications */
.toolbar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: 1.6rem; }
.toolbar input[type="search"] {
  flex: 1 1 260px; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: .95rem;
}
.filter-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.filter-btns button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .45rem .9rem;
  font: inherit; font-size: .85rem; cursor: pointer; color: var(--ink-2);
}
.filter-btns button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.pub-year { font-family: var(--font-head); font-size: 1.4rem; color: var(--ink); margin: 2rem 0 .8rem; padding-bottom: .4rem; border-bottom: 2px solid var(--line); }
.pub { padding: 1.1rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: .4rem 1.2rem; }
.pub h3 { font-family: var(--font-body); font-size: 1.03rem; margin: .35rem 0 .25rem; line-height: 1.4; }
.pub .authors { font-size: .9rem; margin: 0; }
.pub .venue { font-size: .88rem; color: var(--muted); font-style: italic; margin: 0; }
.pub .links { display: flex; gap: .5rem; align-items: start; flex-wrap: wrap; }
.pub .links a { font-size: .82rem; font-weight: 600; text-decoration: none; border: 1px solid var(--line); padding: .3rem .7rem; border-radius: 8px; white-space: nowrap; }
.pub .links a:hover { border-color: var(--teal); }
.pub .me { font-weight: 600; color: var(--ink); }
@media (max-width: 640px) { .pub { grid-template-columns: 1fr; } }
.empty { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Featured book */
.feature { display: grid; grid-template-columns: 180px 1fr; gap: 2rem; align-items: center; }
.book-cover {
  aspect-ratio: 2/3; border-radius: 6px 12px 12px 6px; padding: 1.1rem .9rem; color: #fff;
  background: linear-gradient(160deg, #12877f, #0f2a3d); box-shadow: 0 14px 30px rgba(15,42,61,.25);
  display: flex; flex-direction: column; justify-content: space-between; font-family: var(--font-head);
}
.book-cover b { font-size: 1.15rem; line-height: 1.15; }
.book-cover small { font-family: var(--font-body); font-size: .62rem; letter-spacing: .08em; opacity: .85; }
@media (max-width: 640px) { .feature { grid-template-columns: 1fr; } .book-cover { max-width: 170px; } }

/* News & events */
.news-list { display: grid; gap: 1.2rem; }
.news-item { display: grid; grid-template-columns: 92px 1fr; gap: 1.3rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; }
.date-badge { text-align: center; border-radius: 12px; background: var(--teal-wash); padding: .7rem .3rem; height: fit-content; }
.date-badge .d { font-family: var(--font-head); font-size: 1.8rem; color: var(--ink); line-height: 1; display: block; }
.date-badge .m { font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-dark); }
.date-badge .y { font-size: .75rem; color: var(--muted); display: block; }
.news-item.upcoming .date-badge { background: var(--coral-wash); }
.news-item.upcoming .date-badge .m { color: #b23c18; }
.news-item h3 { font-size: 1.15rem; margin: .4rem 0 .3rem; }
.news-item .meta { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.news-item p { margin-bottom: .5rem; font-size: .96rem; }
.news-item .more { font-size: .88rem; font-weight: 600; }
.news-item img.thumb { border-radius: 10px; margin: .6rem 0; max-height: 260px; object-fit: cover; width: 100%; }
@media (max-width: 560px) { .news-item { grid-template-columns: 1fr; } .date-badge { width: 92px; } }
.tabs { display: flex; gap: .4rem; border-bottom: 1px solid var(--line); margin-bottom: 1.6rem; }
.tabs button { background: none; border: none; font: inherit; font-weight: 600; padding: .8rem 1rem; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--teal); }

/* EWS demo */
.demo { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 1.5rem; box-shadow: var(--shadow); }
.demo-controls { display: flex; flex-wrap: wrap; gap: 1.2rem 2rem; align-items: center; margin-bottom: 1rem; font-size: .92rem; }
.demo-controls label { display: flex; align-items: center; gap: .6rem; }
.demo-controls input[type=range] { accent-color: var(--teal); width: 160px; }
.demo-controls select { font: inherit; padding: .35rem .5rem; border-radius: 8px; border: 1px solid var(--line); }
.demo svg text { font-family: var(--font-body); font-size: 11px; fill: var(--muted); }
.demo .bar { fill: #a9ddd7; }
.demo .bar.flag { fill: var(--coral); }
.demo .exp { stroke: var(--ink); stroke-width: 1.5; fill: none; stroke-dasharray: 4 3; }
.demo .thr { stroke: var(--coral); stroke-width: 1.5; fill: none; }
.demo .grid-line { stroke: #eef2f4; }
.demo-summary { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .8rem; font-size: .9rem; }
.demo-summary b { color: var(--ink); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .75rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink); background: var(--sand); font-weight: 600; }

/* Contact */
.form-grid { display: grid; gap: 1rem; }
.form-grid label { font-weight: 600; font-size: .9rem; color: var(--ink); display: block; margin-bottom: .3rem; }
.form-grid input, .form-grid textarea, .form-grid select {
  width: 100%; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: .95rem; background: #fff;
}
.form-grid textarea { min-height: 150px; resize: vertical; }
.contact-line { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 1.2rem; }
.contact-line .icon { margin: 0; flex: none; }
.contact-line b { display: block; color: var(--ink); }

/* CTA band */
.cta-band { background: var(--ink); color: #c9d8e0; border-radius: 22px; padding: clamp(2rem, 5vw, 3rem); display: flex; justify-content: space-between; align-items: center; gap: 2rem; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin-bottom: .3em; }
.cta-band p { margin: 0; max-width: 38em; }

/* ---------- Footer ---------- */
.site-footer { background: #0b1f2d; color: #9fb6c2; padding: 3.5rem 0 1.5rem; margin-top: 0; font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: 2rem; }
.site-footer h4 { color: #fff; font-family: var(--font-body); font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .5rem; }
.site-footer a { color: #c9d8e0; text-decoration: none; }
.site-footer a:hover { color: var(--teal-light); }
.site-footer .brand { color: #fff; margin-bottom: 1rem; }
.site-footer .funding { font-size: .82rem; margin-top: 1rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); margin-top: 2.5rem; padding-top: 1.2rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; font-size: .82rem; }
@media (max-width: 880px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

/* Utility */
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 2rem; } .mb-0 { margin-bottom: 0; }
.center { text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
