/* ==========================================================================
   Dr Lynda Myra Oluoch — academic portfolio
   Structure: tokens, base, layout, components, sections, responsive
   ========================================================================== */

:root {
  color-scheme: light;
  --navy: #0F2A4A;
  --navy-2: #17497F;
  --teal: #0E7C66;
  --teal-2: #0A6455;
  --berry: #9D2A63;
  --gold: #B7791F;
  --ink: #0C1626;
  --text: #33415C;
  --muted: #64748B;
  --line: rgba(12, 22, 38, 0.12);
  --paper: #FFFFFF;
  --soft: #F6F8FB;
  --wash: #EAF1F6;
  --nav-surface: rgba(255, 255, 255, 0.9);
  --shadow: 0 16px 42px rgba(12, 22, 38, 0.10);
  --shadow-soft: 0 8px 24px rgba(12, 22, 38, 0.07);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --max: 1160px;
  font-family: Inter, "Segoe UI", Roboto, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --navy: #9CC0FF;
  --navy-2: #CFE0FF;
  --teal: #6FE0C4;
  --teal-2: #A9F0DC;
  --berry: #F0A0C4;
  --gold: #F3C16B;
  --ink: #F7FAFC;
  --text: #CED7E3;
  --muted: #A3AEBF;
  --line: rgba(232, 240, 248, 0.16);
  --paper: #101A2B;
  --soft: #070E1B;
  --wash: #16233A;
  --nav-surface: rgba(11, 18, 32, 0.86);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--navy) 12%, transparent), transparent 34rem),
    radial-gradient(circle at top right, color-mix(in srgb, var(--teal) 12%, transparent), transparent 32rem),
    var(--soft);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body.nav-open { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; }
p, h1, h2, h3, h4 { margin-top: 0; }
p:last-child { margin-bottom: 0; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; }

.wrap { width: min(var(--max), calc(100% - 40px)); margin-inline: auto; }
.skip-link {
  position: absolute; left: 16px; top: -80px; z-index: 100;
  padding: 10px 14px; border-radius: 999px;
  background: #0C1626; color: #FFFFFF; text-decoration: none;
  transition: top 160ms ease;
}
.skip-link:focus { top: 14px; }

.site-header {
  position: sticky; top: 0; z-index: 60;
  border-bottom: 1px solid var(--line);
  background: var(--nav-surface);
  backdrop-filter: blur(18px);
}
.header-inner {
  display: flex; min-height: 74px; align-items: center; justify-content: space-between; gap: 18px;
}
.brand { display: inline-flex; min-width: 0; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center;
  border-radius: 15px; background: linear-gradient(145deg, var(--navy), var(--teal));
  color: #fff; font-weight: 900; letter-spacing: 0.03em; box-shadow: var(--shadow-soft);
}
.brand strong { display: block; color: var(--ink); font-size: 0.98rem; line-height: 1.18; }
.brand small { display: block; color: var(--muted); font-size: 0.78rem; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a, .theme-toggle {
  min-height: 40px; padding: 8px 11px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text); cursor: pointer; font: inherit;
  font-size: 0.88rem; font-weight: 750; text-decoration: none;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}
.nav a:hover, .theme-toggle:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--teal) 10%, transparent); color: var(--ink); }
.nav a.is-active { background: color-mix(in srgb, var(--navy) 10%, transparent); color: var(--ink); }
.nav .social-link { border: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 88%, transparent); color: var(--navy); }
.nav-toggle {
  display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); cursor: pointer; font-weight: 800;
}

/* ---------- Hero ---------- */
.hero { padding: clamp(50px, 7vw, 96px) 0 clamp(58px, 8vw, 104px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(310px, 0.88fr);
  gap: clamp(34px, 6vw, 72px); align-items: center;
}
.eyebrow {
  margin-bottom: 14px; color: var(--teal); font-size: 0.74rem; font-weight: 900;
  letter-spacing: 0.14em; text-transform: uppercase;
}
h1 {
  max-width: 850px; margin-bottom: 22px; color: var(--ink);
  font-size: clamp(2.4rem, 4.5vw, 4.35rem); line-height: 1.02; letter-spacing: -0.05em;
}
h1 span { display: block; }
.hero-lead { max-width: 760px; color: var(--text); font-size: clamp(1.04rem, 1.6vw, 1.18rem); }
.actions, .social-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: 12px 18px;
  border: 1px solid transparent; border-radius: 999px; font-weight: 850; text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--navy); color: #fff; box-shadow: 0 12px 28px color-mix(in srgb, var(--navy) 26%, transparent); }
.btn.secondary { border-color: var(--line); background: var(--paper); color: var(--navy); }
.btn.teal { background: var(--teal); color: #fff; }
[data-theme="dark"] .btn.primary,
[data-theme="dark"] .btn.teal { color: #071322; }

.impact-strip { display: grid; max-width: 790px; margin-top: 34px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric, .value-card, .institution-card, .focus-card, .project-card, .talk-card,
.pub-card, .credential-panel, .credential-item, .ref-card {
  border: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 96%, transparent); box-shadow: var(--shadow-soft);
}
.metric { padding: 16px; border-radius: var(--radius-sm); }
.metric strong { display: block; color: var(--ink); font-size: 1.34rem; line-height: 1; }
.metric span { display: block; margin-top: 8px; color: var(--muted); font-size: 0.84rem; line-height: 1.42; }

.hero-card { padding: 12px; border: 1px solid var(--line); border-radius: 30px; background: color-mix(in srgb, var(--paper) 86%, transparent); box-shadow: var(--shadow); }
.portrait-frame { position: relative; overflow: hidden; border-radius: 24px; background: var(--wash); }
.portrait-frame img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 12%; }
.portrait-frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent 52%, rgba(9, 18, 32, 0.34));
}
.role-card {
  position: relative; width: calc(100% - 34px); margin: -58px auto 0; padding: 18px;
  border: 1px solid var(--line); border-left: 5px solid var(--teal); border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 96%, transparent); box-shadow: var(--shadow-soft);
}
.role-card span, .role-card small { display: block; color: var(--muted); font-size: 0.78rem; }
.role-card strong { display: block; margin: 4px 0; color: var(--ink); line-height: 1.26; }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 8vw, 108px) 0; }
.white { background: var(--paper); }
.section-grid, .about-layout { display: grid; grid-template-columns: minmax(240px, 0.42fr) minmax(0, 1fr); gap: clamp(30px, 6vw, 74px); align-items: start; }
.section-heading h2 { margin-bottom: 14px; color: var(--ink); font-size: clamp(1.85rem, 3.7vw, 3.1rem); line-height: 1.08; letter-spacing: -0.045em; }
.section-heading p:not(.eyebrow) { max-width: 760px; color: var(--muted); }
.wide { max-width: 860px; margin-bottom: 30px; }
.balanced-text { text-wrap: balance; }
.readable-copy { display: grid; gap: 16px; }
.readable-copy p { max-width: 70ch; }

.about-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.44fr); gap: 24px; align-items: start; }
.institution-card { padding: 22px; border-radius: var(--radius-md); }
.institution-card a { display: block; margin-top: 10px; padding: 14px; border-radius: 16px; background: var(--wash); text-decoration: none; transition: transform 150ms ease; }
.institution-card a:hover { transform: translateY(-1px); }
.institution-card strong { display: block; color: var(--ink); }
.institution-card small { color: var(--muted); }
.value-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.value-card { min-height: 150px; padding: 22px; border-radius: var(--radius-md); }
.value-card strong { display: block; margin-bottom: 9px; color: var(--ink); font-size: 1.04rem; line-height: 1.25; }
.value-card p { color: var(--muted); font-size: 0.95rem; line-height: 1.55; }

.focus-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.focus-card { overflow: hidden; border-radius: var(--radius-md); }
.media, .project-media { position: relative; overflow: hidden; background: var(--wash); }
.focus-card .media { aspect-ratio: 8 / 5; }
.focus-card img, .project-media img { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform 220ms ease; }
.focus-card:hover img, .project-card:hover .project-media img { transform: scale(1.03); }
.card-body, .project-body { padding: 22px; }
.tag {
  display: inline-flex; min-height: 30px; align-items: center; padding: 5px 10px; margin-bottom: 14px;
  border-radius: 999px; background: color-mix(in srgb, var(--teal) 13%, transparent); color: var(--teal);
  font-size: 0.72rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em;
}
.tag.berry { background: color-mix(in srgb, var(--berry) 12%, transparent); color: var(--berry); }
.tag.gold { background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold); }
.tag.navy { background: color-mix(in srgb, var(--navy) 11%, transparent); color: var(--navy); }
.focus-card h3, .project-card h3, .talk-card h3, .pub-card h3, .value-card h3, .ref-card h3 { margin-bottom: 9px; color: var(--ink); line-height: 1.25; }
.focus-card p, .project-card p, .talk-card p, .pub-card p, .ref-card p { margin-bottom: 0; color: var(--muted); }

/* ---------- Portfolio ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.filter-button {
  min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); cursor: pointer; font: inherit; font-size: 0.88rem;
  font-weight: 850; transition: transform 150ms ease, background 150ms ease;
}
.filter-button:hover { transform: translateY(-1px); }
.filter-button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
[data-theme="dark"] .filter-button.active { color: #071322; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.project-card {
  overflow: hidden; border-radius: var(--radius-md); background: var(--paper);
  transition: transform 170ms ease, border-color 170ms ease;
}
.project-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--teal) 36%, var(--line)); }
.project-card.is-hidden { display: none; }
.project-media { aspect-ratio: 16 / 10; }
.project-body { min-height: 250px; }
.project-card h3 { font-size: 1.08rem; }
.project-card p:last-child { font-size: 0.95rem; line-height: 1.58; }
.project-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.project-links a { color: var(--navy); font-size: 0.88rem; font-weight: 900; text-decoration: none; }
.project-links a:hover { text-decoration: underline; }
.grid-empty { display: none; padding: 22px; border: 1px dashed var(--line); border-radius: var(--radius-md); color: var(--muted); }
.grid-empty.is-visible { display: block; }

/* ---------- Experience timeline ---------- */
.timeline { display: grid; gap: 18px; }
.timeline-item { position: relative; padding: 24px 24px 24px 30px; border: 1px solid var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--paper) 96%, transparent); box-shadow: var(--shadow-soft); }
.timeline-item::before { content: ""; position: absolute; left: 0; top: 24px; bottom: 24px; width: 5px; border-radius: 0 4px 4px 0; background: linear-gradient(var(--navy), var(--teal)); }
.role-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; }
.role-head h3 { margin-bottom: 2px; font-size: 1.12rem; }
.role-when { color: var(--teal); font-size: 0.78rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.role-org { margin: 0 0 14px; color: var(--muted); font-size: 0.95rem; font-weight: 700; }
.bullet-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.bullet-list li { position: relative; padding-left: 20px; color: var(--muted); font-size: 0.95rem; line-height: 1.6; }
.bullet-list li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--teal) 70%, transparent); }

/* ---------- Publications ---------- */
.pub-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 22px; }
.search-field { position: relative; flex: 1 1 260px; }
.search-field input {
  width: 100%; min-height: 46px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 0.95rem;
}
.search-field input::placeholder { color: var(--muted); }
.pub-list { display: grid; gap: 14px; }
.pub-card { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 20px; padding: 22px; border-radius: var(--radius-md); }
.pub-card.is-hidden { display: none; }
.pub-year { color: var(--teal); font-size: 1.08rem; font-weight: 900; }
.pub-card h3 { font-size: 1.02rem; }
.pub-card p { font-size: 0.92rem; line-height: 1.6; }
.pub-card a { display: inline-flex; margin-top: 12px; color: var(--navy); font-weight: 900; font-size: 0.88rem; text-decoration: none; }
.pub-card a:hover { text-decoration: underline; }

/* ---------- Speaking, credentials, references ---------- */
.talk-grid, .ref-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.ref-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.talk-card, .ref-card { padding: 22px; border-radius: var(--radius-md); }
.talk-card .project-meta, .ref-card .project-meta { margin-bottom: 10px; }
.project-meta, .collab-meta { margin-bottom: 12px; color: var(--gold); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.ref-card a { color: var(--navy); font-weight: 800; text-decoration: none; word-break: break-word; }
.ref-card a:hover { text-decoration: underline; }

.tools-stack { display: grid; gap: 16px; }
.credential-panel { margin-top: 4px; padding: 20px; border-radius: var(--radius-md); }
.credential-panel > strong { display: block; color: var(--ink); font-size: 1.02rem; margin-bottom: 6px; }
.credential-panel > p { color: var(--muted); font-size: 0.94rem; }
.credential-grid { display: grid; gap: 10px; margin-top: 14px; }
.credential-item { display: block; padding: 14px; border-radius: 16px; transition: transform 150ms ease, border-color 150ms ease; }
.credential-item:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--teal) 34%, var(--line)); }
.credential-item span { display: block; color: var(--teal); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.credential-item b { display: block; margin: 3px 0 4px; color: var(--ink); line-height: 1.25; }
.credential-item small { display: block; color: var(--muted); line-height: 1.45; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.badge { display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--wash); color: var(--ink); font-size: 0.8rem; font-weight: 800; }

/* ---------- Contact ---------- */
.contact-panel {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.45fr); gap: clamp(26px, 6vw, 68px);
  align-items: end; padding: clamp(32px, 6vw, 58px); border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 12% 8%, rgba(14, 124, 102, 0.36), transparent 24rem),
    linear-gradient(145deg, #0F2A4A, #17497F);
  color: #fff; box-shadow: var(--shadow);
}
.contact-panel h2 { color: #fff; font-size: clamp(1.75rem, 3.9vw, 3rem); line-height: 1.08; letter-spacing: -0.045em; }
.contact-panel p { color: rgba(255, 255, 255, 0.78); }
.contact-panel .eyebrow { color: #A9F0DC; }
.contact-panel .btn.secondary { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.1); color: #fff; }
address { display: grid; gap: 10px; font-style: normal; }
address a { padding: 12px 14px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 14px; background: rgba(255, 255, 255, 0.08); color: #fff; text-decoration: none; word-break: break-word; }
address a:hover { background: rgba(255, 255, 255, 0.16); }

.footer { background: #06141F; color: rgba(255, 255, 255, 0.72); }
.footer-inner { display: grid; gap: 14px; padding: 26px 0; font-size: 0.9rem; }
.footer-top { display: flex; justify-content: space-between; gap: 16px; }
.footer p { margin-bottom: 0; }
details.credits { color: rgba(255, 255, 255, 0.55); font-size: 0.78rem; }
details.credits summary { cursor: pointer; font-weight: 800; }

/* ---------- Responsive ---------- */
@media (max-width: 1060px) {
  .hero-grid, .section-grid, .about-layout, .about-main, .contact-panel { grid-template-columns: 1fr; }
  .focus-grid, .talk-grid, .value-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-grid, .ref-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .impact-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-card { max-width: 620px; }
}
@media (max-width: 760px) {
  .wrap { width: min(100% - 28px, var(--max)); }
  .hero { padding-top: 34px; }
  h1 { font-size: clamp(2.3rem, 11vw, 3.2rem); letter-spacing: -0.045em; }
  .section-heading h2 { font-size: clamp(1.68rem, 7.6vw, 2.3rem); letter-spacing: -0.035em; }
  .brand small { display: none; }
  .nav-toggle { display: inline-grid; place-items: center; }
  .nav {
    position: fixed; inset: 78px 14px auto; display: grid; padding: 12px;
    border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow);
    transform: translateY(-16px); visibility: hidden; opacity: 0;
    transition: transform 160ms ease, opacity 160ms ease, visibility 160ms ease;
  }
  .nav.is-open { transform: translateY(0); visibility: visible; opacity: 1; }
  .nav a, .theme-toggle { width: 100%; text-align: left; }
  .impact-strip, .focus-grid, .talk-grid, .value-grid, .project-grid, .ref-grid { grid-template-columns: 1fr; }
  .portrait-frame img { aspect-ratio: 4 / 5; }
  .pub-card { grid-template-columns: 1fr; gap: 8px; }
  .footer-top { display: grid; }
}
@media (max-width: 480px) {
  .actions, .social-row { display: grid; }
  .btn { width: 100%; }
  .contact-panel { padding: 26px 18px; border-radius: 22px; }
}

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

@media print {
  .site-header, .actions, .filter-bar, .pub-toolbar, .footer { display: none; }
  body { background: #fff; }
}
