/* ---------- Base layout ---------- */

:root {
  --bg: #f5f7fb;
  --bg-card: #ffffff;
  --text-main: #111111;
  --text-muted: #666666;
  --accent: #0b72ff;
  --border-soft: #e2e6f0;
  --shadow-soft: 0 14px 30px rgba(15, 23, 42, 0.08);
  --radius-lg: 18px;
  --radius-pill: 999px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: var(--bg);
}

/* A max-width wrapper for content sections */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 5.5rem 1.5rem 4rem;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffff;
  border-bottom: 1px solid var(--border-soft);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.05);
}

.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-title {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--accent); /* turns blue on hover — optional */
}

.site-nav a.active {
  background: var(--accent);
  color: #fff;
}

.nav-link {
  font-size: 0.95rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  text-decoration: none;
  color: #222;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: #e8f1ff;
}

.nav-link.active {
  background: var(--accent);
  color: #ffffff;
}

a {
  color: #5E78CC;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  color: #5E78CC;   /* keep same color on hover */
}

/* Optional simple icon style */
.icon-link {
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.2s ease;
}

.icon-link:hover {
  background: #e8f0fe;
}

/* style JUST the substack image */
.icon-img {
  width: 1.2rem;     /* adjust if needed */
  height: 1.2rem;
  object-fit: contain;
  border-radius: 4px; /* Substack logo has square edges */
}

/* ---------- Section headings ---------- */
section {
  scroll-margin-top: 80px; /* adjust to your header height */
}

.section {
  margin-bottom: 3rem;
}

.section-header {
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.8rem;
  margin: 0 0 0.25rem;
}

.section-underline {
  width: 60px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.section-intro {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Align About Me section text to ragged-right (left aligned) */
p {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

/* ---------- Blog cards ---------- */

/* ---------- Blog grid: three cards side-by-side ---------- */

.blog-grid {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;

  /* nice scrolling behaviour */
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.blog-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.1rem 1.2rem 1.2rem;

  /* NEW: behave like slides in a horizontal row */
  flex: 0 0 320px;         /* width of each card; tweak 300–340 if you like */
  scroll-snap-align: start;
}

.blog-title {
  font-weight: 700;
  margin-bottom: 0.35rem;

  /* NEW: force 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;     /* always show 3 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;

  line-height: 1.25;
  min-height: calc(1.25rem * 3); /* ensures 3-line block height */

  text-overflow: ellipsis; /* adds "..." if text overflows */
}

.blog-description {
  font-size: 0.95rem;
  color: var(--text-muted);

  /* NEW: force 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 1;      /* change to 1 if you prefer */
  -webkit-box-orient: vertical;
  overflow: hidden;

  line-height: 1.25;
  min-height: calc(1.25rem * 1);
  margin-bottom: 0.1rem;      /* spacing before image */
}

/* Image block from Substack */
.blog-image {
  margin-top: 0.9rem;
  border-radius: 6px;      /* your updated choice */
  overflow: hidden;

  /* NEW: lock image block height */
  height: 200px;           /* adjust to taste: 180–240px works great */
  display: flex;
  align-items: center;
  justify-content: center;
}

.blog-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Date + "Read post" row */
.blog-meta {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.blog-date {
  color: var(--text-muted);
}

/* "Read post" link (no button, no underline by default) */
.blog-link {
  text-decoration: none;
  color: var(--accent);
  font-weight: 500;
}

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

/* ---------- Paper publication cards layout ---------- */
.paper-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.2rem;
}

.paper-text {
  flex: 1;
}

/* first line: authors / description */
.paper-authors {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

/* second line: blue italic title link */
.paper-title {
  font-style: normal;
  color: var(--text-muted); 
  text-decoration: none;      /* remove underline */
  font-weight: 400; 
  font-size: 0.95rem;
}

.paper-title:hover {
  text-decoration: none;      /* no underline on hover */
  color: var(--text-muted);   /* stays grey */
}
/* right-hand column: year + link pill */
.paper-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}


/* ---------- Generic card layout ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-main {
  display: flex;
  gap: 0.75rem;
}

.card-number {
  font-weight: 600;
  color: var(--text-muted);
}

.card-content {
  flex: 1;
}

.card-title {
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.card-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.card-meta {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ---------- Pills (date, buttons) ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 1rem;
  border-radius: 999px;   /* fully round */
  font-size: 0.7rem;
  font-weight: 500;
}

.pill-muted { /* grey pill for dates */
  background: #eef0f6;
  color: #555;
  padding: 0.3rem 0.8rem;
  font-weight: 500;
}

.pill-primary {
  background: var(--accent);
  color: #ffffff;
  padding: 0.4rem 0.8rem;   /* taller + wider */
  font-weight: 500;
}

.pill-primary:hover {
  filter: brightness(0.95);
}

/* ---------- About section layout ---------- */

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
}

.about-photo img {
  width: 100%;
  border-radius: 22px;
  object-fit: cover;
  display: block;
}

.about-text p {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 0.98rem;
}

.logo-row {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-row img {
  height: 42px;
  object-fit: contain;
}

/* ---------- Simple list ---------- */

.simple-list {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.simple-list li {
  margin-bottom: 0.25rem;
}

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

.site-footer {
  border-top: 1px solid var(--border-soft);
  background: #ffffff;
}

.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links a {
  margin-left: 0.8rem;
  text-decoration: none;
  color: var(--text-muted);
}

/* Substack icon: swap PNG on hover */
.substack-icon .icon-img {
  content: url("Images/substackGrey.png");
  transition: 0.15s ease;
}

.substack-icon:hover .icon-img {
  content: url("Images/substackBlue.png");
}

.me-author {
  color: #5E78CC;      /* slightly darker blue-grey 3a3f52 6f7DB5 4D70D6 */ 
  font-weight: 500;    /* subtle emphasis */
}

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

@media (max-width: 800px) {
  .site-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .about-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-meta {
    justify-content: space-between;
  }
}
