/* ══════════════════════════════════════════
   Theme Definitions
   ══════════════════════════════════════════ */

/* ── Classic: clean white, traditional academic ── */
:root, [data-theme="classic"] {
  --color-bg: #fff;
  --color-text: #000;
  --color-heading: #000;
  --color-muted: #444;
  --color-link: #0645AD;
  --color-link-hover: #0645AD;
  --color-divider: #ccc;
  --color-year: #666;
  --color-photo-shadow: rgba(0,0,0,0.08);
  --color-switcher-bg: #f5f5f5;
  --color-switcher-border: #ddd;
}

/* ── Parchment: warm cream, burgundy links, old-library feel ── */
[data-theme="parchment"] {
  --color-bg: #f5f0e6;
  --color-text: #3a2f28;
  --color-heading: #2a1f18;
  --color-muted: #6b5d52;
  --color-link: #7a2040;
  --color-link-hover: #5a1030;
  --color-divider: #d4c5ac;
  --color-year: #8a7b6b;
  --color-photo-shadow: rgba(60,40,20,0.15);
  --color-switcher-bg: #ece6d8;
  --color-switcher-border: #d4c5ac;
}

/* ── Slate: cool gray, modern institutional ── */
[data-theme="slate"] {
  --color-bg: #eef0f3;
  --color-text: #2c3e50;
  --color-heading: #1a252f;
  --color-muted: #5a6a7a;
  --color-link: #1a6b8a;
  --color-link-hover: #0e4f68;
  --color-divider: #c5cbd3;
  --color-year: #5a6a7a;
  --color-photo-shadow: rgba(0,20,40,0.12);
  --color-switcher-bg: #e2e6eb;
  --color-switcher-border: #c5cbd3;
}

/* ── Dark Study: deep charcoal, gold accents, evening reading ── */
[data-theme="dark-study"] {
  --color-bg: #1a1d2a;
  --color-text: #d0ccc4;
  --color-heading: #e8e4db;
  --color-muted: #908a7e;
  --color-link: #c8a84c;
  --color-link-hover: #dfc060;
  --color-divider: #333648;
  --color-year: #908a7e;
  --color-photo-shadow: rgba(200,168,76,0.15);
  --color-switcher-bg: #252838;
  --color-switcher-border: #333648;
}

/* ── NYU Violet: white ground, purple accents ── */
[data-theme="nyu-violet"] {
  --color-bg: #fff;
  --color-text: #222;
  --color-heading: #57068c;
  --color-muted: #555;
  --color-link: #57068c;
  --color-link-hover: #3d046a;
  --color-divider: #d0bfe0;
  --color-year: #7a5a9a;
  --color-photo-shadow: rgba(87,6,140,0.1);
  --color-switcher-bg: #f4f0f8;
  --color-switcher-border: #d0bfe0;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: 'Libre Caslon Text', serif;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); text-decoration: underline; }

/* ══════════════════════════════════════════
   Switcher Controls
   ══════════════════════════════════════════ */
.switcher-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0.6rem 1rem 0;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  align-items: center;
}

.switcher-label {
  font-family: 'IBM Plex Mono', 'Menlo', monospace;
  font-size: 0.68rem;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.switcher-select {
  font-family: 'IBM Plex Mono', 'Menlo', monospace;
  font-size: 0.68rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--color-switcher-border);
  border-radius: 3px;
  background: var(--color-switcher-bg);
  color: var(--color-muted);
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.switcher-select:focus { outline: 1px solid var(--color-link); }

/* ══════════════════════════════════════════
   Single-Page Layout
   ══════════════════════════════════════════ */
.site {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: 2rem 0;
  transition: border-color 0.3s ease;
}

.site h2 {
  font-size: 1.4rem;
  margin: 0 0 0.8rem;
  font-weight: bold;
  color: var(--color-heading);
}

.site h3 {
  font-size: 1.15rem;
  margin: 1rem 0 0.5rem;
  font-weight: bold;
  color: var(--color-heading);
}

.site h4 {
  font-size: 1rem;
  margin: 0.8rem 0 0.3rem;
  font-weight: bold;
  color: var(--color-heading);
}

/* ══════════════════════════════════════════
   Bio Section
   ══════════════════════════════════════════ */
.bio-header {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.profile-photo {
  width: 280px;
  height: 340px;
  object-fit: cover;
  object-position: top;
  flex-shrink: 0;
  box-shadow: 0 2px 12px var(--color-photo-shadow);
  transition: box-shadow 0.3s ease;
}

.bio-header-text {
  flex: 1;
  min-width: 0;
}

.bio-header-text h1 {
  font-size: 2.4rem;
  margin: 0 0 0.3rem;
  line-height: 1.15;
  color: var(--color-heading);
}

.bio-header-text .homepage-subtitle {
  margin: 0;
  font-size: 1rem;
  color: var(--color-muted);
}

.section-bio > p {
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}

/* ══════════════════════════════════════════
   Contact Section
   ══════════════════════════════════════════ */
.section-contact p {
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   Research Section
   ══════════════════════════════════════════ */
.books-section, .articles-section { margin-bottom: 1.5rem; }

.publication-item {
  display: flex;
  align-items: first baseline;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
  line-height: 1.45;
  font-size: 0.93rem;
}

.publication-year {
  flex-shrink: 0;
  width: 4rem;
  text-align: right;
  color: var(--color-year);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  font-family: 'IBM Plex Mono', 'Menlo', monospace;
  letter-spacing: -0.02em;
}

.publication-year.forthcoming {
  font-family: inherit;
  font-size: 0.68rem;
  letter-spacing: -0.03em;
}

.publication-detail {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.research-item .itemTitle {
  font-weight: bold;
}

.research-item a.itemTitle:hover {
  text-decoration: underline;
}

.research-item .coauthors,
.research-item .coeditors { font-size: 0.93em; }

.research-item .coauthors::before { content: '('; }
.research-item .coauthors::after  { content: ')'; }

.research-item .bracketed-link {
  font-size: 0.85em;
}

.category-section { margin-bottom: 1.2rem; }

/* Indent publication items under section headings */
.books-section .publication-item,
.category-section .publication-item {
  margin-left: 1.5rem;
}

/* ══════════════════════════════════════════
   Teaching Section
   ══════════════════════════════════════════ */
.courses-section { margin-bottom: 1.5rem; }

.courses-list {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin: 0;
}

.course-entry {
  margin-bottom: 0.7rem;
  line-height: 1.4;
}

.course-title { font-weight: 600; font-size: 0.95rem; }
.course-details { font-size: 0.85rem; color: var(--color-muted); }
.course-semester { font-weight: 500; }

/* ══════════════════════════════════════════
   By-Year (CV) Page — kept for potential reuse
   ══════════════════════════════════════════ */
.filters {
  max-width: 800px;
  margin: 0 auto 1rem;
  padding: 0 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.filters label { font-weight: 600; }

.filters select {
  font-family: 'Libre Caslon Text', serif;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
}

#bibliography {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

#bibliography ul {
  list-style: disc;
  padding-left: 1.5rem;
}

li.entry {
  padding: 4px 0;
}

li.entry.book_edited span.itemTitle,
li.entry.book_authored span.itemTitle { font-size: 1.2em; }

li.entry.book_edited span.links,
li.entry.book_authored span.links { display: block; }

li.entry.book_edited span.coauthors,
li.entry.book_edited span.coeditors,
li.entry.book_authored span.coauthors,
li.entry.book_authored span.coeditors {
  font-size: 0.9em;
  display: block;
}

li.entry:not(.book_edited):not(.book_authored) span.coauthors::before,
li.entry:not(.book_edited):not(.book_authored) span.coeditors::before { content: '('; }

li.entry:not(.book_edited):not(.book_authored) span.coauthors::after,
li.entry:not(.book_edited):not(.book_authored) span.coeditors::after { content: ')'; }

li.entry:not(.book_edited):not(.book_authored) span.links { display: block; }

.itemTitle { font-weight: bold; font-size: 1em; }

/* CV-page link badges */
.fileLink {
  font-weight: bold;
  background: rgb(155,26,26);
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.6em;
  font-family: Verdana, sans-serif;
}

.fileLink:hover { background: rgba(155,26,26,0.7); color: #fff; }

.externalLink {
  font-weight: bold;
  background: rgb(140,140,140);
  color: #f1f1f1;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.6em;
  font-family: Verdana, sans-serif;
}

.externalLink:hover { background: rgba(140,140,140,0.7); color: #f1f1f1; }

ul.reprints {
  margin-left: 0;
  padding-left: 30px;
}

ul.reprints > li { padding: 2px; }

/* ── Coming Soon ── */
.coming-soon {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  text-align: center;
}

/* ══════════════════════════════════════════
   Design 1: Serif Editorial (default)
   ══════════════════════════════════════════ */
/* — Base styles above already define Design 1 — */

/* ══════════════════════════════════════════
   Design 3: Modern Sans
   Clean sans-serif, smaller rounded photo,
   accent-bordered headings, contemporary feel
   ══════════════════════════════════════════ */
[data-design="3"] body {
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.55;
}

[data-design="3"] .bio-header { align-items: flex-start; }

[data-design="3"] .profile-photo {
  width: 180px;
  height: 220px;
  border-radius: 6px;
}

[data-design="3"] .bio-header-text h1 {
  font-size: 2.2rem;
  font-weight: 700;
}

[data-design="3"] .site h2 {
  font-weight: 600;
  font-size: 1.2rem;
  padding-bottom: 0.35rem;
  border-bottom: 2.5px solid var(--color-link);
  display: inline-block;
  margin-bottom: 1rem;
}

[data-design="3"] .site h3 { font-weight: 600; font-size: 1.05rem; }
[data-design="3"] .site h4 { font-weight: 600; font-size: 0.95rem; }

[data-design="3"] .publication-year {
  font-family: 'IBM Plex Mono', 'Menlo', monospace;
}

[data-design="3"] .section-bio > p { font-size: 0.93rem; }

/* ══════════════════════════════════════════
   Design 2: Classical Centred
   Cormorant Garamond, centred photo above name,
   small-caps headings, generous spacing, bookish
   ══════════════════════════════════════════ */
[data-design="2"] body {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  line-height: 1.6;
  font-size: 1.05rem;
}

[data-design="2"] .bio-header {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.2rem;
}

[data-design="2"] .profile-photo {
  width: 220px;
  height: 280px;
  border-radius: 0;
}

[data-design="2"] .bio-header-text { text-align: center; }

[data-design="2"] .bio-header-text h1 {
  font-size: 2.8rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

[data-design="2"] .bio-header-text .homepage-subtitle {
  font-variant: small-caps;
  letter-spacing: 0.06em;
  font-size: 1.05rem;
}

[data-design="2"] .section-bio > p {
  text-align: justify;
  font-size: 1rem;
}

[data-design="2"] .site h2 {
  font-variant: small-caps;
  letter-spacing: 0.1em;
  font-weight: 400;
  font-size: 1.6rem;
  text-align: center;
}

[data-design="2"] .site h3 {
  font-variant: small-caps;
  letter-spacing: 0.06em;
  font-weight: 400;
  font-size: 1.25rem;
}

[data-design="2"] .site h4 {
  font-style: italic;
  font-weight: 400;
  font-size: 1.1rem;
}

[data-design="2"] .section-divider { margin: 2.5rem 0; }

[data-design="2"] .publication-year {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-size: 0.95rem;
}

[data-design="2"] .publication-item { font-size: 0.98rem; }

/* ══════════════════════════════════════════
   Design 4: Compact Academic
   Dense, CV-like, small photo, uppercase headings,
   maximum information per screen
   ══════════════════════════════════════════ */
[data-design="4"] body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.88rem;
  line-height: 1.4;
}

[data-design="4"] .site { max-width: 900px; }

[data-design="4"] .bio-header {
  align-items: flex-start;
  gap: 1.2rem;
}

[data-design="4"] .profile-photo {
  width: 120px;
  height: 150px;
  border-radius: 2px;
}

[data-design="4"] .bio-header-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

[data-design="4"] .bio-header-text .homepage-subtitle { font-size: 0.82rem; }

[data-design="4"] .section-bio > p {
  font-size: 0.86rem;
  margin-bottom: 0.5rem;
}

[data-design="4"] .site h2 {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--color-divider);
}

[data-design="4"] .site h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

[data-design="4"] .site h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

[data-design="4"] .section-divider { margin: 1.2rem 0; }

[data-design="4"] .publication-item {
  margin-bottom: 0.2rem;
  font-size: 0.83rem;
  line-height: 1.35;
}

[data-design="4"] .publication-year {
  font-family: 'IBM Plex Mono', 'Menlo', monospace;
  font-size: 0.78rem;
  width: 3.2rem;
}

[data-design="4"] .course-entry { margin-bottom: 0.35rem; }
[data-design="4"] .course-title { font-size: 0.86rem; }
[data-design="4"] .course-details { font-size: 0.78rem; }

[data-design="4"] .publication-year.forthcoming {
  font-size: 0.56rem;
  letter-spacing: -0.04em;
}

[data-design="4"] .books-section .publication-item,
[data-design="4"] .category-section .publication-item {
  margin-left: 1rem;
}


/* ══════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════ */
@media (max-width: 600px) {
  .site { padding: 0.75rem; }

  /* Switcher: stack vertically */
  .switcher-container {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem 0;
  }

  /* Bio: photo above name, portrait-shaped and centered */
  .bio-header {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  .profile-photo {
    width: 260px;
    height: 320px;
  }
  .bio-header-text h1 { font-size: 1.8rem; }

  /* Publications: narrower year column + less indent */
  .publication-year { width: 3.2rem; font-size: 0.82rem; }
  .publication-year.forthcoming { font-size: 0.58rem; }
  .publication-item { gap: 0.5rem; font-size: 0.88rem; }
  .books-section .publication-item,
  .category-section .publication-item {
    margin-left: 0.5rem;
  }

  /* Teaching */
  .courses-list { padding-left: 1.2rem; }

  /* Design 2 (Classical Centred) */
  [data-design="2"] .bio-header-text h1 { font-size: 2.2rem; }
  [data-design="2"] .profile-photo { width: 180px; height: 230px; }

  /* Design 3 (Modern Sans) */
  [data-design="3"] .profile-photo { width: 160px; height: 200px; border-radius: 4px; }
  [data-design="3"] .bio-header-text h1 { font-size: 1.7rem; }

  /* Design 4 (Compact) — keep side-by-side, small photo */
  [data-design="4"] .bio-header { flex-direction: row; gap: 1rem; }
  [data-design="4"] .profile-photo { width: 100px; height: 125px; }
  [data-design="4"] .publication-year { width: 2.8rem; font-size: 0.72rem; }
  [data-design="4"] .publication-year.forthcoming { font-size: 0.5rem; }
  [data-design="4"] .books-section .publication-item,
  [data-design="4"] .category-section .publication-item { margin-left: 0.5rem; }
}
