/* ============================================================
   Maneesha Wickramasuriya — Academic Portfolio
   Navy/slate + white, mobile-first, accessible
   ============================================================ */

:root {
  --navy-950: #0b1220;
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #dbeafe;
  --ring: #3b82f6;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

  --header-h: 4rem;
  --max: 68rem;
  --narrow: 42rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 0.75rem);
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--navy-800);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.15s var(--ease);
}

a:hover {
  color: var(--accent-hover);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: 1000;
  background: var(--navy-900);
  color: var(--white);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-4);
}

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.container.narrow {
  width: min(100% - 2rem, var(--narrow));
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--slate-200);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: var(--space-4);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--navy-900);
  font-weight: 600;
  min-width: 0;
}

.logo:hover {
  color: var(--navy-900);
}

.logo-mark {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.55rem;
  background: linear-gradient(145deg, var(--navy-900), var(--navy-700));
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.logo-text {
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--navy-800);
  border-radius: 1px;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 0.45rem 0.65rem;
  color: var(--slate-600);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--navy-900);
  background: var(--slate-100);
}

/* ---------- Hero ---------- */

.hero {
  padding: var(--space-16) 0 var(--space-20);
  background:
    radial-gradient(ellipse 80% 60% at 90% 10%, rgba(29, 78, 216, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 80%, rgba(15, 23, 42, 0.04), transparent 50%),
    linear-gradient(180deg, var(--slate-50) 0%, var(--white) 100%);
  border-bottom: 1px solid var(--slate-100);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: var(--space-12);
  align-items: center;
}

.eyebrow {
  margin: 0 0 var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 4.5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--navy-950);
}

.hero-title {
  margin: 0 0 var(--space-4);
  font-size: 1.1875rem;
  font-weight: 600;
  color: var(--navy-700);
}

.hero-focus {
  margin: 0 0 var(--space-8);
  max-width: 38rem;
  color: var(--slate-600);
  font-size: 1.0625rem;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--navy-900);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--navy-800);
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  color: var(--navy-900);
  border-color: var(--slate-200);
}

.btn-secondary:hover {
  border-color: var(--navy-700);
  color: var(--navy-900);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent-soft);
}

.btn-ghost:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}

.hero-meta a {
  color: var(--slate-500);
  text-decoration: none;
  font-weight: 500;
}

.hero-meta a:hover {
  color: var(--accent);
}

.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 16rem;
}

.avatar-ring {
  position: relative;
  z-index: 1;
  width: min(100%, 16rem);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 0.5rem;
  background: linear-gradient(145deg, var(--navy-900), var(--accent), var(--slate-400));
  box-shadow: var(--shadow-lg);
}

.avatar-initials {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--navy-900);
  color: var(--white);
  font-family: var(--font-serif);
  font-size: clamp(3rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hero-accent {
  position: absolute;
  inset: 12% -8% -8% 12%;
  border-radius: 2rem;
  background:
    linear-gradient(135deg, transparent 40%, rgba(29, 78, 216, 0.12) 40%, rgba(29, 78, 216, 0.12) 55%, transparent 55%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 10px,
      rgba(15, 23, 42, 0.04) 10px,
      rgba(15, 23, 42, 0.04) 11px
    );
  z-index: 0;
}

/* ---------- Sections ---------- */

.section {
  padding: var(--space-20) 0;
}

.section-alt {
  background: var(--slate-50);
  border-block: 1px solid var(--slate-100);
}

.section h2 {
  margin: 0 0 var(--space-10);
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3vw, 2.125rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--navy-950);
  position: relative;
  padding-bottom: var(--space-4);
}

.section h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.5rem;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-10);
}

.section-head h2 {
  margin-bottom: 0;
}

.text-link {
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.lead {
  margin: 0;
  font-size: 1.125rem;
  color: var(--navy-700);
  line-height: 1.75;
}

/* ---------- Timeline ---------- */

.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  position: relative;
  padding-left: var(--space-6);
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 2px;
  background: var(--slate-200);
}

.timeline-item {
  position: relative;
}

.timeline-marker {
  position: absolute;
  left: calc(-1 * var(--space-6) + 0.1rem);
  top: 0.55rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.item-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-1);
}

.item-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 650;
  color: var(--navy-900);
}

.item-header time {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-500);
  white-space: nowrap;
}

.item-org {
  margin: 0 0 var(--space-3);
  color: var(--slate-600);
  font-weight: 500;
}

.item-details {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--navy-700);
}

.item-details li + li {
  margin-top: var(--space-1);
}

.item-details em {
  font-style: italic;
}

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.card:hover {
  border-color: var(--slate-400);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}

.org {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--slate-500);
}

.card h3 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--navy-900);
}

.card p {
  margin: 0;
  flex: 1;
  font-size: 0.9375rem;
  color: var(--slate-600);
}

.card-link {
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  margin-top: var(--space-1);
}

.card-link:hover {
  text-decoration: underline;
}

/* ---------- Publications ---------- */

.pub-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: pub;
}

.pub-list li {
  counter-increment: pub;
  position: relative;
  padding: var(--space-5) 0 var(--space-5) 2.75rem;
  border-bottom: 1px solid var(--slate-200);
  color: var(--navy-700);
  font-size: 0.975rem;
  line-height: 1.6;
}

.pub-list li:first-child {
  padding-top: 0;
}

.pub-list li::before {
  content: counter(pub, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: var(--space-5);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--slate-400);
  font-variant-numeric: tabular-nums;
}

.pub-list li:first-child::before {
  top: 0.15rem;
}

.pub-authors {
  color: var(--navy-800);
}

.pub-list a {
  font-weight: 600;
  white-space: nowrap;
  margin-left: 0.25rem;
}

/* ---------- Skills ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-8);
}

.skill-group h3 {
  margin: 0 0 var(--space-4);
  font-size: 0.9375rem;
  font-weight: 650;
  color: var(--navy-900);
  letter-spacing: 0.01em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.chips li {
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--navy-800);
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 999px;
}

.section-alt .chips li {
  background: var(--white);
}

/* ---------- Awards ---------- */

.award-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.award-list li {
  padding: var(--space-5) var(--space-6);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}

.award-list strong {
  display: block;
  color: var(--navy-900);
  font-size: 1.0625rem;
  margin-bottom: var(--space-1);
}

.award-list span {
  display: block;
  color: var(--slate-600);
  font-size: 0.9375rem;
}

/* ---------- Contact ---------- */

.section-contact {
  background: var(--navy-900);
  color: var(--slate-200);
  border: none;
}

.section-contact h2 {
  color: var(--white);
}

.section-contact h2::after {
  background: #60a5fa;
}

.section-contact .lead {
  color: var(--slate-400);
  margin-bottom: var(--space-8);
}

.contact-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.contact-links a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--white);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.contact-links a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.contact-label {
  flex: 0 0 5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #93c5fd;
}

.contact-value {
  font-weight: 500;
  font-size: 0.975rem;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--navy-950);
  color: var(--slate-400);
  padding: var(--space-6) 0;
  font-size: 0.875rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--slate-300);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--white);
}

.back-top {
  font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }

  .hero-visual {
    order: -1;
    min-height: auto;
  }

  .avatar-ring {
    width: 10rem;
  }

  .hero-accent {
    inset: 8% 20% -5% 20%;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--slate-200);
    box-shadow: var(--shadow);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.3s var(--ease), opacity 0.2s var(--ease), visibility 0.2s;
  }

  .site-nav.is-open {
    max-height: 24rem;
    opacity: 1;
    visibility: visible;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-3) var(--space-4) var(--space-5);
    gap: 0;
  }

  .site-nav a {
    padding: 0.75rem 0.85rem;
    font-size: 1rem;
  }

  .logo-text {
    max-width: 12rem;
  }

  .hero {
    padding: var(--space-10) 0 var(--space-12);
  }

  .section {
    padding: var(--space-12) 0;
  }

  .section h2 {
    margin-bottom: var(--space-8);
  }

  .section-head {
    margin-bottom: var(--space-8);
  }
}

@media (max-width: 480px) {
  .hero-ctas {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .item-header {
    flex-direction: column;
  }

  .contact-label {
    flex-basis: 100%;
  }

  .pub-list li {
    padding-left: 2.25rem;
  }
}

/* Print */
@media print {
  .site-header,
  .nav-toggle,
  .back-top,
  .hero-visual {
    display: none !important;
  }

  body {
    font-size: 11pt;
    color: #000;
  }

  .section,
  .hero {
    padding: 1rem 0;
    background: none !important;
    border: none !important;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
  }
}


/* Curated portfolio tweaks */
.logo-text-only {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: inherit;
  text-decoration: none;
}
.logo-text-only:hover { opacity: 0.85; }
.hero-compact {
  padding-block: 4.5rem 3rem;
}
.hero-compact .hero-focus {
  max-width: 38rem;
  margin-block: 0.75rem 1.5rem;
}
.muted {
  color: var(--muted, #64748b);
  font-size: 0.95rem;
  line-height: 1.55;
}
.card-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr));
}


/* Project cards with figures */
.hero-split {
  display: grid;
  gap: 2rem;
  align-items: center;
}
@media (min-width: 860px) {
  .hero-split {
    grid-template-columns: 1.15fr 0.85fr;
  }
}
.hero-media {
  margin: 0;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.hero-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.hero-sub {
  color: var(--muted, #64748b);
  max-width: 38rem;
  margin: 0 0 1.25rem;
  line-height: 1.55;
}
.project-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}
.project-card {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.section-alt .project-card {
  background: #fff;
}
.project-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #e2e8f0;
}
.project-body {
  padding: 1rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}
.project-body h3 {
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.3;
}
.project-body p {
  margin: 0;
  color: var(--muted, #64748b);
  font-size: 0.92rem;
  line-height: 1.5;
  flex: 1;
}


.pubs-scholar-note {
  margin-top: 1.5rem;
}
.pubs-scholar-note .scholar-btn {
  display: inline-flex;
  text-decoration: none;
}
