/* Editorial restyle for Gabriele Letta's academic website. */
:root {
  --paper: #ffffff;
  --ink: #17231f;
  --muted: #66716b;
  --accent: #9b4f35;
  --line: rgba(23, 35, 31, 0.16);
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: var(--sans);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.72;
}

body::before { display: none; }

a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--ink); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0 4vw;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.site-header .wrapper {
  max-width: 1180px;
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-title {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -.02em;
  text-decoration: none;
}

.nav-list { display: flex; align-items: center; gap: 1.6rem; margin: 0; padding: 0; list-style: none; }
.nav-list a { color: var(--ink); font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-decoration: none; text-transform: uppercase; }
.nav-list a:hover, .nav-list a[aria-current="page"] { color: var(--accent); }

#main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 5.5rem 4vw 6rem;
  display: grid;
  grid-template-columns: 285px minmax(0, 760px);
  gap: clamp(3rem, 7vw, 7rem);
}

.sidebar { position: static !important; width: auto !important; height: auto !important; padding: 0 !important; background: #fff !important; }
.author__avatar, .author__content, .author__urls-wrapper { display: block; padding: 0; }
.author__avatar img { width: 230px; height: 288px; max-width: none; padding: 0; object-fit: cover; object-position: center top; border: 0; border-radius: 115px 115px 12px 12px; filter: saturate(.72) contrast(1.04); }
.author__name { margin: 1.25rem 0 .2rem; font-family: var(--serif) !important; font-size: 1.25rem !important; }
.author__pronouns { color: var(--muted); font-size: .73rem !important; }
.author__bio { margin: .55rem 0 1.2rem; color: var(--muted); font-size: .86rem !important; }
.author__urls { display: block; position: static; margin: 0; padding: 1rem 0 0; border: 0; border-top: 1px solid var(--line); background: none; box-shadow: none; list-style: none; }
.author__urls::before, .author__urls::after { display: none; }
.author__urls li { margin: .4rem 0; white-space: normal; color: var(--muted); font-size: .76rem !important; }
.author__urls a { color: var(--muted); text-decoration: none; }

.page, .archive { width: auto !important; margin: 0 !important; padding: 0 !important; float: none !important; }
.page__content, .archive { font-size: 1.02rem; }
.page__content h1, .archive h1, .page__title { font-family: var(--sans); font-size: 2.4rem; font-weight: 650; line-height: 1.15; letter-spacing: -.025em; }
.page__content h2, .archive h2 { margin: 3.5rem 0 1.5rem; padding: 0 0 .8rem; border-bottom: 1px solid var(--line); font-family: var(--sans); font-size: 2.05rem; font-weight: 650; letter-spacing: -.02em; }
.page__content h2 + hr, .archive h2 + hr { display: none; }
.page__content h3, .archive h3 { margin-top: 2.75rem; color: var(--accent); font-size: .78rem; letter-spacing: .13em; text-transform: uppercase; }
.page__content p { max-width: 68ch; }
.page__content hr, .archive hr { height: 1px; margin: 2rem 0; border: 0; background: var(--line); }

.academic-hero { padding: 1.2rem 0 3rem; }
.academic-kicker { margin-bottom: 1.5rem; color: var(--accent); font-size: .75rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.academic-hero h1 { max-width: 780px; margin: 0; font-family: var(--sans); font-size: 2.4rem; font-weight: 650; line-height: 1.15; letter-spacing: -.025em; }
.academic-lead { max-width: 650px; margin: 2rem 0; color: var(--muted); font-family: var(--serif); font-size: clamp(1.25rem, 2.2vw, 1.7rem); line-height: 1.45; }
.academic-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.academic-button { display: inline-flex; align-items: center; min-height: 46px; padding: 0 1.15rem; border: 1px solid var(--ink); border-radius: 999px; color: var(--ink); font-size: .76rem; font-weight: 750; letter-spacing: .08em; text-decoration: none !important; text-transform: uppercase; }
.academic-button--primary { color: var(--paper); background: var(--ink); }
.academic-button:hover { color: var(--paper); background: var(--accent); border-color: var(--accent); }
.academic-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 3.5rem 0; border: 1px solid var(--line); background: var(--line); }
.academic-meta > div { padding: 1.3rem; background: var(--paper); }
.academic-meta span { display: block; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.academic-meta strong { display: block; margin-top: .35rem; font-family: var(--serif); font-size: 1.05rem; font-weight: 500; }
.album-image { margin: 4rem 0 0; }
.album-image img { display: block; width: min(100%, 440px); height: auto; border-radius: 3px; }
.other-page .image-container img { width: min(100%, 680px) !important; max-width: none !important; }

/* Page-specific refinements. */
.publications-page .archive h2 {
  margin-top: 3.6rem;
  padding-bottom: .15rem;
  border-bottom: 0;
  font-size: 1.7rem;
  font-weight: 650;
}
.publications-page .archive h2 + hr {
  display: block;
  margin: .75rem 0 1.5rem;
}
.workshop-page .page__title,
.other-page .page__title { display: none; }
.publication-detail .page__title {
  font-size: 1.85rem;
  line-height: 1.28;
  letter-spacing: -.015em;
}

.archive__item { padding: 1.35rem 0 1.7rem; border-bottom: 1px solid var(--line); }
.archive__item-title { margin: 0 0 .4rem !important; font-family: var(--serif); font-size: 1.35rem !important; font-weight: 500; line-height: 1.25; text-transform: none !important; letter-spacing: -.015em !important; }
.archive__item-excerpt { color: var(--muted); }

.page__content img, .archive img { max-width: 100%; border-radius: 4px; }
.page__content > div[style*="display: flex"], .archive > div[style*="display: flex"] { flex-wrap: wrap; }
.page__content > div[style*="display: flex"] img, .archive > div[style*="display: flex"] img { flex: 1 1 320px; width: min(100%, 650px) !important; }

@media (max-width: 860px) {
  .site-header .wrapper { min-height: 66px; align-items: flex-start; flex-direction: column; gap: .7rem; padding: .9rem 0; }
  .nav-list { max-width: 100%; gap: 1rem; overflow-x: auto; padding-bottom: .25rem; }
  .nav-list a { font-size: .67rem; white-space: nowrap; }
  #main { grid-template-columns: 1fr; padding-top: 3.5rem; }
  .sidebar { display: grid; grid-template-columns: 100px 1fr; gap: 1.2rem; align-items: start; padding-bottom: 2rem !important; border-bottom: 1px solid var(--line); }
  .author__avatar img { width: 100px; height: 125px; }
  .author__name { margin-top: 0; }
  .author__urls-wrapper { grid-column: 1 / -1; }
  .author__urls { display: flex; flex-wrap: wrap; gap: .35rem 1rem; }
  .academic-meta { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  body { font-size: 15px; }
  .site-header { padding-inline: 5vw; }
  #main { padding-inline: 5vw; }
  .nav-list li:nth-child(5), .nav-list li:nth-child(6) { display: none; }
  .academic-hero h1 { font-size: 3.25rem; }
}

/* Final content hierarchy. */
#main { grid-template-columns: 325px minmax(0, 800px); }
.author__avatar img {
  width: 270px;
  height: 340px;
  border-radius: 135px 135px 14px 14px;
}

.section-banner {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: 190px;
  margin: 0 0 3rem;
  padding: 1.7rem 1.9rem;
  overflow: hidden;
  background-position: center;
  background-size: cover;
  border-radius: 16px;
}
.section-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(10, 16, 13, .78), rgba(10, 16, 13, .13));
}
.section-banner h1 {
  margin: 0 !important;
  color: #fff !important;
  font-size: 2rem !important;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .45);
}
.research-banner { background-image: url('/images/rugen.jpg'); }
.teaching-banner { background-image: url('/images/segantini.jpg'); }
.presentations-banner { background-image: url('/images/repin.jpg'); }
.about-banner { background-image: url('/images/built-to-spill-etsy.jpg'); }
.workshop-banner { background-image: url('/images/depero.jpg'); }
.other-banner { background-image: url('/images/hunger-header.png'); }

.publications-page .archive__item {
  position: relative;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.publications-page .archive__item:hover,
.publications-page .archive__item:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 16px 38px rgba(23, 35, 31, .14);
  outline: none;
}

.publication-detail .publication-image {
  margin: 1.4rem 0 1.6rem;
  text-align: center;
}
.publication-detail .publication-image img {
  width: min(100%, 560px);
  max-width: none;
  height: auto;
  border-radius: 10px;
}
.paper-body-card {
  margin: 0 0 2rem;
  padding: 1.65rem 1.8rem;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.paper-body-card > :first-child { margin-top: 0; }
.paper-body-card > :last-child { margin-bottom: 0; }
.floating-download {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 1.2rem;
  color: #fff !important;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .07em;
  text-decoration: none !important;
  text-transform: uppercase;
}
.floating-download:hover { background: var(--ink); }

.home-page .page__inner-wrap {
  position: relative;
  isolation: isolate;
  min-height: 720px;
  padding: 2rem;
  overflow: hidden;
  background: url('/images/built-to-spill-etsy.jpg') center / cover no-repeat;
  border-radius: 18px;
}
.home-page .page__inner-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, .24);
  backdrop-filter: blur(1px);
}
.home-page .content-box {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
}

/* Light is always the initial state; dark mode overrides every text family. */
html:not([data-theme="dark"]), html:not([data-theme="dark"]) body { background: #fff !important; }
html[data-theme="dark"] body,
html[data-theme="dark"] .page,
html[data-theme="dark"] .archive,
html[data-theme="dark"] .page__content,
html[data-theme="dark"] .page__title,
html[data-theme="dark"] .page__content h1,
html[data-theme="dark"] .page__content h2,
html[data-theme="dark"] .page__content h3,
html[data-theme="dark"] .archive h1,
html[data-theme="dark"] .archive h2,
html[data-theme="dark"] .archive h3,
html[data-theme="dark"] .archive__item-title,
html[data-theme="dark"] .archive__item-title a,
html[data-theme="dark"] .archive__item-content,
html[data-theme="dark"] .paper-body-card,
html[data-theme="dark"] .content-box,
html[data-theme="dark"] strong,
html[data-theme="dark"] em { color: var(--ink) !important; }
html[data-theme="dark"] .home-page .page__inner-wrap::before { background: rgba(8, 12, 10, .42); }
html[data-theme="dark"] .home-page .content-box { background: rgba(24, 31, 28, .94); }

@media (max-width: 860px) {
  #main { grid-template-columns: 1fr; }
  .author__avatar img { width: 112px; height: 140px; }
  .section-banner { min-height: 150px; }
  .home-page .page__inner-wrap { padding: 1.15rem; }
}

@media (max-width: 520px) {
  .section-banner { min-height: 125px; margin-bottom: 2rem; padding: 1.25rem; }
  .section-banner h1 { font-size: 1.6rem !important; }
  .floating-download { right: 16px; bottom: 16px; }
}

/* Cohesive card system and accessible color themes. */
:root {
  --paper: #fff;
  --surface: #fff;
  --surface-soft: #f7f7f5;
  --ink: #17231f;
  --muted: #66716b;
  --line: rgba(23, 35, 31, .15);
  --shadow: 0 12px 32px rgba(23, 35, 31, .07);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101513;
  --surface: #181f1c;
  --surface-soft: #202925;
  --ink: #f4f6f4;
  --muted: #b5beb9;
  --accent: #e18a69;
  --line: rgba(244, 246, 244, .16);
  --shadow: 0 12px 32px rgba(0, 0, 0, .25);
}

html, body, .site-header, .sidebar, .academic-meta > div {
  background: var(--paper) !important;
  color: var(--ink);
}

body, .page__content, .archive, .page__content h1, .page__content h2,
.page__content h3, .archive h1, .archive h2, .archive h3, .page__title,
.archive__item-title, .site-title, .author__name {
  font-family: var(--sans) !important;
}

.site-header { border-color: var(--line) !important; }
.site-title, .nav-list a { color: var(--ink) !important; }
.site-nav { display: flex; align-items: center; gap: 1rem; }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}
.theme-toggle:hover { transform: translateY(-1px); background: var(--surface); }
.theme-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }

#main { grid-template-columns: 320px minmax(0, 780px); }
.author__avatar img {
  width: 265px;
  height: 333px;
  border-radius: 133px 133px 14px 14px;
}

.content-box,
.page__content > p,
.archive > p,
.teaching-page .archive > p,
.presentations-page .archive > p,
.archive__item {
  margin: 1rem 0;
  padding: 1.5rem 1.65rem;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid rgba(23, 35, 31, .22);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(23, 35, 31, .10);
}

.content-box { margin: 1.4rem 0; }
.content-box h2 {
  margin: 0 0 1.1rem;
  padding: 0 0 .7rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.55rem;
}
.content-box p:last-child { margin-bottom: 0; }

/* Research: one clean divider per category, boxed publication entries. */
.publications-page .archive h2 {
  margin: 3.8rem 0 1.15rem;
  padding: 0;
  border: 0;
  font-size: 1.95rem;
  font-weight: 700;
}
.publications-page .archive h2 + hr { display: none !important; }
.publications-page .archive__item {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
}
.archive__item-title { font-size: 1.28rem !important; font-weight: 700 !important; }

/* Paper pages use compact titles. */
.publication-detail .page__title {
  max-width: 760px;
  font-size: 1.65rem !important;
  line-height: 1.3;
}

/* No oversized title on Workshop or Other. */
.workshop-page .page__title, .other-page .page__title { display: none !important; }
.workshop-feature h2 { font-size: 1.45rem; }
.workshop-feature img { display: block; width: min(100%, 340px); margin: 1.4rem auto 0; }

.other-card blockquote { margin: 0; padding: 0; border: 0; }
.other-card blockquote p { margin-top: 0; font-size: 1.18rem; }
.other-card .image-container { text-align: center; }
.other-card .image-container img {
  width: min(100%, 560px) !important;
  max-width: none !important;
  margin-top: 1.25rem;
}

.album-image { margin: 3.5rem 0 0; }
.album-image img { width: min(100%, 520px); }

html[data-theme="dark"] img { filter: brightness(.88) contrast(1.05); }
html[data-theme="dark"] .content-box,
html[data-theme="dark"] .page__content > p,
html[data-theme="dark"] .archive > p,
html[data-theme="dark"] .archive__item {
  border-color: var(--line);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .32);
}

/* Final refinements: paper layout, home interests and complete dark contrast. */
.research-interests p {
  font-weight: 650;
  letter-spacing: .01em;
}

.content-box .research-interests h2 {
  margin-top: 1.5rem;
  font-size: 1.15rem;
}

.publication-detail .publication-image img {
  width: min(100%, 610px);
}

.publication-detail .paper-body-card {
  max-width: none;
}

html[data-theme="dark"] body :where(h1, h2, h3, h4, h5, h6, p, li, dt, dd, span, time, strong, em),
html[data-theme="dark"] .page__date,
html[data-theme="dark"] .presented-at,
html[data-theme="dark"] .archive__item-excerpt,
html[data-theme="dark"] .author__urls,
html[data-theme="dark"] .author__urls a {
  color: var(--ink) !important;
}

html[data-theme="dark"] a:not(.floating-download):not(.academic-button) {
  color: var(--accent) !important;
}

html[data-theme="dark"] .section-banner h1,
html[data-theme="dark"] .floating-download,
html[data-theme="dark"] .academic-button--primary {
  color: #fff !important;
}

/* Home and Workshop use image headers; the paper action sits above its image. */
.home-page .page__inner-wrap {
  min-height: 0;
  padding: 0;
  overflow: visible;
  background: none;
  border-radius: 0;
}
.home-page .page__inner-wrap::before { display: none; }
.home-page .content-box {
  background: var(--surface-soft);
  backdrop-filter: none;
}
html[data-theme="dark"] .home-page .content-box { background: var(--surface-soft); }

.floating-download {
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
  margin: 0 0 1rem;
}

@media (max-width: 860px) {
  .home-page .page__inner-wrap { padding: 0; }
}

@media (max-width: 520px) {
  .floating-download { margin-bottom: .85rem; }
}

@media (max-width: 860px) {
  #main { grid-template-columns: 1fr; }
  .site-header .wrapper { align-items: stretch; }
  .site-nav { width: 100%; }
  .nav-list { flex: 1 1 auto; }
  .author__avatar img { width: 112px; height: 140px; }
}

@media (max-width: 520px) {
  .content-box, .page__content > p, .archive > p, .archive__item { padding: 1.15rem; border-radius: 11px; }
  .theme-toggle { width: 34px; height: 34px; }
}

/* Slightly shorter image headers across the site. */
.section-banner {
  min-height: 150px;
  padding-top: 1.35rem;
  padding-bottom: 1.35rem;
}

@media (max-width: 860px) {
  .section-banner { min-height: 125px; }
}

@media (max-width: 520px) {
  .section-banner { min-height: 105px; }
}

/* Mobile profile and complete navigation. */
@media (max-width: 860px) {
  .sidebar {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    width: 100% !important;
    text-align: center;
  }

  .author__avatar,
  .author__content,
  .author__urls-wrapper {
    width: 100%;
  }

  .author__avatar img {
    display: block;
    width: 150px;
    height: 188px;
    margin: 0 auto;
  }

  .author__name { margin-top: 1rem; }
  .author__urls-wrapper { grid-column: auto; }
  .author__urls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    width: 100%;
  }
  .author__urls li { text-align: center; }

  .site-header .wrapper {
    align-items: center;
    text-align: center;
  }
  .site-nav {
    justify-content: center;
    width: 100%;
  }
  .nav-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .55rem 1rem;
    width: 100%;
    overflow: visible;
  }
  .nav-list li { display: list-item !important; }
  .nav-list a { font-size: .66rem; }
}

@media (max-width: 520px) {
  .site-nav { align-items: center; gap: .55rem; }
  .nav-list { gap: .45rem .75rem; }
  .nav-list a { padding: .2rem !important; font-size: .62rem; }
  .theme-toggle { flex: 0 0 34px; }
}

/* Rectangular portrait and compact mobile dropdown navigation. */
.author__avatar img {
  border-radius: 10px;
}

.nav-toggle { display: none; }

/* Reduce page-header height one more step. */
.section-banner { min-height: 120px; }

@media (max-width: 860px) {
  body:not(.home-page) .sidebar { display: none !important; }

  .home-page .sidebar {
    display: flex !important;
    align-items: center;
  }

  .author__avatar img { border-radius: 9px; }

  .site-header .wrapper {
    align-items: stretch;
    text-align: left;
  }

  .site-title { text-align: center; }

  .site-nav {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: .6rem;
  }

  .nav-toggle {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 0 .9rem;
    color: var(--ink);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-family: var(--sans);
    font-size: .76rem;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
  }

  .nav-toggle__icon {
    margin-left: .8rem;
    transition: transform .2s ease;
  }
  .site-nav.is-open .nav-toggle__icon { transform: rotate(180deg); }

  .site-nav .nav-list {
    display: none !important;
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding: .45rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
  }

  .site-nav.is-open .nav-list { display: flex !important; }
  .site-nav > .theme-toggle {
    grid-column: 2;
    grid-row: 1;
  }
  .site-nav .nav-list li { width: 100%; }
  .site-nav .nav-list a {
    display: block;
    padding: .7rem .75rem !important;
    border-radius: 7px;
    font-size: .7rem;
    text-align: left;
  }
  .site-nav .nav-list a:hover { background: var(--surface-soft); }

  .section-banner { min-height: 95px; }
}

@media (max-width: 520px) {
  .section-banner { min-height: 80px; }
}

/* Final simplification: profile only on Home, faster reveal, shorter headers. */
body:not(.home-page) #main {
  grid-template-columns: minmax(0, 920px);
  justify-content: center;
}

#main,
.page,
.archive,
.sidebar {
  animation-duration: .25s !important;
  animation-delay: 0s !important;
  transition-duration: .25s !important;
}

.section-banner { min-height: 105px; }

@media (max-width: 860px) {
  .section-banner { min-height: 85px; }
}

@media (max-width: 520px) {
  .section-banner { min-height: 72px; }
}

/* Fit text cards to their readable line length instead of the full page width. */
.content-box,
.paper-body-card {
  width: min(760px, 100%);
  max-width: 100%;
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
}
