/* ============================================================
   Dr. Winston Ewert — editorial style
   ============================================================ */

:root {
  --bg:        #FAF6EE;
  --bg-elev:   #F2EBDB;
  --ink:       #1A1814;
  --ink-mute:  #5A544A;
  --accent:    #1B2A4E;
  --accent-2:  #7A1F2B;
  --rule:      #D4CDB8;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --measure: 70ch;
  --container: 760px;
  --section-y: 4rem;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg:        #1A1714;
  --bg-elev:   #252119;
  --ink:       #F0E8D6;
  --ink-mute:  #A89F8C;
  --accent:    #8FA8E0;
  --accent-2:  #D89098;
  --rule:      #3D3528;

  color-scheme: dark;
}

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

html, body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 200ms ease, color 200ms ease;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  transition: border-color 150ms ease, color 150ms ease;
}

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

/* ---------- Layout ---------- */

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

section {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--rule);
}

section:first-of-type {
  border-top: none;
}

.section-title {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 2rem 0;
}

.section-title::before {
  content: "§ ";
  color: var(--accent-2);
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: background-color 150ms ease, transform 150ms ease;
}

.theme-toggle:hover {
  background: var(--rule);
  transform: rotate(-12deg);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .sun  { display: none; }
[data-theme="dark"] .theme-toggle .sun  { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ---------- Hero ---------- */

.hero {
  text-align: center;
  padding: 5rem 0 4rem;
  border-top: none;
}

.hero__portrait {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  object-fit: cover;
  border: 1px solid var(--rule);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.hero__eyebrow {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 1rem;
}

.hero__eyebrow span { color: var(--accent-2); margin: 0 0.4em; }

.hero__name {
  font-family: var(--serif);
  font-weight: 600;
  font-style: normal;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
  font-variation-settings: "opsz" 36;
}

.hero__rule {
  width: 60px;
  height: 1px;
  background: var(--accent-2);
  margin: 1.5rem auto;
  border: none;
}

.hero__tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.125rem;
  color: var(--ink-mute);
  margin: 0;
  max-width: 36ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* ---------- About ---------- */

.about p {
  font-size: 1.0625rem;
  margin: 0 0 1.25rem;
  max-width: var(--measure);
}

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

.affiliations li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.95rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.affiliations li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  flex-shrink: 0;
  transform: translateY(-2px);
}

.affiliations .role {
  color: var(--ink-mute);
}

.affiliations .org {
  color: var(--ink);
  font-weight: 500;
  border-bottom: none;
}

.affiliations .org:hover {
  color: var(--accent);
}

/* ---------- Filter pills ---------- */

.filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 3rem;
  padding: 0;
  list-style: none;
}

.filter button {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 0.85rem;
  background: transparent;
  color: var(--ink-mute);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: all 150ms ease;
}

.filter button:hover {
  color: var(--ink);
  border-color: var(--ink-mute);
}

.filter button.is-active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

[data-theme="dark"] .filter button.is-active {
  color: var(--bg);
}

/* ---------- Publications list ---------- */

.year-group {
  margin-bottom: 3rem;
}

.year-marker {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin: 0 0 1.5rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 36;
}

.year-marker::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
  transform: translateY(-0.5em);
}

.publication {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
  transition: background-color 150ms ease;
  margin: 0 -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  border-radius: 4px;
}

.publication:last-child {
  border-bottom: 1px solid var(--rule);
}

.publication:hover {
  background: var(--bg-elev);
}

.publication__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 0.5rem;
  letter-spacing: -0.005em;
}

.publication__summary {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 0.85rem;
}

.publication__summary a {
  border-bottom-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.publication__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  font-family: var(--sans);
  font-size: 0.8rem;
}

.publication__tag {
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
  border-radius: 999px;
}

.publication__link {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--accent);
  border-bottom: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.publication__link:hover {
  color: var(--accent-2);
}

.publication__link::after {
  content: "→";
  transition: transform 150ms ease;
}

.publication__link:hover::after {
  transform: translateX(3px);
}

.publication__thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  filter: saturate(0.9);
}

.publication[data-tags~="book"] .publication__thumb {
  width: 88px;
  height: 132px;
  object-fit: contain;
  background: transparent;
  border: none;
  border-radius: 1px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.12);
  filter: none;
}

[data-theme="dark"] .publication__thumb {
  filter: saturate(0.85) brightness(0.92);
}

[data-theme="dark"] .publication[data-tags~="book"] .publication__thumb {
  filter: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.45);
}

/* ---------- Footer ---------- */

.footer {
  padding: 3rem 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-mute);
  border-top: 1px solid var(--rule);
}

.footer a {
  color: var(--ink-mute);
  border-bottom-color: var(--rule);
}

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

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  :root { --section-y: 2.5rem; }

  body { font-size: 17px; }

  .hero { padding: 4rem 0 3rem; }

  .publication {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .publication__thumb {
    grid-row: 1;
    width: 72px;
    height: 72px;
  }

  .publication[data-tags~="book"] .publication__thumb {
    width: 64px;
    height: 96px;
  }

  .year-marker {
    font-size: 1.6rem;
  }
}

/* ---------- Misc ---------- */

.is-hidden { display: none !important; }

::selection {
  background: color-mix(in srgb, var(--accent-2) 30%, transparent);
  color: var(--ink);
}
