/*
 * Peirce Interprets Peirce
 * Custom stylesheet
 * Aesthetic: manuscript paper + existential graphs + editorial typography
 */

/* ---- Variables ---- */
:root {
  --cream:        #f7f2e8;
  --cream-dark:   #ede7d8;
  --ink:          #18100a;
  --ink-mid:      #4a3820;
  --ink-light:    #8b7a5e;
  --accent:       #2d3f8b;
  --accent-light: #c4a55a;
  --nav-height:   64px;
  --max-width:    1120px;
  --pad-section:  100px;
  --font-serif:   'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:    'Lora', Georgia, 'Times New Roman', serif;
  --font-mono:    'Space Mono', 'Courier New', monospace;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.75;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

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

a:hover {
  text-decoration: underline;
}

/* ---- Navigation ---- */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--cream);
  border-bottom: 1px solid rgba(24, 16, 10, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  z-index: 100;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-logo:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2.25rem;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mid);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  text-decoration: none;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}

/* ---- Hero ---- */
#hero {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

#graph-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 2.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero-content h1 {
  font-family: var(--font-serif);
  font-size: clamp(3.2rem, 8.5vw, 7.5rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 2rem;
}

.hero-sub {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  color: var(--ink-light);
  max-width: 55ch;
  line-height: 1.7;
}

.hero-scroll {
  position: absolute;
  bottom: 2.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: hero-bounce 2.4s ease-in-out infinite;
}

@keyframes hero-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(7px); }
}

/* ---- Section base ---- */
.section {
  padding: var(--pad-section) 2.5rem;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4.5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 3rem;
}

/* ---- About ---- */
#about {
  background: var(--cream);
  border-top: 1px solid rgba(24, 16, 10, 0.07);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 5rem;
  align-items: start;
}

.about-grid .section-title {
  margin-bottom: 0;
}

.about-body p {
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--ink-mid);
  margin-bottom: 1.4rem;
}

.about-body p:last-child {
  margin-bottom: 0;
}

/* ---- Objectives ---- */
#objectives {
  background: var(--cream-dark);
  border-top: 1px solid rgba(24, 16, 10, 0.07);
}

.objectives-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 5rem;
  align-items: start;
}

.objectives-grid .section-title {
  margin-bottom: 0;
}

.objectives-intro {
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--ink-mid);
  margin-bottom: 2.5rem;
}

.methods-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  list-style: none;
}

.methods-list li {
  padding: 1.5rem 1.75rem;
  border: 1px solid rgba(24, 16, 10, 0.12);
  background: var(--cream);
}

.method-name {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.method-desc {
  font-size: 0.92rem;
  color: var(--ink-mid);
  line-height: 1.65;
}

/* ---- Team ---- */
#team {
  background: var(--cream);
  border-top: 1px solid rgba(24, 16, 10, 0.07);
}

.team-subsection {
  margin-bottom: 4rem;
}

.team-subsection:last-child {
  margin-bottom: 0;
}

.team-subtitle {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-light);
  border-bottom: 1px solid rgba(24, 16, 10, 0.1);
  padding-bottom: 0.8rem;
  margin-bottom: 2.5rem;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 2.75rem 2rem;
}

.team-member {
  cursor: pointer;
  text-align: center;
}

.member-photo {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 1.1rem;
  border: 2px solid rgba(24, 16, 10, 0.1);
  transition: border-color 0.25s, transform 0.25s;
}

.team-member:hover .member-photo {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.member-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.3s;
}

.team-member:hover .member-photo img {
  filter: grayscale(0%);
}

.member-name {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.member-role {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-light);
}

/* ---- Bio Modal ---- */
.bio-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(24, 16, 10, 0.65);
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.bio-modal.active {
  display: flex;
}

.bio-modal-content {
  background: var(--cream);
  max-width: 580px;
  width: 100%;
  padding: 3rem 3.5rem;
  position: relative;
  max-height: 82vh;
  overflow-y: auto;
}

.bio-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s;
}

.bio-modal-close:hover {
  color: var(--ink);
}

.bio-modal-name {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.4rem;
  line-height: 1.2;
}

.bio-modal-role {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.75rem;
}

.bio-modal-text {
  font-size: 0.97rem;
  line-height: 1.85;
  color: var(--ink-mid);
}

/* ---- Partners ---- */
#partners {
  background: var(--cream-dark);
  border-top: 1px solid rgba(24, 16, 10, 0.07);
}

.partners-subsection {
  margin-bottom: 3.5rem;
}

.partners-subsection:last-child {
  margin-bottom: 0;
}

.partners-subtitle {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-light);
  border-bottom: 1px solid rgba(24, 16, 10, 0.1);
  padding-bottom: 0.8rem;
  margin-bottom: 2rem;
}

.logos-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2rem;
  align-items: center;
}

.logo-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-item img {
  height: 70px;
  width: auto;
  max-width: 100%;
  opacity: 0.6;
  filter: grayscale(100%);
  mix-blend-mode: multiply;
  transition: opacity 0.25s, filter 0.25s;
}

.logo-item img:hover {
  opacity: 1;
  filter: grayscale(0%);
}

.advisory-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 3.5rem;
  list-style: none;
}

.advisory-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(24, 16, 10, 0.07);
}

.advisory-name {
  display: block;
  font-size: 0.97rem;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.35;
}

.advisory-institution {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--ink-light);
}

/* ---- Publications ---- */
#publications {
  background: var(--ink);
  border-top: 1px solid rgba(24, 16, 10, 0.1);
}

#publications .section-label {
  color: var(--accent-light);
}

#publications .section-title {
  color: var(--cream);
}

.publications-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.publication-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 2.5rem;
  padding: 2.25rem 0;
  border-bottom: 1px solid rgba(247, 242, 232, 0.08);
}

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

.pub-year {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-light);
  padding-top: 0.15rem;
  flex-shrink: 0;
}

.pub-authors {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: rgba(247, 242, 232, 0.45);
  margin-bottom: 0.5rem;
}

.pub-title {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  color: var(--cream);
  line-height: 1.55;
  margin-bottom: 0.5rem;
}

.pub-venue {
  font-size: 0.85rem;
  color: rgba(247, 242, 232, 0.5);
  margin-bottom: 0.9rem;
  line-height: 1.5;
}

.pub-doi {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-light);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  transition: color 0.2s;
}

.pub-doi:hover {
  color: var(--cream);
  text-decoration: none;
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .about-grid,
  .objectives-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .about-grid .section-title,
  .objectives-grid .section-title {
    margin-bottom: 0.5rem;
  }

  .methods-list {
    grid-template-columns: 1fr;
  }

  .advisory-list {
    grid-template-columns: 1fr;
  }

  .publication-item {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
}

@media (max-width: 680px) {
  :root {
    --pad-section: 60px;
  }

  #main-nav {
    padding: 0 1.25rem;
  }

  .nav-links {
    gap: 1.25rem;
  }

  .nav-links a {
    font-size: 0.65rem;
  }

  .hero-content {
    padding: 0 1.25rem;
  }

  .section {
    padding: var(--pad-section) 1.25rem;
  }

  .team-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 1.25rem;
  }

  .member-photo {
    width: 120px;
    height: 120px;
  }

  .bio-modal-content {
    padding: 2rem 1.75rem;
  }
}

/* ---- Hamburger button (hidden by default) ---- */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
}

.nav-burger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.25s, opacity 0.25s;
  transform-origin: center;
}

.nav-burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav-burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

@media (max-width: 400px) {
  .nav-burger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--cream);
    border-bottom: 1px solid rgba(24, 16, 10, 0.1);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    border-top: 1px solid rgba(24, 16, 10, 0.06);
  }

  .nav-links a {
    display: block;
    padding: 0.85rem 1.5rem;
    font-size: 0.72rem;
  }

  .nav-links a::after {
    display: none;
  }
}
