:root {
  --bg: #fbf4e6;
  --paper: #fffdf8;
  --ink: #23222a;
  --muted: #6b6772;
  --orange: #ff8a3d;
  --yellow: #ffc83d;
  --teal: #3cc5b0;
  --pink: #ff9fb0;
  --line: #23222a;
  --display: "Fredoka", system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; touch-action: pan-x pan-y; overflow-x: hidden; overflow-x: clip; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  overflow-x: clip;
  background-image: radial-gradient(#e9dcc2 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}

a { color: inherit; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; }
h2 { font-size: clamp(32px, 5vw, 48px); margin-bottom: 28px; }

section, .nav, footer { padding-left: max(16px, calc(50% - 560px)); padding-right: max(16px, calc(50% - 560px)); }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 14px; padding-bottom: 14px;
  background: rgba(251, 244, 230, .85);
  backdrop-filter: blur(8px);
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 700; font-size: 22px;
  text-decoration: none;
}
.logo-mark { width: 36px; height: 36px; display: block; background: url("assets/logo.png") center / contain no-repeat; }
.nav nav { display: flex; gap: 22px; align-items: center; font-weight: 700; }
.nav nav a { text-decoration: none; }
.nav nav a:hover { color: var(--orange); }
.lang {
  position: relative;
  display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px;
  background: var(--paper); border: 2px solid var(--line); border-radius: 999px;
  font-family: "Fredoka", "Jua", system-ui, sans-serif; font-weight: 600; font-size: 14px;
  cursor: pointer; color: var(--ink);
}
/* sliding knob */
.lang::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 3px);
  background: var(--ink); border-radius: 999px;
  transition: transform .45s cubic-bezier(.68, -0.35, .32, 1.35);
}
.lang.is-ko::before { transform: translateX(100%); }
.lang span {
  position: relative; z-index: 1;
  min-width: 36px; padding: 2px 10px; text-align: center;
  transition: color .3s .1s;
}
.lang:not(.is-ko) [data-l="en"],
.lang.is-ko [data-l="ko"] { color: var(--paper); }

/* page text cross-fade while switching language */
[data-i18n] { transition: opacity .18s ease, filter .18s ease; }
body.lang-swap [data-i18n] { opacity: 0; filter: blur(3px); }

/* Korean: Fredoka/Nunito have no Hangul */
html[lang="ko"] { --display: "Jua", "Fredoka", system-ui, sans-serif; --body: "Gowun Dodum", "Nunito", system-ui, sans-serif; }
html[lang="ko"] body { word-break: keep-all; }
html[lang="ko"] h1, html[lang="ko"] h2, html[lang="ko"] h3 { font-weight: 400; }

.pill, .btn {
  background: var(--ink); color: var(--paper) !important;
  padding: 8px 18px; border-radius: 999px;
  transition: transform .15s;
}
.pill:hover, .btn:hover { transform: translateY(-2px) rotate(-1deg); }

/* hero */
.hero {
  display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 32px;
  padding-top: 64px; padding-bottom: 72px;
}
.kicker {
  display: inline-block;
  font-weight: 700; font-size: 14px;
  background: var(--yellow); border: 2px solid var(--line); border-radius: 999px;
  padding: 2px 14px; margin-bottom: 20px;
  transform: rotate(-2deg);
}
.hero h1 { font-size: clamp(48px, 8vw, 92px); letter-spacing: -.01em; }
.hl {
  color: var(--orange);
  display: inline-block;
  animation: wiggle 2.4s ease-in-out infinite;
}
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.lead { font-size: 19px; color: var(--muted); max-width: 30em; margin: 22px 0 30px; }
.btn {
  display: inline-block; text-decoration: none;
  font-family: var(--display); font-weight: 600; font-size: 18px;
  padding: 14px 26px;
  box-shadow: 4px 4px 0 var(--orange);
}

.mascot {
  position: relative;
  background: none; border: 0; cursor: pointer;
  justify-self: center; width: min(400px, 78vw);
  color: var(--ink); padding: 0; -webkit-tap-highlight-color: transparent;
}
.mascot .crow {
  display: block; width: 100%; aspect-ratio: 820 / 764;
  background: url("assets/crow.png") center / contain no-repeat;
  transform-origin: 50% 90%;
  animation: bob 2.6s ease-in-out infinite;
  filter: drop-shadow(0 18px 14px rgba(35, 34, 42, .15));
}
.mascot.hop .crow { animation: hop .5s ease-out; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes hop {
  0% { transform: translateY(0) scale(1, 1); }
  20% { transform: translateY(0) scale(1.06, .92); }
  50% { transform: translateY(-36px) scale(.96, 1.05); }
  100% { transform: translateY(0) scale(1, 1); }
}
.bubble {
  position: absolute; top: 4%; left: 2%;
  font-family: var(--display); font-weight: 700; font-size: 22px;
  background: var(--paper); border: 2px solid var(--line); border-radius: 16px;
  padding: 4px 14px;
  opacity: 0; transform: scale(.6);
  transition: opacity .2s, transform .2s;
}
.bubble.show { opacity: 1; transform: scale(1) rotate(-6deg); }

/* marquee */
/* wrapper clips the tilted band so it never widens the page (iOS ignores body overflow) */
.marquee-wrap { overflow: hidden; padding: 16px 0; margin: -16px 0; }
.marquee {
  background: var(--ink); color: var(--paper);
  overflow: hidden; padding: 14px 0;
  transform: rotate(-1.5deg); margin: 0 -20px;
  font-family: var(--display); font-weight: 600; font-size: 20px;
}
.track { display: flex; gap: 40px; width: max-content; animation: scroll 32s linear infinite; }
.track span:nth-child(3n+1) { color: var(--yellow); }
.track span:nth-child(3n+2) { color: var(--teal); }
@keyframes scroll { to { transform: translateX(-50%); } }

/* project */
.project { padding-top: 96px; padding-bottom: 48px; }
.card {
  display: grid; grid-template-columns: 1fr 1.2fr;
  background: var(--paper);
  border: 3px solid var(--line); border-radius: 24px;
  box-shadow: 8px 8px 0 var(--line);
  overflow: hidden;
}
.cover {
  position: relative; min-height: 300px;
  display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, var(--teal) 0 24px, #36b5a1 24px 48px);
  border-right: 3px solid var(--line);
}
.q {
  font-family: var(--display); font-weight: 700; font-size: 160px; color: var(--paper);
  text-shadow: 6px 6px 0 var(--line);
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
.sticker {
  position: absolute; bottom: 18px; right: -6px;
  background: var(--yellow); border: 2px solid var(--line);
  font-family: var(--display); font-weight: 700;
  padding: 6px 16px; transform: rotate(-6deg);
}
.info { padding: 32px; }
.code { font-family: var(--display); font-size: 28px; margin-bottom: 10px; }
.code strong { color: var(--orange); }
.info > p:not(.code) { color: var(--muted); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 24px; }
.tags li { font-size: 14px; font-weight: 700; border: 2px solid var(--line); border-radius: 999px; padding: 2px 12px; }
.tags li:first-child { background: var(--pink); }
.progress-label { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.bar { height: 18px; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--bg); }
.fill {
  height: 100%; width: 0;
  background: repeating-linear-gradient(-45deg, var(--orange) 0 10px, #ff9d5c 10px 20px);
  transition: width 1.6s cubic-bezier(.2, .8, .2, 1);
}

/* about */
.about { padding-top: 72px; padding-bottom: 48px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.fact {
  background: var(--paper); border: 3px solid var(--line); border-radius: 20px;
  padding: 24px; transition: transform .2s;
}
.fact:nth-child(1) { transform: rotate(-1deg); }
.fact:nth-child(2) { transform: rotate(1deg); }
.fact:hover { transform: rotate(0) translateY(-4px); }
.emoji { font-size: 36px; display: block; margin-bottom: 8px; }
.fact h3 { font-size: 22px; margin-bottom: 6px; }
.fact p { color: var(--muted); font-size: 16px; }

/* contact */
.contact { text-align: center; padding-top: 96px; padding-bottom: 110px; }
.contact p { color: var(--muted); margin-top: -14px; margin-bottom: 26px; }
.mail {
  display: inline-block;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(24px, 5vw, 44px);
  text-decoration: none;
  background: var(--yellow); border: 3px solid var(--line); border-radius: 18px;
  padding: 10px 28px; box-shadow: 6px 6px 0 var(--line);
  transition: transform .15s, box-shadow .15s;
  word-break: break-all;
}
.mail:hover { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--line); }

footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding-top: 24px; padding-bottom: 24px;
  border-top: 2px dashed #d9c9a8;
  color: var(--muted); font-size: 14px;
}

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; text-align: center; }
  .hero .mascot { grid-row: 1; width: min(240px, 65vw); }
  .lead { margin-left: auto; margin-right: auto; }
  .card { grid-template-columns: 1fr; }
  .cover { border-right: 0; border-bottom: 3px solid var(--line); min-height: 220px; }
  .facts { grid-template-columns: 1fr; }
  .nav nav a:not(.pill) { display: none; }
  .nav nav { gap: 10px; }
  .logo { font-size: 19px; gap: 8px; }
  .pill { padding: 8px 14px; }
}

@media (max-width: 340px) {
  .logo { font-size: 17px; }
  .lang span { min-width: 30px; padding: 2px 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* no long-press save / drag on the artwork */
.logo, .mascot { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
