/*
  Marek Chadim — personal site
  Academic, brand-first layout. Yale blue as accent only.
*/

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/fraunces-500.woff2") format("woff2");
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/fraunces-600.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/source-sans-400.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/source-sans-500.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/source-sans-600.woff2") format("woff2");
}

:root {
  --ink: #0c1522;
  --ink-soft: #1a2838;
  --mist: #e8eef4;
  --paper: #f5f7f9;
  --yale: #00356b;
  --yale-mid: #1a5a9c;
  --text: #1e2a36;
  --text-muted: #5a6a7a;
  --text-faint: #8a96a3;
  --line: rgba(12, 21, 34, 0.1);
  --focus: #286dc0;

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "Source Sans 3", "Helvetica Neue", Helvetica, sans-serif;

  --measure: 40rem;
  --page: 68rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background-color: #dfe8f0;
  background-image:
    radial-gradient(ellipse 100% 70% at 0% 0%, rgba(26, 90, 156, 0.28), transparent 55%),
    radial-gradient(ellipse 80% 55% at 100% 0%, rgba(12, 21, 34, 0.18), transparent 50%),
    radial-gradient(ellipse 60% 40% at 70% 100%, rgba(40, 109, 192, 0.12), transparent 55%),
    linear-gradient(165deg, #c9d7e6 0%, var(--mist) 22%, var(--paper) 48%, #eef2f6 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--yale);
  font-weight: 600;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color 0.2s var(--ease);
}

a:hover {
  color: var(--yale-mid);
}

a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* —— Layout shell —— */
.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(245, 247, 249, 0.85);
  border-bottom: 1px solid var(--line);
}

.site-header-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  font-variation-settings: "SOFT" 40, "WONK" 0;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--yale);
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  position: relative;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.2rem 0;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1.5px;
  background: var(--yale);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.nav a:hover::after,
.nav a.active::after {
  transform: scaleX(1);
}

.nav a.active {
  color: var(--ink);
  font-weight: 600;
}

main {
  flex: 1;
}

.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.footer {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.footer a {
  color: var(--text-faint);
  font-weight: 400;
}

.footer a:hover {
  color: var(--yale);
}

/* —— Home hero (typography + atmosphere; no portrait) —— */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: calc(100vh - 3.4rem);
  width: 100%;
  margin: 0;
  overflow: hidden;
}

.hero--text::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 12% 35%, rgba(26, 90, 156, 0.22), transparent 60%),
    radial-gradient(ellipse 55% 50% at 88% 20%, rgba(12, 21, 34, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 40% at 70% 90%, rgba(40, 109, 192, 0.1), transparent 60%);
  animation: fade 1.2s var(--ease) both;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 3.75rem clamp(1.5rem, 5vw, 4.5rem) 4rem;
  text-align: left;
}

.hero-label {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--text-faint);
  animation: rise 0.9s var(--ease) both;
}

.hero-brand {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 600;
  font-variation-settings: "SOFT" 30, "WONK" 0.4;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink);
  animation: rise 0.9s var(--ease) 0.06s both;
}

.hero-headline {
  margin: 0 0 1rem;
  max-width: 24em;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  font-weight: 500;
  font-variation-settings: "SOFT" 50, "WONK" 0;
  line-height: 1.35;
  color: var(--ink-soft);
  animation: rise 0.9s var(--ease) 0.14s both;
}

.hero-lede {
  margin: 0 0 1.25rem;
  max-width: 28em;
  font-size: 1.05rem;
  color: var(--text-muted);
  animation: rise 0.9s var(--ease) 0.2s both;
}

.hero-methods {
  margin: 0 0 1.85rem;
  max-width: 36em;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text);
  animation: rise 0.9s var(--ease) 0.24s both;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  animation: rise 0.9s var(--ease) 0.3s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 2px;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.btn-primary {
  background: var(--yale);
  color: #fff;
  border: 1.5px solid var(--yale);
}

.btn-primary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--yale);
  border: 1.5px solid rgba(0, 53, 107, 0.35);
}

.btn-ghost:hover {
  border-color: var(--yale);
  color: var(--yale);
  text-decoration: none;
  background: rgba(0, 53, 107, 0.04);
}

/* —— Interior page mast —— */
.mast {
  padding: 2.75rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}

.mast h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  animation: rise 0.7s var(--ease) both;
}

.mast p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.1rem;
  animation: rise 0.7s var(--ease) 0.08s both;
}

/* —— Content —— */
.content {
  max-width: 42rem;
}

.content-wide {
  max-width: 48rem;
}

.prose p {
  margin: 0 0 1.15rem;
}

.prose h2,
.content h2 {
  margin: 2.25rem 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.015em;
}

.prose h3,
.content h3 {
  margin: 1.75rem 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.prose ul,
.news-list,
.work-list {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.news-list li,
.work-list li {
  margin: 0 0 1.25rem;
  padding: 0 0 1.25rem;
  border-bottom: 1px solid var(--line);
}

.news-list li:last-child,
.work-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.news-list em,
.meta {
  color: var(--text-muted);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.links-inline a {
  margin-right: 0.65rem;
  white-space: nowrap;
}

.contact-block {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
}

.credit {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Coursework entries */
.course {
  margin: 0 0 1.75rem;
  padding: 0 0 1.75rem;
  border-bottom: 1px solid var(--line);
}

.course:last-child {
  border-bottom: none;
}

.course-title {
  font-weight: 600;
  color: var(--ink);
}

.course-detail {
  margin: 0.4rem 0 0;
  color: var(--text);
}

.course-detail em.label {
  font-style: italic;
  color: var(--text-muted);
}

/* —— Motion —— */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.85rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }

  .hero--text::before {
    animation: none;
  }
}

/* —— Responsive —— */
@media screen and (max-width: 900px) {
  .hero {
    min-height: calc(100vh - 3.4rem);
  }

  .hero-copy {
    padding: 2.5rem 1.35rem 2.75rem;
    max-width: none;
  }

  .hero-brand {
    font-size: clamp(2.6rem, 11vw, 3.5rem);
  }
}

@media screen and (max-width: 640px) {
  .site-header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 1.15rem;
  }

  .nav {
    gap: 0.1rem 1rem;
  }

  .page {
    padding: 0 1.15rem 3rem;
  }

  .hero {
    min-height: auto;
  }

  .hero-copy {
    padding: 2rem 1.15rem 2.5rem;
  }

  .cta-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .site-header,
  .cta-row {
    break-inside: avoid;
  }

  .hero {
    display: block;
    min-height: auto;
  }

  .hero--text::before {
    display: none;
  }
}
