/* ==========================================================
   Andrea Tizzani — academic website
   Elegant editorial · hand-crafted, no dependencies
   ========================================================== */

/* ---------- Latin Modern Roman (self-hosted) ---------- */

@font-face {
  font-family: "LM Roman";
  src: url("fonts/lmroman10-regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "LM Roman";
  src: url("fonts/lmroman10-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "LM Roman";
  src: url("fonts/lmromandemi10-regular.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "LM Roman";
  src: url("fonts/lmromandemi10-oblique.woff2") format("woff2");
  font-weight: 600; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "LM Roman";
  src: url("fonts/lmroman10-bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "LM Roman";
  src: url("fonts/lmroman10-bolditalic.woff2") format("woff2");
  font-weight: 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "LM Roman Display";
  src: url("fonts/lmroman17-regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --paper:      #faf7f1;
  --paper-deep: #f3eee4;
  --ink:        #21201c;
  --ink-soft:   #57534a;
  --ink-faint:  #8a857a;
  --accent:     #99392c;   /* Florentine terracotta */
  --accent-deep:#7c2d22;
  --rule:       #e2dcce;
  --link-underline: #d8b0a3;
  --selection: #e8c9b8;
  --badge-ink: #7c2d22;
  --btn-border: #d8b0a3;
  --flash-bg: rgba(153, 57, 44, .05);
  --glow-a: rgba(250, 247, 241, .95);
  --glow-b: rgba(250, 247, 241, .8);
  --serif-display: "LM Roman Display", "LM Roman", Georgia, serif;
  --serif-text:    "LM Roman", Georgia, serif;
  --max: 1060px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-text);
  font-size: 1.15rem;
  line-height: 1.72;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--selection); }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--link-underline); transition: color .15s, border-color .15s; }
a:hover { color: var(--accent-deep); border-bottom-color: var(--accent-deep); }

/* ---------- header / nav ---------- */

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

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

.wordmark {
  font-family: var(--serif-text);
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink);
  border: none;
}
.wordmark:hover { color: var(--accent); }

nav.main-nav { display: flex; gap: 1.6rem; }

nav.main-nav a {
  font-family: var(--serif-text);
  font-size: .84rem;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: none;
  padding-bottom: .2rem;
}
nav.main-nav a:hover { color: var(--accent); }
nav.main-nav a.active { color: var(--accent); border-bottom: 2px solid var(--accent); }

/* ---------- layout ---------- */

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

/* eyebrow labels */
.eyebrow {
  font-family: var(--serif-text);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.1rem;
}

/* ---------- archival map backdrop ----------
   Starts at full strength just under the header stripe, then melts
   progressively into the paper so the text below stays readable. */

body.home { position: relative; }

.map-veil {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1250px;
  background-image: url("map.jpg");
  background-size: cover;
  background-position: 52% 30%;   /* keeps Roma in view */
  pointer-events: none;
  z-index: 0;
  /* ease-out fade: full band under the header, quick drop before the name,
     then a long soft tail that lingers far down the page */
  -webkit-mask-image: linear-gradient(to bottom,
      black 0%, black 13%,
      rgba(0,0,0,.38) 19%,
      rgba(0,0,0,.2) 26%,
      rgba(0,0,0,.13) 38%,
      rgba(0,0,0,.08) 55%,
      rgba(0,0,0,.04) 72%,
      transparent 93%);
          mask-image: linear-gradient(to bottom,
      black 0%, black 13%,
      rgba(0,0,0,.38) 19%,
      rgba(0,0,0,.2) 26%,
      rgba(0,0,0,.13) 38%,
      rgba(0,0,0,.08) 55%,
      rgba(0,0,0,.04) 72%,
      transparent 93%);
}

body.home .page { padding-top: 7rem; }
body.home .content-col { padding-top: 5.5rem; }

body.home .site-header { position: relative; z-index: 2; }
body.home .page,
body.home .site-footer { position: relative; z-index: 1; }

/* ---------- home ---------- */

.home-grid {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 4rem;
  align-items: start;
}

.portrait-col { position: sticky; top: 2.2rem; }

.portrait {
  width: 100%;
  display: block;
  filter: saturate(.97);
}

.mobile-intro { display: none; }

.contact-block { margin-top: 1.6rem; font-size: .93rem; color: var(--ink-soft); line-height: 1.9; }
.contact-block a { color: var(--ink-soft); border-bottom-color: var(--rule); }
.contact-block a:hover { color: var(--accent); }
.contact-links { margin-top: .8rem; display: flex; flex-wrap: wrap; gap: .45rem .9rem; }
.contact-links a {
  font-family: var(--serif-text);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  border: none;
}

h1.display {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(2.5rem, 5.4vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -.015em;
  margin-bottom: .65rem;
}

.subtitle {
  font-family: var(--serif-text);
  font-style: italic;
  font-weight: 400;
  font-size: 1.22rem;
  color: var(--ink-soft);
  margin-bottom: 2.2rem;
}

/* soft paper halo so the title melts with the map instead of fighting it */
h1.display, .subtitle, .lede {
  text-shadow: 0 1px 12px var(--glow-a), 0 0 26px var(--glow-b);
}

.lede { margin-bottom: 1.15rem; }
.bio p, .abstract p { text-align: justify; hyphens: auto; }
.lede em, .bio em { font-style: italic; }

.bio p { margin-bottom: 1.15rem; color: var(--ink); }
.bio p:last-child { margin-bottom: 0; }

.divider {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.4rem 0;
}

.interests { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .2rem; }
.interests span {
  font-family: var(--serif-text);
  font-size: .82rem;
  font-weight: 400;
  letter-spacing: .09em;
  padding: .38rem .85rem;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
}

.award-item { margin-bottom: 1.05rem; }
.award-item:last-child { margin-bottom: 0; }
.award-name { font-family: var(--serif-text); font-weight: 600; font-size: 1.02rem; }
.award-note { font-size: .95rem; color: var(--ink-soft); }

/* ---------- single-page sections ---------- */

.content-col { min-width: 0; }

section { scroll-margin-top: 1.6rem; }

.section-head {
  border-top: 2px solid var(--ink);
  margin-top: 4.2rem;
  padding-top: 1.4rem;
  margin-bottom: 2rem;
}

.section-title {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 3.6vw, 2.4rem);
  letter-spacing: -.01em;
  line-height: 1.1;
}

.section-head + .section-label { margin-top: 0; border-top: none; padding-top: 0; }

/* sidebar section nav */
.side-nav {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.side-nav a {
  font-family: var(--serif-text);
  font-size: .82rem;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: none;
  width: fit-content;
}
.side-nav a:hover { color: var(--accent); }

/* latest-news highlight */
.news-flash {
  margin-top: 2.6rem;
  padding: 1rem 1.3rem;
  border-left: 2px solid var(--accent);
  background: var(--flash-bg);
  font-size: 1.02rem;
}
.news-flash-label {
  font-family: var(--serif-text);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: .25rem;
}
.news-flash p { color: var(--ink-soft); }
.news-flash-more {
  font-family: var(--serif-text);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  border: none;
  white-space: nowrap;
  margin-left: .5rem;
}

/* news feed */
.news-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.2rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--rule);
}
.news-item:last-child { border-bottom: 1px solid var(--rule); }
.news-date {
  font-family: var(--serif-text);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: .35rem;
  white-space: nowrap;
}
.news-item p { font-size: 1.02rem; color: var(--ink); }
.news-item strong { font-weight: 600; }

/* ---------- research ---------- */

.page-title {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 4.6vw, 3rem);
  letter-spacing: -.012em;
  line-height: 1.1;
  margin-bottom: 2.8rem;
}

.section-label {
  font-family: var(--serif-text);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
  border-top: 1px solid var(--rule);
  padding-top: 1.3rem;
  margin: 3rem 0 1.8rem;
}
.section-label:first-of-type { margin-top: 0; }

.paper { margin-bottom: 3rem; }
.paper:last-child { margin-bottom: 0; }

.paper-number {
  font-family: var(--serif-text);
  font-style: italic;
  color: var(--ink-faint);
  font-size: .95rem;
  margin-bottom: .25rem;
}

.paper h3 {
  font-family: var(--serif-text);
  font-weight: 600;
  font-size: 1.62rem;
  line-height: 1.22;
  letter-spacing: -.008em;
  margin-bottom: .3rem;
}

.paper .coauthors { font-style: italic; color: var(--ink-soft); margin-bottom: .75rem; }

.paper-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .35rem;
}
.paper-icon {
  height: 64px;
  width: auto;
  flex: none;
  opacity: .92;
}
.paper-icon.icon-night { display: none; }
[data-theme="night"] .paper-icon.icon-ink { display: none; }
[data-theme="night"] .paper-icon.icon-night { display: block; }

.paper .badges { display: flex; flex-wrap: wrap; gap: .45rem; margin: .55rem 0 1rem; }
.paper .badges span, .paper .badges a {
  font-family: var(--serif-text);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--badge-ink);
  background: transparent;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  padding: .3rem .75rem;
}
.paper .badges span.neutral { color: var(--ink-soft); border-color: var(--rule); }
.paper .badges a:hover { color: var(--accent); border-color: var(--accent); background: var(--flash-bg); }

.paper .abstract p { margin-bottom: .9rem; }

.paper details { margin-top: .9rem; }
.paper summary {
  cursor: pointer;
  font-family: var(--serif-text);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  list-style: none;
}
.paper summary::-webkit-details-marker { display: none; }
.paper summary::after { content: " +"; color: var(--accent); }
.paper details[open] summary::after { content: " −"; }
.paper details div { margin-top: .6rem; font-size: .97rem; color: var(--ink-soft); line-height: 1.75; text-align: justify; hyphens: auto; }
.paper details.abs div { font-size: 1.05rem; color: var(--ink); line-height: 1.7; }
.paper details.abs { margin-top: .4rem; }

.paper .meta-line { font-size: .97rem; color: var(--ink-soft); margin-top: .6rem; }
.paper .meta-line strong { font-family: var(--serif-text); font-weight: 600; font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }

/* ---------- teaching ---------- */

.course { border-top: 1px solid var(--rule); padding: 1.5rem 0; }
.course:last-of-type { border-bottom: 1px solid var(--rule); }

.course-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.course h3 { font-family: var(--serif-text); font-weight: 600; font-size: 1.3rem; }
.course h3 a { color: inherit; border-bottom: 1px solid var(--rule); }
.course h3 a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.course details.comments { margin-top: .8rem; }
.course details.comments summary {
  cursor: pointer;
  font-family: var(--serif-text);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  list-style: none;
}
.course details.comments summary::-webkit-details-marker { display: none; }
.course details.comments summary::after { content: " +"; color: var(--accent); }
.course details.comments[open] summary::after { content: " \2212"; }
.comment {
  margin: .85rem 0 .85rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--rule);
  font-style: italic;
  font-size: .98rem;
  line-height: 1.7;
  color: var(--ink-soft);
  text-align: justify;
  hyphens: auto;
}
.comments-note { margin-top: .7rem; font-size: .88rem; font-style: italic; color: var(--ink-faint); }
.course .term { font-family: var(--serif-text); font-style: italic; color: var(--accent); white-space: nowrap; }
.course .details { color: var(--ink-soft); font-size: .99rem; margin-top: .3rem; }

blockquote.pull {
  margin: 2.6rem 0 0;
  padding-left: 1.4rem;
  border-left: 2px solid var(--accent);
  font-family: var(--serif-text);
  font-style: italic;
  font-size: 1.28rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
blockquote.pull footer { font-size: .85rem; font-style: normal; letter-spacing: .12em; text-transform: uppercase; margin-top: .8rem; color: var(--ink-faint); }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--rule); background: var(--paper); }
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.6rem 1.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem;
  font-size: .88rem;
  color: var(--ink-faint);
}
.footer-inner a { color: var(--ink-faint); border-bottom-color: var(--rule); }
.footer-inner a:hover { color: var(--accent); }

/* ---------- responsive ---------- */

@media (max-width: 820px) {
  .map-veil { height: 640px; }
  body.home .content-col { padding-top: 0; }
  .home-grid { display: flex; flex-direction: column; gap: 2.4rem; }
  .portrait-col { position: static; max-width: 300px; margin: 0 auto; text-align: center; }
  .contact-links { justify-content: center; }
  .mobile-intro { display: block; margin-bottom: 1.8rem; }
  .mobile-intro .subtitle { margin-bottom: 0; }
  .desktop-intro { display: none; }
  .side-nav { display: none; }
  .section-head { margin-top: 3.2rem; }
  .news-item { grid-template-columns: 1fr; gap: .15rem; }
  .news-date { padding-top: 0; }
  nav.main-nav { gap: 1rem; }
  nav.main-nav a { font-size: .78rem; letter-spacing: .12em; }
  .page { padding-top: 2.4rem; }
  .header-inner { padding: 1.1rem 1.25rem; }
  nav.main-nav { gap: 1.1rem; }
}


/* ==========================================================
   Themes
   ========================================================== */

/* --- soft blue: all blue tones --- */
[data-theme="blue"] {
  --accent:      #336699;
  --accent-deep: #274e73;
  --link-underline: #aac4da;
  --selection:   #d7e4f0;
  --badge-ink:   #274e73;
  --btn-border:  #a9c4dc;
  --flash-bg:    rgba(51, 102, 153, .06);
}

/* --- night: warm dark, easy on the eyes --- */
[data-theme="night"] {
  --paper:      #1c1a18;
  --paper-deep: #26231f;
  --ink:        #e9e3d6;
  --ink-soft:   #b5ad9d;
  --ink-faint:  #837c6f;
  --accent:     #d99672;   /* warm ember — low blue light */
  --accent-deep:#e7b190;
  --rule:       #3a3630;
  --link-underline: #6b5140;
  --selection:  #4a3b30;
  --badge-ink:  #e7b190;
  --btn-border: #6b5140;
  --flash-bg:   rgba(217, 150, 114, .08);
  --glow-a: rgba(28, 26, 24, .95);
  --glow-b: rgba(28, 26, 24, .8);
}

/* night: re-ink the map as light lines on dark paper */
[data-theme="night"] .map-veil {
  filter: invert(.88) hue-rotate(180deg) saturate(.6);
  opacity: .55;
}

/* ---------- theme picker: three swatch dots ---------- */

.brand { display: flex; align-items: baseline; gap: 1.4rem; flex-wrap: wrap; }
.theme-picker-group { display: flex; align-items: center; gap: .55rem; }
.theme-hint {
  font-style: italic;
  font-size: .82rem;
  color: var(--ink-faint);
}
.theme-picker {
  display: flex;
  gap: .55rem;
  align-items: center;
}
.theme-dot {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(33, 32, 28, .25);
  padding: 0;
  margin: 0;
  cursor: pointer;
  background-origin: border-box;
  transition: transform .15s ease, border-color .15s ease;
}
.theme-dot:hover { transform: translateY(-1px); border-color: rgba(33, 32, 28, .55); }
.theme-dot.active { border: 2px solid var(--ink); }
[data-theme="night"] .theme-dot { border-color: rgba(233, 227, 214, .3); }
[data-theme="night"] .theme-dot:hover { border-color: rgba(233, 227, 214, .6); }
[data-theme="night"] .theme-dot.active { border-color: var(--ink); }
/* each chip shows its theme's pairing: accent + paper */
.theme-dot[data-set="classic"] { background: linear-gradient(135deg, #99392c 49%, #faf7f1 51%); }
.theme-dot[data-set="blue"]    { background: linear-gradient(135deg, #336699 49%, #faf7f1 51%); }
.theme-dot[data-set="night"]   { background: linear-gradient(135deg, #d99672 49%, #1c1a18 51%); }
