/* ===== テーマ：日中はクリーム、夜は紺（切り替えは head のスクリプト） ===== */
:root,
[data-theme="cream"]  { --bg: #ebe4dd; --ink: #1d212c; --dot: rgba(29, 33, 44, .16); --card: #f6f2ee; --note: #f3c9a3; --accent: #dc7b31; }
[data-theme="navy"]   { --bg: #1d212c; --ink: #ebe4dd; --dot: rgba(235, 228, 221, .14); --card: #262b38; --note: #dc7b31; --accent: #60b1b9; }

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.4px, transparent 1.6px);
  background-size: 22px 22px;
  background-attachment: fixed;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

/* ===== ずっといる人 ===== */
#character {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1;
  pointer-events: none;
  will-change: transform, width, height;
}
.char-anim {
  position: relative;
  width: 100%;
  height: 100%;
}
.char-img { width: 100%; height: 100%; object-fit: contain; }

/* 看板：手の高さに持たせる */
.char-sign {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 156%;
  overflow: visible;
  transform: translateX(-50%) scale(.8);
  opacity: 0;
  transition: opacity .25s, transform .3s cubic-bezier(.3, 1.6, .5, 1);
}
.char-sign rect { fill: var(--card); stroke: var(--ink); stroke-width: 3; }
.char-sign text { fill: var(--ink); font: 800 22px/1 system-ui, sans-serif; letter-spacing: .08em; }
#character[data-pose="sign"] .char-sign,
.sp-char.sign .char-sign { opacity: 1; transform: translateX(-50%) scale(1); }

/* スマホ用の置いてある人（PC では出さない） */
.sp-char { display: none; }

main { position: relative; z-index: 2; }

/* ===== 場面 ===== */
.scene {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  padding: 6vh 6vw 12vh;
  display: flex;
}
.frame {
  position: relative;
  flex: 1;
  min-width: 0; /* 中の横スクロール（作品カード）に引っぱられて画面より広がらないように */
  padding: 6vh 4vw;
}

/* トップの下の ↓（スクロールの合図） */
.arrow {
  position: absolute;
  left: 50%;
  bottom: 1.5vh;
  width: 28px;
  height: 64px;
  transform: translateX(-50%) rotate(-4deg);
  background: var(--ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 64'%3E%3Cpath d='M14 3 C13 22 15 40 14 58 M4 46 L14 59 L24 45' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 64'%3E%3Cpath d='M14 3 C13 22 15 40 14 58 M4 46 L14 59 L24 45' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.label {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: .06em;
  line-height: 1.2;
}

/* ===== トップ ===== */
.hero {
  position: absolute;
  left: 50%;
  top: 9%;
  transform: translateX(-50%);
  text-align: center;
  width: 90%;
}
/* 名前は弧を描いて並べる */
.hero-title { position: relative; width: clamp(300px, 44vw, 600px); margin: 0 auto; line-height: 0; }
.hero-title svg {
  display: block;
  width: 100%;
  /* 弧の両端より下は人の頭が入ってよい場所なので、箱の高さから外す */
  margin-bottom: -15%;
  overflow: visible;
}
.hero-title text {
  fill: var(--ink);
  font-size: 64px;
  font-weight: 800;
  letter-spacing: .1em;
}

/* ===== ABOUT ===== */
.about .label { margin-bottom: 18px; }
.about-name { font-weight: 700; margin-bottom: 8px; }
.about-since { margin-top: 16px; font-size: 14px; opacity: .75; }

/* ===== WORKS ===== */
.cards {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-top: 24px;
}
.card {
  flex: 1 1 0;
  max-width: 300px;
  padding: 14px 14px 18px;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.75;
  transition: transform .2s;
}
.card:nth-child(1) { transform: rotate(-3deg); }
.card:nth-child(2) { transform: rotate(2deg) translateY(10px); }
.card:nth-child(3) { transform: rotate(4deg) translateY(-4px); }
.card a { text-decoration: none; display: block; }
.card img, .card .q {
  aspect-ratio: 16 / 9;
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 2px;
  object-fit: cover;
  margin-bottom: 10px;
}
.card .q {
  display: grid;
  place-items: center;
  font-size: 56px;
  font-weight: 800;
}
.card h3 { font-size: 17px; letter-spacing: .04em; }
.card.unknown h3 { color: var(--accent); }
.card .more { display: inline-block; margin-top: 8px; font-weight: 700; text-decoration: underline; }

/* ===== NEWS ===== */
.news .label { margin-bottom: 18px; }
.note {
  padding: 18px 20px 20px;
  background: var(--note);
  color: #1d212c;
  transform: rotate(-2deg);
  box-shadow: 3px 4px 0 rgba(0, 0, 0, .12);
}
.note time { display: block; font-weight: 700; font-size: 14px; letter-spacing: .06em; }

/* ===== CONTACT ===== */
.contact { font-size: clamp(16px, 1.8vw, 20px); font-weight: 700; }
.contact .label { margin-bottom: 14px; }
.contact li + li { margin-top: 10px; }
.footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3vh;
  text-align: center;
  font-size: 12px;
  letter-spacing: .1em;
  opacity: .7;
}
.site-footer { position: fixed; bottom: 2vh; z-index: 2; pointer-events: none; }

/* ===== PC：1画面の黒板 =====
   1200×750 の板として px で組み、JS が画面に収まる倍率（--scale）で丸ごと拡大縮小する。
   画面の縦横比が変わっても、文字・カード・人の大きさの釣り合いが崩れない。 */
@media (min-width: 900px) {
  html:has(.home) { scroll-behavior: auto; }
  .home { height: 100%; overflow: hidden; }
  .home main { position: fixed; inset: 0; }
  .home .board {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1200px;
    height: 750px;
    transform: translate(-50%, -50%) scale(var(--scale, 1));
  }

  .home .scene { position: absolute; min-height: 0; padding: 0; display: block; }
  .home .frame { padding: 0; }
  #top { inset: 0; pointer-events: none; }
  .home .arrow { display: none; }
  .home .hero { top: 4%; }
  .home .hero-title { width: 500px; }

  /* 作品カード：ふだんは小さく、ホバー（タブレットはタップ、キーボードはフォーカス）で大きくなって説明が出る */
  .home .card .detail { display: none; }
  .home .card:is(:hover, :focus-within) { z-index: 3; transform: rotate(0) scale(1.35); }
  .home .card:is(:hover, :focus-within) .detail { display: block; animation: show .25s ease-out; }
  .home .card:is(:hover, :focus-within) p.detail { font-size: 10px; line-height: 1.6; margin-top: 2px; }
  .home .card:is(:hover, :focus-within) .more { font-size: 10px; margin-top: 4px; }
  .home .card { position: relative; transform-origin: 50% 0; }

  /* 配置：ABOUT 左 / WORKS 右上 / CONTACT 右下、人はまん中（NEWS は今は出さない） */
  #about   { left: 64px;  top: 290px; width: 410px; }
  #works   { right: 48px; top: 200px; }
  #news    { left: 96px;  bottom: 62px; width: 310px; }
  #contact { right: 100px; bottom: 70px; }

  .home .label { font-size: 38px; }
  .about .label, .news .label { margin-bottom: 12px; }
  .about { font-size: 14px; line-height: 1.8; }
  .about-since { margin-top: 12px; font-size: 12px; }
  .note p { font-size: 15px; }
  .note time { font-size: 13px; }
  .contact { font-size: 18px; }

  .home .cards { gap: 20px; margin-top: 12px; }
  .home .card { flex: 0 0 auto; width: 118px; max-width: none; padding: 8px 8px 10px; font-size: 13px; }
  .home .card .q { font-size: 36px; }
  .home .card h3 { font-size: 12px; }
}
@keyframes show { from { opacity: 0; } to { opacity: 1; } }

/* ===== スマホ・タブレット縦：縦スクロール ===== */
@media (max-width: 899px) {
  .scene { padding: 4vh 16px 11vh; }
  .frame { padding: 5vh 18px; }

  .hero { top: 17%; }
  .hero-title { width: 88vw; }

  .about .label, .news .label { margin-bottom: 12px; }
  .about { font-size: 15px; }

  /* カードは横並びのまま、横スクロールで見る（下に人の居場所を空ける） */
  #works .frame { display: flex; flex-direction: column; }
  #works .label { text-align: center; }
  .cards {
    gap: 16px;
    margin: 18px -18px 0;
    padding: 14px 18px 18px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .cards::-webkit-scrollbar { display: none; }
  .card { flex: 0 0 72%; max-width: none; scroll-snap-align: center; }
  @media (min-width: 600px) { .card { flex-basis: 40%; } }

  .contact { text-align: center; padding-top: 4vh; }
  .site-footer { position: static; padding: 0 0 4vh; }

  /* トップ：人は動かさず、名前の下と CONTACT にだけ置く */
  .home #character { display: none; }
  .home .scene { min-height: 0; padding: 6vh 16px; }
  .home #top { min-height: 100svh; padding-bottom: 11vh; }
  .home #top .frame { display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .home .hero { position: static; transform: none; width: auto; }
  .sp-char {
    display: block;
    position: relative;
    height: 50svh;
    aspect-ratio: 482 / 1200;
    margin: 0 auto;
  }
  .sp-char img { width: 100%; height: 100%; object-fit: contain; }
  .home .hero-title svg { margin-bottom: -6%; }
  .sp-char.sign { height: 40svh; margin-top: 4vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ===== 作品ページ ===== */
.page-work .frame { padding-bottom: 10vh; }
.back { font-weight: 700; font-size: 14px; text-decoration: none; }
.back:hover { text-decoration: underline; }
.back-bottom { display: inline-block; margin-top: 6vh; }
.work { max-width: 760px; margin: 5vh auto 0; }
.work-status { margin-top: 6px; font-size: 14px; opacity: .75; }
.work-hero {
  margin: 24px 0;
  border: 2.5px solid var(--ink);
}
.work-desc { font-size: 16px; }
.shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 32px 0;
}
.shots img { border: 2px solid var(--ink); }
.work-links { font-weight: 700; }
.work-links li + li { margin-top: 6px; }

@media (max-width: 719px) {
  .shots { grid-template-columns: 1fr; }
  .work-desc br { display: none; }
}
