/* =====================================================
   Pamela Medina Quispe — academic site
   Design: warm-paper editorial (Literata/Inter/Plex Mono),
   sticky sidebar layout, burgundy accent, chip links.
   ===================================================== */

@import url("https://fonts.googleapis.com/css2?family=Literata:ital,opsz,wght@0,7..72,400;0,7..72,500;0,7..72,600;1,7..72,400&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --paper: #fbf9f4;
  --paper-deep: #f5f2ea;
  --ink: #1c1a17;
  --body: #33302b;
  --muted: #6f6a61;
  --faint: #a09a8f;
  --rule: #e7e3dc;
  --accent: #7b1040;
  --accent-hover: #a4225c;
  --serif: "Literata", Georgia, serif;
  --sans: "Inter", -apple-system, system-ui, sans-serif;
  --mono: "IBM Plex Mono", Menlo, Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 16px;
  color: var(--body);
  background: var(--paper);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* Andean accent stripe */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #7b1040, #a4433f, #c97b52, #e0b184, #e7ccbb);
  z-index: 999;
}

::selection { background: rgba(123, 16, 64, 0.14); }

/* ---- Layout: fixed sidebar (à la Kevin) + scrolling content ---- */
.layout {
  margin-left: 300px;
  padding: 3rem 3rem 4rem 5rem;
  display: flex;
  justify-content: center;
}

.layout > .content {
  width: 100%;
  max-width: 980px;
}

/* ---- Sidebar: fixed full-height column, centered ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  height: 100vh;
  overflow-y: auto;
  padding: 3.6rem 2rem 1.8rem;
  border-right: 1px solid var(--rule);
  background: var(--paper-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sidebar-photo img {
  width: 175px;
  display: block;
  border-radius: 3px;
  border: 1px solid var(--rule);
  box-shadow: 2px 3px 10px rgba(28, 26, 23, 0.1);
}

.sidebar-photo-placeholder {
  width: 175px;
  aspect-ratio: 4 / 5;
  border-radius: 3px;
  background: var(--paper);
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 0.8rem;
  text-align: center;
  padding: 1rem;
}

.sidebar-name {
  margin-top: 1.2rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.2;
}
.sidebar-name a { color: inherit; }
.sidebar-name a:hover { color: var(--accent); }

.sidebar-affiliation {
  margin-top: 0.55rem;
  font-family: var(--sans);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.6;
}

/* Minimal icon row (mirrors the landing) */
.side-icons {
  margin-top: 1.7rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.85rem;
}
.side-icons a {
  color: var(--muted);
  display: inline-flex;
  transition: color 0.15s ease, transform 0.15s ease;
}
.side-icons a:hover { color: var(--accent); transform: translateY(-1px); }
.side-icons svg { width: 17px; height: 17px; display: block; }

/* Vertical nav in the sidebar */
.side-nav {
  margin: 1.6rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.side-nav a {
  position: relative;
  display: inline-block;
  align-self: center;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  padding-bottom: 2px;
}
.side-nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: width 0.25s ease, opacity 0.25s ease;
}
.side-nav a:hover { color: var(--accent); }
.side-nav a:hover::after { width: 100%; opacity: 0.45; }
.side-nav a.active { color: var(--accent); }
.side-nav a.active::after { width: 100%; opacity: 1; }

.sidebar-contact {
  margin-top: 1.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.65;
}
.sidebar-contact a { color: var(--accent); }

.quick-links {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}
.quick-links a {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 11px;
  border-radius: 2px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.quick-links a:hover { background: var(--accent); color: var(--paper); }

/* ---- Dark mode toggle (à la Monica) ---- */
.dark-toggle {
  margin-top: auto;
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.switch { position: relative; display: inline-block; width: 32px; height: 18px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d6cfc4;
  border-radius: 999px;
  transition: 0.2s;
}
.slider::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  top: 2px;
  background: var(--paper);
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: #4a4038; }
.switch input:checked + .slider::before { transform: translateX(14px); background: #e8e2d8; }

/* ---- Content ---- */
.content { min-width: 0; }

h1 {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-bottom: 1.6rem;
  line-height: 1.15;
}

h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.006em;
  color: var(--ink);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  margin: 2.8rem 0 1.4rem;
}
.content > h2:first-child, .content section:first-child h2 { margin-top: 0; }

p { margin-bottom: 1rem; }

.about p {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--body);
}
.about strong { color: var(--ink); }

/* ---- Landing hero (à la Kevin: full-page, no sidebar) ---- */
.hero-page {
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5.5rem;
  padding: 3rem 2rem 2rem;
}

.hero-photo { flex-shrink: 0; padding-top: 4vh; }

.hero-photo img {
  width: 320px;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--rule);
  box-shadow: 4px 6px 22px rgba(28, 26, 23, 0.14);
}

.hero-photo-placeholder {
  width: 320px;
  aspect-ratio: 4 / 5;
  border-radius: 4px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}

.hero-main {
  width: 100%;
  max-width: 560px;
  padding-top: 6vh;
}

.hero-name {
  font-family: var(--serif);
  font-size: clamp(2.3rem, 4vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 0.7rem;
}

/* Gentle entrance */
@media (prefers-reduced-motion: no-preference) {
  .hero-photo, .hero-main {
    animation: fade-up 0.7s ease both;
  }
  .hero-main { animation-delay: 0.12s; }
  @keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
  }
}

.hero-role {
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2.6rem;
}

.hero-tagline {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.6vw, 1.4rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.5;
  color: var(--body);
  max-width: 44ch;
  margin-bottom: 2.8rem;
}

.hero-toggle {
  position: fixed;
  top: 1.6rem;
  right: 2rem;
}

.hero-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.05rem;
  margin-bottom: 3rem;
}
.hero-nav a {
  position: relative;
  display: inline-block;
  font-family: var(--sans);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  transition: color 0.25s ease;
}
.hero-nav a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.hero-nav a:hover { color: var(--accent); }
.hero-nav a:hover::after { width: 100%; }

.hero-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.3rem;
  margin-bottom: 2.6rem;
}
.hero-links a {
  color: var(--muted);
  display: inline-flex;
  transition: color 0.15s ease, transform 0.15s ease;
}
.hero-links a:hover { color: var(--accent); transform: translateY(-1px); }
.hero-links svg { width: 22px; height: 22px; display: block; }

.hero-keywords {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Full-width footer on the landing page */
body.home footer {
  margin-left: 0;
  max-width: none;
}

html.dark @media (max-width: 900px) {
  .hero-page {
    flex-direction: column;
    gap: 2rem;
    min-height: auto;
    padding: 4.5rem 1.5rem 3rem;
  }
  .hero-photo { padding-top: 0; }
  .hero-photo img, .hero-photo-placeholder { width: 190px; }
  .hero-main { padding-top: 0; max-width: 620px; }
}
html.dark .hero-nav a { color: #e5ded3; }
html.dark .hero-nav a:hover { color: #e08bab; }
html.dark .hero-nav a::after { background: #e08bab; }
html.dark .hero-links a { color: #a59d90; }
html.dark .hero-links a:hover { color: #e08bab; }
html.dark .hero-keywords { color: #e08bab; }

/* ---- News (badges à la Gianmarco) ---- */
.news-list { list-style: none; }
.news-item {
  display: flex;
  gap: 0.9rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.92rem;
  align-items: flex-start;
}
.news-item:last-child { border-bottom: none; }

.news-badge {
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--accent);
  padding: 2.5px 8px;
  border-radius: 2px;
  margin-top: 3px;
  white-space: nowrap;
}
.news-badge.paper { background: #1a5c3a; }
.news-badge.award { background: #7b5200; }
.news-badge.appt  { background: #6d2544; }
.news-badge.media { background: #5a2d82; }

.news-date {
  flex-shrink: 0;
  min-width: 3.4rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--faint);
  margin-top: 4px;
}

/* ---- Research page (à la Kevin Bryan) ---- */
.coauthor-note { font-size: 0.84rem; color: var(--muted); margin-bottom: 1.6rem; }

.research-group {
  margin: 1.8rem 0;
  padding: 1.3rem 1.7rem 0.8rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}
.research-group.pubs     { background: #f6ece2; }
.research-group.working  { background: #f3eedd; }
.research-group.nonref   { background: #ecdac7; }
.research-group.progress { background: #e7ccbb; }

.group-label {
  margin: 0 0 0.4rem;
  color: var(--ink-soft, #5a5856);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 600;
}

.paper-entry {
  padding: 1.1rem 0 1.2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.paper-entry:first-of-type { border-top: 0; }

.paper-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.006em;
  color: var(--ink);
  line-height: 1.3;
}
.paper-title a { color: inherit; }
.paper-title a:hover { color: var(--accent); }

/* Expandable abstract (à la Kevin: + / − chevron) */
.paper-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.paper-header .paper-title { flex: 1 1 auto; min-width: 0; }
.paper-header:hover .paper-title { color: var(--accent); }
.paper-chevron {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}
.paper-chevron::before { content: "+"; }
.paper-entry.open .paper-chevron::before { content: "\2212"; }
.paper-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.paper-body p {
  margin: 0.7rem 0 0;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-family: var(--serif);
  font-size: 0.9rem;
  line-height: 1.62;
  color: #55514b;
}

.paper-meta-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.2rem;
  margin-top: 0.35rem;
}

.paper-meta {
  min-width: 0;
  font-family: var(--serif);
  font-size: 0.88rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
}
.paper-meta .journal { color: #55514b; }

.paper-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  white-space: nowrap;
}
.paper-actions a {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.paper-actions a:hover { text-decoration: underline; text-underline-offset: 3px; }
.paper-actions a + a::before {
  content: "/";
  display: inline-block;
  margin: 0 8px;
  color: var(--faint);
}

.paper-description {
  margin: 0.45rem 0 0;
  font-family: var(--serif);
  font-size: 0.92rem;
  color: #55514b;
  line-height: 1.55;
}

.paper-note {
  margin-top: 0.35rem;
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

/* ---- Teaching ---- */
.course { margin-bottom: 1.5rem; }
.course-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}
.course-meta { font-size: 0.86rem; color: var(--muted); margin-top: 1px; }

/* ---- Media ---- */
.media-list { list-style: none; }
.media-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.92rem;
}
.media-list li:last-child { border-bottom: none; }
.media-outlet {
  font-family: var(--sans);
  font-weight: 600;
  color: var(--ink);
}
.media-year {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--faint);
}

/* ---- Footer ---- */
footer {
  margin-left: 300px;
  padding: 1.4rem 3.5rem 2.2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  text-align: center;
}

/* ---- Dark mode palette (warm) ---- */
html.dark body { background: #181411; color: #d9d2c7; }
html.dark { background: #181411; }
html.dark .sidebar { background: #1d1916; border-right-color: #2e2822; }
html.dark .side-nav a { color: #e5ded3; }
html.dark .side-nav a:hover { color: #e08bab; }
html.dark .side-nav a.active { color: #e08bab; }
html.dark .side-nav a::after { background: #e08bab; }
html.dark a { color: #e08bab; }
html.dark a:hover { color: #eba9c2; }
html.dark h1, html.dark h2 { color: #f2ede5; }
html.dark h2 { border-bottom-color: #3a332c; }
html.dark .sidebar-name, html.dark .sidebar-name a { color: #f2ede5; }
html.dark .sidebar-affiliation, html.dark .sidebar-contact { color: #a59d90; }
html.dark .sidebar-contact a { color: #e08bab; }
html.dark .side-icons a { color: #a59d90; }
html.dark .side-icons a:hover { color: #e08bab; }
html.dark .sidebar-photo img { border-color: #3a332c; box-shadow: 2px 3px 10px rgba(0,0,0,0.4); }
html.dark .sidebar-photo-placeholder { background: #241f1b; border-color: #3a332c; color: #7d766b; }
html.dark .quick-links a { color: #e08bab; border-color: #e08bab; }
html.dark .quick-links a:hover { background: #e08bab; color: #181411; }
html.dark .about p { color: #d9d2c7; }
html.dark .about strong { color: #f2ede5; }
html.dark .news-item { border-bottom-color: #2e2822; }
html.dark .news-date { color: #7d766b; }
html.dark .research-group { border-color: rgba(255,255,255,0.06); }
html.dark .research-group.pubs     { background: #272019; }
html.dark .research-group.working  { background: #25221a; }
html.dark .research-group.nonref   { background: #2b221a; }
html.dark .research-group.progress { background: #2e211c; }
html.dark .group-label { color: #b3a99a; }
html.dark .paper-entry { border-top-color: rgba(255,255,255,0.08); }
html.dark .paper-title { color: #f2ede5; }
html.dark .paper-header:hover .paper-title { color: #e08bab; }
html.dark .paper-chevron { color: #e08bab; }
html.dark .paper-meta { color: #a59d90; }
html.dark .paper-meta .journal { color: #c4bbac; }
html.dark .paper-actions a { color: #e08bab; }
html.dark .paper-body p { border-top-color: rgba(255,255,255,0.08); color: #c4bbac; }
html.dark .paper-note { color: #a59d90; }
html.dark .course-title { color: #f2ede5; }
html.dark .course-meta { color: #a59d90; }
html.dark .media-list li { border-bottom-color: #2e2822; }
html.dark .media-outlet { color: #f2ede5; }
html.dark .media-year { color: #7d766b; }
html.dark .dark-toggle { color: #a59d90; }
html.dark footer { border-top-color: #2e2822; color: #7d766b; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .layout {
    margin-left: 0;
    padding: 1.6rem 1.4rem 3rem;
  }
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    padding: 1.8rem 1.4rem 1.4rem;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }
  .sidebar-photo img, .sidebar-photo-placeholder { width: 140px; }
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.3rem;
  }
  .dark-toggle { margin-top: 1.2rem; padding-top: 0; }
  footer { margin-left: 0; padding: 1.2rem 1.4rem 2rem; }
  .research-group { padding: 1rem 1.1rem 0.6rem; }
  .paper-meta-line { display: block; }
  .paper-actions { margin-top: 0.3rem; }
}
