/* Star Chart – embeddable widget. Font: PolySans Bulky (loaded from baseUrl). */

/* Font: relative URL so when styles.css is loaded from S3, it resolves to same folder (no static path needed) */
@font-face {
  font-family: 'PolySans Bulky';
  src: url('PolySans-Bulky.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

.star-chart {
  font-family: 'PolySans Bulky', sans-serif;
  --star-chart-accent: #fff;
  --star-chart-accent-hover: #fff;
  box-sizing: border-box;
  background-color: rgba(82,0,255);
  max-width: 600px;
  width: 100%;
  margin: 60px auto;
  padding: 0 2vw;
  border-radius: 1.5rem;
}

.star-chart *,
.star-chart *::before,
.star-chart *::after {
  box-sizing: inherit;
}

/* Header: stickers behind, title + text on top */
.star-chart-header {
  position: relative;
  text-align: center;
  padding: 0.5rem 1rem;
  min-height: 60px;
  margin: 24px auto;
}

.star-chart-sticker {
  position: absolute;
  width: 5.5rem;
  aspect-ratio: 1;
  object-fit: contain;
  z-index: 0;
}

.star-chart-sticker-1 {
  left: 5%;
  top: 25%;
  transform: translateY(-50%, -50%);
}

.star-chart-sticker-2 {
  right: 25%;
  top: 5%;
  transform: translate(50%, -50%);
}

.star-chart-header-title,
.star-chart-header-text {
  position: relative;
  z-index: 1;
}

.star-chart-header-title {
  font-family: 'PolySans Bulky', sans-serif;
  font-size: 3rem;
  font-weight: normal;
  margin: 1rem 0 0.25rem;
  line-height: 1.1;
  color: #fff;
}

.star-chart-header-text {
  font-family: 'PolySans Bulky', sans-serif;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  margin: 0 auto;
  color: rgba(255, 255, 255, 0.95);
  max-width: 22.5rem;
  width: 100%;
}

/* Body: grid + plaque row */
.star-chart-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 0 0 1rem;
}

/* 10×13 grid of stars */
.star-chart-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 4px;
  max-width: 100%;
  width: min(520px, 100%);
  list-style: none;
  margin: 0;
  padding: 0;
}

.star-chart-cell {
  aspect-ratio: 1;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.star-chart-cell:focus {
  outline: none;
}

.star-chart-cell:focus-visible {
  outline: 2px solid var(--star-chart-accent);
  outline-offset: 2px;
}

.star-chart-cell:hover {
  transform: scale(1.08);
}

@media (prefers-reduced-motion: reduce) {
  .star-chart-cell,
  .star-chart-nav-btn {
    transition: none;
  }
  .star-chart-cell:hover {
    transform: none;
  }
  .star-chart-nav-btn:hover {
    transform: none;
  }
}

.star-chart-cell--highlighted .star-chart-star-img {
  filter: drop-shadow(0 0 6px var(--star-chart-accent));
}

.star-chart-star-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Plaque: single element with background image, name fitted inside */
.star-chart-plaque-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
}

.star-chart-plaque {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 2.4 / 1;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-chart-plaque-text {
  font-family: 'PolySans Bulky', sans-serif;
  font-size: 1.75rem;
  text-align: center;
  padding: 0.5% 14%;
  color: #1a1a1a;
  line-height: 1.2;
  max-width: 100%;
  display: block;
  box-sizing: border-box;
}

/* Nav: prev, random, next – below plaque */
.star-chart-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.star-chart-nav-btn {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.star-chart-nav-btn:focus {
  outline: none;
}

.star-chart-nav-btn:focus-visible {
  outline: 2px solid var(--star-chart-accent);
  outline-offset: 2px;
}

.star-chart-nav-btn:hover {
  transform: scale(1.1);
}

.star-chart-nav-btn .star-chart-nav-img-hover {
  display: none;
}

.star-chart-nav-btn:hover .star-chart-nav-img-default {
  display: none;
}

.star-chart-nav-btn:hover .star-chart-nav-img-hover {
  display: block;
}

.star-chart-nav-next .star-chart-nav-img {
  transform: rotate(180deg);
}

.star-chart-nav-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.star-chart-nav-random {
  width: 56px;
  height: 40px;
}

.star-chart-nav-random .star-chart-nav-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
