/*
  SUPER CAKE GAME STUDIO homepage styles.
  Every colour below is taken from the intro sting (see README, "디자인 토큰").
  No external requests: fonts are self-hosted subsets, images are same-origin.
*/

@font-face {
  font-family: "SC Round";
  src: url("/fonts/sc-round-eb.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SC Round Light";
  src: url("/fonts/sc-round-l.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Stage and gamepad */
  /* Page background. Measured on the encoded video: frame sides and bottom #000007 to
     #000009, top #000000. The brief's estimate #02040B left a visible frame edge. */
  --stage: #000007;
  --pad: #1c1d2d;          /* gamepad body */
  --pad-hi: #25263b;
  --pad-lo: #131422;
  --rim: #a79aaa;          /* gamepad rim highlight */
  --violet: #494154;       /* thin rules, as in the GAME STUDIO line */

  /* Text */
  --cream: #f5eee5;        /* wordmark, cream */
  --ink-2: #bcb3b4;        /* secondary text, 9:1 on stage */

  /* Accents, used small */
  --cherry: #e7777b;
  --pink: #ec8594;
  --beam: #ffb7e9;
  --gold: #f3c681;
  --sponge: #ebc28e;
  --mint: #8bc4bd;
  --cocoa: #382326;

  --font-display: "SC Round", "Arial Rounded MT Bold", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-thin: "SC Round Light", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic",
    "Noto Sans KR", "Noto Sans CJK KR", sans-serif;

  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 64px;
  --measure: 34rem;
  --ease: cubic-bezier(0.7, 0, 0.3, 1);

  /* Cake cross-section, top to bottom: cream, ganache line, pink sponge, cream, gold sponge.
     Stops are placed on the measured glyph box of SC Round ExtraBold (Hangul spans about
     1.5% to 89% of a line-height:1 box). */
  --layers: linear-gradient(180deg,
      var(--cream) 0 31%,
      var(--cocoa) 31% 34.5%,
      var(--pink) 34.5% 56%,
      var(--cream) 56% 59.5%,
      var(--sponge) 59.5% 100%);

  /* Blurred placeholder of the last frame, written by tools/build_media.py. */
  /* lqip:start */--lqip: url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCIoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCAAUACgDASIAAhEBAxEB/8QAGgABAQACAwAAAAAAAAAAAAAAAAUDBgECB//EACoQAAEDBAIBAwIHAAAAAAAAAAECAxEABAUSEyEGMUFRIpEUFmFxktHx/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAIB/8QAGREBAAIDAAAAAAAAAAAAAAAAAAIRASFB/9oADAMBAAIRAxEAPwDxtS1LIK1FUAASfYelVcLgnctyLSHShpJUoMt7qIAkmPgf5UkAk9Ca2OxsfJrRPHYWN+04plW3EkgqQoSfT9CKvAr/AJSwCsUt9q6yS2G0chv/AMGNVKPQaCN/nrafWtSyWOVYOhMkpUOtgAR9uv6MgwavC28ht8ebBzFuNF1BbQpXIFFSTuQO9RA7giOvmp7+Lzt63yOY66UAkK2LcCNdp/j9U+8zUx7a51qkOlckEGCINK1ACQZBirA8izTjPAcpcBvXTVKo+nWI69opSgyO5/MPOpU7kn3ClSiNiCJUmFdRHY9fmurnk2dUC2rK3C0lJTqpQIgiCPsY/bqlKDHZYtm7xbt24tzkQVAAER0mR7UpStY//9k=");/* lqip:end */
}

/* Base */

*,
*::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(--stage);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

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

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

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  top: 12px;
  left: var(--gutter);
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--cream);
  color: var(--stage);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1440px;
  height: var(--header-h);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.brand {
  padding-block: 0.5rem;
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-decoration: none;
}

.nav ul {
  display: flex;
  gap: clamp(1rem, 3vw, 2.25rem);
}

.nav a {
  display: inline-block;
  padding: 0.5rem 0.125rem;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.4;
  text-decoration: none;
  background: linear-gradient(var(--pink), var(--pink)) 0 100% / 0 2px no-repeat;
  transition: color 0.2s, background-size 0.3s var(--ease);
}

.nav a:hover {
  color: var(--cream);
  background-size: 100% 2px;
}

/* Hero: the intro sting on a stage of the same colour, so the frame edge disappears. */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  padding-bottom: clamp(2rem, 6vh, 4rem);
}

.screen {
  position: relative;
  width: min(100%, 1280px, calc((100vh - var(--header-h) - 8rem) * 1.9512));
  width: min(100%, 1280px, calc((100svh - var(--header-h) - 8rem) * 1.9512));
  aspect-ratio: 1280 / 656;
  overflow: hidden;
  background: var(--stage);
}

.screen__video,
.screen__still,
.screen__fallback {
  position: absolute;
  inset: 0;
}

.screen__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen__still {
  transition: opacity 0.5s ease, visibility 0s;
}

.screen__still::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--lqip) center / cover no-repeat;
  filter: blur(14px);
  transform: scale(1.06);
}

.screen__still img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen[data-state="playing"] .screen__still,
.screen[data-state="ended"] .screen__still {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s 0.5s;
}

/* With script and motion allowed, the stage stays dark until the sting starts. */
@media (prefers-reduced-motion: no-preference) {
  .js .screen[data-state="waiting"] .screen__still {
    opacity: 0;
  }
}

.screen[data-still="failed"] .screen__still {
  display: none;
}

/* Text lockup, only when neither the video nor the still image can be shown. */
.screen__fallback {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6em;
  padding-bottom: 6%;
  font-size: clamp(0.75rem, 2.2vw, 1.75rem);
}

.screen[data-fallback] .screen__fallback {
  display: flex;
}

.screen__fallback-name {
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3.4em;
  line-height: 1;
  letter-spacing: 0.02em;
}

.screen__fallback-sub {
  display: flex;
  align-items: center;
  gap: 1em;
  color: var(--ink-2);
  font-family: var(--font-thin);
  font-weight: 300;
  letter-spacing: 0.5em;
}

.screen__fallback-sub span {
  margin-right: -0.5em;
}

.screen__fallback-sub::before,
.screen__fallback-sub::after {
  content: "";
  width: 4em;
  height: 1px;
  background: var(--violet);
}

.hero__controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: clamp(1rem, 2.5vh, 1.75rem);
  padding-inline: var(--gutter);
  visibility: hidden;
}

.js .hero__controls {
  visibility: visible;
}

/* Pill buttons */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0 1.05rem 0 0.9rem;
  border: 1px solid rgba(245, 238, 229, 0.16);
  border-radius: 999px;
  background: rgba(28, 29, 45, 0.6);
  color: var(--cream);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.chip:hover {
  border-color: rgba(255, 183, 233, 0.55);
  background: rgba(28, 29, 45, 0.95);
}

.chip svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip[data-muted="true"] .i-sound,
.chip[data-muted="false"] .i-muted {
  display: none;
}

/* Sections */

.section {
  padding: clamp(3.5rem, 8vw, 6rem) var(--gutter);
  text-align: center;
}

/* Thin wide-tracked caps between two rules, after the GAME STUDIO line of the logo. */
.label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  color: var(--ink-2);
  font-family: var(--font-thin);
  font-weight: 300;
  font-size: 0.8125rem;
  line-height: 1;
  letter-spacing: 0.5em;
}

.label span {
  margin-right: -0.5em;
}

.label::before,
.label::after {
  content: "";
  flex: 0 1 clamp(2.25rem, 9vw, 5rem);
  height: 1px;
  background: linear-gradient(90deg, rgba(73, 65, 84, 0), var(--violet));
}

.label::after {
  background: linear-gradient(270deg, rgba(73, 65, 84, 0), var(--violet));
}

.section-title {
  margin-bottom: clamp(2rem, 4.5vw, 3.25rem);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.25rem, 5.2vw, 3.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.lead {
  max-width: var(--measure);
  margin-inline: auto;
  font-size: clamp(1.125rem, 1.9vw, 1.375rem);
  line-height: 1.7;
}

.note {
  max-width: var(--measure);
  margin: 0.75rem auto 0;
  color: var(--ink-2);
}

/* Studio: the name as a sliced cake. A pink beam cuts it once, as in the intro. */

.cake-word {
  position: relative;
  display: inline-block;
  margin: 0.25rem 0 clamp(1.75rem, 4vw, 2.75rem);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.25rem, 16vw, 11.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.cake-word__text {
  display: block;
  padding-inline: 0.02em;
  background: var(--layers);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cake-word__cover {
  position: absolute;
  inset: 0;
  padding-inline: 0.02em;
  color: var(--pad);
  -webkit-text-stroke: 0.012em rgba(167, 154, 170, 0.55);
  paint-order: stroke fill;
  clip-path: inset(0 0 0 100%);
  pointer-events: none;
  user-select: none;
}

/* The outer box clips the moving bar so it never widens the page. */
.cake-word__beam {
  position: absolute;
  top: -14%;
  bottom: -14%;
  left: -2rem;
  right: -2rem;
  overflow: hidden;
  pointer-events: none;
}

.cake-word__beam span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2rem;
  right: 2rem;
  opacity: 0;
}

.cake-word__beam span::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1.5px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 183, 233, 0), #fff 18%, #fff 82%, rgba(255, 183, 233, 0));
  box-shadow: 0 0 10px 2px rgba(255, 183, 233, 0.9), 0 0 36px 10px rgba(236, 133, 148, 0.45);
}

@media (prefers-reduced-motion: no-preference) {
  .js .cake-word__cover {
    clip-path: inset(0 0 0 0);
    transition: clip-path 1.25s var(--ease);
  }

  .js .cake-word.is-sliced .cake-word__cover {
    clip-path: inset(0 0 0 100%);
  }

  .js .cake-word.is-sliced .cake-word__beam span {
    animation: slice 1.25s var(--ease) both;
  }
}

@keyframes slice {
  0% {
    transform: translateX(0);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  86% {
    opacity: 1;
  }
  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Games: empty state drawn as the gamepad from the logo. */

.pad {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "dpad screen buttons";
  align-items: center;
  gap: clamp(1.25rem, 4vw, 3.5rem);
  max-width: 54rem;
  margin-inline: auto;
  padding: clamp(1.75rem, 4.5vw, 3rem) clamp(1.75rem, 5.5vw, 4rem);
  border-radius: clamp(2rem, 7vw, 5rem);
  background: linear-gradient(180deg, var(--pad-hi), var(--pad) 45%, var(--pad-lo));
  box-shadow:
    inset 0 1px 0 rgba(167, 154, 170, 0.5),
    inset 0 -14px 28px rgba(2, 4, 10, 0.45),
    0 40px 80px -40px rgba(0, 0, 0, 0.9);
  --key: clamp(3.5rem, 8vw, 5.25rem);
}

.pad__dpad,
.pad__buttons {
  position: relative;
  width: var(--key);
  height: var(--key);
}

.pad__dpad {
  grid-area: dpad;
}

.pad__dpad::before,
.pad__dpad::after {
  content: "";
  position: absolute;
  border-radius: calc(var(--key) * 0.09);
  background: var(--cream);
  box-shadow: inset 0 -3px 0 rgba(56, 35, 38, 0.18);
}

.pad__dpad::before {
  top: 0;
  bottom: 0;
  left: 33.5%;
  right: 33.5%;
}

.pad__dpad::after {
  top: 33.5%;
  bottom: 33.5%;
  left: 0;
  right: 0;
}

.pad__buttons {
  grid-area: buttons;
}

.pad__btn {
  position: absolute;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  box-shadow: inset 0 -3px 0 rgba(2, 4, 10, 0.22), inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.pad__btn--top {
  top: 0;
  left: 33%;
  background: var(--gold);
}

.pad__btn--left {
  top: 33%;
  left: 0;
  background: var(--gold);
}

.pad__btn--right {
  top: 33%;
  right: 0;
  background: var(--pink);
}

.pad__btn--bottom {
  bottom: 0;
  left: 33%;
  background: var(--mint);
}

.pad__screen {
  grid-area: screen;
  padding-block: 0.25rem;
}

.pad__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 3.4vw, 2.125rem);
  line-height: 1.25;
}

.pad__text {
  margin-top: 0.6rem;
  color: var(--ink-2);
}

@media (max-width: 600px) {
  .pad {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "dpad buttons"
      "screen screen";
    row-gap: 1.5rem;
  }

  .pad__buttons {
    justify-self: end;
  }
}

/* Games: cards, rendered from /data/games.json by app.js */

.game-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  max-width: 72rem;
  margin-inline: auto;
  text-align: left;
}

.game-card {
  display: flex;
  flex: 0 1 22rem;
  flex-direction: column;
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(180deg, var(--pad-hi), var(--pad) 40%);
  box-shadow: inset 0 1px 0 rgba(167, 154, 170, 0.45);
}

.game-card__media {
  aspect-ratio: 16 / 9;
  background: var(--pad-lo);
}

.game-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* No image yet: a quiet cake cross-section instead of an empty box. */
.game-card__media--blank {
  position: relative;
}

.game-card__media--blank::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--layers);
  opacity: 0.22;
}

.game-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.25rem 1.5rem 1.5rem;
}

.game-card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.3;
}

.game-card__tagline {
  color: var(--ink-2);
}

.game-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.game-card__meta li {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(245, 238, 229, 0.07);
  color: var(--ink-2);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.game-card__meta [data-status] {
  border: 1px solid currentColor;
  background: none;
}

.game-card__meta [data-status="released"] {
  color: var(--mint);
}

.game-card__meta [data-status="upcoming"] {
  color: var(--gold);
}

.game-card__meta [data-status="in-development"] {
  color: var(--pink);
}

.game-card__link {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 0.6rem;
  color: var(--cream);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--pink);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

.game-card__link:hover {
  color: var(--beam);
}

/* Contact */

.mail-wrap {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
}

.mail {
  padding-bottom: 0.12em;
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.375rem, 6.2vw, 3.75rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  text-decoration: none;
  background: linear-gradient(var(--cherry), var(--cherry)) 0 100% / 100% 0.08em no-repeat;
  transition: color 0.2s;
}

.mail:hover {
  color: var(--beam);
}

.contact__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
  visibility: hidden;
}

.js .contact__actions {
  visibility: visible;
}

.copy-status {
  min-height: 1.75em;
  color: var(--mint);
  font-size: 0.875rem;
}

/* Footer: the GAME STUDIO line again, with the pink glint. */

.site-footer {
  padding: clamp(3rem, 8vw, 5rem) var(--gutter) clamp(2.5rem, 6vw, 3.5rem);
  text-align: center;
}

.glint {
  width: 14px;
  height: 14px;
  margin: 0 auto 1.1rem;
  fill: var(--pink);
}

.footer-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--ink-2);
  font-family: var(--font-thin);
  font-weight: 300;
  font-size: 0.6875rem;
  line-height: 1.4;
  letter-spacing: 0.34em;
  white-space: nowrap;
}

.footer-line span {
  margin-right: -0.34em;
}

.footer-line::before,
.footer-line::after {
  content: "";
  flex: 0 1 4rem;
  min-width: 1rem;
  height: 1px;
  background: var(--violet);
}

/* 404 */

.notfound {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-h) - 10rem);
  min-height: calc(100svh - var(--header-h) - 10rem);
  padding: 3rem var(--gutter);
  text-align: center;
}

.notfound .cake-word {
  margin-bottom: 1.5rem;
}

.notfound h1 {
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.3;
}

.notfound p {
  color: var(--ink-2);
}

.notfound .chip {
  margin-top: 2rem;
  text-decoration: none;
}

/* Narrow screens */

@media (max-width: 720px) {
  :root {
    --header-h: 56px;
  }

  .hero {
    min-height: 0;
    padding-block: clamp(1.5rem, 6vw, 2.5rem) clamp(1rem, 4vw, 2rem);
  }

  .brand {
    font-size: 0.9375rem;
  }
}

@media (max-width: 480px) {
  .footer-line {
    gap: 0.6rem;
    letter-spacing: 0.22em;
  }

  .footer-line span {
    margin-right: -0.22em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
