/* The crop differs on desktop, but the buttons and image slices share the same scale. */
.cover-stage {
  position: relative;
  container-type: inline-size;
  --action-unit: calc(100cqw / 1672);
  --crop-left: 0;
}

@media (min-width: 1101px) {
  .cover-stage {
    --action-unit: calc(100cqw / 1516);
    --crop-left: 104;
  }
}

/* Blend a nearby strip of the same landscape over the baked-in plaques. */
.hero-backfill {
  position: absolute;
  top: calc(315 * var(--action-unit));
  left: calc((436 - var(--crop-left)) * var(--action-unit));
  width: calc(826 * var(--action-unit));
  height: calc(84 * var(--action-unit));
  overflow: hidden;
  pointer-events: none;
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent),
    linear-gradient(transparent, #000 12%, #000 90%, transparent);
  mask-composite: intersect;
}

.hero-backfill img {
  position: absolute;
  left: calc(-436 * var(--action-unit));
  top: calc(-632 * var(--action-unit));
  width: calc(1672 * var(--action-unit));
  height: calc(1270.35 * var(--action-unit));
  max-width: none;
}

.hero-actions {
  position: absolute;
  top: calc(326 * var(--action-unit));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: calc(21 * var(--action-unit));
  width: calc(960 * var(--action-unit));
  /* Trace the outer gold edge. The same outline also contains the hover sweep. */
  --plaque-shape: shape(
    from 8% 1%, hline to 92%,
    curve to 95.5% 16% with 94% 1% / 94.8% 7%,
    curve to 98% 28% with 96.7% 17% / 97.8% 20%,
    curve to 100% 36% with 99.4% 29% / 100% 30%,
    vline to 65%,
    curve to 98% 73% with 100% 70% / 99.4% 72%,
    curve to 95.5% 86% with 97.8% 81% / 96.6% 84%,
    curve to 92% 99% with 94.8% 95% / 94% 99%,
    hline to 8%,
    curve to 4.5% 86% with 6% 99% / 5.2% 95%,
    curve to 2% 73% with 3.4% 84% / 2.2% 81%,
    curve to 0 65% with .6% 72% / 0 70%,
    vline to 36%,
    curve to 2% 28% with 0 30% / .6% 29%,
    curve to 4.5% 16% with 2.2% 20% / 3.3% 17%,
    curve to 8% 1% with 5.2% 7% / 6% 1%,
    close
  );
}

.hero-plaque {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-width: 0;
  min-height: calc(64 * var(--action-unit));
  padding: 0 0.7em;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  color: #fff4d8;
  background: none;
  font: 700 clamp(13px, calc(21 * var(--action-unit)), 32px)/1.2 'STSong', 'SimSun', serif;
  text-align: center;
  text-shadow: 0 1px 2px #16352b85;
  white-space: nowrap;
  isolation: isolate;
  clip-path: var(--plaque-shape);
  transition: transform 160ms ease, filter 160ms ease;
}

.hero-plaque:nth-child(1) { --full-x: 462; --full-width: 241; }
.hero-plaque:nth-child(2) { --full-x: 721; --full-width: 257; }
.hero-plaque:nth-child(3) { --full-x: 997; --full-width: 242; }

/* Sample the unlettered center and the two ornamental ends of the painted
   plaque. The source image stays intact, and every control shares its artwork. */
.plaque-face {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  --sample-x: 647;
  --sample-width: 11;
  --left-x: 462;
  --left-width: 40;
  --right-x: 671;
  --right-width: 32;
}
.hero-plaque-red .plaque-face {
  --sample-x: 921;
  --sample-width: 10;
  --left-x: 721;
  --left-width: 40;
  --right-x: 946;
  --right-width: 32;
}

.plaque-face,
.plaque-face::before,
.plaque-face::after {
  /* A percentage background position offsets the excess size of the image.
     Compensate for the width of each slice so its first pixel sits at x = 0. */
  background: url('concept.webp') no-repeat
    calc(100% * var(--sample-x) / (1672 - var(--sample-width))) calc(100% * 400 / (941 - 64)) /
    calc(100% * 1672 / var(--sample-width)) calc(100% * 941 / 64);
}

.plaque-face::before,
.plaque-face::after {
  content: '';
  position: absolute;
  inset-block: 0;
}

.plaque-face::before {
  inset-inline-start: 0;
  width: 17%;
  --sample-x: var(--left-x);
  --sample-width: var(--left-width);
  mask-image: linear-gradient(to right, #000 82%, transparent);
}

.plaque-face::after {
  inset-inline-end: 0;
  width: 14%;
  --sample-x: var(--right-x);
  --sample-width: var(--right-width);
  mask-image: linear-gradient(to left, #000 82%, transparent);
}

@media (min-width: 651px) {
  /* The three original buttons keep their exact painted lettering and icons.
     Their live text still names each link for accessibility. */
  .hero-plaque:not(.hero-plaque-simulator) .plaque-face {
    --sample-x: var(--full-x);
    --sample-width: var(--full-width);
  }
  .hero-plaque:not(.hero-plaque-simulator) .plaque-face::before,
  .hero-plaque:not(.hero-plaque-simulator) .plaque-face::after {
    content: none;
  }
  .hero-plaque:not(.hero-plaque-simulator) > :not(.plaque-face) {
    opacity: 0;
  }
}

/* The sheen is clipped by the same outline as the plate. */
.hero-plaque::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(108deg, transparent 38%, #ffefc455 50%, transparent 62%) 115% 0 / 260% 100%;
  opacity: 0;
  pointer-events: none;
}

.hero-plaque:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.hero-plaque:hover::after {
  opacity: 1;
  animation: plaque-sweep 620ms ease-out both;
}

.hero-plaque:focus-visible { filter: brightness(1.18); }
.hero-plaque:focus-visible span { text-decoration: underline; }

.hero-plaque:disabled { cursor: default; opacity: 1; }

.hero-plaque svg {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-plaque svg.solid { fill: currentColor; stroke: none; }

.plaque-arrow {
  width: 0.35em;
  height: 0.35em;
  margin-inline-start: 0.12em;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
  flex: none;
}

@keyframes plaque-sweep {
  from { background-position: 115% 0; }
  to { background-position: -15% 0; }
}

@media (max-width: 950px) {
  .hero-actions {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: auto;
    margin: 3px 12px 0;
    gap: 4px;
  }

  .hero-plaque { min-height: 46px; }
}

@media (max-width: 650px) {
  .hero-plaque {
    min-height: 55px;
    padding: 5px 4px;
    flex-direction: column;
    gap: 3px;
    white-space: normal;
    font-size: clamp(10px, 2.8vw, 14px);
  }

  .hero-plaque svg { width: 15px; height: 15px; }
  .plaque-arrow { display: none; }
}

/* Keep hover feedback without movement for visitors who reduce animation. */
@media (prefers-reduced-motion: reduce) {
  .hero-plaque { transition: none; }
  .hero-plaque:hover { transform: none; }
  .hero-plaque:hover::after { animation: none; opacity: 0; }
}
