/* ============================================
   KEHELIYA KUDAHEWA — PERSONAL SCIENCE SITE
   Clean, modern, molecular/scientific feel
   ============================================ */

/* --- CSS Variables --- */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f7f9fc;
  --color-bg-card: #ffffff;
  --color-text: #1a1a2e;
  --color-text-light: #5a5a7a;
  --color-text-muted: #8888a8;
  --color-accent: #0d7377;
  --color-accent-dark: #094f52;
  --color-accent-light: #14a3a8;
  --color-accent-bg: #e8f6f7;
  --color-border: #e2e8f0;
  --color-border-light: #f0f3f8;
  --color-code-bg: #f4f6fa;
  --color-hero-gradient-start: #0d2137;
  --color-hero-gradient-end: #0d7377;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 1120px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --transition: 0.25s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--color-accent-dark);
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-light);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--color-text);
  text-decoration: none;
}
.logo-icon {
  font-size: 1.5rem;
  color: var(--color-accent);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
}
.nav-links a {
  display: block;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--color-text-light);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--color-accent);
  background: var(--color-accent-bg);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: var(--transition);
}

/* --- Hero --- */
.hero {
  background: linear-gradient(135deg, var(--color-hero-gradient-start) 0%, var(--color-hero-gradient-end) 100%);
  color: #fff;
  padding: 100px 0 80px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(20,163,168,0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-accent-light);
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.hero-tagline {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: rgba(255,255,255,0.8);
  max-width: 600px;
  line-height: 1.6;
  margin-bottom: 32px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--color-accent-light);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
}
.hero-cta:hover {
  background: #fff;
  color: var(--color-accent-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Molecular decoration dots */
.hero-molecules {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.molecule-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
}
.molecule-dot:nth-child(1) { top: 15%; left: 70%; width: 8px; height: 8px; }
.molecule-dot:nth-child(2) { top: 40%; left: 85%; }
.molecule-dot:nth-child(3) { top: 60%; left: 75%; width: 10px; height: 10px; }
.molecule-dot:nth-child(4) { top: 25%; left: 90%; }
.molecule-dot:nth-child(5) { top: 80%; left: 80%; width: 4px; height: 4px; }
.molecule-dot:nth-child(6) { top: 10%; left: 60%; width: 5px; height: 5px; }
.molecule-line {
  position: absolute;
  height: 1px;
  background: rgba(255,255,255,0.06);
  transform-origin: left center;
}
.molecule-line:nth-child(7) { top: 20%; left: 72%; width: 120px; transform: rotate(35deg); }
.molecule-line:nth-child(8) { top: 45%; left: 78%; width: 80px; transform: rotate(-20deg); }
.molecule-line:nth-child(9) { top: 65%; left: 82%; width: 60px; transform: rotate(55deg); }

/* --- Section Cards --- */
.section-cards {
  padding: 80px 0;
}
.section-cards-title {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-text-muted);
  margin-bottom: 40px;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 36px 32px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}
.card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card:hover::before {
  transform: scaleX(1);
}
.card-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  display: block;
}
.card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--color-text);
}
.card p {
  color: var(--color-text-light);
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 20px;
}
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-accent);
}
.card-link::after {
  content: '\2192';
  transition: transform var(--transition);
}
.card:hover .card-link::after {
  transform: translateX(4px);
}

/* --- Posts Section --- */
.posts-section {
  padding: 80px 0;
  background: var(--color-bg-alt);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}
.section-header h2 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.section-header a {
  font-weight: 600;
  font-size: 0.9rem;
}
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.post-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  transition: all var(--transition);
}
.post-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.post-card-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.post-card-meta .tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--color-accent-bg);
  color: var(--color-accent);
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.post-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
}
.post-card h3 a {
  color: var(--color-text);
}
.post-card h3 a:hover {
  color: var(--color-accent);
}
.post-card p {
  color: var(--color-text-light);
  font-size: 0.9rem;
  line-height: 1.65;
}

/* --- About Blurb on Home --- */
.about-blurb {
  padding: 80px 0;
}
.about-blurb-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}
.about-blurb h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}
.about-blurb p {
  color: var(--color-text-light);
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 16px;
}
.about-blurb .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--color-text);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition);
  margin-top: 8px;
}
.about-blurb .btn:hover {
  background: var(--color-accent);
  color: #fff;
}
.about-visual {
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  border: 1px solid var(--color-border);
}
.about-visual-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}
.about-visual p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* --- Page Content --- */
.page-content {
  padding: 60px 0 100px;
}
.page-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 2px solid var(--color-border-light);
}
.page-header h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.page-subtitle {
  font-size: 1.15rem;
  color: var(--color-text-light);
  max-width: 600px;
}

.page-body h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: 48px;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
.page-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 14px;
  color: var(--color-text);
}
.page-body p {
  margin-bottom: 18px;
  color: var(--color-text-light);
  line-height: 1.8;
}
.page-body ul, .page-body ol {
  margin-bottom: 18px;
  padding-left: 24px;
  color: var(--color-text-light);
}
.page-body li {
  margin-bottom: 8px;
  line-height: 1.7;
}
.page-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-code-bg);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--color-accent-dark);
}
.page-body pre {
  background: var(--color-hero-gradient-start);
  color: #e0e0e0;
  padding: 24px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 24px;
  font-size: 0.88rem;
  line-height: 1.6;
}
.page-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.page-body blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 16px 24px;
  margin: 24px 0;
  background: var(--color-accent-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-light);
  font-style: italic;
}
.page-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 40px 0;
}

/* --- Subsection Cards on topic pages --- */
.subsection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 32px 0 48px;
}
.subsection-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: all var(--transition);
}
.subsection-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}
.subsection-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: var(--color-text);
}
.subsection-card p {
  font-size: 0.9rem;
  color: var(--color-text-light);
  line-height: 1.6;
  margin: 0;
}

/* --- Post Layout --- */
.post-content {
  padding: 60px 0 100px;
}
.post-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 2px solid var(--color-border-light);
}
.post-header h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}
.post-category {
  display: inline-block;
  padding: 2px 12px;
  background: var(--color-accent-bg);
  color: var(--color-accent);
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.post-body {
  max-width: 720px;
}
.post-body h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 40px;
  margin-bottom: 16px;
}
.post-body p {
  margin-bottom: 18px;
  color: var(--color-text-light);
  line-height: 1.8;
}
.post-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}
.back-link {
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* --- About Page Specifics --- */
.cv-section {
  margin-top: 48px;
}
.cv-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid var(--color-border-light);
}
.cv-date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 600;
}
.cv-details h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 4px 0;
}
.cv-details .cv-org {
  color: var(--color-accent);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.cv-details p {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin: 0;
}

.awards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 32px;
}
.award-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
}
.award-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 6px 0;
}
.award-card .award-year {
  font-size: 0.8rem;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.award-card p {
  font-size: 0.88rem;
  color: var(--color-text-light);
  margin: 0;
  line-height: 1.6;
}

/* --- Footer --- */
.site-footer {
  background: var(--color-hero-gradient-start);
  color: rgba(255,255,255,0.8);
  padding: 60px 0 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.site-footer h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}
.site-footer h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 16px;
}
.site-footer p {
  font-size: 0.9rem;
  line-height: 1.6;
}
.site-footer ul {
  list-style: none;
}
.site-footer li {
  margin-bottom: 8px;
}
.site-footer a {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  transition: color var(--transition);
}
.site-footer a:hover {
  color: var(--color-accent-light);
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
}

/* --- Mobile --- */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
  }
  .nav-open .nav-links {
    display: flex;
  }
  .hero {
    padding: 60px 0 50px;
  }
  .about-blurb-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .cv-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .subsection-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  .hero h1 {
    font-size: 2rem;
  }
}
