/* ── RESET & BASE ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #ffffff;
  font-family: 'EB Garamond', Georgia, serif;
  overflow: hidden;
  touch-action: none;
  /* CRITICAL FOR MOBILE: Prevents iOS Safari from fighting custom scroll with its native rubber-banding */
  overscroll-behavior: none; 
}

/* ── BOTTOM LEFT: MTGRP LOGO ── */

#wordmark {
  position: fixed;
  bottom: 16px;
  left: 12px;
  width: calc((100vw - 48px) / 3 - 8px);
  font-family: 'Karla', sans-serif;
  font-weight: 800;
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  line-height: 0.85;
  letter-spacing: -0.02em;
  color: white;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 10;
  user-select: none;
}

#landing-desc {
  position: fixed;
  bottom: calc(16px + clamp(2.8rem, 8vw, 5.5rem) * 0.85 + 10px);
  left: 12px;
  width: calc((100vw - 48px) / 3 - 8px);
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.78rem;
  line-height: 1.65;
  color: #0a0a0a;
  pointer-events: none;
  z-index: 10;
}

@media (max-width: 768px) {
  #wordmark {
    width: 52vw;
    left: 0;
    bottom: 14px;
    font-size: clamp(3rem, 14vw, 6rem);
  }

  #landing-desc {
    bottom: unset;
    top: 20px;
    left: 16px;
    width: 52vw;
    font-size: 0.72rem;
  }
}

/* ── TOP RIGHT: + ABOUT BUTTON ── */
#about-btn {
  position: fixed;
  top: 10px;
  right: 18px;
  padding: 10px;
  font-family: 'Karla', sans-serif;
  font-weight: 800;
  font-size: 2.4rem;
  line-height: 0.8;
  color: white;
  mix-blend-mode: difference;
  cursor: pointer;
  z-index: 10;
  user-select: none;
  transition: opacity 0.15s;
}
#about-btn:hover { opacity: 0.6; }

/* ── BOTTOM CENTRE: CITIES ── */
#footer-cities {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: white;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}
@media (max-width: 768px) { #footer-cities { display: none; } }

/* ── PARALLAX GRID ── */
.parallax-wrapper {
  display: flex;
  gap: 12px;
  height: 100vh;
  padding: 0 12px;
}

.parallax-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  will-change: transform;
  contain: layout style;
}

.parallax-col img {
  width: 100%;
  height: 60vh;
  object-fit: cover;
  cursor: pointer;
  display: block;
  background: #f0f0f0;
  transition: opacity 0.2s ease;
}

.parallax-col:nth-child(1) img { height: 55vh; }
.parallax-col:nth-child(2) img { height: 72vh; }
.parallax-col:nth-child(3) img { height: 48vh; }

@media (hover: hover) {
  .parallax-col img:hover { opacity: 0.75; }
  .parallax-col img { cursor: crosshair; }
}

/* ── DATA HUD — cursor telemetry over the grid ── */
#data-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
}

.hud-line {
  position: absolute;
  top: 0;
  left: 0;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, 'Courier New', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  will-change: transform;
  opacity: 0;
  transition: opacity 0.28s ease, color 0.3s ease;
}

#data-hud.active .hud-line { opacity: 1; }

/* Over light imagery the HUD samples the pixels beneath it and flips to near-black */
#data-hud.on-light .hud-line { color: #111; }

/* Fallback if pixel sampling is unavailable (e.g. cross-origin canvas taint) */
#data-hud.hud-blend .hud-line { color: #fff; mix-blend-mode: difference; }

/* ── Mobile variant: static stack anchored left of the screen centre.
     Positions live entirely in CSS — the JS only swaps text and classes ── */
#data-hud.hud-mobile .hud-line { left: 16px; will-change: auto; }
#data-hud.hud-mobile .hud-line:nth-child(1) { top: calc(50% - 34px); }
#data-hud.hud-mobile .hud-line:nth-child(2) { top: calc(50% - 16px); }
#data-hud.hud-mobile .hud-line:nth-child(3) { top: calc(50% + 20px); }
#data-hud.hud-mobile .hud-line:nth-child(4) { top: calc(50% + 36px); }
#data-hud.hud-mobile .hud-line:nth-child(5) { top: calc(50% + 52px); }

/* blinking block cursor after the title — CSS-only, compositor-cheap */
#data-hud.hud-mobile.active .hud-title::after {
  content: ' ▌';
  animation: hudBlink 1.06s steps(1) infinite;
}
@keyframes hudBlink { 50% { opacity: 0; } }

.hud-line.hud-title { font-weight: 700; }

.hud-line.hud-cross {
  font-size: 1.05rem;
  letter-spacing: 0;
  line-height: 1;
}

@media (max-width: 768px) {
  .parallax-wrapper { padding: 0; gap: 0; }
}

/* ── MODAL OVERLAY ── */
.hidden { display: none !important; }

#modal-container {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.55);
  z-index: 20;
}

.modal-box {
  position: absolute;
  top: 0;
  left: 0;
  /* Two columns of the three-column grid: (100vw - 3×12px gap) × 2/3 */
  width: calc((100vw - 36px) * 2 / 3 + 12px);
  height: 100vh;
  background: #fff;
  padding: 52px 52px 52px 48px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Slide-in animation */
  animation: modalSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes modalSlideIn {
  from { transform: translateX(-32px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

#close-modal {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  font-family: 'EB Garamond', Georgia, serif;
  line-height: 1;
  padding: 0;
  color: #aaa;
  transition: color 0.15s;
}
#close-modal:hover { color: #000; }

/* ── MODAL TYPOGRAPHY — Garamond throughout, Karla only for title ── */
/* project titles — Garamond italic */
.modal-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-weight: 400;
  font-style: italic;
  font-size: 1.3rem;
  letter-spacing: 0;
  margin-bottom: 20px;
  line-height: 1.1;
}

/* about modal title only — Karla */
.modal-title.about-title {
  font-family: 'Karla', sans-serif;
  font-weight: 800;
  font-style: normal;
  letter-spacing: -0.01em;
}

.modal-subtitle {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.9rem;
  color: #888;
  display: block;
  margin-top: 2px;
  margin-bottom: 20px;
}

.modal-data-table {
  width: 100%;
  margin-bottom: 20px;
}

/* Two-column layout: meta table left, description right */
.modal-body-cols {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0 40px;
  align-items: start;
  margin-bottom: 28px;
}

.modal-body-cols .modal-data-table {
  margin-bottom: 0;
}

.modal-body-cols .modal-desc {
  margin-bottom: 0;
  padding-top: 6px; /* optically align with first table row */
}

@media (max-width: 600px) {
  .modal-body-cols {
    grid-template-columns: 1fr;
    gap: 20px 0;
  }
}

.modal-data-table td {
  padding: 7px 0;
  vertical-align: top;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #333;
}

.modal-data-table td:first-child {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.82rem;
  color: #bbb;
  width: 100px;
  padding-top: 9px;
}

.modal-desc {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.98rem;
  line-height: 1.78;
  color: #444;
  margin-bottom: 24px;
}

.modal-team-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.modal-team-list li {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.9rem;
  color: #888;
}

/* ── PROJECT MODAL IMAGES — two-column masonry ── */
.modal-images {
  columns: 2;
  column-gap: 8px;
  margin-top: 24px;
}
.modal-images img {
  break-inside: avoid;
  margin-bottom: 8px;
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}
@media (max-width: 600px) { .modal-images { columns: 1; } }

/* ── ABOUT MODAL ── */
.about-statement {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.98rem;
  line-height: 1.78;
  color: #333;
  margin-bottom: 28px;
}

/* Partner grid: photo + name + bio */
.about-partners {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px 20px;
  margin-bottom: 24px;
}

.partner-photo {
  width: 100%;
  aspect-ratio: 3/4;
  background: #ebebeb;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.78rem;
  color: #bbb;
  overflow: hidden;
}
.partner-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.partner-name {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.88rem;
  color: #111;
  margin-bottom: 2px;
}

.partner-role {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.82rem;
  color: #aaa;
  margin-bottom: 6px;
}

.partner-bio {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #666;
}

/* contact rows inside about modal */
.about-contact-table {
  width: 100%;
  margin-top: 8px;
}
.about-contact-table td {
  padding: 6px 0;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.88rem;
  color: #444;
}
.about-contact-table td:first-child {
  font-style: italic;
  color: #bbb;
  width: 90px;
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .modal-box {
    width: 100vw;
    padding: 40px 20px 32px;
  }
  .about-partners { grid-template-columns: 1fr 1fr; gap: 20px; }
  #modal-container { padding: 0; }
}

/* ── COLLABORATORS in about modal ── */
.about-collabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 36px;
  margin-top: 28px;
  padding-top: 4px;
}

.collabs-label {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.82rem;
  color: #bbb;
  margin-bottom: 10px;
}

.collab-entry {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.92rem;
  color: #444;
  padding: 4px 0;
}

@media (max-width: 600px) {
  .about-collabs { grid-template-columns: 1fr; gap: 24px; }
}

/* ── ADDED FOR ABOUT MODAL PUBLICATIONS & ACADEMIC ── */
.about-list-section {
  margin-top: 36px;
}

.about-list-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid #eee;
  text-decoration: none;
  color: #444;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.92rem;
  transition: color 0.15s;
}

.about-list-item:last-child {
  border-bottom: 1px solid #eee;
}

a.about-list-item:hover {
  color: #0033FF; /* Matches your MTGRP blue */
}

.about-list-meta {
  font-style: italic;
  color: #888;
  font-size: 0.85rem;
  white-space: nowrap;
  margin-left: 24px;
}

@media (max-width: 600px) {
  .about-list-item {
    flex-direction: column;
    gap: 4px;
  }
  .about-list-meta {
    margin-left: 0;
  }
}