/* =========================================================
   TAKAYUKI MIURA — サイト共通スタイル
   白ベース + フラット + ポップ
   ========================================================= */
:root {
  --bg: #FAFAF7;
  --fg: #1B1B1F;
  --muted: #6b6b72;
  --line: #e6e3dc;
  --yellow: #FFD23F;
  --pink: #FF5D73;
  --blue: #3A86FF;
  --mint: #06D6A0;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1280px;
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
  --ease-io: cubic-bezier(.7, 0, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Poppins", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- ヘッダー ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px var(--gutter);
  transition: background .3s, box-shadow .3s, padding .3s;
}
/* スクロールしたら背景を付けて、下の作品と文字が重ならないようにする */
.site-header.scrolled { background: rgba(250, 250, 247, .92); box-shadow: 0 1px 0 var(--line); padding-top: 12px; padding-bottom: 12px; }
@supports (backdrop-filter: blur(8px)) { .site-header.scrolled { background: rgba(250, 250, 247, .78); backdrop-filter: blur(10px); } }
.xfer-active .site-header.scrolled { background: transparent; box-shadow: none; backdrop-filter: none; }
.logo { font-weight: 800; letter-spacing: .14em; font-size: 14px; text-decoration: none; white-space: nowrap; }
.site-nav { display: flex; gap: clamp(14px, 2.6vw, 32px); }
.site-nav a { position: relative; text-decoration: none; font-size: 12px; font-weight: 600; letter-spacing: .14em; padding: 4px 0; }
.site-nav a::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%;
  background: var(--pink); transform: scale(0); transition: transform .3s var(--ease-pop);
}
.site-nav a:hover::after, .site-nav a[aria-current="page"]::after { transform: scale(1); }
@media (max-width: 480px) { .logo { font-size: 11.5px; letter-spacing: .06em; } .site-nav { gap: 12px; } .site-nav a { font-size: 10.5px; letter-spacing: .06em; } }
@media (max-width: 360px) { .logo { font-size: 10.5px; letter-spacing: .03em; } .site-nav { gap: 9px; } .site-nav a { font-size: 10px; letter-spacing: .03em; } }

/* ---------- フッター ---------- */
.site-footer {
  padding: 56px var(--gutter) 40px; display: flex; flex-wrap: wrap; gap: 16px 24px;
  justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted);
}
.site-footer .sns { display: flex; gap: 12px; }
.site-footer .sns a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--fg); color: var(--bg);
  transition: transform .3s var(--ease-pop), background .2s;
}
.site-footer .sns a:hover { transform: translateY(-3px) rotate(-8deg); background: var(--blue); }
.site-footer .sns svg { width: 18px; height: 18px; fill: currentColor; }
.footer-dots { display: flex; gap: 6px; }
.footer-dots i { width: 10px; height: 10px; border-radius: 50%; }
.footer-dots i:nth-child(1) { background: var(--yellow); } .footer-dots i:nth-child(2) { background: var(--pink); }
.footer-dots i:nth-child(3) { background: var(--blue); } .footer-dots i:nth-child(4) { background: var(--mint); }

/* ---------- ページ移動のトランジション(色の帯) ---------- */
.page-xfer { position: fixed; inset: 0; z-index: 2000; pointer-events: none; display: flex; }
.page-xfer i { flex: 1; margin-right: -1px; transform: translateY(101%); }
.page-xfer i:nth-child(1) { background: var(--blue); --d: 0ms; }
.page-xfer i:nth-child(2) { background: var(--pink); --d: 40ms; }
.page-xfer i:nth-child(3) { background: var(--yellow); --d: 80ms; }
.page-xfer i:nth-child(4) { background: var(--mint); --d: 120ms; }
.page-xfer i:nth-child(5) { background: var(--blue); --d: 160ms; }
.pt-out .page-xfer { pointer-events: auto; }
.pt-out .page-xfer i { animation: pt-cover .38s var(--ease-io) var(--d) forwards; }
.pt-in .page-xfer i { transform: translateY(0); animation: pt-reveal .5s var(--ease-io) calc(var(--d) + 60ms) forwards; }
@keyframes pt-cover { from { transform: translateY(101%); } to { transform: translateY(0); } }
@keyframes pt-reveal { from { transform: translateY(0); } to { transform: translateY(-101%); } }

/* =========================================================
   HOME
   ========================================================= */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 480px; overflow: hidden; background: var(--bg); }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }

/* 名前:three.js が使えないときだけ文字で表示(使えるときは読み上げ・検索用に残して隠す) */
.hero-name {
  position: absolute; left: 0; right: 0; top: 42%; transform: translateY(-50%);
  text-align: center; font-weight: 800; line-height: .98; letter-spacing: -.01em;
  font-size: min(13.6vw, 18.7vh);
}
.hero-name span { display: block; }
.js .hero-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; top: 0; }
.js.no-gl .hero-name { width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; top: 42%; }

/* 肩書き:色違いのピル型ラベル。スマホは2段・中央揃え(段の分け方は index.html の .row)、PC は1列 */
.roles {
  position: absolute; left: 0; right: 0; bottom: clamp(92px, 14vh, 150px); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 16px; pointer-events: none;
}
.roles .row { display: flex; justify-content: center; gap: 10px; }
@media (min-width: 601px) { .roles { flex-direction: row; justify-content: center; } }
/* three.js で名前を描いたときは、名前のすぐ下に置いて1つの塊として画面中央へ(位置は hero.js が計算) */
.hero.centered .roles { top: var(--roles-top); bottom: auto; }
/* スマホでは右下のステッカーと重ならないよう、その上まで持ち上げる */
@media (max-width: 600px) { .roles { bottom: calc(clamp(20px, 5vh, 52px) + 112px); } }
.role {
  font-weight: 600; font-size: clamp(11px, 1.15vw, 14px); letter-spacing: .08em; line-height: 1; white-space: nowrap;
  padding: 10px 16px; border-radius: 999px; color: var(--fg);
}
.role.yellow { background: var(--yellow); }
.role.pink { background: var(--pink); }
.role.sky { background: #7DB4FF; } /* 青だと黒文字が読みにくいので、明るい水色に */
.role.mint { background: var(--mint); }
.role.purple { background: #C3A6FF; } /* 明るい紫に黒文字 */
.js .role { transform: translateY(20px) scale(.6); opacity: 0; transition: transform .6s var(--ease-pop), opacity .3s; transition-delay: calc(1.5s + var(--i) * .1s); }
.hero.ready .role, .no-gl .role { transform: none; opacity: 1; }

/* 回転するステッカー(WORKS へのリンク) */
.sticker { position: absolute; right: clamp(16px, 5vw, 64px); bottom: clamp(20px, 5vh, 52px); width: clamp(84px, 9vw, 120px); z-index: 3; display: block; }
.sticker svg { width: 100%; animation: spin 14s linear infinite; }
.sticker b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; color: var(--bg); }
.sticker:hover svg { animation-duration: 4s; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sticker svg { animation: none; } }

/* ---------- 章(chapter)と、章の間のスクロール連動トランジション ----------
   章の最後までスクロールすると、その画面(panel)が止まり、色の帯が覆って次の章がせり上がる。
   章の高さと panel の止まる位置は xfer.js が中身の高さから計算して設定する。
   (xfer-on が無いとき = JS が動かない / 視差効果を減らす設定のときは、普通に縦に並ぶだけ) */
.chapter { position: relative; }
.panel { position: relative; min-height: 100vh; background: var(--bg); }
.xfer-on .chapter + .chapter { margin-top: -100vh; }
.xfer-on .chapter[data-next] > .panel { position: sticky; }
.panel-inner { position: relative; isolation: isolate; max-width: var(--max); margin: 0 auto; padding: clamp(88px, 12vw, 140px) var(--gutter) clamp(64px, 9vw, 120px); }
.panel.hero { min-height: 480px; }
/* 次の章へ切り替わる章(WORKS / BIO)は、下に余白を取って最後の内容を見てから切り替わるようにする */
.chapter[data-next] .panel-inner { padding-bottom: clamp(180px, 32vh, 340px); }
.vh-probe { position: absolute; top: 0; left: 0; width: 1px; height: 100vh; visibility: hidden; pointer-events: none; }
.xfer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; visibility: hidden; }
.xfer .xfer-under { position: absolute; inset: 0; background: var(--bg); visibility: hidden; }
.xfer .bar { position: absolute; top: 0; bottom: 0; transform: translateY(101%); will-change: transform; }
.xfer-label {
  position: fixed; left: 0; top: 0; pointer-events: none; visibility: hidden;
  transform-origin: 0 0; white-space: nowrap; line-height: 1;
  font-weight: 800; font-size: clamp(72px, 20vw, 280px); letter-spacing: -.01em; color: var(--fg);
}
.xfer-label span {
  display: inline-block; transform-origin: 50% 80%;
  /* 黒い文字の右下に白い文字をずらして敷き、色の帯の上でも読みやすくする(ずらす量は --pop-offset) */
  text-shadow: var(--pop-offset) var(--pop-offset) 0 #fff;
}
:root { --pop-offset: .065em; }
.menu-label { z-index: 2001; } /* メニュー移動の帯(.page-xfer)より手前 */
.menu-veil { position: fixed; inset: 0; background: var(--bg); visibility: hidden; pointer-events: none; }

/* ---------- 作品ギャラリー ---------- */
.sec-title { font-size: clamp(44px, 8vw, 110px); font-weight: 800; letter-spacing: -.01em; line-height: 1; margin-bottom: clamp(20px, 3vw, 32px); }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; border-radius: clamp(10px, 1.4vw, 16px); }
.player img { width: 100%; height: 100%; object-fit: cover; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .play {
  position: absolute; inset: 0; margin: auto; width: clamp(64px, 8vw, 88px); height: clamp(64px, 8vw, 88px); border-radius: 50%;
  border: 0; background: var(--yellow); cursor: pointer; display: grid; place-items: center;
  transition: transform .35s var(--ease-pop); box-shadow: 0 6px 0 rgba(27, 27, 31, .15);
}
.player .play:hover { transform: scale(1.1) rotate(-6deg); }
.player .play svg { width: 40%; fill: var(--fg); margin-left: 6%; }
.now { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 14px 0 clamp(36px, 5vw, 56px); font-size: 15px; line-height: 1.6; font-weight: 600; }
.now span { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 28px 18px; }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr 1fr; gap: 20px 12px; } .now { font-size: 14px; } }
.grid { list-style: none; }
.card { display: block; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.card .thumb { display: block; position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: #ebe8e1; }
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.card:hover img { transform: scale(1.06); }
.card .dur { position: absolute; right: 6px; bottom: 6px; background: var(--fg); color: var(--bg); font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.card .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.6; margin-top: 10px; }
.card.active .thumb { outline: 3px solid var(--pink); outline-offset: 3px; }
.card.active .thumb::after {
  content: "NOW PLAYING"; position: absolute; left: 6px; top: 6px; background: var(--pink); color: var(--fg);
  font-size: 9px; font-weight: 800; letter-spacing: .1em; line-height: 1; padding: 5px 7px; border-radius: 999px;
}
/* サムネイルのポップイン */
.reveal { opacity: 0; transform: translateY(28px) scale(.94); }
.reveal.in { opacity: 1; transform: none; transition: opacity .5s, transform .7s var(--ease-pop); }

/* =========================================================
   下層ページ(BIO / CONTACT)共通
   ========================================================= */
.page { position: relative; isolation: isolate; max-width: var(--max); margin: 0 auto; padding: clamp(110px, 14vw, 170px) var(--gutter) clamp(48px, 7vw, 96px); }
/* 見出しの大きさは作品ページの「WORKS」(.sec-title)とそろえる */
.page-title { font-size: clamp(44px, 8vw, 110px); font-weight: 800; line-height: 1; letter-spacing: -.01em; margin-bottom: clamp(28px, 4vw, 48px); }
.page-title span { display: inline-block; }
.js .page-title span { transform: translateY(.4em) scale(0); animation: letter-pop .7s var(--ease-pop) forwards; animation-delay: calc(var(--i) * 60ms + 250ms); }
@keyframes letter-pop { to { transform: none; } }
/* 背景の飾り(CSS だけで描くので軽い) */
.deco { position: absolute; z-index: -1; pointer-events: none; }
.deco.circle { width: clamp(70px, 10vw, 140px); aspect-ratio: 1; border-radius: 50%; background: var(--yellow); }
.deco.ring { width: clamp(48px, 6vw, 84px); aspect-ratio: 1; border-radius: 50%; border: clamp(9px, 1.2vw, 14px) solid var(--blue); }
.deco.tri { width: clamp(40px, 5vw, 70px); aspect-ratio: 1; background: var(--pink); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.deco.dots { width: clamp(70px, 9vw, 110px); aspect-ratio: 5 / 4; background: radial-gradient(circle, var(--mint) 28%, transparent 30%) 0 0 / 20% 25%; }
/* 画面に入ったら(home.js が .in を付ける)ポンと出て、ゆらゆら浮かぶ */
.js .deco { visibility: hidden; }
.js .deco.in { visibility: visible; animation: deco-pop .8s var(--ease-pop) both, float 6s ease-in-out 1s infinite alternate; }
@keyframes deco-pop { from { transform: scale(0) rotate(-40deg); } }
@keyframes float { to { translate: 0 -10px; rotate: 8deg; } }
@media (prefers-reduced-motion: reduce) { .js .deco, .js .page-title span { animation: none; transform: none; } }

/* ---------- BIO ---------- */
.bio-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
@media (max-width: 860px) { .bio-grid { grid-template-columns: 1fr; } }
.bio-photo { position: relative; }
.bio-photo::before {
  content: ""; position: absolute; right: -14px; bottom: -14px; width: 100%; height: 100%;
  border-radius: 20px; background: var(--yellow); z-index: -1;
}
.bio-photo::after {
  content: ""; position: absolute; left: -18px; top: -18px; width: 56px; height: 56px; border-radius: 50%; background: var(--blue);
}
/* 写真は profile.jpg を上書きするだけで差し替わる。縦横比が違っても枠に合わせて切り抜く */
.bio-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 35%; border-radius: 20px; background: #ebe8e1; }
.bio-name { font-size: clamp(18px, 2vw, 24px); font-weight: 800; line-height: 1.5; margin-bottom: 20px; }
.bio-text p { font-size: 15px; line-height: 2; }
.bio-text p + p { margin-top: 1.1em; }
@media (max-width: 600px) { .bio-text p { font-size: 14.5px; } }
.contact-me { margin-top: 44px; padding: 24px 26px; border-radius: 16px; background: var(--fg); color: var(--bg); }
.contact-me h3 { font-size: 15px; font-weight: 800; letter-spacing: .06em; margin-bottom: 10px; }
.contact-me ul { list-style: none; display: grid; gap: 6px; }
.contact-me a { text-decoration: none; font-weight: 600; font-size: clamp(14px, 1.6vw, 17px); word-break: break-all; }
.contact-me a::before { content: "→ "; color: var(--yellow); }
.contact-me a:hover { color: var(--yellow); }

/* ---------- CONTACT ---------- */
.contact-wrap { max-width: 760px; }
@media (max-width: 1180px) { .contact-wrap .deco { display: none; } }
.form { display: grid; gap: 22px; }
.field label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.tag { font-size: 10px; font-weight: 800; letter-spacing: .06em; line-height: 1; padding: 4px 7px; border-radius: 999px; }
.tag.req { background: var(--pink); color: var(--fg); }
.tag.opt { background: var(--line); color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 16px; /* iPhone で入力時に拡大されない大きさ */
  color: var(--fg); background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 13px 15px;
  transition: border-color .2s, box-shadow .2s; appearance: none;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--fg) 50%), linear-gradient(135deg, var(--fg) 50%, transparent 50%);
  background-position: calc(100% - 22px) 55%, calc(100% - 16px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 44px;
}
.field textarea { min-height: 200px; resize: vertical; line-height: 1.7; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(58, 134, 255, .18); }
.field input:user-invalid, .field textarea:user-invalid { border-color: var(--pink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; } /* 迷惑メール対策の見えない欄 */
.btn {
  justify-self: start; display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  font-size: 16px; font-weight: 800; letter-spacing: .06em; padding: 16px 34px; border: 0; border-radius: 999px;
  background: var(--fg); color: var(--bg); box-shadow: 0 6px 0 var(--yellow); transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--yellow); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--yellow); }
.btn[disabled] { opacity: .5; cursor: wait; }
.form-status { min-height: 1.6em; font-size: 14px; color: var(--pink); font-weight: 600; }
.form-done { text-align: center; padding: clamp(40px, 6vw, 64px) 24px; border-radius: 20px; background: #fff; border: 2px solid var(--line); }
.form-done .check {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%; background: var(--mint); display: grid; place-items: center;
  animation: deco-pop .7s var(--ease-pop) both;
}
.form-done .check svg { width: 42px; fill: none; stroke: var(--fg); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.form-done p { font-size: clamp(20px, 3vw, 28px); font-weight: 800; }
.mail-alt { margin-top: 56px; padding-top: 32px; border-top: 2px dashed var(--line); }
.mail-alt h3 { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.mail-alt ul { list-style: none; display: grid; gap: 4px; }
.mail-alt a { font-weight: 800; font-size: clamp(16px, 2.2vw, 20px); text-decoration: none; word-break: break-all; background: linear-gradient(transparent 62%, var(--yellow) 62%); }

/* ---------- 404 ---------- */
.notfound { min-height: 70vh; display: grid; place-content: center; text-align: center; gap: 20px; }
.notfound .btn { justify-self: center; text-decoration: none; }
