/* Academic / Jekyll-adjacent portfolio — calm typography, restrained color */

:root {
  --color-header: #1a5f7a;
  --color-header-hover: #134a61;
  --color-text: #1c1c1c;
  --color-muted: #5c5c5c;
  --color-link: #1a6fa0;
  --color-link-hover: #145a82;
  --color-border: #e2e6ea;
  --color-surface: #fafbfc;
  --font-serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --font-sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto,
    Arial, sans-serif;
  --content-max: 56rem;
  --space-xs: 0.35rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --radius-sm: 6px;
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.06);
  /* layout dividers (horizontal + vertical rules) */
  --hairline: 2px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--color-text);
  background: #fff;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-header);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  left: var(--space-md);
  top: var(--space-md);
  border-radius: var(--radius-sm);
}

a {
  color: var(--color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--color-link-hover);
}

/* Header */
.site-header {
  background: var(--color-header);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.site-header__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.site-logo {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  font-size: 1.1rem;
}

.site-logo:hover {
  color: #e8f4f8;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
}

.site-nav a {
  color: #e8f4f8;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: #fff;
  text-decoration: underline;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: var(--hairline) solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-sm);
  width: 2.5rem;
  height: 2.25rem;
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-toggle__bar {
  display: block;
  width: 1.25rem;
  height: 3px;
  background: #fff;
  box-shadow: 0 -9px 0 #fff, 0 9px 0 #fff;
}

/* Hero */
.hero {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md) var(--space-lg);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(7rem, 9rem) 1fr minmax(12rem, 14rem);
  gap: var(--space-lg) var(--space-xl);
  align-items: start;
}

.avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-border);
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(26, 95, 122, 0.15);
}

.avatar__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.hero__name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin: 0 0 var(--space-sm);
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-transform: lowercase;
}

.hero__meta {
  list-style: none;
  margin: 0 0 var(--space-md);
  padding: 0;
  color: var(--color-muted);
  font-size: 0.98rem;
}

.hero__meta li {
  margin-bottom: var(--space-xs);
}

.social {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--space-sm);
}

.social__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--color-surface);
  border: var(--hairline) solid var(--color-border);
  color: var(--color-header);
  font-weight: 700;
  font-size: 0.75rem;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.social__link:hover {
  background: var(--color-header);
  color: #fff;
  border-color: var(--color-header);
}

.social__link .social__icon {
  width: 1.125rem;
  height: 1.125rem;
  display: block;
  flex-shrink: 0;
}

.social__link svg[fill="none"] {
  fill: none;
}

.hero__aside {
  border-left: var(--hairline) solid var(--color-border);
  padding-left: var(--space-lg);
}

.aside-heading {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 var(--space-sm);
  text-transform: lowercase;
}

.interest-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--color-muted);
  font-size: 0.98rem;
}

.interest-list li {
  margin-bottom: var(--space-xs);
}

/* Main sections */
.content-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md) var(--space-xl);
}

.site-nav a[aria-current="page"] {
  color: #fff;
  text-decoration: underline;
}

.section {
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
  border-top: var(--hairline) solid var(--color-border);
}

.section:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.section__title {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.5vw, 1.6rem);
  font-weight: 700;
  margin: 0 0 var(--space-md);
  text-transform: lowercase;
}

.section__body p {
  margin: 0 0 var(--space-md);
  max-width: 48rem;
}

.section__body p:last-child {
  margin-bottom: 0;
}

/* Home about: use full content-wrap width (not 48rem measure column) */
#about .section__body p {
  max-width: none;
}

.section--projects .section__body .projects-intro {
  margin: 0 0 var(--space-md);
  max-width: none;
}

/* Projects page — image slot (left) + copy (right) */
.project-showcase {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.project-showcase > li {
  margin: 0;
  padding: 0;
}

.section--projects .project-card {
  display: grid;
  grid-template-columns: minmax(10.5rem, 16rem) minmax(0, 1fr);
  gap: var(--space-lg) var(--space-xl);
  align-items: start;
  padding: var(--space-md) 0;
  border-bottom: var(--hairline) solid var(--color-border);
}

.project-showcase > li:first-child .project-card {
  padding-top: 0;
}

.project-showcase > li:last-child .project-card {
  border-bottom: none;
  padding-bottom: 0;
}

.project-card__media {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: var(--hairline) solid var(--color-border);
  box-shadow: var(--shadow-soft);
  background: repeating-linear-gradient(
    -45deg,
    var(--color-surface),
    var(--color-surface) 8px,
    var(--color-border) 8px,
    var(--color-border) calc(8px + var(--hairline))
  );
  aspect-ratio: 20 / 13;
  align-self: start;
}

.project-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-card__body {
  min-width: 0;
}

.project-card__title {
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 2.1vw, 1.4rem);
  font-weight: 700;
  margin: 0 0 var(--space-xs);
  line-height: 1.3;
  text-transform: none;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.5rem;
  margin: 0 0 var(--space-md);
  padding: 0;
  list-style: none;
}

.project-card__tags li {
  margin: 0;
  padding: 0;
}

.project-tag {
  display: inline-block;
  padding: 0.3rem 0.72rem;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.02em;
  border: var(--hairline) solid rgb(0, 0, 0);
}

.project-card__tags li:nth-child(7n + 1) .project-tag {
  background: #e3f2fd;
  color: #0d47a1;
  border-color: #90caf9;
}

.project-card__tags li:nth-child(7n + 2) .project-tag {
  background: #fce4ec;
  color: #880e4f;
  border-color: #f48fb1;
}

.project-card__tags li:nth-child(7n + 3) .project-tag {
  background: #e8f5e9;
  color: #1b5e20;
  border-color: #81c784;
}

.project-card__tags li:nth-child(7n + 4) .project-tag {
  background: #fff3e0;
  color: #e65100;
  border-color: #ffb74d;
}

.project-card__tags li:nth-child(7n + 5) .project-tag {
  background: #f3e5f5;
  color: #4a148c;
  border-color: #ce93d8;
}

.project-card__tags li:nth-child(7n + 6) .project-tag {
  background: #e0f7fa;
  color: #006064;
  border-color: #4dd0e1;
}

.project-card__tags li:nth-child(7n + 7) .project-tag {
  background: #efebe9;
  color: #3e2723;
  border-color: #bcaaa4;
}

.project-card__desc {
  margin: 0 0 var(--space-sm);
  max-width: 48rem;
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.65;
}

.project-card__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.5rem;
  margin: 0;
  padding: 0;
}

a.project-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.72rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  /* same flat treatment as first tech-tag colorway */
  background: #e3f2fd;
  color: #0d47a1;
  border: var(--hairline) solid #90caf9;
}

a.project-pill:hover {
  background: #bbdefb;
  color: #0d47a1;
  border-color: #64b5f6;
}

a.project-pill:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

/* News — vertical rail + markers only */
.news-timeline {
  --news-rail-width: 6px;
  --news-dot-size: 18px;
  list-style: none;
  margin: 0;
  padding: 0.2rem 0 0;
  position: relative;
  max-width: 44rem;
}

.news-timeline::before {
  content: "";
  position: absolute;
  left: calc(var(--news-dot-size) / 2 - var(--news-rail-width) / 2);
  top: 0.25rem;
  bottom: 0.25rem;
  width: var(--news-rail-width);
  background: var(--color-border);
  border-radius: 2px;
}

.news-timeline__item {
  position: relative;
  padding-left: calc(var(--news-dot-size) + var(--space-md));
  margin-bottom: var(--space-md);
}

.news-timeline__item:last-child {
  margin-bottom: 0;
}

.news-timeline__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  width: var(--news-dot-size);
  height: var(--news-dot-size);
  border-radius: 50%;
  background: var(--color-header);
  border: 3px solid #fff;
  box-sizing: border-box;
}

.news-timeline__date {
  display: block;
  margin: 0 0 var(--space-xs);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
}

.news-timeline__text {
  margin: 0;
}

.site-footer {
  border-top: var(--hairline) solid var(--color-border);
  padding: var(--space-md);
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-muted);
  background: var(--color-surface);
}

.site-footer p {
  margin: 0;
}

.back-to-top {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  z-index: 50;
  padding: 0.45rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--color-header);
  border: var(--hairline) solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.35rem);
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease,
    background 0.15s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-header-hover);
  color: #fff;
}

.back-to-top:focus {
  outline: 2px solid var(--color-link);
  outline-offset: 3px;
}

.back-to-top:focus:not(:focus-visible) {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: none;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--color-header-hover);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .site-nav.is-open {
    max-height: 320px;
  }

  .site-nav ul {
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-sm);
  }

  .site-header {
    position: relative;
  }

  .hero__grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero__photo {
    justify-self: center;
    max-width: 10rem;
  }

  .hero__meta {
    text-align: center;
  }

  .social {
    justify-content: center;
  }

  .hero__aside {
    border-left: none;
    padding-left: 0;
    border-top: var(--hairline) solid var(--color-border);
    padding-top: var(--space-lg);
    text-align: left;
  }

  .section--projects .project-card {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .project-card__media {
    width: 100%;
  }
}

@media (min-width: 769px) and (max-width: 900px) {
  .hero__grid {
    grid-template-columns: 8rem 1fr;
    grid-template-rows: auto auto;
  }

  .hero__photo {
    grid-row: 1 / span 2;
  }

  .hero__aside {
    grid-column: 2;
    border-left: none;
    padding-left: 0;
    border-top: var(--hairline) solid var(--color-border);
    padding-top: var(--space-md);
  }
}
