/* ===== Variables ===== */
:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #555;
  --color-accent: #480f28;
  --color-accent-light: #f5e8ee;
  --color-accent-warm: #6b1a3a;
  --color-border: #e0e0e0;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, serif;
  --max-width: 900px;
  --nav-height: 60px;
}

/* ===== Skip Link ===== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 8px 16px;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.85rem;
  z-index: 1000;
  border-radius: 0 0 4px 4px;
}

.skip-link:focus {
  left: 50%;
  transform: translateX(-50%);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 20px);
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  font-size: 16px;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s;
}

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

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== Navigation ===== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
}

.nav-name:hover {
  color: var(--color-accent);
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width 0.25s;
}

.nav-links a:hover {
  color: var(--color-text);
}

.nav-links a:hover::after {
  width: 100%;
}

/* ===== Main Content ===== */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Hero / About ===== */
.hero {
  padding-top: calc(var(--nav-height) + 60px);
  padding-bottom: 60px;
}

.hero-content {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

.hero-text {
  flex: 1;
}

.hero-text h1 {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-text h1::selection {
  -webkit-text-fill-color: #fff;
  background: var(--color-accent);
}

.subtitle {
  font-size: 1.15rem;
  color: var(--color-text);
  font-weight: 500;
  margin-bottom: 4px;
}

.affiliation {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

.bio {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text);
  margin-bottom: 16px;
}


.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.btn {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn:not(.btn-outline) {
  background: var(--color-accent);
  color: #fff;
}

.btn:not(.btn-outline):hover {
  background: var(--color-accent-hover, #3a0b20);
  color: #fff;
}

.btn-outline {
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
}

.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.hero-photo {
  flex-shrink: 0;
}

.hero-photo img {
  width: 200px;
  height: 240px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ===== Sections ===== */
.section {
  padding: 48px 0;
  border-top: 1px solid var(--color-border);
}

.section h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 32px;
  position: relative;
  display: inline-block;
}

.section h2::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

/* ===== Research Cards ===== */
.research-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.research-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 28px 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.research-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(72, 15, 40, 0.12);
}

.research-icon {
  color: var(--color-accent);
  margin-bottom: 12px;
  line-height: 0;
}

.research-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.research-card p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.tools-line {
  margin-top: 28px;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

/* ===== Publications ===== */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.pub {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.pub-year {
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-accent);
  padding-top: 3px;
  min-width: 48px;
}

.pub-details h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.4;
}

.pub-details h3 a {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
}

.pub-details h3 a:hover {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}

.pub-authors {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}

.pub-venue {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  font-style: italic;
  margin-bottom: 8px;
}

.pub-links {
  display: flex;
  gap: 12px;
}

.pub-links a {
  font-size: 0.82rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--color-accent-light);
  color: var(--color-accent);
  transition: background 0.2s;
}

.pub-links a:hover {
  background: var(--color-accent);
  color: #fff;
}

.pub-footer {
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

/* ===== Experience ===== */
.experience-group {
  margin-bottom: 36px;
}

.experience-group:last-child {
  margin-bottom: 0;
}

.exp-category {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  margin-bottom: 18px;
  padding-left: 12px;
  border-left: 3px solid var(--color-accent);
}

.exp-item {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  align-items: flex-start;
}

.exp-item:last-child {
  margin-bottom: 0;
}

.exp-date {
  flex-shrink: 0;
  min-width: 100px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  padding-top: 2px;
}

.exp-details h3,
.exp-details h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.exp-org {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.exp-details > p:last-of-type {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

/* ===== Contact ===== */
.contact-text {
  font-size: 1rem;
  color: var(--color-text-secondary);
}

/* ===== Footer ===== */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.last-updated {
  font-size: 0.75rem;
  margin-top: 4px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero-content {
    flex-direction: column-reverse;
    gap: 32px;
    align-items: center;
    text-align: center;
  }

  .hero-text h1 {
    font-size: 2rem;
  }

  .hero-links {
    justify-content: center;
  }

  .hero-photo img {
    width: 160px;
    height: 192px;
  }

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

  .pub {
    flex-direction: column;
    gap: 4px;
  }

  .exp-item {
    flex-direction: column;
    gap: 4px;
  }

  .nav-name {
    font-size: 0.95rem;
  }

  .nav-links {
    gap: 16px;
  }

  .nav-links a {
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  :root {
    --nav-height: 100px;
  }

  header {
    height: auto;
    min-height: var(--nav-height);
    padding: 10px 0;
  }

  .nav-name {
    display: none;
  }

  .nav-inner {
    justify-content: center;
    height: auto;
  }

  .nav-links {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }

  body {
    font-size: 15px;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }

  .research-card:hover {
    transform: none;
  }
}

/* ===== Dark Mode ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #121220;
    --color-surface: #1a1a2e;
    --color-text: #e0e0e0;
    --color-text-secondary: #a0a0b0;
    --color-accent: #c4647e;
    --color-accent-light: #2a1520;
    --color-accent-warm: #d4889a;
    --color-border: #3a3a52;
    --color-accent-hover: #d4889a;
  }

  .pub-year, .pub-links a {
    color: #d4889a;
  }

  header {
    background: rgba(18, 18, 32, 0.92);
  }

  .hero-photo img {
    border: 1px solid var(--color-border);
  }

  .research-card:hover {
    box-shadow: 0 8px 24px rgba(196, 100, 126, 0.2);
  }

  .pub-details h3 a {
    text-decoration-color: var(--color-text-secondary);
  }
}

/* ===== Print ===== */
@media print {
  header, .skip-link {
    display: none;
  }

  main {
    padding-top: 0;
  }

  .hero {
    padding-top: 0;
  }

  .research-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .pub, .exp-item {
    break-inside: avoid;
  }

  .section h2, .exp-category {
    break-after: avoid;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.75rem;
    color: #555;
    word-break: break-all;
  }

  .btn::after, .btn-outline::after,
  .pub-links a::after, .nav-links a::after,
  .pub-details h3 a::after, .exp-org a::after,
  .affiliation a::after, footer a::after,
  .research-card a::after,
  .pub-footer a::after {
    content: none !important;
  }

  .hero-links .btn {
    border: 1px solid #ccc;
    background: none;
  }

  .hero-email::after {
    content: " (zhornyak@seas.upenn.edu)" !important;
    font-weight: 400;
  }

  footer::after {
    content: "lzhornyak.github.io";
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: #555;
  }
}
