:root {
  --bg: #edf4fc;
  --ink: #1b1e24;
  --muted: #5f6774;
  --faint: #98a2b1;
  --line: #dce6f2;
  --pen: #1f63e0;
  --pen-light: #7fb0f5;
  --sans: "Inter", "Zen Kaku Gothic New", system-ui, sans-serif;
  --ja: "Zen Kaku Gothic New", "Inter", system-ui, sans-serif;
  --hand: "Klee One", "Zen Kaku Gothic New", cursive;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: clamp(20px, 6vw, 64px);
  color-scheme: light;
}

/* いつもライト（薄い水色）で表示する。?theme=dark のときだけダーク（見比べ用） */
:root[data-theme="dark"] {
  --bg: #0f141c;
  --ink: #e9eef5;
  --muted: #9ca6b4;
  --faint: #667080;
  --line: #232c39;
  --pen: #6ea2ff;
  --pen-light: #9cc2ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ja);
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 3px; border-radius: 4px; }

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
  font-family: var(--sans);
  font-size: 14px;
}
.logo { font-weight: 600; letter-spacing: -0.01em; }
.nav { display: flex; gap: 22px; }
.nav a { color: var(--muted); transition: color .2s; }
.nav a:hover { color: var(--ink); }

/* ---------- intro ---------- */
.intro { padding: 24px 0 0; text-align: center; }
.intro-title {
  margin: 48px auto 0;
  font-family: var(--ja);
  font-weight: 700;
  font-size: 36px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  max-width: none;
  margin-inline: auto;
  text-wrap: balance;
}
.tld { color: var(--pen); }
.mark { position: relative; display: inline-block; white-space: nowrap; }
.mark svg {
  position: absolute;
  left: -0.08em;
  top: 0;
  width: calc(100% + 0.16em);
  height: calc(100% + 0.28em);
  overflow: visible;
  pointer-events: none;
  color: var(--pen);
}
.intro-text {
  max-width: 34em;
  margin: 22px auto 0;
  font-size: 19px;
  color: var(--muted);
}

.cast { position: relative; margin: 0 auto; max-width: 560px; }
.cast-svg path, .work-visual path, .mark path { stroke-linecap: round; stroke-linejoin: round; }
.cast-svg { display: block; width: 100%; height: auto; overflow: visible; color: var(--ink); }
.cast-btn {
  position: absolute;
  right: 0;
  bottom: -30px;
  padding: 2px 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}
.cast-btn:hover { color: var(--pen); }
#skip { display: none; }
.cast.playing #skip { display: inline; }
.cast.playing #redraw { display: none; }

/* ---------- sections ---------- */
.section {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 24px;
  padding-top: clamp(96px, 14vw, 150px);
}
.section-label {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--faint);
  line-height: 1.9;
}

/* ---------- works ---------- */
.work {
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}
.work + .work { margin-top: clamp(56px, 8vw, 88px); }
.work-visual { position: relative; width: 100%; aspect-ratio: 400 / 360; color: var(--ink); }
.work-scene { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* ---------- 3D の iPhone ---------- */
.device {
  position: absolute;
  left: 54%;
  top: 1%;
  width: 42%;
  aspect-ratio: 0.49;
  perspective: 1100px;
}
.device-body {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 3.6%;
  border-radius: 15% / 7.2%;
  background: linear-gradient(145deg, #3a3d44, #16181c 45%, #0c0d10);
  /* 重ねた影で側面の厚みを出す */
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .12),
    1px 1px 0 #2b2e34, 2px 2px 0 #24262b, 3px 3px 0 #1e2024, 4px 4px 0 #191a1e, 5px 5px 0 #141518,
    24px 34px 44px -14px rgba(24, 48, 96, .38);
  transform: rotateY(calc(-18deg + var(--ry, 0deg))) rotateX(calc(7deg + var(--rx, 0deg))) rotateZ(1.5deg);
  transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}
.work-visual:hover .device-body { transition-duration: .15s; }
.device-body::after {
  /* Dynamic Island */
  content: "";
  position: absolute;
  top: 5.2%;
  left: 50%;
  width: 28%;
  height: 3%;
  transform: translateX(-50%);
  border-radius: 99px;
  background: #000;
}
.device-body::before {
  /* 画面のつや */
  content: "";
  position: absolute;
  inset: 3.6%;
  z-index: 1;
  border-radius: 12.5% / 5.8%;
  background: linear-gradient(118deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 38%);
  pointer-events: none;
}
.device-screen {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  border-radius: 12.5% / 5.8%;
  background: #000;
}
.js .device { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1); }
.js .work-visual.in .device { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  .work-visual.in .device-body { animation: device-float 7s ease-in-out infinite; }
}
@keyframes device-float {
  50% { translate: 0 -6px; }
}
.work-name {
  margin: 0;
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.work-meta {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--faint);
  letter-spacing: 0;
}
.work-catch { margin: 8px 0 6px; font-weight: 500; }
.work-desc { margin: 0; font-size: 14px; color: var(--muted); }
.work-body { max-width: 620px; }
.work-link {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--pen);
  border-bottom: 1px solid color-mix(in srgb, var(--pen) 35%, transparent);
  transition: border-color .2s;
}
.work-link:hover { border-bottom-color: var(--pen); }

/* ---------- about / contact ---------- */
.about-text { max-width: 34em; margin: 0; }
.about-text + .about-text { margin-top: 14px; }
.contact-text { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.contact-link {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  transition: border-color .2s, color .2s;
}
.contact-link:hover { color: var(--pen); border-bottom-color: var(--pen); }

.site-footer {
  padding: clamp(96px, 14vw, 150px) 0 40px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

/* ---------- characters ---------- */
.char { cursor: pointer; outline: none; }
.char:focus-visible .bob { filter: drop-shadow(0 0 0 var(--pen)); }
.char .hit { fill: transparent; stroke: none; }
.char .bob { transition: transform .38s cubic-bezier(.3, 1.8, .5, 1); }
.char.hop .bob { transform: translateY(-12px); }
.eyes, .eyes-open { transform-box: fill-box; transform-origin: center; }
.char.talk .pen { color: var(--pen); }

.eyes-open, .arms-up { display: none; }
.char-cat.awake .eyes-closed, .char-cat.awake .zzz { display: none; }
.char-cat.awake .eyes-open { display: inline; }
.zzz { font-family: var(--hand); font-size: 13px; fill: var(--faint); }
.barbell { transition: transform .32s cubic-bezier(.5, 0, .3, 1); }
.char-lifter.up .barbell { transform: translateY(-44px); }
.char-lifter.up .arms-down { display: none; }
.char-lifter.up .arms-up { display: inline; }

@media (prefers-reduced-motion: no-preference) {
  .eyes { animation: blink 5.5s infinite; }
  .char-cat .eyes-closed { animation: none; }
  .zzz { animation: zzz 3.2s ease-in-out infinite; }
}
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 4px); } 30%, 70% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -8px); } }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .intro { padding-top: 8px; }
  .intro-title { font-size: 26px; margin-top: 44px; letter-spacing: 0.02em; }
  .intro-text { margin-top: 14px; font-size: 17px; }
  .section { grid-template-columns: 1fr; gap: 20px; }
  .work { grid-template-columns: 1fr; gap: 18px; }
  .work-visual { max-width: 420px; }
  .nav { gap: 16px; }
}

/* 日本語は文節の区切りで折り返す */
.phrase { display: inline-block; }

/* ---------- 歩く人とポン! ---------- */
.far { opacity: .45; }
.pop { transition: transform .5s cubic-bezier(.3, 1.7, .5, 1), opacity .2s ease; }
.pop.hidden { transform: scale(.2); opacity: 0; pointer-events: none; }
.walker .shadow { fill: currentColor; opacity: .1; }
.burst line { stroke: var(--pen); stroke-width: 1.8; stroke-linecap: round; }
.burst line.light { stroke: var(--pen-light); }
.burst circle { fill: none; stroke: var(--pen-light); stroke-width: 1.4; }
.burst { transform-box: fill-box; transform-origin: center; animation: burst .7s cubic-bezier(.2, .8, .3, 1) forwards; }
.occlude { fill: var(--bg); }
.pen { color: var(--pen); }
@keyframes burst {
  0% { opacity: 0; transform: scale(.4); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.35); }
}

/* 考え中の雲とぐるぐる */
.thought circle { fill: none; stroke: currentColor; stroke-width: 1.3; transform-box: fill-box; transform-origin: center; }
.thought .scribble {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100 100;
  animation: scribble 1s linear infinite;
}
@keyframes scribble {
  0% { stroke-dashoffset: 100; }
  60% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -100; }
}

/* 歩き終えたあとのサイン */
.signature { font-family: var(--ja); font-size: 25px; font-weight: 700; letter-spacing: 0.02em; fill: currentColor; }
.signature .accent { fill: var(--pen); }

/* 最初のアニメーションが終わるまで、Works から下は隠しておく */
.js .section-label,
.js .group-label,
.js .work,
.js .about-text,
.js .contact-text,
.js .contact-link,
.js .site-footer {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s ease, transform .8s cubic-bezier(.2, .8, .2, 1);
}
.js .contact-link { display: inline-block; }
.intro-done .section-label,
.intro-done .group-label,
.intro-done .work,
.intro-done .about-text,
.intro-done .contact-text,
.intro-done .contact-link,
.intro-done .site-footer { opacity: 1; transform: none; }
.intro-done #works .section-label, .intro-done .group-label { transition-delay: 0s; }
.intro-done .work:nth-of-type(1) { transition-delay: .08s; }
.intro-done .work:nth-of-type(2) { transition-delay: .2s; }
.intro-done .work:nth-of-type(3) { transition-delay: .32s; }
.intro-done #about .section-label, .intro-done .about-text { transition-delay: .44s; }
.intro-done .about-text + .about-text { transition-delay: .5s; }
.intro-done #contact .section-label, .intro-done .contact-text, .intro-done .contact-link { transition-delay: .58s; }
.intro-done .site-footer { transition-delay: .66s; }
@media (prefers-reduced-motion: reduce) {
  .js .section-label, .js .group-label, .js .work, .js .about-text, .js .contact-text, .js .contact-link, .js .site-footer { opacity: 1; transform: none; transition: none; }
}

/* 広い画面では、見出しとイラストを一回り大きく */
@media (min-width: 1080px) {
  /* 余白は詰めて、絵の大きさで「Works の上端が画面の下にのぞく」位置に合わせる */
  .intro { padding: 16px 0 0; }
  .cast { width: 100%; max-width: min(1000px, calc((100svh - 480px) * 2.95)); }
  .intro-title { font-size: 46px; line-height: 1.4; max-width: none; margin-top: 44px; letter-spacing: 0.03em; }
  .intro-text { font-size: 26px; margin-top: 20px; }

  /* 下のセクションも、トップに合わせて文字を大きく */
  .section { grid-template-columns: 130px 1fr; }
  .section-label { font-size: 18px; }
  .work-name { font-size: 32px; }
  .work-meta { font-size: 13px; }
  .work-catch { font-size: 21px; margin: 12px 0 10px; }
  .work-desc { font-size: 17px; line-height: 2; }
  .work-link { font-size: 16px; }
  .about-text { font-size: 19px; line-height: 2; }
  .contact-text { font-size: 17px; }
  .contact-link { font-size: 24px; }
  .site-footer { font-size: 13px; }
}

/* 見出しは上からスッと降りてきて、続けて日本語が出る */
@media (prefers-reduced-motion: no-preference) {
  .js .intro-title { animation: drop-in .7s cubic-bezier(.2, .8, .2, 1) both; }
  .js .intro-text { animation: fade-up .7s ease .55s both; }
}
@keyframes drop-in { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

#works { padding-top: 96px; }
@media (min-width: 1080px) {
  #works { padding-top: 128px; } /* 見出しと Works のあいだ（PC） */
}

/* Works のプラットフォーム別グループ（iOS / 今後 Web・Android を追加） */
.work-group + .work-group { margin-top: clamp(72px, 10vw, 120px); }
.group-label {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 clamp(28px, 4vw, 44px);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}
.group-line { flex: 1; height: 1px; background: var(--line); }
.group-count { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--faint); }
@media (min-width: 1080px) {
  .group-label { font-size: 20px; }
  .group-count { font-size: 13px; }
}

/* 言語切り替え（右上） */
.header-right { display: flex; align-items: center; gap: 22px; }
.lang { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12px; }
.lang span { color: var(--line); }
.lang button {
  padding: 4px 3px;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: var(--faint);
  transition: color .2s;
}
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { color: var(--ink); }

/* 英語のときの見出しは欧文の書体で */
html[lang="en"] .intro-title { font-family: var(--sans); font-weight: 600; letter-spacing: -0.03em; text-wrap: balance; }
html[lang="en"] body { letter-spacing: 0; }

@media (max-width: 720px) {
  .header-right { gap: 12px; }
  .nav { gap: 12px; }
  .nav a { font-size: 13px; }
  .lang { font-size: 11px; }
}

/* 焚き火（TAKIPORO）は炎がゆらゆら揺れる */
.flame, .sparks { transform-box: fill-box; transform-origin: 50% 100%; }
@media (prefers-reduced-motion: no-preference) {
  .flame { animation: flicker 1.6s ease-in-out infinite; }
  .sparks { animation: sparks 2.4s ease-out infinite; }
}
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) skewX(0deg); }
  30% { transform: scale(.97, 1.05) skewX(-2deg); }
  60% { transform: scale(1.03, .97) skewX(2deg); }
}
@keyframes sparks {
  0% { opacity: 0; transform: translateY(4px); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}
.intro-done .work:nth-of-type(4) { transition-delay: .44s; }


@media (max-width: 720px) {
  #works { padding-top: 52px; } /* 見出しと Works のあいだ（スマホ） */
}

/* 書き出す言葉（英語のときは欧文の書体で） */
html[lang="en"] .signature { font-family: var(--sans); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }

/* 画面には出さず、読み上げと検索のために残す見出し */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 見出しを消した分、PC は絵をさらに大きくして、Works までを詰める */
@media (min-width: 1080px) {
  .cast { max-width: min(1152px, calc((100svh - 300px) * 2.95)); }
  #works { padding-top: 80px; }
}

