:root {
  --ink: #07070a;
  --navy: #101833;
  --red: #df1722;
  --red-deep: #6f0b12;
  --gold: #d8ae57;
  --gold-bright: #ffe3a0;
  --paper: #fff4df;
  --muted: #b8abb2;
  --stage-line: rgba(216, 174, 87, 0.34);
  --card-width: clamp(245px, 23vw, 326px);
  --card-step: clamp(230px, 25vw, 338px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(8, 8, 12, 0.92), rgba(8, 8, 12, 0.28), rgba(8, 8, 12, 0.92)),
    radial-gradient(circle at 50% 12%, rgba(255, 211, 105, 0.22), transparent 24%),
    radial-gradient(circle at 20% 48%, rgba(223, 23, 34, 0.32), transparent 28%),
    radial-gradient(circle at 82% 42%, rgba(31, 80, 184, 0.24), transparent 28%),
    linear-gradient(135deg, #050508 0%, #101833 48%, #22070b 100%);
  color: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, transparent 0 12%, rgba(223, 23, 34, 0.16) 12% 13%, transparent 13% 87%, rgba(223, 23, 34, 0.16) 87% 88%, transparent 88%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.032) 0 1px, transparent 1px 96px);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 88%);
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(255, 227, 160, 0.1) 45%, transparent 48%),
    linear-gradient(65deg, transparent 0 50%, rgba(223, 23, 34, 0.11) 51%, transparent 54%),
    radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, 0.72), transparent 58%);
}

button,
a {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1220px, calc(100% - 36px));
  min-height: 68px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(255, 244, 223, 0.14);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 50px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 227, 160, 0.54);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(145deg, var(--red), var(--red-deep));
  box-shadow: 0 0 30px rgba(223, 23, 34, 0.34);
  color: white;
  font-size: 0.8rem;
  font-weight: 950;
  letter-spacing: 0;
}

.brand-copy {
  overflow: hidden;
  color: var(--paper);
  font-size: 0.98rem;
  font-weight: 900;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topline {
  margin: 0;
  color: var(--gold-bright);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-style: italic;
  text-shadow: 0 0 24px rgba(255, 227, 160, 0.36);
}

.court {
  display: grid;
  width: min(1220px, calc(100% - 36px));
  min-height: calc(100svh - 152px);
  margin: 0 auto;
  padding: 20px 0 18px;
  align-content: center;
  gap: 16px;
}

.intro {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px 0 14px;
  text-align: center;
}

.intro::before,
.intro::after {
  width: min(760px, 100%);
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(216, 174, 87, 0.45), transparent);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.intro h1 {
  max-width: 880px;
  margin: 0;
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 6vw, 6.45rem);
  line-height: 0.88;
  text-shadow:
    0 16px 36px rgba(0, 0, 0, 0.38),
    0 0 34px rgba(223, 23, 34, 0.28),
    0 2px 0 rgba(216, 174, 87, 0.26);
}

.intro p:last-child {
  max-width: 660px;
  margin: 0;
  color: rgba(255, 244, 223, 0.7);
  font-size: clamp(0.92rem, 1.2vw, 1rem);
  line-height: 1.52;
}

.showcase {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 20px;
  padding: clamp(16px, 2vw, 28px);
  overflow: hidden;
  border: 1px solid rgba(216, 174, 87, 0.36);
  background:
    linear-gradient(180deg, rgba(255, 227, 160, 0.08), transparent 18%),
    radial-gradient(ellipse at 50% 40%, rgba(223, 23, 34, 0.27), transparent 40%),
    linear-gradient(135deg, rgba(10, 12, 20, 0.92), rgba(30, 8, 12, 0.92));
  box-shadow:
    0 22px 88px rgba(0, 0, 0, 0.48),
    inset 0 0 0 1px rgba(255, 244, 223, 0.08);
}

.showcase::before {
  position: absolute;
  inset: 8px;
  z-index: -1;
  border: 1px solid rgba(216, 174, 87, 0.16);
  content: "";
}

.showcase::after {
  position: absolute;
  top: 24px;
  left: 50%;
  z-index: -1;
  width: min(860px, 90%);
  height: 240px;
  content: "RED HAT COURT";
  transform: translateX(-50%);
  color: rgba(255, 244, 223, 0.045);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.5rem, 10vw, 8.6rem);
  font-weight: 900;
  line-height: 0.86;
  text-align: center;
  pointer-events: none;
}

.carousel-shell {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 62px;
  align-items: center;
  min-height: clamp(485px, 52vw, 610px);
}

.rail-window {
  position: relative;
  min-width: 0;
  height: clamp(455px, 48vw, 570px);
  overflow: hidden;
  perspective: 1200px;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(255, 227, 160, 0.08), transparent 34%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.78));
}

.rail-window::before,
.rail-window::after {
  position: absolute;
  inset-block: 0;
  z-index: 8;
  width: 18%;
  pointer-events: none;
  content: "";
}

.rail-window::before {
  left: 0;
  background: linear-gradient(90deg, rgba(9, 9, 13, 0.94), transparent);
}

.rail-window::after {
  right: 0;
  background: linear-gradient(270deg, rgba(9, 9, 13, 0.94), transparent);
}

.card-rail {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.character-card {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: var(--z, 1);
  width: var(--card-width);
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 1px solid rgba(216, 174, 87, 0.26);
  background: #111;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.58);
  cursor: pointer;
  opacity: var(--opacity, 0.28);
  transform:
    translate(-50%, -50%)
    translateX(calc(var(--offset, 0) * var(--card-step)))
    scale(var(--scale, 0.72))
    rotateY(calc(var(--offset, 0) * -10deg));
  transform-origin: center center;
  transition:
    transform 430ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 330ms ease,
    filter 330ms ease,
    box-shadow 330ms ease,
    border-color 330ms ease;
  will-change: transform, opacity;
}

.character-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-card.is-hidden {
  pointer-events: none;
}

.character-card:not(.is-active) {
  filter: saturate(0.86) brightness(0.68);
}

.character-card:hover,
.character-card:focus-visible {
  outline: none;
  border-color: rgba(255, 244, 223, 0.86);
  filter: saturate(1.02) brightness(0.9);
}

.character-card.is-active {
  border-color: rgba(255, 227, 160, 0.98);
  box-shadow:
    0 0 0 1px rgba(255, 244, 223, 0.2),
    0 34px 110px rgba(0, 0, 0, 0.72),
    0 0 92px rgba(223, 23, 34, 0.54),
    0 0 38px rgba(255, 227, 160, 0.22);
  filter: saturate(1.08) contrast(1.05) brightness(1.02);
}

.character-card.is-active::after {
  position: absolute;
  inset: -10px;
  z-index: -1;
  border: 1px solid rgba(255, 227, 160, 0.42);
  content: "";
  box-shadow: inset 0 0 26px rgba(255, 227, 160, 0.12);
}

.arrow {
  position: relative;
  z-index: 12;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(255, 227, 160, 0.52);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(145deg, #ed2230, #730c13);
  color: white;
  cursor: pointer;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.44),
    0 0 36px rgba(223, 23, 34, 0.28);
}

.arrow span {
  font-size: 1.32rem;
  line-height: 1;
}

.arrow:hover,
.arrow:focus-visible {
  outline: none;
  border-color: white;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(145deg, #ff3340, #8b1018);
}

.arrow-left {
  justify-self: start;
}

.arrow-right {
  justify-self: end;
}

.profile {
  display: grid;
  grid-template-columns: minmax(260px, 0.44fr) minmax(360px, 0.56fr);
  gap: 18px 28px;
  align-items: stretch;
  padding: 24px 28px;
  border: 1px solid rgba(216, 174, 87, 0.34);
  background:
    linear-gradient(90deg, rgba(111, 11, 18, 0.36), transparent 48%, rgba(16, 24, 51, 0.44)),
    rgba(4, 5, 8, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 223, 0.08),
    0 20px 54px rgba(0, 0, 0, 0.32);
}

.profile-heading {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 10px;
  padding-right: 22px;
  border-right: 1px solid rgba(216, 174, 87, 0.22);
}

.profile-index,
.profile-name {
  margin: 0;
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.profile h2 {
  max-width: 360px;
  margin: 6px 0 0;
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.05rem, 3.2vw, 3.25rem);
  line-height: 0.92;
  text-shadow: 0 0 22px rgba(223, 23, 34, 0.38);
}

.profile-line {
  align-self: end;
  margin: 0;
  color: #ffe3a0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.36rem, 2.1vw, 2rem);
  line-height: 1.18;
}

.profile-copy {
  align-self: start;
  margin: 0;
  color: rgba(255, 244, 223, 0.74);
  font-size: 0.96rem;
  line-height: 1.56;
}

.profile-stats {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-self: start;
  gap: 10px;
  margin: 2px 0 0;
}

.profile-stats div {
  min-width: 132px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 244, 223, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 227, 160, 0.08), rgba(255, 244, 223, 0.025)),
    rgba(70, 14, 18, 0.42);
}

.profile-stats dt {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-stats dd {
  margin: 0;
  color: var(--paper);
  font-size: 0.92rem;
  font-weight: 950;
  white-space: nowrap;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1220px, calc(100% - 36px));
  min-height: 84px;
  margin: 0 auto;
  gap: 18px;
  border-top: 1px solid rgba(255, 244, 223, 0.14);
}

.footer p {
  max-width: 720px;
  margin: 0;
  color: rgba(255, 244, 223, 0.62);
  font-size: 0.8rem;
  line-height: 1.48;
}

.x-button {
  display: inline-grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 227, 160, 0.5);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    var(--paper);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
  text-decoration: none;
  box-shadow: 0 0 30px rgba(216, 174, 87, 0.22);
}

.x-button:hover,
.x-button:focus-visible {
  outline: none;
  background: var(--gold-bright);
}

@media (max-width: 920px) {
  :root {
    --card-width: clamp(220px, 42vw, 292px);
    --card-step: clamp(210px, 48vw, 310px);
  }

  .topline {
    display: none;
  }

  .court {
    min-height: auto;
  }

  .carousel-shell {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    min-height: clamp(430px, 72vw, 548px);
  }

  .rail-window {
    height: clamp(410px, 68vw, 520px);
  }

  .arrow {
    width: 42px;
    height: 42px;
  }

  .profile {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .profile-heading {
    padding-right: 0;
    border-right: 0;
  }
}

@media (max-width: 620px) {
  :root {
    --card-width: min(72vw, 310px);
    --card-step: 68vw;
  }

  .topbar,
  .court,
  .footer {
    width: min(100% - 24px, 1220px);
  }

  .topbar {
    min-height: 62px;
  }

  .brand-mark {
    width: 46px;
    height: 36px;
  }

  .brand-copy {
    max-width: 188px;
    font-size: 0.9rem;
  }

  .court {
    padding-top: 16px;
  }

  .intro {
    padding: 8px 0 10px;
  }

  .intro h1 {
    max-width: 360px;
    font-size: clamp(2.1rem, 13vw, 3.7rem);
  }

  .showcase {
    padding: 12px;
  }

  .showcase::after {
    top: 20px;
    font-size: 3.35rem;
  }

  .carousel-shell {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    min-height: min(120vw, 520px);
  }

  .rail-window {
    height: min(112vw, 486px);
  }

  .rail-window::before,
  .rail-window::after {
    width: 12%;
  }

  .arrow {
    width: 36px;
    height: 36px;
  }

  .profile {
    padding: 15px;
  }

  .profile-stats {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 0 22px;
  }
}

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

  .character-card,
  .arrow {
    transition: none;
  }
}
