.home-screen {
  position: relative;
  isolation: isolate;
  display: grid;
  /*
   * The single column must be capped by the shell instead of resolving to
   * the title's max-content width, otherwise heavy browser zoom pushes the
   * brand copy past the screen's overflow clip.
   */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(4, auto);
  align-content: start;
  justify-items: center;
  padding-block-start: max(
    clamp(2.5rem, 8.5dvh, 5rem),
    env(safe-area-inset-top)
  );
  overflow-x: clip;
  overflow-y: visible;
  text-align: center;
}

.home-brand {
  display: grid;
  justify-items: center;
  width: min(100%, 28rem);
  margin-block-end: clamp(1.125rem, 3dvh, 1.75rem);
}

.home-brand__eyebrow,
.home-screen__title,
.home-screen__statement {
  margin: 0;
}

.home-brand__mark {
  width: clamp(1.875rem, 8.5vw, 2.5rem);
  margin-block-end: clamp(0.125rem, 0.35dvh, 0.25rem);
  color: var(--color-gold-500);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

/* Gold rule with a centre diamond, directly beneath the brand mark. */
.home-brand__rule {
  position: relative;
  display: block;
  width: clamp(2.75rem, 12vw, 3.5rem);
  height: 7px;
  margin-block-end: clamp(0.75rem, 1.8dvh, 1rem);
}

.home-brand__rule::before {
  position: absolute;
  inset-block-start: 3px;
  inset-inline: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0,
    rgb(197 164 94 / 62%) 22%,
    rgb(197 164 94 / 62%) 78%,
    transparent 100%
  );
  content: "";
}

.home-brand__rule::after {
  position: absolute;
  inset-block-start: 0.5px;
  inset-inline-start: 50%;
  width: 6px;
  height: 6px;
  border: 1px solid rgb(197 164 94 / 76%);
  background: var(--color-table-light);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.home-screen__subtitle {
  color: var(--color-ink);
}

.home-brand__eyebrow {
  margin-block-end: clamp(1rem, 2.2dvh, 1.25rem);
  color: color-mix(in srgb, var(--color-ink) 72%, transparent);
  font-family: var(--font-serif);
  font-size: clamp(0.75rem, 3.35vw, 0.875rem);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-tight);
  letter-spacing: 0.14em;
}

.home-screen__title {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  margin-block-end: clamp(1.25rem, 2.4dvh, 1.5rem);
  color: var(--color-ink);
  font-family: var(--font-serif);
  font-size: clamp(2rem, 10.1vw, 3rem);
  font-weight: var(--font-weight-regular);
  line-height: 1.12;
  letter-spacing: 0.08em;
  text-wrap: balance;
}

/* Four-point sparkle at the upper right of the wordmark. */
.home-screen__title::after {
  position: absolute;
  inset-block-start: -0.08em;
  inset-inline-end: -0.34em;
  width: 0.17em;
  height: 0.17em;
  background: var(--color-gold-500);
  clip-path: polygon(
    50% 0%,
    58% 42%,
    100% 50%,
    58% 58%,
    50% 100%,
    42% 58%,
    0% 50%,
    42% 42%
  );
  content: "";
  opacity: 0.86;
  pointer-events: none;
}

.home-screen__statement {
  display: grid;
  gap: 0.02em;
  max-width: 21rem;
  color: color-mix(in srgb, var(--color-ink) 72%, transparent);
  font-family: var(--font-serif);
  font-size: clamp(0.75rem, 3.3vw, 0.9375rem);
  line-height: 1.5;
  letter-spacing: 0.075em;
}

.home-screen__statement span {
  display: block;
}

.home-screen__visual {
  display: grid;
  place-items: center;
  width: 100%;
  margin-block-start: clamp(0.5rem, 1dvh, 0.75rem);
  margin-block-end: clamp(1rem, 2.4dvh, 1.5rem);
}

.home-card-stack {
  --home-hero-reflection-opacity: 0.035;

  position: relative;
  width: var(--card-width);
  /* Mirrors the Card's Home ratio so the wrapper and the Cards agree. */
  aspect-ratio: 0.62;
  animation: home-hero-idle 18s cubic-bezier(0.42, 0, 0.24, 1) infinite;
  transform-style: preserve-3d;
}

/*
 * Decorative deck depth. The reference shows a physical stack whose right
 * side reveals a run of individual card edges. This is one pseudo-element
 * behind the three shared Cards: it adds no DOM node, no focus stop and no
 * runtime owner, and it never redraws protected Card anatomy.
 */
.home-card-stack::before {
  position: absolute;
  z-index: 0;
  /*
   * The reference front Card is ~158 CSS px wide with ~41px of deck edges
   * beside it. Our shared Card is locked to 3:4 by the protected Card
   * geometry, so it is wider; the depth is scaled to read as a thick deck
   * without making the assembly disproportionately wide.
   */
  inset: 3.5% -13.5% 6% 13%;
  border-radius: 4px var(--card-radius) var(--card-radius) 4px;
  background:
    linear-gradient(
      90deg,
      rgb(6 21 34 / 0%) 0 38%,
      rgb(6 21 34 / 26%) 82%,
      rgb(6 21 34 / 40%) 100%
    ),
    repeating-linear-gradient(
      91.6deg,
      var(--color-navy-900) 0 5.4px,
      color-mix(in srgb, var(--color-navy-700) 76%, var(--color-ivory-200))
        5.4px 6.9px
    );
  box-shadow:
    2px 10px 18px -10px rgb(6 21 34 / 42%),
    0 2px 4px -2px rgb(6 21 34 / 30%);
  content: "";
  pointer-events: none;
  transform: rotate(2deg);
}

.home-card-stack::after {
  position: absolute;
  z-index: 4;
  inset: 0;
  border-radius: var(--card-radius);
  background: linear-gradient(
    118deg,
    transparent 18%,
    rgb(247 226 174 / 68%) 38%,
    transparent 56%
  );
  content: "";
  opacity: var(--home-hero-reflection-opacity);
  pointer-events: none;
  transform: rotate(2deg);
}

/*
 * The only geometry knob the Home Hero is allowed to set. Everything else
 * about the Card — anatomy, decoration, typography — stays owned by the
 * shared component. Gameplay never sets this and keeps the default 3:4.
 */
.home-card-stack > .card-root {
  --card-ratio: 0.62;

  position: absolute;
  inset: 0;
  transform-origin: 50% 84%;
}

.home-card-stack > [data-stack-position="left"] {
  z-index: 1;
  filter: brightness(0.78);
  transform: translate(-6%, 2%) rotate(-4deg) scale(0.965);
}

.home-card-stack > [data-stack-position="right"] {
  z-index: 2;
  filter: brightness(0.88);
  transform: translate(6%, 3%) rotate(4deg) scale(0.978);
}

.home-card-stack > [data-stack-position="front"] {
  z-index: 3;
  transform: rotate(2deg);
}

@keyframes home-hero-idle {
  0%,
  100% {
    transform: translateY(0) rotateZ(0);
  }

  31% {
    transform: translateY(-1.5px) rotateZ(0.18deg);
  }

  67% {
    transform: translateY(-0.35px) rotateZ(-0.08deg);
  }

  82% {
    transform: translateY(0.6px) rotateZ(0.04deg);
  }
}

.home-screen__action {
  display: grid;
  width: 100%;
  margin-block-end: clamp(1.5rem, 3.9dvh, 2.25rem);
  place-items: center;
}

.home-cta {
  position: relative;
  /*
   * The floor must stay narrower than the smallest supported CSS viewport
   * so heavy browser zoom cannot push the pill past the screen clip.
   */
  width: clamp(10.5rem, 59vw, 15rem);
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-5);
  border: 1px solid rgb(222 201 143 / 78%);
  border-radius: 999px;
  background:
    linear-gradient(
      120deg,
      rgb(247 242 232 / 4%) 0,
      rgb(247 242 232 / 0%) 42%
    ),
    var(--color-navy-900);
  box-shadow:
    inset 0 1px 0 rgb(247 242 232 / 4%),
    0 16px 34px -18px rgb(0 0 0 / 68%);
  color: var(--color-gold-300);
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-tight);
  letter-spacing: 0.18em;
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.home-cta::before {
  position: absolute;
  inset: 4px;
  border: 1px solid rgb(197 164 94 / 24%);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.home-cta__label {
  position: relative;
  z-index: 1;
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: var(--space-3);
}

.home-cta__label::before,
.home-cta__label::after {
  width: 0.5rem;
  height: 0.5rem;
  background: rgb(197 164 94 / 82%);
  clip-path: polygon(
    50% 0%,
    58% 42%,
    100% 50%,
    58% 58%,
    50% 100%,
    42% 58%,
    0% 50%,
    42% 42%
  );
  content: "";
}

.home-cta:hover {
  border-color: var(--color-gold-300);
  background:
    linear-gradient(
      120deg,
      rgb(247 242 232 / 5%) 0,
      rgb(247 242 232 / 0%) 42%
    ),
    var(--color-navy-700);
}

.home-cta:active {
  transform: translateY(1px);
}

.home-values {
  display: grid;
  grid-template-columns: 1fr;
  width: min(100%, 44rem);
  gap: var(--space-4);
  align-items: start;
}

.home-value {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  min-width: 0;
  padding-inline: var(--space-2);
}

.home-value__icon-frame {
  display: grid;
  width: 2.625rem;
  height: 2.625rem;
  border: 1px solid rgb(255 252 245 / 78%);
  border-radius: 50%;
  background:
    linear-gradient(
      160deg,
      rgb(255 253 248 / 62%) 0%,
      rgb(247 240 228 / 26%) 62%,
      rgb(214 198 178 / 18%) 100%
    );
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 68%),
    inset 0 -1px 2px rgb(160 140 118 / 20%),
    0 6px 14px -9px rgb(16 40 62 / 34%);
  color: var(--color-gold-500);
  place-items: center;
}

.home-value__icon {
  width: 1.375rem;
  height: 1.375rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.home-value__title,
.home-value__description {
  margin: 0;
}

.home-value__title {
  color: var(--color-ink);
  font-family: var(--font-serif);
  font-size: 0.8125rem;
  font-weight: var(--font-weight-regular);
  line-height: 1.25;
  letter-spacing: 0.1em;
}

.home-value__description {
  max-width: 12rem;
  color: color-mix(in srgb, var(--color-ink) 58%, transparent);
  font-family: var(--font-serif);
  font-size: 0.6875rem;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-wrap: nowrap;
}

/* Decorative scroll hint mirroring the reference footer ornament. */
.home-scroll-hint {
  position: absolute;
  inset-block-end: max(0.625rem, env(safe-area-inset-bottom));
  inset-inline-start: 50%;
  display: block;
  width: 1.625rem;
  height: 1.625rem;
  border: 1px solid rgb(197 164 94 / 46%);
  border-radius: 50%;
  pointer-events: none;
  transform: translateX(-50%);
}

.home-scroll-hint::after {
  position: absolute;
  inset-block-start: 42%;
  inset-inline-start: 50%;
  width: 0.4375rem;
  height: 0.4375rem;
  border-right: 1px solid rgb(197 164 94 / 78%);
  border-bottom: 1px solid rgb(197 164 94 / 78%);
  content: "";
  transform: translate(-50%, -50%) rotate(45deg);
}

@media (max-width: 479px) {
  /* The dvh term caps Hero height at 46dvh, so it scales by the Home ratio. */
  .home-card-stack {
    width: min(62vw, calc(46dvh * 0.62), 186px);
  }
}

@media (max-width: 359px) {
  .home-screen__title {
    font-size: 2.25rem;
    letter-spacing: 0.06em;
  }
}

@media (min-width: 480px) {
  /* 273 x 440 keeps the previously approved Hero height at 768px and above. */
  .home-card-stack {
    width: 273px;
  }
}

@media (min-width: 360px) {
  .home-values {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
  }

  .home-value + .home-value::before {
    position: absolute;
    inset-block: 0.35rem;
    inset-inline-start: 0;
    width: 1px;
    background: rgb(16 40 62 / 10%);
    content: "";
  }
}

@media (max-height: 619px) {
  .home-screen {
    padding-block-start: max(
      var(--space-6),
      env(safe-area-inset-top)
    );
  }

  .home-brand {
    margin-block-end: 1.125rem;
  }

  .home-brand__mark {
    width: 2.5rem;
  }

  .home-screen__statement {
    line-height: 1.55;
  }

  .home-screen__visual {
    margin-block-end: 1.125rem;
  }
}

@media (max-width: 359px) and (max-height: 619px) {
  .home-screen {
    padding-block-start: max(var(--space-3), env(safe-area-inset-top));
    padding-inline-start: max(var(--space-3), env(safe-area-inset-left));
    padding-inline-end: max(var(--space-3), env(safe-area-inset-right));
  }

  .home-brand__mark {
    width: 2rem;
  }
}

@media (min-width: 1024px) {
  .home-screen {
    grid-template-columns: minmax(0, 1fr) minmax(20.625rem, 0.9fr);
    grid-template-rows: auto auto auto;
    align-content: center;
    column-gap: clamp(3rem, 6vw, 4.5rem);
  }

  .home-brand {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    width: 100%;
    margin-block-end: 0;
  }

  .home-screen__visual {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    margin-block-end: var(--space-6);
  }

  .home-screen__action {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    margin-block-end: 0;
  }

  .home-values {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-block-start: var(--space-8);
  }
}

@media (hover: none) {
  .home-cta:hover {
    border-color: rgb(197 164 94 / 76%);
    background:
      linear-gradient(
        120deg,
        rgb(247 242 232 / 4%) 0,
        rgb(247 242 232 / 0%) 42%
      ),
      var(--color-navy-900);
  }
}
