/* Full-screen research landing page; the shared palette comes from main.scss. */
body.landing {
  margin: 0;
  padding: 0;
}
.landing [hidden] {
  display: none !important;
}
.landing a {
  text-decoration: none;
}
.landing a:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}
.landing button {
  font: inherit;
  cursor: pointer;
}
.landing :is(a, button):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 5px;
}
.landing-skip {
  position: fixed;
  top: -6rem;
  left: 1rem;
  z-index: 20;
  padding: 0.8rem;
  background: var(--global-bg-color);
}
.landing-skip:focus {
  top: 1rem;
}
.landing-header {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.7rem clamp(1.25rem, 4vw, 4rem) 3.5rem;
  background: linear-gradient(rgba(18, 24, 32, 0.85), transparent);
  pointer-events: none;
}
.landing-header :is(a, button) {
  color: #f4f6f8;
  pointer-events: auto;
}
/* The name is the page's main heading; keep it looking like a plain link. */
.landing-title {
  margin: 0;
  font-size: inherit;
  line-height: 1.2;
}
.landing-name {
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  white-space: nowrap;
}
.landing-menu {
  display: flex;
  gap: clamp(1rem, 2vw, 2rem);
  align-items: center;
  font-size: 0.95rem;
}
.landing-menu button,
.landing-menu-toggle {
  border: 0;
  background: transparent;
}
.landing-menu #light-toggle {
  font-size: 1.4rem;
}
.landing-menu-toggle {
  display: none;
}
.landing-showcase {
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: minmax(22rem, 1fr) auto;
}

/* Stage: the current project's visualizations. */
.landing-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #121820;
}
.landing-project {
  position: absolute;
  inset: 0;
}
.landing-project:not(.is-current) {
  display: none;
}
.landing-project.is-entering {
  animation: landing-fade-in 0.35s ease-out;
}
@keyframes landing-fade-in {
  from {
    opacity: 0;
  }
}
.landing-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  /* Keeps a swipe past the last item from triggering the browser's back gesture. */
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.landing-track::-webkit-scrollbar {
  display: none;
}
.landing-track:focus-visible {
  outline: 2px solid #f4f6f8;
  outline-offset: -6px;
}
.landing-item {
  position: relative;
  box-sizing: border-box;
  flex: 0 0 100%;
  height: 100%;
  margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.landing-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Figures are shown whole, clear of the header above and the controls below. */
.landing-fit-contain {
  padding: 5.5rem clamp(4.5rem, 8vw, 8rem) 4.75rem;
}
.landing-fit-contain .landing-media {
  object-fit: contain;
}

/* Keep both full crowd diagrams readable when the portrait comparison stacks them on a phone. */
@media (max-width: 760px) and (orientation: portrait) {
  .landing-stage:has(.landing-project.is-current[data-id="crowd-dynamics"]) {
    min-height: calc((100vw - 2rem) * 2.144 + 11rem);
  }
  .landing-project[data-id="crowd-dynamics"] .landing-fit-contain {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

/* Visualization controls, drawn on the stage. */
.landing-step {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translateY(-50%);
  border: 1px solid rgba(244, 246, 248, 0.4);
  border-radius: 50%;
  background: rgba(18, 24, 32, 0.7);
  color: #f4f6f8;
}
.landing-step:hover {
  background: rgba(18, 24, 32, 0.95);
}
.landing-step-prev {
  left: clamp(0.75rem, 2vw, 1.75rem);
}
.landing-step-next {
  right: clamp(0.75rem, 2vw, 1.75rem);
}
.landing-media-bar {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "playback dots caption";
  align-items: center;
  gap: 1rem;
  padding: 2.5rem clamp(1.25rem, 4vw, 4rem) 0.75rem;
  background: linear-gradient(transparent, rgba(18, 24, 32, 0.8));
  color: #f4f6f8;
  pointer-events: none;
}
.landing-media-bar > * {
  pointer-events: auto;
}
.landing-playback {
  grid-area: playback;
  justify-self: start;
  min-height: 44px;
  padding: 0 1.1rem;
  border: 1px solid rgba(244, 246, 248, 0.4);
  border-radius: 2rem;
  background: rgba(18, 24, 32, 0.7);
  color: #f4f6f8;
  font-size: 0.8rem;
  white-space: nowrap;
}
.landing-playback span {
  color: inherit;
  margin-right: 0.45rem;
}
.landing-dots {
  grid-area: dots;
  display: flex;
}
.landing-dot {
  position: relative;
  width: 30px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f4f6f8;
}
.landing-dot::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  box-sizing: border-box;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.landing-dot[aria-current="true"]::before {
  background: currentColor;
}
.landing .landing-dot:focus-visible {
  outline-offset: -6px;
}
.landing-caption {
  grid-area: caption;
  justify-self: end;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: #f4f6f8;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Panel: who you are, then choose the project and read about it. */
.landing-identity {
  display: flex;
  flex-wrap: wrap;
  row-gap: 0.15rem;
  max-width: 1600px;
  margin: 0 auto;
  padding-top: 0.95rem;
  color: var(--global-text-color-light);
  font-size: 0.875rem;
}
.landing-identity-text,
.landing-identity-links {
  display: inline-flex;
  flex-wrap: wrap;
}
.landing-identity-text > * + *::before,
.landing-identity-links > * + *::before,
.landing-identity-links::before {
  content: "·";
  display: inline-block; /* keeps the separator out of the link underline */
  margin: 0 0.55rem;
  color: var(--global-text-color-light);
}
.landing-identity a {
  color: var(--global-theme-color);
  font-weight: 500;
}
.landing-introduction {
  padding: 0 clamp(1.25rem, 4vw, 4rem) 1.8rem;
  background: var(--global-bg-color);
}
.landing-projects {
  max-width: 1600px;
  margin: 0 auto 1.3rem;
  border-bottom: 1px solid var(--global-divider-color);
}
.landing-tabs {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.75rem);
  overflow-x: auto;
  scrollbar-width: none;
}
.landing-tab {
  min-height: 44px;
  margin-bottom: -1px;
  padding: 1rem 0 0.75rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--global-text-color-light);
  font-size: 0.85rem;
  white-space: nowrap;
}
.landing-tab:hover {
  color: var(--global-text-color);
}
.landing-tab[aria-selected="true"] {
  border-bottom-color: var(--global-theme-color);
  color: var(--global-text-color);
}
.landing .landing-tab:focus-visible {
  outline-offset: 2px;
}
.landing-tab-number {
  margin-right: 0.45rem;
  color: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}
.landing-stepper {
  display: none;
}
/* All summaries share one cell, so the panel (and the stage above it) keeps one height across projects. */
.landing-summaries {
  display: grid;
}
.landing-summary {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 3rem;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}
.landing-summary:not(.is-current) {
  visibility: hidden;
}
.landing-summary h2 {
  font-size: clamp(1.35rem, 2.3vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
  margin: 0;
}
.landing-summary h2 a {
  color: var(--global-text-color);
}
.landing-details p {
  color: var(--global-text-color-light);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 0.6rem;
  max-width: 38rem;
}
.landing-project-link {
  font-size: 0.8rem;
  font-weight: 500;
}
.landing-project-link span {
  color: inherit;
  margin-left: 0.35rem;
}
@media (max-width: 760px) {
  .landing-header {
    padding-top: 1.2rem;
  }
  .landing-menu-toggle {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    min-height: 44px;
  }
  .landing-menu-toggle span {
    color: inherit;
  }
  .landing-menu {
    display: none;
    position: absolute;
    right: 1.25rem;
    top: 4.7rem;
    padding: 1rem 1.5rem;
    min-width: 12rem;
    background: #121820;
    border: 1px solid #415a77;
    border-radius: 0.4rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    pointer-events: auto;
  }
  .landing-menu.is-open {
    display: flex;
  }
  .landing-menu :is(a, button) {
    padding: 0.7rem 0;
    text-align: left;
  }
  .landing-fit-contain {
    padding: 4.75rem 3.75rem 6rem;
  }
  .landing-media-bar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas:
      "caption caption caption"
      "playback dots .";
    row-gap: 0.15rem;
    padding: 2.5rem 1.25rem 0.5rem;
  }
  .landing-caption {
    justify-self: center;
  }
  .landing-playback {
    padding: 0 0.9rem;
  }
  .landing-identity,
  .landing-identity-text {
    flex-direction: column;
  }
  .landing-identity-text > * + *::before,
  .landing-identity-links::before {
    content: none;
  }
  .landing-tabs {
    display: none;
  }
  .landing-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
  }
  .landing-stepper button {
    width: 44px;
    height: 44px;
    border: 1px solid var(--global-divider-color);
    border-radius: 50%;
    background: transparent;
    color: var(--global-text-color);
    font-size: 1.3rem;
    line-height: 1;
  }
  .landing-count {
    margin: 0;
    color: var(--global-text-color-light);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .landing-count span {
    color: inherit;
  }
  .landing-projects {
    margin-bottom: 0.9rem;
  }
  .landing-summary {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }
}
/* On touch-only phones, swiping and the dots replace the arrows so the picture stays clear. */
@media (max-width: 760px) and (hover: none) and (pointer: coarse) {
  .landing-step {
    display: none;
  }
  .landing-fit-contain {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}
/* Short screens, such as a phone held sideways: give figures more of the height. */
@media (min-width: 761px) and (max-height: 600px) {
  .landing-fit-contain {
    padding-top: 4.25rem;
    padding-bottom: 3.5rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .landing-project.is-entering {
    animation: none;
  }
}
