/* Methane self-diffusion case study */

:root {
  color-scheme: dark;
}

body {
  min-height: 100svh;
  background: var(--c-bg-deep);
}

.diff-study {
  overflow-x: clip;
}

.diff-study main > section:not(:first-of-type) > .site {
  animation: none !important;
}

/* Hero */

.diff-hero {
  position: relative;
  display: grid;
  height: 100svh;
  min-height: 46rem;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: center;
  overflow: clip;
  padding-block: 1.35rem 1.5rem;
  background:
    radial-gradient(
      circle at 76% 42%,
      rgba(0, 166, 214, 0.16),
      transparent 31rem
    ),
    linear-gradient(
      180deg,
      rgba(31, 37, 46, 0.97),
      rgba(23, 28, 35, 0.99)
    );
  border-bottom: 1px solid rgba(217, 240, 246, 0.08);
  isolation: isolate;
}

.diff-hero::before {
  position: absolute;
  inset: 0;
  z-index: -2;
  content: "";
  opacity: 0.28;
  background-image:
    linear-gradient(
      rgba(217, 240, 246, 0.025) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(217, 240, 246, 0.025) 1px,
      transparent 1px
    );
  background-size: 5rem 5rem;
  mask-image:
    radial-gradient(
      circle at 74% 42%,
      black,
      transparent 72%
    );
}

.diff-hero::after {
  position: absolute;
  right: -8rem;
  bottom: -18rem;
  z-index: -1;
  width: 40rem;
  aspect-ratio: 1;
  content: "";
  border: 1px solid rgba(110, 187, 213, 0.1);
  border-radius: 50%;
  box-shadow:
    0 0 0 5rem rgba(0, 166, 214, 0.025),
    0 0 0 10rem rgba(0, 166, 214, 0.018);
}

.diff-hero__top,
.diff-hero__grid,
.diff-hero__facts {
  width: min(94vw, 92rem);
  max-width: none;
}

.diff-hero__top {
  display: flex;
  justify-content: flex-end;
  color: var(--c-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-100);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

.diff-hero__grid {
  display: grid;
  grid-template-columns:
    minmax(26rem, 0.84fr)
    minmax(36rem, 1.16fr);
  gap: clamp(3rem, 5vw, 5.5rem);
  align-items: center;
}

.diff-hero__copy {
  display: grid;
  min-width: 0;
  gap: var(--sp-4);
  justify-items: start;
}

.diff-hero h1 {
  max-width: 12ch;
  font-size: clamp(3rem, 4.45vw, 4.8rem);
  line-height: 0.99;
  text-wrap: balance;
}

.diff-hero__copy .lead {
  max-width: 40rem;
  font-size: clamp(1rem, 1.35vw, 1.18rem);
}

.diff-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.diff-tags li {
  padding: 0.44rem 0.72rem;
  color: var(--c-text-soft);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(217, 240, 246, 0.1);
  border-radius: var(--r-pill);
  font-size: var(--fs-200);
}

.diff-viewer {
  position: relative;
  display: grid;
  width: min(100%, 45rem);
  overflow: hidden;
  justify-self: end;
  background: rgba(17, 24, 31, 0.78);
  border: 1px solid rgba(110, 187, 213, 0.2);
  border-radius: var(--r-xl);
  box-shadow:
    var(--sh-lg),
    0 0 3rem rgba(0, 166, 214, 0.1);
}

.diff-viewer video {
  display: block;
  width: 100%;
  aspect-ratio: 22 / 17;
  background: #fff;
  object-fit: contain;
}

.diff-viewer__controls {
  display: grid;
  grid-template-columns:
    minmax(14rem, 0.8fr)
    minmax(0, 1.2fr);
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem;
  background: rgba(23, 28, 35, 0.96);
  border-top: 1px solid rgba(217, 240, 246, 0.08);
}

.diff-viewer__cue {
  display: grid;
  gap: 0.18rem;
  color: var(--c-main-2);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: var(--fw-bold);
  letter-spacing: 0.045em;
  line-height: 1.35;
  text-transform: uppercase;
}

.diff-viewer__cue strong {
  color: var(--c-text-soft);
  font-size: 0.55rem;
  letter-spacing: 0;
  text-transform: none;
}

.diff-viewer__tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.diff-viewer__tabs button {
  min-height: 2.3rem;
  color: var(--c-muted);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(217, 240, 246, 0.08);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-100);
  font-weight: var(--fw-bold);
  cursor: pointer;
  animation: diff-invite 1.8s ease-in-out infinite alternate;
  transition:
    color var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.diff-viewer__tabs button:hover,
.diff-viewer__tabs button:focus-visible,
.diff-viewer__tabs button.is-active {
  color: var(--c-text);
  background: rgba(0, 166, 214, 0.11);
  border-color: rgba(110, 187, 213, 0.42);
}

.diff-viewer__tabs button.is-active,
.diff-viewer.has-selection .diff-viewer__tabs button {
  animation: none;
}

.diff-hero__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  background: rgba(38, 46, 57, 0.56);
  border: 1px solid rgba(217, 240, 246, 0.1);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.diff-hero__facts article {
  display: grid;
  grid-template-rows: 1.2rem minmax(2.7rem, auto);
  gap: 0.35rem;
  align-content: start;
  padding: 0.82rem 1.05rem;
}

.diff-hero__facts article + article {
  border-left: 1px solid rgba(217, 240, 246, 0.08);
}

.diff-hero__facts span,
.diff-method span,
.diff-results span,
.diff-note > span,
.diff-equation > span {
  color: var(--c-main-2);
  font-family: var(--font-mono);
  font-size: var(--fs-100);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

.diff-hero__facts strong {
  color: var(--c-text-soft);
  font-family: var(--font-display);
  font-size: var(--fs-200);
  line-height: 1.4;
}

/* Sections */

.diff-section {
  position: relative;
  background:
    linear-gradient(
      180deg,
      rgba(31, 37, 46, 0.62),
      rgba(23, 28, 35, 0.95)
    );
}

.diff-section.section {
  padding-block: clamp(4.5rem, 7vw, 7rem);
}

.diff-section--surface {
  background:
    radial-gradient(
      circle at 80% 18%,
      rgba(0, 166, 214, 0.08),
      transparent 26rem
    ),
    linear-gradient(
      180deg,
      rgba(23, 28, 35, 0.98),
      rgba(31, 37, 46, 0.74)
    );
  border-block: 1px solid rgba(217, 240, 246, 0.07);
}

.diff-section__head,
.diff-relation,
.diff-outcome__grid {
  display: grid;
  grid-template-columns:
    minmax(0, 0.94fr)
    minmax(22rem, 1.06fr);
  gap: clamp(2rem, 7vw, 7rem);
  align-items: center;
}

.diff-section__head > div,
.diff-relation > div,
.diff-outcome__grid > div {
  display: grid;
  gap: var(--sp-4);
}

.diff-section__head h2,
.diff-relation h2,
.diff-feature h2,
.diff-outcome h2 {
  max-width: 14ch;
  font-size: clamp(2.25rem, 3.75vw, 3.9rem);
  line-height: 1.02;
  text-wrap: balance;
}

.diff-section__head > p {
  justify-self: end;
}

.diff-relation__copy {
  justify-items: start;
}

.diff-relation__copy a {
  color: var(--c-main-soft);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  text-decoration: none;
}

.diff-relation__copy a span {
  display: inline-block;
  margin-left: 0.4rem;
  transition: translate var(--dur-fast) var(--ease);
}

.diff-relation__copy a:hover span,
.diff-relation__copy a:focus-visible span {
  translate: 0.18rem -0.18rem;
}

.diff-method {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
  overflow: hidden;
  background: rgba(38, 46, 57, 0.5);
  border: 1px solid rgba(217, 240, 246, 0.1);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
}

.diff-method article {
  display: grid;
  min-height: 16rem;
  grid-template-rows:
    1.4rem
    minmax(3.1rem, auto)
    auto;
  gap: var(--sp-3);
  align-content: start;
  padding: clamp(1.4rem, 2.4vw, 2rem);
}

.diff-method article + article {
  border-left: 1px solid rgba(217, 240, 246, 0.09);
}

.diff-method h3 {
  font-size: clamp(1.25rem, 1.8vw, 1.7rem);
}

.diff-method p,
.diff-feature__copy > p:not(.lead),
.diff-outcome__copy > p:not(.lead),
.diff-note p,
.diff-results p {
  color: var(--c-muted);
}

.diff-equation {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  padding: 1.3rem 1.5rem;
  background: rgba(0, 166, 214, 0.06);
  border: 1px solid rgba(110, 187, 213, 0.16);
  border-radius: var(--r-lg);
}

.diff-equation strong {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
  align-items: center;
  color: var(--c-text);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.4vw, 2rem);
}

.math-frac {
  display: inline-grid;
  min-width: 2.2em;
  grid-template-rows: auto auto;
  align-items: center;
  line-height: 1;
  text-align: center;
}

.math-frac > span:first-child {
  padding: 0 0.32em 0.2em;
  border-bottom: 1.5px solid currentColor;
}

.math-frac > span:last-child {
  padding: 0.2em 0.32em 0;
}

.diff-feature {
  display: grid;
  grid-template-columns:
    minmax(0, 0.88fr)
    minmax(24rem, 1.12fr);
  gap: clamp(3rem, 7vw, 7rem);
  align-items: center;
}

.diff-feature--reverse {
  grid-template-columns:
    minmax(24rem, 1.12fr)
    minmax(0, 0.88fr);
}

.diff-feature__copy {
  display: grid;
  gap: var(--sp-4);
}

.diff-media {
  overflow: hidden;
  margin: 0;
  background: rgba(38, 46, 57, 0.56);
  border: 1px solid rgba(217, 240, 246, 0.1);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
}

.diff-media img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.diff-media figcaption {
  padding: 1rem 1.2rem;
  color: var(--c-muted);
  font-size: var(--fs-200);
  line-height: 1.55;
}

.diff-media--result {
  width: min(100%, 48rem);
  justify-self: end;
}

.diff-feature--reverse .diff-media--result {
  justify-self: start;
}

.diff-gallery {
  display: grid;
  gap: var(--sp-4);
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
}

.diff-gallery--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.diff-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  margin-top: var(--sp-5);
  padding: 1.25rem 1.5rem;
  background: rgba(0, 166, 214, 0.06);
  border: 1px solid rgba(110, 187, 213, 0.16);
  border-radius: var(--r-lg);
}

.diff-validation {
  display: grid;
  grid-template-columns:
    minmax(24rem, 1.12fr)
    minmax(0, 0.88fr);
  gap: var(--sp-5);
  align-items: stretch;
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
}

.diff-results {
  display: grid;
  overflow: hidden;
  background: rgba(38, 46, 57, 0.5);
  border: 1px solid rgba(217, 240, 246, 0.1);
  border-radius: var(--r-xl);
}

.diff-results article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  align-content: center;
  padding: 1.2rem 1.4rem;
}

.diff-results article + article {
  border-top: 1px solid rgba(217, 240, 246, 0.09);
}

.diff-results strong {
  grid-row: span 2;
  align-self: center;
  color: var(--c-text);
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 3rem);
}

.diff-results small {
  color: var(--c-main-soft);
}

.diff-results p {
  grid-column: 2;
}

.diff-units {
  margin-top: var(--sp-3);
  color: var(--c-muted);
  font-size: var(--fs-200);
  text-align: right;
}

.diff-outcome {
  display: grid;
  min-height: 72svh;
  align-content: center;
  background:
    radial-gradient(
      circle at 78% 32%,
      rgba(0, 166, 214, 0.1),
      transparent 28rem
    ),
    linear-gradient(
      180deg,
      rgba(31, 37, 46, 0.74),
      rgba(23, 28, 35, 0.99)
    );
  border-top: 1px solid rgba(217, 240, 246, 0.08);
}

.diff-outcome__grid {
  align-items: center;
}

.diff-outcome__copy {
  display: grid;
  gap: var(--sp-4);
}

.diff-study .page-top {
  animation: none !important;
  opacity: 1 !important;
  filter: none !important;
  translate: 0 0 !important;
  scale: 1 !important;
}

/* Project modal */

@media (min-width: 68.001rem) {
  .is-project-embed .diff-hero {
    height: 100svh;
    min-height: 38rem;
    grid-template-rows:
      minmax(0, 1fr)
      auto;
    align-content: stretch;
    row-gap: 0.75rem;
    padding-block: 1rem 0.8rem;
  }

  .is-project-embed .diff-hero__top {
    position: absolute;
    top: 0.8rem;
    right: 3.2rem;
    z-index: 3;
    width: auto;
  }

  .is-project-embed .diff-hero__grid {
    grid-row: 1;
    height: 100%;
    min-height: 0;
    grid-template-columns:
      minmax(24rem, 0.94fr)
      minmax(30rem, 1.06fr);
    gap: clamp(1.8rem, 3vw, 3rem);
    align-self: stretch;
    align-items: center;
    padding-top: 1.1rem;
  }

  .is-project-embed .diff-hero__copy {
    gap: 0.75rem;
    align-self: center;
  }

  .is-project-embed .diff-hero h1 {
    font-size: clamp(2.7rem, 3.45vw, 3.75rem);
  }

  .is-project-embed .diff-hero__copy .lead {
    font-size: 0.96rem;
  }

  .is-project-embed .diff-tags li {
    padding: 0.35rem 0.6rem;
    font-size: 0.68rem;
  }

  .is-project-embed .diff-viewer {
    width: min(100%, 39rem);
    height: min(51svh, 25rem);
    min-height: 0;
    grid-template-rows:
      minmax(0, 1fr)
      auto;
    align-self: center;
    justify-self: end;
  }

  .is-project-embed .diff-viewer video {
    width: 100%;
    height: 100%;
    min-height: 0;
    aspect-ratio: auto;
    object-fit: contain;
  }

  .is-project-embed .diff-viewer__controls {
    grid-template-columns:
      minmax(13rem, 0.82fr)
      minmax(0, 1.18fr);
    padding: 0.45rem;
  }

  .is-project-embed .diff-viewer__cue {
    font-size: 0.5rem;
  }

  .is-project-embed .diff-viewer__cue strong {
    font-size: 0.5rem;
  }

  .is-project-embed .diff-viewer__tabs button {
    min-height: 1.95rem;
  }

  .is-project-embed .diff-hero__facts {
    grid-row: 2;
    align-self: end;
  }

  .is-project-embed .diff-hero__facts article {
    grid-template-rows:
      1rem
      minmax(1.8rem, auto);
    padding: 0.52rem 0.72rem;
  }

  .is-project-embed .diff-hero__facts span {
    font-size: 0.5rem;
  }

  .is-project-embed .diff-hero__facts strong {
    font-size: 0.63rem;
    line-height: 1.28;
  }
}

/* Responsive */

@media (max-width: 82rem) {
  .diff-hero__grid {
    grid-template-columns:
      minmax(23rem, 0.86fr)
      minmax(32rem, 1.14fr);
    gap: 2.5rem;
  }

  .diff-hero h1 {
    font-size: clamp(2.75rem, 4vw, 4rem);
  }

  .diff-method {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .diff-method article:nth-child(3) {
    border-top: 1px solid rgba(217, 240, 246, 0.09);
    border-left: 0;
  }

  .diff-method article:nth-child(4) {
    border-top: 1px solid rgba(217, 240, 246, 0.09);
  }

  .diff-gallery--three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 68rem) {
  .diff-hero__grid,
  .diff-section__head,
  .diff-relation,
  .diff-feature,
  .diff-feature--reverse,
  .diff-validation,
  .diff-outcome__grid {
    grid-template-columns: 1fr;
  }

  .diff-hero__grid {
    gap: 1.25rem;
  }

  .diff-viewer {
    width: min(100%, 42rem);
    justify-self: center;
  }

  .diff-section__head > p {
    justify-self: start;
  }

  .diff-media--result,
  .diff-feature--reverse .diff-media--result {
    justify-self: center;
  }
}

@media (max-width: 48rem) {
  .diff-hero {
    height: 100svh;
    min-height: 0;
    padding-block: 0.75rem 0.9rem;
  }

  .diff-hero__top {
    font-size: 0.56rem;
  }

  .diff-hero__grid {
    align-content: center;
    gap: 0.75rem;
  }

  .diff-hero__copy {
    gap: 0.55rem;
  }

  .diff-hero h1 {
    max-width: none;
    font-size: clamp(2.05rem, 9.4vw, 2.75rem);
    line-height: 0.98;
  }

  .diff-hero__copy .lead {
    font-size: 0.84rem;
    line-height: 1.38;
  }

  .diff-tags {
    gap: 0.3rem;
  }

  .diff-tags li {
    padding: 0.28rem 0.44rem;
    font-size: 0.61rem;
  }

  .diff-viewer {
    width: min(100%, 23rem);
    border-radius: var(--r-lg);
  }

  .diff-viewer video {
    aspect-ratio: 22 / 14;
  }

  .diff-viewer__controls {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    padding: 0.4rem;
  }

  .diff-viewer__cue {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.45rem;
  }

  .diff-viewer__cue strong {
    font-size: 0.45rem;
    text-align: right;
  }

  .diff-viewer__tabs {
    gap: 0.3rem;
  }

  .diff-viewer__tabs button {
    min-height: 1.75rem;
  }

  .diff-hero__facts article {
    grid-template-rows: 0.9rem minmax(1.9rem, auto);
    padding: 0.45rem 0.38rem;
  }

  .diff-hero__facts span {
    font-size: 0.45rem;
  }

  .diff-hero__facts strong {
    font-size: 0.55rem;
    line-height: 1.2;
  }

  .diff-section__head h2,
  .diff-relation h2,
  .diff-feature h2,
  .diff-outcome h2 {
    max-width: none;
    font-size: clamp(2.05rem, 9.8vw, 3.1rem);
  }

  .diff-method {
    grid-template-columns: 1fr;
  }

  .diff-method article {
    min-height: 11rem;
  }

  .diff-method article + article {
    border-top: 1px solid rgba(217, 240, 246, 0.09);
    border-left: 0;
  }

  .diff-media,
  .diff-method,
  .diff-results {
    border-radius: var(--r-lg);
  }

  .diff-note {
    grid-template-columns: 1fr;
  }

  .diff-results article {
    grid-template-columns: 1fr;
  }

  .diff-results strong {
    grid-row: auto;
  }

  .diff-results p {
    grid-column: auto;
  }

  .diff-units {
    text-align: left;
  }

  .diff-outcome {
    min-height: 76svh;
  }
}

@keyframes diff-invite {
  to {
    background: rgba(0, 166, 214, 0.075);
    border-color: rgba(110, 187, 213, 0.3);
    box-shadow: 0 0 0.75rem rgba(0, 166, 214, 0.08);
  }
}
