/* Moru studio site. Visual spec: DESIGN.md. Breakpoints: 768 / 1024 / 1200. */

:root {
  --canvas: #fafaf6;
  --surface: #ffffff;
  --soft: #eef3ec;
  --ink: #171a18;
  --muted: #525a54;
  --accent: #24583d;
  --accent-strong: #1b452f;
  --control-border: #626b64;
  --line: #dde2d9;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --gutter: 20px;
  --header-h: 96px;
  --ease-out-expo: cubic-bezier(.22, 1, .36, 1);
}

@media (min-width: 768px) {
  :root { --gutter: 32px; --header-h: 80px; }
}
@media (min-width: 1024px) {
  :root { --gutter: 40px; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 26px;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
[tabindex="-1"]:focus { outline: none; }

.container {
  width: 100%;
  max-width: calc(1200px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus-visible {
  transform: none;
  box-shadow: 0 0 0 2px #fff;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "brand lang" "nav nav";
  grid-template-rows: 48px 48px;
  align-items: center;
  height: calc(var(--header-h) - 1px);
}
.brand {
  grid-area: brand;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-size: 26px;
  line-height: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}
.nav { grid-area: nav; }
.nav ul { display: flex; gap: 24px; }
.nav a, .lang a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}
.nav a {
  justify-content: flex-start;
  color: var(--ink);
  text-decoration: none;
}
.nav a:hover, .nav a:focus-visible { text-decoration: underline; }
.lang {
  grid-area: lang;
  display: flex;
  gap: 4px;
}
.lang a {
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 140ms ease-out;
}
.lang a:hover { background: var(--soft); }
.lang a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

@media (min-width: 768px) {
  .header-inner {
    grid-template-columns: 1fr auto auto;
    grid-template-areas: "brand nav lang";
    grid-template-rows: auto;
    column-gap: 24px;
  }
  .brand { font-size: 28px; line-height: 34px; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background-color 140ms ease-out;
}
.btn:hover, .btn:active { background: var(--accent-strong); }
.btn:focus-visible {
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff;
}

/* Hero */
.hero { overflow: hidden; }
.hero-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 600px;
  padding-block: 112px; /* 88px icon band + 24px */
}
.hero-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
}
.hero h1 {
  font-size: 88px;
  line-height: 88px;
  font-weight: 800;
  letter-spacing: -0.06em;
}
.hero-desc {
  margin-top: 16px;
  font-size: 24px;
  line-height: 34px;
  font-weight: 650;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero-status {
  margin-top: 16px;
  text-wrap: balance;
  color: var(--muted);
  font-size: 15px;
  line-height: 24px;
}
.hero-copy .btn { margin-top: 24px; }

.hero-icons {
  position: absolute;
  inset: 0 var(--gutter);
  pointer-events: none;
}
.hi {
  position: absolute;
  left: var(--mx);
  top: var(--my);
  width: var(--ms);
  height: var(--ms);
  transform: translate(-50%, -50%) rotate(var(--mr));
}
.hi:nth-child(n + 7) { display: none; }
.hi-enter, .hi-float, .hi img {
  display: block;
  width: 100%;
  height: 100%;
}
.hi img {
  border-radius: 22%;
  object-fit: contain;
}

@media (min-width: 768px) {
  .hero-stage { min-height: 640px; padding-block: 144px; } /* 120px band + 24px */
  .hero-copy { max-width: 560px; }
  .hero h1 { font-size: 128px; line-height: 128px; }
  .hero-desc { font-size: 30px; line-height: 40px; }
  .hero-status { font-size: 16px; line-height: 26px; }
  .hi {
    left: var(--tx);
    top: var(--ty);
    width: var(--ts);
    height: var(--ts);
    transform: translate(-50%, -50%) rotate(var(--r));
  }
  .hi:nth-child(-n + 8) { display: block; }
}
@media (min-width: 1024px) {
  .hero h1 { font-size: 160px; line-height: 160px; }
  .hero-desc { font-size: 36px; line-height: 46px; }
  .hero-status { font-size: 18px; line-height: 28px; }
}
@media (min-width: 1200px) {
  .hero-stage { min-height: 680px; padding-block: 96px; }
  .hi {
    left: var(--x);
    top: var(--y);
    width: var(--s);
    height: var(--s);
  }
  .hi:nth-child(n) { display: block; }
}

/* Hero motion: one bouncy entrance, then a slow, continuous float. */
@keyframes hi-enter {
  from { transform: translate(var(--ex), var(--ey)) scale(var(--es)); opacity: 0; }
  60% { transform: translate(0, var(--e60)) scale(var(--e60s)); opacity: 1; animation-timing-function: var(--ease-out-expo); }
  80% { transform: translate(0, var(--e80)) scale(.99); animation-timing-function: var(--ease-out-expo); }
  to { transform: none; opacity: 1; }
}
@keyframes hi-float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(var(--fx), var(--fy1)) rotate(var(--fr)); }
  50% { transform: translate(0, 0) rotate(0deg); }
  75% { transform: translate(calc(-1 * var(--fx)), var(--fy2)) rotate(calc(-1 * var(--fr))); }
}
.hi-enter {
  --ex: 0px; --ey: var(--mey); --es: .85;
  --e60: -6px; --e60s: 1.02; --e80: 2px;
  animation: hi-enter 600ms var(--ease-out-expo) calc((var(--i) - 1) * 70ms) both;
}
.hi-float {
  --fy1: -3px; --fy2: 2px;
  animation: hi-float var(--fd) ease-in-out var(--fdelay) infinite;
}
@media (min-width: 768px) {
  .hi-enter {
    --ex: var(--tex); --ey: 32px; --es: .8;
    --e60: -10px; --e60s: 1.04; --e80: 4px;
    animation-duration: 720ms;
    animation-delay: calc((var(--i) - 1) * 60ms);
  }
  .hi-float { --fy1: -6px; --fy2: 4px; }
}
@media (min-width: 1200px) {
  .hi-enter { --ex: var(--dex); }
}
.no-intro .hi-enter { animation: none; }
.hero.is-offscreen .hi-float { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .hi-enter, .hi-float { animation: none; }
}

/* Sections */
section[id] { scroll-margin-top: calc(var(--header-h) + 16px); }
.section-title {
  font-size: 32px;
  line-height: 40px;
  font-weight: 750;
  letter-spacing: -0.035em;
}
@media (min-width: 768px) {
  .section-title { font-size: 40px; line-height: 48px; }
}
@media (min-width: 1024px) {
  .section-title { font-size: 48px; line-height: 56px; }
}

/* Games */
.games { padding: 64px 0 80px; }
.games-count {
  margin-top: 8px;
  color: var(--muted);
}
.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
}
@media (min-width: 768px) {
  .games { padding: 96px 0 120px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 32px; }
}
@media (min-width: 1200px) {
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(23, 26, 24, .04);
}
.banner {
  position: relative;
  aspect-ratio: var(--ratio);
  overflow: hidden;
  border-radius: 19px 19px 0 0;
  background: var(--banner-bg);
}
.banner img {
  width: 100%;
  height: 100%;
}
.banner-fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
  text-align: center;
}
.banner.is-error { background: var(--surface); border-bottom: 1px solid var(--line); }
.banner.is-error img { visibility: hidden; }
.banner.is-error .banner-fallback { display: flex; }

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 20px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
}
.card h3 {
  min-width: 0;
  font-size: 20px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.card-sub {
  margin-top: 12px;
  color: var(--muted);
}
.card-actions {
  position: relative;
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 20px;
}
.card-actions .btn { flex: 1; min-width: 0; }

/* Desktop-only QR popover (needs JS, a fine pointer and hover). */
.qr-btn, .qr-pop { display: none; }
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .js .qr-btn {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--control-border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--accent);
    cursor: pointer;
    transition: background-color 140ms ease-out;
  }
  .js .qr-btn:hover, .js .qr-btn[aria-expanded="true"] { background: var(--soft); }
  .js .qr-pop:not([hidden]) { display: block; }
}
.qr-pop {
  position: absolute;
  right: 0;
  bottom: calc(100% - 12px);
  z-index: 40;
  width: 240px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(23, 26, 24, .14);
}
.qr-pop.is-below { top: calc(100% + 8px); bottom: auto; }
.qr-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin: -12px -12px 0 0;
}
.qr-title {
  padding-top: 12px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
}
.qr-close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.qr-close:hover { background: var(--soft); }
.qr-code {
  display: grid;
  place-items: center;
  width: 192px;
  height: 192px;
  margin-top: 8px;
  background: #fff;
}
.qr-code img { width: 192px; height: 192px; }
.qr-code .qr-error {
  display: none;
  padding: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
  text-align: center;
}
.qr-code.is-error img { display: none; }
.qr-code.is-error .qr-error { display: block; }
.qr-caption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}

/* About */
.about {
  padding: 64px 0;
  background: var(--soft);
}
.about-inner {
  display: grid;
  gap: 24px;
}
.about-text {
  max-width: 680px;
  font-size: 18px;
  line-height: 30px;
  letter-spacing: -0.01em;
}
@media (min-width: 768px) {
  .about { padding: 96px 0; }
  .about-text { font-size: 20px; line-height: 32px; }
}
@media (min-width: 1024px) {
  .about-inner { grid-template-columns: 1fr 2fr; gap: 24px; }
}

/* Contact */
.contact { padding: 64px 0 80px; }
.contact-email {
  display: inline-block;
  margin-top: 24px;
  font-size: 28px;
  line-height: 36px;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.contact-email:hover { color: var(--accent-strong); }
@media (min-width: 768px) {
  .contact { padding: 96px 0 120px; }
  .contact-email { font-size: 32px; line-height: 40px; }
}

/* Footer */
.site-footer {
  padding: 40px 0 calc(32px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--soft);
  font-size: 14px;
  line-height: 23px;
}
.biz {
  display: grid;
  gap: 32px;
}
.biz dl { display: grid; gap: 8px; }
.biz-row { display: grid; gap: 4px; }
.biz dt { color: var(--muted); }
.biz dd { min-width: 0; overflow-wrap: anywhere; }
.biz .nowrap { white-space: nowrap; }
.copyright {
  margin-top: 32px;
  color: var(--muted);
}
@media (min-width: 768px) {
  .site-footer { padding-top: 48px; }
  .biz { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; }
}
@media (min-width: 1024px) {
  .biz-row { grid-template-columns: 144px minmax(0, 1fr); gap: 16px; }
}

/* Root language chooser and 404 */
.plain {
  display: grid;
  place-content: center;
  min-height: 100vh;
  padding: 40px var(--gutter);
  text-align: center;
}
.plain h1 {
  font-size: 64px;
  line-height: 64px;
  font-weight: 800;
  letter-spacing: -0.06em;
}
.plain p { margin-top: 16px; }
.plain .choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}
