/* Design tokens */
:root {
  --color-accent-text: #cdcdcd;
  --color-label: #dfecc6;
  --color-body: #6f6f6f;
  --color-on-bleed: #ffffff;
  --color-bg-dark: #000000;
  --pad-x: 16px;
  --track: -0.0425em;
  --font-serif: "Crimson Text", Georgia, serif;
  --font-mono: "Roboto Mono", ui-monospace, monospace;
}

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

html {
  height: 100%;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--color-bg-dark);
  color: var(--color-body);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.45;
  letter-spacing: var(--track);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.snap-root {
  display: flex;
  flex-direction: column;
}

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  flex-shrink: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
}

.page--dark {
  background: var(--color-bg-dark);
}

.page__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
}

.page__inner--padded {
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
  padding-top: clamp(1.25rem, 4vw, 2rem);
}

.page__inner--stack {
  padding-bottom: clamp(2rem, 6vh, 4rem);
}

.page__inner--creds {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding-bottom: 0.5rem;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.page__inner--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  padding-bottom: clamp(2rem, 8vh, 4rem);
}

/* Page 1 layout */
.page--hero {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2.5vh, 1.75rem);
}

.page__bar {
  display: flex;
  justify-content: center;
  padding-top: clamp(1.25rem, 4vw, 2rem);
  padding-bottom: 0;
}

.page__hero-mid {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: clamp(1rem, 4vh, 2rem);
  padding-bottom: clamp(1rem, 4vh, 2rem);
}

#p1 .page__hero-mid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.intro {
  margin: 0;
  max-width: 22rem;
  font-size: 50px;
  line-height: 90%;
  color: var(--color-body);
}

.intro .accent {
  font-style: italic;
  color: var(--color-accent-text);
}

#p1 .page__media--bottom {
  flex-shrink: 1;
  padding-top: clamp(1.5rem, 5vh, 3rem);
}

#p1 .page__gif {
  max-width: min(100%, 300px, 80vw);
  max-height: min(34vh, 300px);
}

@media (max-width: 520px) {
  #p1 .page__media--bottom {
    max-height: min(38vh, 320px);
    padding-top: clamp(1.25rem, 4vh, 2.5rem);
  }

  #p1 .page__gif {
    max-width: min(100%, 260px, 85vw);
    max-height: min(28vh, 220px);
  }

  #p1 .page__hero-mid {
    padding-top: clamp(0.5rem, 2vh, 1.25rem);
    padding-bottom: clamp(0.5rem, 2vh, 1.25rem);
  }
}

@media (max-height: 640px) {
  #p1 .page__media--bottom {
    max-height: min(32vh, 260px);
  }

  #p1 .page__gif {
    max-height: min(24vh, 200px);
  }
}

/* Page 2 */
#p2 {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#p2 .page__inner--stack {
  text-align: left;
  flex: 1 1 auto;
  min-height: 0;
  width: min(100%, 42rem);
  max-width: 100%;
  margin-inline: 0;
  padding-top: clamp(2.75rem, 10vh, 5.5rem);
  padding-bottom: clamp(2.75rem, 10vh, 5.5rem);
}

#p2 .body {
  font-size: 32px;
}

#p2 .page__media--top {
  display: block;
  flex-shrink: 0;
  align-self: stretch;
  width: 100%;
  max-width: none;
  margin-inline: 0;
  height: min(48vh, 520px);
  overflow: hidden;
}

#p2 .page__gif--wide {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

/* Page 3 */
#p3 {
  display: flex;
  flex-direction: column;
}

.creds-block .body {
  margin: 0.35rem 0 0;
  font-size: 16px;
}

.creds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1rem;
  align-items: start;
}

.creds-list {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.creds-list li {
  margin-bottom: 0.5rem;
  font-size: 16px;
}

.creds-list li:last-child {
  margin-bottom: 0;
}

@media (max-width: 520px) {
  .creds-grid {
    grid-template-columns: 1fr;
  }
}

/* Contact button */
.btn-contact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.35rem;
  border: 1px solid var(--color-label);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--color-label);
  margin-top: 0.5rem;
}

#p8 .btn-contact {
  margin-top: 1.75rem;
  color: #ffffff;
}

/* Typography */
.label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: var(--track);
  text-transform: none;
  color: var(--color-label);
}

.body {
  margin: 0.75rem 0 0;
  font-size: 24px;
  line-height: 90%;
  color: var(--color-body);
}

.body .accent {
  font-style: italic;
  color: var(--color-accent-text);
}

.body--contact {
  margin-top: 0.5rem;
}

.body--contact a {
  font-size: 24px;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Media blocks */
.page__media {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-shrink: 0;
  width: 100%;
  pointer-events: none;
}

.page__media--top {
  align-items: flex-start;
  max-height: 42vh;
  overflow: hidden;
}

.page__media--bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
  flex-shrink: 1;
  min-height: 0;
  max-height: min(52vh, 520px);
  align-items: flex-end;
}

.page--hero .page__media--bottom,
#p3 .page__media--bottom {
  max-height: min(48vh, 480px);
}

.page__gif {
  display: block;
  width: auto;
  max-width: min(100%, 420px, 92vw);
  max-height: min(48vh, 420px);
  height: auto;
  object-fit: contain;
}

.page__gif--wide {
  width: min(100%, 92vw);
  max-width: 100%;
  max-height: 42vh;
  height: auto;
  object-fit: contain;
  object-position: center center;
}

.page__media--contact {
  flex: 1;
  min-height: 0;
  align-items: center;
  padding-top: clamp(1rem, 4vh, 2rem);
}

.page__gif--tunnel {
  width: auto;
  max-width: min(92%, 440px, 92vw);
  max-height: min(42vh, 360px);
  height: auto;
  object-fit: contain;
}

#p8.page--contact {
  display: flex;
  flex-direction: column;
}

/* Full-bleed pages */
.page--bleed {
  color: var(--color-on-bleed);
}

.bleed-bg {
  position: absolute;
  inset: 0;
  background-color: #111;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 1;
  transition: opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.bleed-bg.is-switching {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .bleed-bg {
    transition-duration: 0.01ms;
  }
}

.bleed__content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1.25rem, 4vw, 2rem) var(--pad-x);
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
}

.bleed__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 24px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: var(--track);
  color: var(--color-on-bleed);
}

.bleed__footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: end;
}

.bleed__link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: fit-content;
  max-width: 100%;
  font-family: var(--font-serif);
  letter-spacing: var(--track);
  color: var(--color-on-bleed);
}

.bleed__link > span:not(.bleed__rule) {
  font-size: 16px;
  font-weight: 400;
}

.bleed__link--right {
  text-align: right;
  align-items: flex-end;
  margin-left: auto;
}

.bleed__rule {
  display: block;
  height: 1px;
  background: var(--color-on-bleed);
  width: 100%;
  opacity: 0.95;
  align-self: stretch;
}

@media (min-width: 768px) {
  .page__inner--padded,
  .bleed__content {
    padding-left: max(var(--pad-x), calc((100vw - 960px) / 2));
    padding-right: max(var(--pad-x), calc((100vw - 960px) / 2));
  }

  /* Page 2: keep side padding minimal so width: min(100%, 42rem) is not eaten by gutters */
  #p2 .page__inner--padded {
    padding-left: var(--pad-x);
    padding-right: var(--pad-x);
  }

  .intro {
    max-width: 36rem;
  }
}
