:root {
  color-scheme: dark;
  --page: #10051a;
  --page-rgb: 16 5 26;
  --white: #fff;
  --pale: #d9e8c4;
  --ink: #160a22;
  --gutter: 1rem;
  --radius: 0.75rem;
  --sans: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Segoe UI', Roboto, Arial, sans-serif;
}

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

body {
  margin: 0;
  background: var(--page);
  color: var(--white);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.profile {
  width: min(100%, 30rem);
  margin-inline: auto;
  padding-bottom: calc(env(safe-area-inset-bottom) + 2rem);
}

/* Edge-to-edge portrait that fades into the page; the name sits on the fade. */
.hero {
  position: relative;
  display: grid;
}

.hero > * {
  grid-area: 1 / 1;
}

.hero__photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 752 / 720;
  object-fit: cover;
}

.hero::after {
  content: '';
  grid-area: 1 / 1;
  background: linear-gradient(
    180deg,
    rgb(var(--page-rgb) / 0) 54%,
    rgb(var(--page-rgb) / 0.3) 67%,
    rgb(var(--page-rgb) / 0.82) 79%,
    var(--page) 93%
  );
  pointer-events: none;
}

.identity {
  z-index: 1;
  align-self: start;
  margin-top: 73%;
  padding: 0 var(--gutter) 0.5rem;
  text-align: center;
}

.identity__name {
  margin: 0;
  font: 700 2rem / 1.15 var(--sans);
  letter-spacing: -0.015em;
  text-shadow: 0 1px 14px rgb(var(--page-rgb) / 0.7);
}

.identity__area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 1.25rem;
  margin: 0.35rem 0 0;
  color: var(--pale);
  font: 500 0.875rem / 1.25rem var(--sans);
  overflow-wrap: anywhere;
}

/* Keep the line's space reserved so a late answer does not move the links. */
.identity__area[hidden] {
  visibility: hidden;
}

.identity__pin {
  flex: none;
}

.destinations {
  display: grid;
  gap: 0.75rem;
  padding: 1rem var(--gutter) 0;
}

/* Fanvue photo card: service mark top-left, the single action at the bottom. */
.card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: 0.6rem;
  /* 358:219 at a 390px viewport, without letting the height dictate the width on narrow screens. */
  min-height: clamp(11.5rem, 56.15vw, 17.125rem);
  padding: 0.75rem;
  border-radius: var(--radius);
  background: #241a2c;
}

.card__photo,
.card::before {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.card__photo {
  z-index: -2;
  object-fit: cover;
  object-position: 50% 8%;
}

.card::before {
  content: '';
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgb(var(--page-rgb) / 0.3) 0%,
    rgb(var(--page-rgb) / 0.12) 34%,
    rgb(var(--page-rgb) / 0.74) 62%,
    rgb(var(--page-rgb) / 0.92) 100%
  );
}

.card__service {
  justify-self: start;
  align-self: start;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgb(var(--page-rgb) / 0.62);
  font: 700 0.75rem / 1 var(--sans);
  letter-spacing: 0.02em;
}

/* The whole card is the tap target; the pill stays the visible, focusable link. */
.card .card__action::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.card__action,
.gate__button,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--sans);
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.card__action,
.gate__button {
  min-height: 2.75rem;
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.2;
}

.card__action svg,
.secondary svg {
  flex: none;
}

.secondary {
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 0.07);
  color: var(--white);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
}

.secondary[hidden] {
  display: none;
}

.card__action:focus-visible,
.gate__button:focus-visible,
.gate__back:focus-visible,
.secondary:focus-visible {
  outline: 3px solid var(--pale);
  outline-offset: 3px;
}

.card__action:active,
.gate__button:active,
.secondary:active {
  transform: scale(0.98);
}

@media (hover: hover) {
  .card__action:hover,
  .gate__button:hover {
    background: var(--pale);
  }

  .secondary:hover {
    background: rgb(255 255 255 / 0.12);
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Interim page before Fanvue: avatar, destination, check status, retry. */
.gate {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.75rem;
  min-height: 100vh;
  min-height: 100svh;
  padding: 2rem var(--gutter) calc(env(safe-area-inset-bottom) + 2rem);
  text-align: center;
}

.gate__avatar {
  width: 6rem;
  height: 6rem;
  margin-bottom: 0.5rem;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 32%;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.14);
}

.gate__title {
  margin: 0;
  font: 700 1.375rem / 1.2 var(--sans);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.gate__status {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  color: rgb(255 255 255 / 0.86);
  font: 500 0.9375rem / 1.5rem var(--sans);
}

.gate__form {
  display: grid;
  justify-items: center;
}

/* Turnstile stays empty unless Cloudflare needs an interaction; its frame is 300px wide. */
.gate__widget:empty {
  display: none;
}

.gate__button {
  cursor: pointer;
}

.gate__button[hidden] {
  display: none;
}

.gate__back {
  margin-top: 0.75rem;
  border-radius: 0.25rem;
  color: rgb(255 255 255 / 0.7);
  font: 500 0.875rem / 1.25rem var(--sans);
  text-underline-offset: 0.2em;
}

/* Desktop only: one rounded portrait panel in front of a blurred, plum-washed enlargement of the hero. */
@media (min-width: 768px) {
  :root {
    /* Narrows on shorter windows so both links stay in view; the page scrolls below the minimum. */
    --panel: clamp(22.5rem, calc((100vh - 10rem) * 0.66), 30rem);
  }

  html {
    background: var(--page);
  }

  body {
    display: grid;
    align-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: transparent;
  }

  body::before,
  body::after {
    content: '';
    position: fixed;
    z-index: -1;
    pointer-events: none;
  }

  body::before {
    inset: -5rem;
    background: url('thea-hero.webp') 50% 25% / cover no-repeat;
    filter: blur(44px) saturate(1.15);
  }

  body::after {
    inset: 0;
    background: linear-gradient(180deg, rgb(var(--page-rgb) / 0.5), rgb(var(--page-rgb) / 0.78));
  }

  .profile {
    width: var(--panel);
    padding-bottom: 1.25rem;
    border-radius: 1.5rem;
    background: var(--page);
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.06), 0 1.5rem 3.5rem rgb(5 1 9 / 0.5);
    overflow: hidden;
  }

  /* The panel width can land on a fraction of a pixel; overlap the fade so no photo row shows under it. */
  .hero::after {
    margin-bottom: -1px;
  }

  .card {
    /* Same 358:219 proportion as mobile, measured against the panel instead of the window. */
    min-height: calc((var(--panel) - 2 * var(--gutter)) * 0.6117);
  }

  .gate {
    min-height: 0;
    padding: 2.5rem 1.5rem;
  }
}
