/* ==========================================================================
   Piotr Dybka — personal site
   Design tokens
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f7;
  --text: #1c2127;
  --text-muted: #5b6470;
  --text-faint: #8b93a0;
  --border: #e3e5e8;
  --accent: #7a2331;
  --accent-dark: #5c1a25;
  --accent-tint: #f7eeee;

  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;

  --container: 760px;
  --container-wide: 840px;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;

  --radius: 10px;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 var(--space-2);
  color: var(--text);
}

h1 {
  font-size: clamp(2.1rem, 1.4rem + 3vw, 3.1rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.5rem, 1.3rem + 1vw, 1.9rem);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: var(--font-sans);
  margin-bottom: 0.35rem;
}

p {
  margin: 0 0 var(--space-2);
}

.lede {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 62ch;
}

/* Links inside running text get a quiet underline; nav/buttons override this */
main p a,
main li a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

main p a:hover,
main li a:hover {
  text-decoration-color: currentColor;
}

.external::after {
  content: "↗";
  display: inline-block;
  margin-left: 0.2em;
  font-size: 0.8em;
  transform: translateY(-1px);
}

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

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

/* ==========================================================================
   Skip link
   ========================================================================== */

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 6px 0;
  z-index: 100;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
  top: 0;
}

/* ==========================================================================
   Header / nav
   ========================================================================== */

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 1.25rem var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: var(--space-3);
}

.nav a {
  font-size: 0.98rem;
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

@media (max-width: 480px) {
  .site-header__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding-bottom: 1rem;
  }

  .nav {
    gap: var(--space-2);
  }
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */

main {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-5) var(--space-3) var(--space-6);
}

main.wide {
  max-width: var(--container-wide);
}

section + section {
  margin-top: var(--space-5);
}

/* ==========================================================================
   Home / hero
   ========================================================================== */

.hero {
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
  margin-bottom: var(--space-5);
}

.hero__photo {
  flex: none;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-alt);
  box-shadow: 0 0 0 1px var(--border);
}

.hero__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.hero__body h1 {
  margin-bottom: 0.4rem;
}

.hero__role {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: var(--space-2);
}

.hero__bio {
  max-width: 56ch;
  color: var(--text);
}

@media (max-width: 620px) {
  .hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero__bio {
    max-width: 46ch;
  }
}

/* Profile / external links list (ORCID, Scholar, Scopus...) */

.profile-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: var(--space-3) 0 0;
  padding: 0;
}

.profile-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.profile-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-tint);
}

.profile-links a::after {
  content: "↗";
  font-size: 0.78em;
  opacity: 0.6;
}

/* Contact block */

.contact-grid {
  display: grid;
  gap: var(--space-3);
}

.contact-item dt {
  font-size: 0.85rem;
  text-transform: none;
  color: var(--text-faint);
  margin-bottom: 0.2rem;
}

.contact-item dd {
  margin: 0;
  color: var(--text);
}

.contact-item a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

.contact-item a:hover {
  text-decoration-color: currentColor;
}

@media (min-width: 560px) {
  .contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Research / publications list
   ========================================================================== */

.pub-status {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.pub-status a {
  color: var(--accent);
}

.pub-year-group {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.pub-year-group:first-of-type {
  padding-top: 0;
}

.pub-year {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-faint);
  padding-top: 0.15rem;
}

.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pub-item__title {
  font-weight: 500;
  color: var(--text);
}

.pub-item__title a {
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.15s ease;
}

.pub-item__title a:hover {
  background-size: 100% 1px;
}

.pub-item__meta {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 0.2rem;
}

.pub-item__type {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05rem 0.4rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

@media (max-width: 560px) {
  .pub-year-group {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .pub-year {
    font-size: 1rem;
  }
}

.pub-empty,
.pub-error {
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* ==========================================================================
   Teaching / courses
   ========================================================================== */

.course {
  margin-bottom: var(--space-4);
}

.course__intro {
  color: var(--text-muted);
  max-width: 60ch;
  margin-bottom: var(--space-3);
}

.lecture-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.lecture-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.lecture-item__num {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  margin-right: 0.6rem;
}

.lecture-item__title {
  font-weight: 500;
  flex: 1 1 auto;
  min-width: 220px;
}

.lecture-item__links {
  display: flex;
  gap: 1rem;
  flex: none;
}

.lecture-item__links a {
  font-size: 0.92rem;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

.lecture-item__links a:hover {
  text-decoration-color: currentColor;
}

.lecture-item__links .pending {
  font-size: 0.92rem;
  color: var(--text-faint);
  cursor: default;
}

.course__intro--muted {
  font-style: italic;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.site-footer__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: var(--space-3);
  color: var(--text-faint);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
}
