/* style.css — 1:1 Cargo template replica */

/* ─── Font: Inter as Diatype substitute (loaded via <link> in HTML) ─── */

/* ─── Swatch System (Cargo-style opacity hierarchy) ─── */
:root {
  --swatch-1: rgba(0, 0, 0, 0.85);
  --swatch-2: rgba(0, 0, 0, 0.75);
  --swatch-3: rgba(0, 0, 0, 0.6);
  --swatch-4: rgba(0, 0, 0, 0.4);
  --swatch-5: rgba(0, 0, 0, 0.25);
  --swatch-6: rgba(0, 0, 0, 0.15);

  --bg: #ffffff;
  --border: rgba(0, 0, 0, 0.15);
  --highlight: #800020;
}

/* ─── Skip Link ─── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--swatch-1);
  color: var(--bg);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.5rem;
}

/* ─── Focus Indicators ─── */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--swatch-1);
  outline-offset: 2px;
}

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

body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  background-color: var(--bg);
  color: var(--swatch-1);
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1.1rem;
  font-weight: normal;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Two-Column Container ─── */
.container {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar (Left Panel) ─── */
.sidebar {
  width: 35%;
  max-width: 500px;
  min-width: 280px;
  padding: 1rem;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

/* Push main content to the right of the fixed sidebar */
main {
  margin-left: 35%;
  padding: 0.5rem 1rem 1rem;
  max-width: 55%;
}

.sidebar-header {
  margin-bottom: 1.8rem;
}

.sidebar h1 {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.1;
  margin: 0;
  color: var(--swatch-1);
}

.sidebar h1 a {
  color: var(--swatch-1);
  text-decoration: none;
}

.sidebar-subtitle {
  display: block;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--swatch-3);
  line-height: 1.1;
}

/* Sidebar info links — stacked, bold, like Cargo's "Information / Email / Instagram" */
.sidebar-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 1.2rem;
}

.sidebar-info a {
  color: var(--swatch-1);
  font-weight: 500;
  font-size: 1.15rem;
  line-height: 1.1;
  text-decoration: none;
}

.sidebar-info a:active {
  opacity: 0.7;
}

/* Navigation — numbered index like Cargo */
.nav-index {
  margin: 0;
  padding: 0 0 0 2.5em;
  list-style-type: decimal;
}

.nav-index li {
  margin-bottom: 0;
  line-height: 1.1;
}

.nav-index a {
  color: var(--swatch-1);
  font-weight: 450;
  font-size: 1.15rem;
  text-decoration: none;
}

.nav-index a:active {
  opacity: 0.7;
}

.nav-index a.active {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─── Main Content (Right Panel) ─── */
/* main margin-left set above after .sidebar */

/* ─── Typography ─── */
h1, h2, h3 {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 480;
  margin-top: 0;
  line-height: 1;
  color: var(--swatch-2);
}

h2, h3 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

h4 {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 480;
  margin-top: 0;
  margin-bottom: 0.4rem;
  line-height: 1.2;
  color: var(--swatch-1);
}

h3 + p {
  margin-top: 0.3rem;
  margin-bottom: 0.8rem;
  color: var(--swatch-4);
}

h4 + ul { margin-top: 0; }
h4 + p { margin-top: 0; }

/* ─── Links — Cargo-style (no underline, opacity on active) ─── */
a {
  color: var(--swatch-1);
  text-decoration: none;
}

a:active {
  opacity: 0.7;
}

/* ─── About Page ─── */
.about-section a {
  color: var(--swatch-4);
  text-decoration: none;
}

.about-section a:hover {
  text-decoration: underline;
}

/* Research interests */
.interests-list { margin: 1.5rem 0; }
.interests-list ol { padding-left: 1.2rem; margin: 0; }

.interests-list li {
  margin-bottom: 0.8rem;
  line-height: 1.3;
  color: var(--swatch-3);
}

.interests-list li strong {
  color: var(--swatch-1);
  font-weight: 600;
}

/* ─── Publications ─── */
.year-section {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
}

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

.year-label {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1.1rem;
  color: var(--swatch-4);
  padding-top: 0.2rem;
  line-height: 1;
}

.year-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.publication {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
  margin-bottom: 0;
}

.publication:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

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

.pub-image {
  max-width: 400px;
  height: auto;
  border-radius: 0;
  filter: grayscale(100%);
  transition: filter 0.3s ease;
  cursor: pointer;
}

.pub-image:hover {
  filter: grayscale(0%);
}

.publication h4 {
  margin-top: 0;
  margin-bottom: 0.3rem;
}

.publication h4 + p,
.publication h4 + p + p {
  color: var(--swatch-4);
}

.publication a {
  color: var(--swatch-1);
  text-decoration: none;
  margin-right: 0.8rem;
}

.publication a:hover {
  text-decoration: underline;
}

.publication p {
  line-height: 1.2;
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
}

.publication, .teaching, .project {
  margin-bottom: 0.8rem;
  padding-bottom: 0.8rem;
}

.publication ul {
  padding-left: 1.2em;
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
}

.publication ul li { margin-bottom: 0.15rem; }

.teaching, .project { margin-bottom: 1.5rem; }

/* ─── News ─── */
.news-section { margin-top: 2rem; }
.news-section h3 { margin-top: 0; }

.news-list {
  border-top: 1px solid var(--border);
  padding: 0.6rem 0;
  max-height: 220px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--swatch-5) transparent;
}

.news-list ul {
  margin: 0;
  padding-left: 1.2rem;
  list-style: disc;
}

.news-list li {
  margin-bottom: 0.25rem;
  line-height: 1.4;
  color: var(--swatch-1);
}

.news-list::-webkit-scrollbar { width: 6px; }
.news-list::-webkit-scrollbar-thumb {
  background-color: var(--swatch-5);
  border-radius: 999px;
}

/* ─── Home page ─── */
.inline-cite {
  white-space: nowrap;
  color: var(--swatch-4);
}

.home-figure {
  float: none;
  width: min(100%, 400px);
  margin: 0 auto 1rem auto;
}

.home-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.home-figure figcaption {
  font-size: 0.9rem;
  color: var(--swatch-4);
  margin-top: 0.4rem;
  line-height: 1.2;
  text-align: center;
}

/* ─── Highlight ─── */
.highlight {
  color: var(--highlight);
  font-weight: 600;
}

.highlight a { color: var(--highlight); }

/* ─── Modal / Lightbox ─── */
.modal {
  position: fixed;
  z-index: 2000;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  cursor: default;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal.active .modal-content {
  transform: scale(1);
}

/* ─── Footer ─── */
.site-footer {
  padding: 1rem;
  color: var(--swatch-4);
  font-size: 1.15rem;
  font-weight: 450;
  line-height: 1.2;
}

/* Sidebar footer pinned to bottom */
.site-footer--sidebar {
  position: absolute;
  bottom: 0;
  left: 0;
}

/* ─── Page Transitions ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.fading-out {
  opacity: 0;
  transition: opacity 0.15s ease;
  will-change: opacity;
}

.fading-in > * {
  opacity: 0;
  animation: fadeInUp 0.4s cubic-bezier(0.2, 1, 0.3, 1) forwards;
}

.fading-in > *:nth-child(1) { animation-delay: 0.03s; }
.fading-in > *:nth-child(2) { animation-delay: 0.06s; }
.fading-in > *:nth-child(3) { animation-delay: 0.09s; }
.fading-in > *:nth-child(4) { animation-delay: 0.12s; }
.fading-in > *:nth-child(5) { animation-delay: 0.15s; }
.fading-in > *:nth-child(6) { animation-delay: 0.18s; }
.fading-in > *:nth-child(7) { animation-delay: 0.21s; }
.fading-in > *:nth-child(8) { animation-delay: 0.24s; }

/* ─── Scroll Reveal (Cargo scale-in) ─── */
.scroll-reveal {
  opacity: 0;
  transform: scale(0.875);
  transform-origin: 50% 0%;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: scale(1);
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  .scroll-reveal { opacity: 1; transform: none; }
}

/* ─── Mobile Header & Menu ─── */
.mobile-header {
  display: none;
}

/* ─── Mobile Footer (hidden on desktop) ─── */
.mobile-footer {
  display: none;
}

/* ─── Mobile ─── */
@media (max-width: 768px) {
  /* Fixed top bar */
  .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 400;
    padding: 0.1rem 1rem 0.4rem;
    background: var(--bg);
  }

  .mobile-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 1px;
    background: var(--swatch-1);
  }

  .mobile-header-name {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--swatch-1);
  }

  .mobile-menu-btn {
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: 450;
    color: var(--swatch-1);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .mobile-menu-btn:active {
    opacity: 0.7;
  }

  /* Increase touch targets for sidebar links */
  .sidebar-info a {
    padding: 0.35rem 0;
    display: block;
  }

  .nav-index li {
    line-height: 1.4;
  }

  .nav-index a {
    padding: 0.3rem 0;
    display: inline-block;
  }

  /* Sidebar becomes fullscreen overlay */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    min-width: auto;
    height: 100vh;
    z-index: 300;
    padding: 3.8rem 1rem 1rem;
    background: var(--bg);
    overflow-y: auto;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.menu-open {
    transform: translateY(0);
  }

  body:has(.sidebar.menu-open) .mobile-header-name {
    visibility: hidden;
  }

  .site-footer--sidebar {
    display: none;
  }

  .container {
    flex-direction: column;
  }

  main {
    margin-left: 0;
    padding: 1rem;
    padding-top: 3.8rem;
    max-width: 100%;
  }

  h2, h3 { font-size: 1.5rem; }

  .year-section {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
  }

  .year-label {
    margin-bottom: 0.5rem;
    opacity: 0.5;
  }

  .publication {
    flex-direction: column;
    gap: 0.8rem;
  }

  .pub-image {
    max-width: 100%;
    align-self: center;
  }

  .publication a {
    display: inline-block;
    padding: 0.25rem 0;
  }

  .home-figure {
    float: none;
    width: 100%;
    margin: 0 0 1rem 0;
  }

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

  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  main {
    padding-bottom: 4rem;
  }

  /* Fixed bottom bar */
  .mobile-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    padding: 0.2rem 1rem;
    padding-bottom: calc(0.2rem + env(safe-area-inset-bottom));
    background: var(--bg);
  }

  .mobile-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 1rem;
    right: 1rem;
    height: 1px;
    background: var(--swatch-1);
  }

  .mobile-footer-btn {
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: 450;
    color: var(--swatch-1);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.15rem 0;
    min-height: 36px;
    display: flex;
    align-items: center;
  }

  .mobile-footer-btn:active {
    opacity: 0.7;
  }
}
