/* Calafate Games: shared stylesheet for all language versions.
   Palette from brand/calafate/README.md. Contrast pairs used for text:
   Crema on Noche 16.6, Crema on Baya 11.1, Noche on Flor 10.0,
   Pruina on Noche 8.5, Noche on Crema, Baya on Crema (11.1).
   Baya clara (#7B4FB8) is used for graphics only, never for text. */

@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/fredoka-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/fredoka-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Japanese: self-hosted subset of M PLUS Rounded 1c (SIL OFL 1.1), built by
   site/subset_ja_font.py from the glyphs used on the ja page. No third-party requests. */
@font-face {
  font-family: "M PLUS Rounded 1c";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/mplus-rounded-1c-ja-400.woff2") format("woff2");
}

@font-face {
  font-family: "M PLUS Rounded 1c";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/mplus-rounded-1c-ja-500.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --baya: #4a1f73;
  --baya-clara: #7b4fb8;
  --noche: #1c0f2e;
  --pruina: #b8a9e8;
  --flor: #ffb13d;
  --crema: #f7f3ff;

  --font: "Fredoka", ui-rounded, "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 20px;
  --radius-band: clamp(28px, 6vw, 56px);
  --gutter: 1rem;
  --max: 68rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--crema);
  color: var(--noche);
  font-family: var(--font);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

/* Japanese: Fredoka covers the Latin glyphs, M PLUS Rounded 1c the rest. */
html[lang="ja"] body {
  font-family: "Fredoka", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", ui-rounded, system-ui, sans-serif;
  line-height: 1.85;
  line-break: strict;
  word-break: auto-phrase; /* keeps Japanese phrases together where supported */
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--flor);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--flor);
  color: var(--noche);
  font-weight: 500;
  border-radius: 0 0 12px 12px;
  text-decoration: none;
  transform: translateY(-120%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Header (sits on the dark hero background) */
.site-header {
  background: var(--noche);
  color: var(--crema);
  padding-block: 1rem;
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--crema);
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.brand-sub {
  margin-top: 0.15rem;
  margin-left: 0.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--pruina);
}

.lang-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lang-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.85rem;
  border: 2px solid transparent;
  border-radius: 999px;
  color: var(--pruina);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.04em;
}

.lang-switch a:hover {
  color: var(--crema);
  border-color: var(--pruina);
}

.lang-switch a[aria-current="page"] {
  background: var(--flor);
  color: var(--noche);
}

/* Hero */
.hero {
  background: var(--noche);
  color: var(--crema);
  border-radius: 0 0 var(--radius-band) var(--radius-band);
  padding-block: clamp(2rem, 6vw, 4rem) clamp(3.5rem, 9vw, 6.5rem);
  overflow: hidden;
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  color: var(--pruina);
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.kicker::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--flor);
  flex: none;
}

.hero h1 {
  font-size: clamp(2.25rem, 1.2rem + 5.2vw, 4.75rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

html[lang="ja"] .hero h1 {
  line-height: 1.3;
  letter-spacing: 0;
}

.hero-intro {
  max-width: 34rem;
  margin-top: 1.5rem;
  color: var(--crema);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
}

.hero-art {
  justify-self: center;
  width: min(58%, 15rem);
}

.hero-art svg {
  width: 100%;
  height: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-art svg {
    animation: float 7s ease-in-out infinite;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-12px) rotate(2deg);
  }
}

@media (min-width: 52rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr);
    gap: 3rem;
  }

  .hero-art {
    width: min(100%, 19rem);
  }
}

/* Generic sections */
.section {
  padding-block: clamp(3.5rem, 9vw, 6.5rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  color: var(--baya);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--flor);
  flex: none;
}

h2 {
  font-size: clamp(1.8rem, 1.2rem + 2.6vw, 2.75rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

html[lang="ja"] h2 {
  line-height: 1.4;
  letter-spacing: 0;
}

/* Story */
.story-grid {
  display: grid;
  gap: 1.5rem;
}

.story h2 {
  color: var(--baya);
}

.story-text {
  max-width: 38rem;
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
}

@media (min-width: 52rem) {
  .story-grid {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 4rem;
    align-items: start;
  }
}

/* Games: a Baya band that the footer tucks under */
.games {
  background: var(--baya);
  color: var(--crema);
  border-radius: var(--radius-band) var(--radius-band) 0 0;
  padding-bottom: calc(clamp(3.5rem, 9vw, 6.5rem) + var(--radius-band));
}

.games .eyebrow {
  color: var(--pruina);
}

/* Carousel: a scroll-snap track (works without JS). Only the track scrolls, never the page. */
.carousel {
  margin-top: 2rem;
}

.carousel-track {
  position: relative; /* slide.offsetLeft is measured from the track (carousel.js) */
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--pruina) transparent;
  padding-bottom: 0.25rem;
}

.is-enhanced .carousel-track {
  scrollbar-width: none; /* the buttons and dots replace the scrollbar once JS runs */
}

.is-enhanced .carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-track:focus-visible {
  outline-offset: 6px;
}

.slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.carousel-controls[hidden] {
  display: none;
}

.car-btn {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--flor);
  color: var(--noche);
  cursor: pointer;
}

.car-btn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: default;
}

.car-dots {
  display: flex;
}

.car-dot {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.car-dot::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--pruina);
}

.car-dot[aria-current="true"]::before {
  width: 1.6rem;
  background: var(--flor);
}

.card {
  display: grid;
  gap: 0;
  overflow: hidden;
  background: var(--crema);
  color: var(--noche);
  border-radius: var(--radius);
}

.card-art {
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background: var(--noche);
}

.card-art svg {
  width: min(100%, 17rem);
  height: auto;
}

.card-body {
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.card h3 {
  color: var(--baya);
  font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.25rem);
  font-weight: 500;
  line-height: 1.15;
}

.card-body h3 + p {
  margin-top: 0.9rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.9rem 0 1.1rem;
  padding: 0.3rem 0.95rem;
  background: var(--flor);
  color: var(--noche);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
}

.status::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--noche);
}

@media (min-width: 46rem) {
  .card {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }

  .card-art {
    padding: 2rem;
  }

  .card-body {
    align-self: center;
  }
}

/* Footer */
.site-footer {
  margin-top: calc(-1 * var(--radius-band));
  background: var(--noche);
  color: var(--pruina);
  border-radius: var(--radius-band) var(--radius-band) 0 0;
  padding-block: clamp(2.5rem, 6vw, 4rem) 2.5rem;
  position: relative;
}

.footer-grid {
  display: grid;
  gap: 1.75rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
  color: var(--crema);
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1;
}

.footer-brand svg {
  width: 2rem;
  height: 2rem;
}

.footer-note {
  font-size: 0.95rem;
}

.footer-lang {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-lang a {
  display: inline-block;
  padding: 0.5rem 0;
  color: var(--crema);
  text-underline-offset: 0.2em;
}

.footer-lang a:hover {
  color: var(--flor);
}

.footer-lang a[aria-current="page"] {
  color: var(--flor);
  text-decoration: none;
}

.footer-label {
  margin-bottom: 0.25rem;
  color: var(--pruina);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

.footer-contact a {
  color: var(--crema);
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}

.footer-contact a:hover {
  color: var(--flor);
}

.footer-privacy {
  padding-top: 1.25rem;
  border-top: 1px solid rgba(184, 169, 232, 0.25);
  font-size: 0.95rem;
}

@media (min-width: 46rem) {
  .footer-grid {
    grid-template-columns: 1fr auto auto;
    gap: 1.75rem 3rem;
    align-items: start;
  }

  .footer-privacy {
    grid-column: 1 / -1;
  }
}
