/* ============================================
   LUKAS WOLF — PERSONAL SITE
   Design system: see DESIGN.md
   ============================================ */

/* ============================================
   1. CUSTOM PROPERTIES
   ============================================ */
:root {
  /* Colors — Primary */
  --color-canvas: #fafafa;
  --color-surface: #ffffff;
  --color-deep-slate: #0f172a;

  /* Colors — Accent */
  --color-accent: #4f46e5;
  --color-accent-hover: #4338ca;
  --color-accent-light: #eef2ff;
  --color-accent-soft: rgba(79, 70, 229, 0.08);

  /* Colors — Text */
  --color-text-heading: #0f172a;
  --color-text-secondary: #334155;
  --color-text-body: #64748b;
  --color-text-muted: #94a3b8;
  --color-text-white: #ffffff;
  --color-text-white-70: rgba(255, 255, 255, 0.7);

  /* Colors — Dark Section */
  --color-dark-surface: #0f172a;
  --color-dark-elevated: #1e293b;
  --color-dark-border: rgba(255, 255, 255, 0.08);

  /* Colors — Borders */
  --color-border: #e2e8f0;
  --color-border-subtle: #f1f5f9;
  --color-border-accent: #c7d2fe;

  /* Shadows — blue-tinted chromatic */
  --shadow-subtle: rgba(15, 23, 42, 0.04) 0px 1px 2px;
  --shadow-standard: rgba(15, 23, 42, 0.04) 0px 1px 2px, rgba(15, 23, 42, 0.08) 0px 4px 16px;
  --shadow-elevated: rgba(15, 23, 42, 0.06) 0px 2px 4px, rgba(15, 23, 42, 0.12) 0px 8px 24px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;
  --space-5xl: 128px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --radius-2xl: 12px;
  --radius-full: 50%;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ============================================
   2. FONT IMPORTS
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:opsz,wght@14..32,300..500&family=JetBrains+Mono:wght@400&display=swap');

/* ============================================
   3. RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text-body);
  background-color: var(--color-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: var(--color-accent-light);
  color: var(--color-text-heading);
}

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

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

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

ul, ol {
  list-style: none;
}

/* Skip to content — accessibility */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  background: var(--color-accent);
  color: var(--color-text-white);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  z-index: 10000;
  font-size: 14px;
  font-weight: 500;
}

.skip-link:focus {
  top: var(--space-sm);
  color: var(--color-text-white);
}

/* ============================================
   4. TYPOGRAPHY
   ============================================ */
.font-serif {
  font-family: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  font-feature-settings: normal;
}

.font-mono {
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  font-feature-settings: normal;
}

h1, h2, h3, h4 {
  color: var(--color-text-heading);
  font-weight: 300;
}

h1 {
  font-size: 3.5rem;
  line-height: 1.05;
  letter-spacing: -1.4px;
}

h2 {
  font-size: 2.25rem;
  line-height: 1.1;
  letter-spacing: -0.72px;
}

h3 {
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.48px;
  font-weight: 400;
}

h4 {
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.2px;
  font-weight: 500;
}

p {
  margin-bottom: 1em;
}

p:last-child {
  margin-bottom: 0;
}

.text-large {
  font-size: 1.125rem;
  line-height: 1.65;
}

.text-caption {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.text-small {
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* ============================================
   5. LAYOUT
   ============================================ */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--wide {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

main {
  position: relative;
}

.section {
  padding: var(--space-4xl) 0;
  position: relative;
}

.section--hero {
  padding: var(--space-5xl) 0 var(--space-4xl);
}

.section--dark {
  background-color: var(--color-dark-surface);
  color: var(--color-text-white-70);
}

.section--dark h2,
.section--dark h3,
.section--dark h4 {
  color: var(--color-text-white);
}

.section--dark a {
  color: var(--color-text-white);
}

.section--dark a:hover {
  color: var(--color-accent-light);
}

/* ============================================
   6. FILM GRAIN OVERLAY
   ============================================ */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ============================================
   7. NAVIGATION
   ============================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(250, 250, 250, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  height: 56px;
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav__name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-heading);
  text-decoration: none;
  letter-spacing: -0.2px;
}

.nav__name:hover {
  color: var(--color-text-heading);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav__links a {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-body);
  text-decoration: none;
  transition: color var(--transition-fast);
  position: relative;
}

.nav__links a:hover {
  color: var(--color-text-heading);
}

.nav__links a.nav__link--active {
  color: var(--color-text-heading);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1.5px;
}

.nav__link--accent {
  color: var(--color-accent) !important;
}

.nav__link--accent:hover {
  color: var(--color-accent-hover) !important;
}

/* Hamburger */
.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  margin-right: calc(-1 * var(--space-sm));
  z-index: 1001;
}

.nav__toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--color-text-heading);
  border-radius: 1px;
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.nav--open .nav__toggle span:nth-child(1) {
  transform: rotate(45deg) translate(4.5px, 4.5px);
}

.nav--open .nav__toggle span:nth-child(2) {
  opacity: 0;
}

.nav--open .nav__toggle span:nth-child(3) {
  transform: rotate(-45deg) translate(4.5px, -4.5px);
}

/* ============================================
   8. HERO SECTION
   ============================================ */
.hero {
  text-align: center;
}

.hero__photo-wrapper {
  display: inline-block;
  margin-bottom: var(--space-2xl);
  position: relative;
}

.hero__photo {
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-standard);
  object-fit: cover;
}

.hero__name {
  margin-bottom: var(--space-md);
}

.hero__tagline {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--color-text-body);
  max-width: 540px;
  margin: 0 auto var(--space-xl);
  min-height: 1.85em;
}

.hero__tagline .cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--color-accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero__social {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

/* ============================================
   9. ABOUT SECTION
   ============================================ */
.about {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-3xl);
  align-items: center;
}

.about__photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center 30%;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-standard);
}

.about__text h2 {
  margin-bottom: var(--space-lg);
}

.about__text p {
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* ============================================
   10. SONIA SECTION
   ============================================ */
.sonia-card {
  background: var(--color-dark-elevated);
  border: 1px solid var(--color-dark-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  margin-top: var(--space-xl);
}

.sonia-card__tagline {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-text-white);
  margin-bottom: var(--space-md);
  letter-spacing: -0.2px;
}

.sonia-card__description {
  color: var(--color-text-white-70);
  line-height: 1.7;
  margin-bottom: var(--space-lg);
}

.sonia-card__links {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* ============================================
   11. SELECTED WORK / PUBLICATIONS
   ============================================ */
.publications {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.pub-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.pub-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

.pub-card__title {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--color-text-heading);
  line-height: 1.4;
  letter-spacing: -0.1px;
  margin-bottom: var(--space-sm);
  overflow-wrap: break-word;
}

.pub-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.pub-card__authors {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
  overflow-wrap: break-word;
}

.pub-card__authors strong {
  color: var(--color-text-secondary);
  font-weight: 500;
}

.pub-card__links {
  display: flex;
  gap: var(--space-md);
}

/* Dark section variant */
.section--dark .pub-card {
  background: var(--color-dark-elevated);
  border-color: var(--color-dark-border);
}

.section--dark .pub-card:hover {
  box-shadow: rgba(0, 0, 0, 0.3) 0px 8px 24px;
}

.section--dark .pub-card__title {
  color: var(--color-text-white);
}

.section--dark .pub-card__authors {
  color: var(--color-text-white-70);
}

.section--dark .pub-card__authors strong {
  color: var(--color-text-white);
}

.section--dark .pub-card__meta .tag {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-white);
}

.section--dark .pub-card__meta .pub-card__citations {
  color: var(--color-text-white-70);
}

/* View all link */
.link--arrow {
  display: inline-block;
  margin-top: var(--space-xl);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-accent);
  transition: color var(--transition-fast);
}

.link--arrow:hover {
  color: var(--color-accent-hover);
}

/* ============================================
   12. FOOTER
   ============================================ */
.footer {
  padding: var(--space-3xl) 0;
  text-align: center;
  border-top: 1px solid var(--color-border);
}

.footer__social {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.footer__location {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.footer__copyright {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ============================================
   13. RESEARCH PAGE
   ============================================ */
.research__narrative {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-body);
  max-width: 640px;
  margin-top: var(--space-md);
}

/* Tighten gap between research intro and publications list */
.research-page .section--hero + .section {
  padding-top: 0;
}

.research__era-title {
  margin-bottom: var(--space-sm);
}

.research__era-subtitle {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
  letter-spacing: 0.02em;
}

.section--dark .research__era-subtitle {
  color: var(--color-text-white-70);
}

/* ============================================
   14. COMPONENTS
   ============================================ */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: inherit;
  font-feature-settings: "cv11", "ss01";
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-text-white);
}

.btn--primary:hover {
  background: var(--color-accent-hover);
  color: var(--color-text-white);
}

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

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

/* Dark section ghost button */
.section--dark .btn--ghost {
  color: var(--color-text-white);
  border-color: rgba(255, 255, 255, 0.2);
}

.section--dark .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--color-text-white);
}

/* Focus ring */
.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* --- Tags / Badges --- */
.tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-feature-settings: normal;
  font-size: 0.75rem;
  font-weight: 400;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-border-subtle);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.tag--accent {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.pub-card__citations {
  font-family: 'JetBrains Mono', monospace;
  font-feature-settings: normal;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* --- Social Links --- */
.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  font-size: 1.125rem;
  transition: color var(--transition-fast), transform var(--transition-fast);
  text-decoration: none;
}

.social-link:hover {
  color: var(--color-accent);
}

/* Dark variant */
.section--dark .social-link,
.footer .social-link {
  color: var(--color-text-muted);
}

.section--dark .social-link:hover,
.footer .social-link:hover {
  color: var(--color-accent);
}

/* --- Animated Link Underlines --- */
.link--animated {
  position: relative;
  text-decoration: none;
  color: var(--color-accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.link--animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: currentColor;
  transition: width var(--transition-slow);
}

.link--animated:hover::after {
  width: 100%;
}

.section--dark .link--animated {
  color: var(--color-text-white);
}

/* ============================================
   15. ANIMATIONS
   ============================================ */

/* Scroll-triggered fade-in */
.fade-in-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children */
.fade-in-up:nth-child(2) { transition-delay: 0.08s; }
.fade-in-up:nth-child(3) { transition-delay: 0.16s; }
.fade-in-up:nth-child(4) { transition-delay: 0.24s; }
.fade-in-up:nth-child(5) { transition-delay: 0.32s; }

/* ============================================
   16. RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
  h1 { font-size: 2.75rem; letter-spacing: -1px; }
  h2 { font-size: 2rem; letter-spacing: -0.5px; }

  .section { padding: var(--space-3xl) 0; }
  .section--hero { padding: var(--space-4xl) 0 var(--space-3xl); }

  .about {
    grid-template-columns: 250px 1fr;
    gap: var(--space-2xl);
  }
}

/* Mobile */
@media (max-width: 640px) {
  h1 { font-size: 2rem; letter-spacing: -0.5px; }
  h2 { font-size: 1.75rem; letter-spacing: -0.3px; }
  h3 { font-size: 1.25rem; }

  .container,
  .container--wide {
    padding: 0 var(--space-lg);
  }

  .section { padding: var(--space-3xl) 0; }
  .section--hero { padding: var(--space-4xl) 0 var(--space-2xl); }

  /* Nav mobile — hide the bar, show floating hamburger */
  .nav {
    position: fixed;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    height: auto;
    pointer-events: none;
  }

  .nav__inner {
    pointer-events: none;
  }

  .nav__name {
    display: none;
  }

  .nav__toggle {
    display: flex;
    pointer-events: auto;
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-full);
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    box-shadow: var(--shadow-standard);
  }

  /* Nav backdrop overlay */
  .nav--open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    pointer-events: auto;
  }

  .nav__links {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    background: var(--color-surface);
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    gap: var(--space-xl);
    z-index: 1000;
    pointer-events: auto;
  }

  .nav--open .nav__links {
    transform: translateX(0);
  }

  .nav__links a {
    font-size: 1.25rem;
  }

  .nav__links li {
    width: auto;
  }

  /* Hero mobile */
  .hero__photo {
    max-width: 100%;
  }

  .hero__tagline {
    font-size: 1rem;
  }

  /* About mobile — stack */
  .about {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .about__photo {
    width: 90%;
    max-width: 250px;
    margin: 0 auto;
  }

  /* Pub cards */
  .pub-card {
    padding: var(--space-md);
  }

  .sonia-card {
    padding: var(--space-lg);
  }

  .sonia-card__links {
    flex-direction: column;
  }

  .sonia-card__links .btn {
    text-align: center;
    justify-content: center;
    width: 100%;
  }

  /* Bigger touch targets on mobile */
  .social-link {
    width: 48px;
    height: 48px;
  }

  .btn {
    padding: 12px 24px;
  }
}

/* ============================================
   17. REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .fade-in-up {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .pub-card {
    transition: none;
  }

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

  .hero__tagline .cursor {
    animation: none;
    display: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
