/* 縹（はなだ）— 一色の空と、縦書きの文字
   studio aila のサイトが「色とりどりの一日の空・絵と光」なら、こちらは「縹の一色の空・文字と余白」。
   ・使う色は白から深い縹までの濃淡だけ（雲・粒・光漏れは使わない）
   ・文字は縦書きを主にして、書き手のページとして組む
   ・空のはるか上から一本の線が垂れ、作品は線が届いたときにだけ本来の色がつく */

:root {
  --h900: #0f3550;
  --h800: #174766;
  --h700: #1f5f84;
  --h600: #2b6f97;
  --h400: #6aa5c8;
  --h200: #cfe3ee;
  --h100: #eaf3f7;
  --h50: #f6fafb;
  --ink: var(--h900);
  --ink-soft: #3d6178;
  --ink-dim: #6f8a9b;

  --f-mincho: "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --f-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;

  --gutter: clamp(16px, 5vw, 64px);
  --tx: max(calc(var(--gutter) + 18px), calc(50% - 520px));
  --content-left: calc(var(--tx) + clamp(36px, 6vw, 88px));
  --content-right: max(var(--gutter), calc(50% - 600px));
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--h50);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: .04em;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--h600); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- header ---------- */
.h-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  color: var(--ink);
  transition: color .4s var(--ease), background-color .4s var(--ease);
}
.h-header[data-tone="light"] { color: #fff; }
.h-header.is-scrolled { background: rgba(246, 250, 251, .85); }
.h-header.is-scrolled[data-tone="light"] { background: rgba(31, 95, 132, .55); }
@media (hover: hover) and (pointer: fine) {
  .h-header.is-scrolled { background: rgba(246, 250, 251, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  .h-header.is-scrolled[data-tone="light"] { background: rgba(31, 95, 132, .3); }
}
.h-brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.h-brand-kanji { font-family: var(--f-mincho); font-weight: 900; font-size: 24px; line-height: 1; }
.h-brand-roman { font-family: var(--f-mono); font-size: 12px; letter-spacing: .3em; opacity: .75; }
.h-nav { display: flex; gap: clamp(12px, 2.6vw, 30px); }
.h-nav a { font-family: var(--f-mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; text-decoration: none; white-space: nowrap; padding: 4px 0; border-bottom: 1px solid transparent; transition: border-color .3s; }
.h-nav a:hover, .h-nav a:focus-visible { border-bottom-color: currentColor; }

/* ---------- 空：縹の一色。上は深く、下へ行くほど淡い ---------- */
.sky {
  position: relative;
  background: linear-gradient(180deg, var(--h600) 0, #3c7ea6 420px, var(--h400) 860px, #a9cde1 1200px, var(--h200) 1600px, var(--h100) 2300px, var(--h50) 100%);
}

/* ---------- 線（hanada.js が描く） ---------- */
.sky-origin { position: absolute; top: 0; left: var(--tx); width: 1px; height: 1px; }
.thread { position: absolute; z-index: 1; left: var(--tx); top: 0; width: 80px; margin-left: -40px; pointer-events: none; }
.braid { display: block; overflow: visible; clip-path: inset(0 0 100% 0); }
.braid path { fill: none; stroke-linecap: round; }

.bloom {
  position: absolute; z-index: 2;
  left: var(--tx);
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--h700) 0 3px, rgba(31, 95, 132, .22) 4.5px, transparent 11px);
  translate: var(--dx, 0) 0;
  transform: scale(.4);
  opacity: .5;
  transition: transform 1s var(--ease), opacity .8s var(--ease);
}
.bloom.is-tied { transform: scale(1); opacity: 1; }
.bloom--bud { background: radial-gradient(circle, transparent 3.5px, var(--h700) 4px 5px, transparent 6px); }
.braid-end {
  position: absolute; z-index: 2;
  left: var(--tx);
  width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--h700) 0 2px, transparent 3px);
  translate: var(--dx, 0) 0;
  opacity: 0;
  transition: opacity .8s var(--ease);
}
.braid-end.is-tied { opacity: 1; }

/* ---------- hero：縦書きで右から組む ---------- */
.hero { position: relative; min-height: 92svh; display: flex; align-items: center; padding: 110px var(--content-right) 80px var(--content-left); color: #fff; }
.hero-body {
  margin-left: auto;
  writing-mode: vertical-rl;
  height: min(76svh, 620px);
}
.hero-body > * { margin: 0; }
.hero-name {
  font-family: var(--f-mincho); font-weight: 900;
  font-size: clamp(130px, 17vw, 240px); line-height: 1;
  margin-inline-start: 0;
  margin-block-end: clamp(28px, 4vw, 64px);
}
.hero-name rt { font-family: var(--f-mincho); font-weight: 400; font-size: 13px; letter-spacing: .5em; }
.hero-role { font-family: var(--f-mincho); font-weight: 700; font-size: clamp(20px, 2vw, 26px); letter-spacing: .3em; margin-block-end: 10px; }
.hero-aff { font-family: var(--f-mono); font-size: 12px; letter-spacing: .18em; opacity: .8; margin-block-end: clamp(28px, 4vw, 56px); padding-top: .2em; }
.hero-bio { font-size: 15px; line-height: 2.2; letter-spacing: .16em; color: rgba(255, 255, 255, .88); max-block-size: none; }

/* ---------- 作品 ---------- */
.anchor { position: relative; top: -60px; }
.work { position: relative; padding: clamp(64px, 8vw, 110px) var(--content-right) clamp(64px, 8vw, 110px) var(--content-left); }
.work .bloom { top: calc(clamp(64px, 8vw, 110px) + 12px); }
.work-year {
  position: absolute; top: calc(clamp(64px, 8vw, 110px) + 1px);
  right: calc(100% - var(--tx) + 20px);
  margin: 0; font-family: var(--f-mono); font-size: 13px; letter-spacing: .14em; color: var(--ink-soft); white-space: nowrap;
}
.work-body {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 480px) auto;
  grid-template-areas: "fig text" "links text" "note note";
  column-gap: clamp(36px, 6vw, 96px);
  row-gap: 14px;
  align-items: start;
  max-width: 1080px;
}
.work-figure { grid-area: fig; margin: 0; }
/* 縦書きの紹介：題名を右端に、担当と一言が左へ続く */
.work-text { grid-area: text; writing-mode: vertical-rl; height: 390px; justify-self: start; }
.work-title { margin: 0 0 0 18px; font-family: var(--f-mincho); font-weight: 700; font-size: clamp(26px, 2.7vw, 34px); line-height: 1.25; letter-spacing: .12em; }
.work-title--latin { font-size: clamp(22px, 2.3vw, 28px); letter-spacing: .12em; }
.work-role { margin: 0 0 0 14px; font-weight: 700; font-size: 13px; letter-spacing: .3em; color: var(--h700); }
.work-desc { margin: 0; font-size: 14px; line-height: 2.1; letter-spacing: .14em; color: var(--ink-soft); }
.work-links { grid-area: links; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; font-size: 13px; }
.link { font-weight: 500; text-decoration: none; border-bottom: 1px solid rgba(15, 53, 80, .4); padding-bottom: 2px; transition: border-color .3s; }
.link::after { content: " →"; font-family: var(--f-mono); }
.link:hover { border-bottom-color: var(--ink); }
.work-note { grid-area: note; margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
/* 受託タイトルであることを示す小さなラベル（自分の作品には付けない） */
.work-tag { margin: 0 0 0 12px; }
.tag { display: inline-block; padding: 8px 2px; border: 1px solid var(--h700); border-radius: 999px; color: var(--h700); font-weight: 700; font-size: 11px; letter-spacing: .14em; line-height: 1.8; }

/* ---------- 作品の画像：空と同じ縹の単色で沈み、線が届くと色づく ---------- */
.window { --arch: 50% 50% 0 0 / 14% 14% 0 0; }
.window-frame { position: relative; display: block; border-radius: var(--arch); overflow: hidden; background: var(--h200); }
.window-frame img { width: 100%; }
/* 単色の画像を上に重ね、線が届いたら上から下へ拭うように消す（色相を動かさないので虹色に流れない） */
.window-frame img.tone {
  position: absolute; inset: 0; height: 100%; object-fit: cover;
  filter: grayscale(1) sepia(.55) hue-rotate(165deg) saturate(1.8) brightness(1.04) contrast(.92);
  -webkit-mask: linear-gradient(180deg, transparent 0 33.3%, #000 66.6% 100%) 0 100% / 100% 300% no-repeat;
          mask: linear-gradient(180deg, transparent 0 33.3%, #000 66.6% 100%) 0 100% / 100% 300% no-repeat;
  transition: -webkit-mask-position 1.8s var(--ease), mask-position 1.8s var(--ease);
  pointer-events: none;
}
.work.is-lit .window-frame img.tone { -webkit-mask-position: 0 0; mask-position: 0 0; }
a.window-frame { transition: transform .3s var(--ease); }
a.window-frame:hover { transform: translateY(-2px); }
.window-caption { margin-top: 10px; font-size: 12px; letter-spacing: .06em; color: var(--ink-soft); text-align: right; }
.window-frame img[src*="ogp.webp"] { aspect-ratio: 16 / 9; object-fit: cover; }
/* 開発中：まだ何も映っていない窓 */
.window--blank .window-frame { aspect-ratio: 16 / 9; background: rgba(255, 255, 255, .45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .9); }

/* ---------- お問い合わせ（線の先） ---------- */
.contact { position: relative; padding: clamp(96px, 11vw, 150px) var(--content-right) clamp(80px, 10vw, 120px) var(--content-left); }
.braid-end { top: calc(clamp(96px, 11vw, 150px) + 6px); }
.contact-inner { position: relative; z-index: 2; max-width: 640px; }
.contact-title { margin: 0 0 32px; font-family: var(--f-mincho); font-weight: 700; font-size: clamp(24px, 2.6vw, 32px); letter-spacing: .16em; }
.contact-lead { margin: 0 0 36px; color: var(--ink-soft); }
.form { display: grid; gap: 22px; }
.field label { display: block; font-size: 13px; letter-spacing: .1em; margin-bottom: 8px; }
.req { font-size: 11px; color: var(--h700); margin-left: .4em; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 16px; letter-spacing: .02em; color: var(--ink);
  background: rgba(255, 255, 255, .7); border: 1px solid rgba(15, 53, 80, .2); border-radius: 4px; padding: 12px 14px;
}
.field select { appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--h600); background-color: #fff; }
.field [aria-invalid="true"] { border-color: #b84a3a; }
.field--trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { margin: 0; color: #a43c2c; font-size: 14px; }
.send {
  justify-self: start; cursor: pointer; border: 1px solid var(--h700); border-radius: 999px;
  padding: 13px 36px 12px; font: inherit; font-weight: 700; letter-spacing: .14em;
  background: var(--h700); color: #fff;
}
.send:hover { background: var(--h600); }
.send:disabled { opacity: .5; cursor: wait; }
.contact-sns { margin: 40px 0 0; font-family: var(--f-mono); font-size: 13px; letter-spacing: .1em; color: var(--ink-soft); }

.h-footer { background: var(--h50); color: var(--ink-soft); padding: 40px var(--gutter); display: flex; justify-content: space-between; align-items: center; gap: 16px; font-family: var(--f-mono); font-size: 12px; letter-spacing: .14em; border-top: 1px solid rgba(15, 53, 80, .08); }
.h-footer p { margin: 0; }
.h-footer a { text-decoration: none; }
.h-footer a:hover { color: var(--ink); }

/* ---------- 動き ---------- */
.js .hero-name { animation: ink 1.8s var(--ease) .1s both; }
.js .hero-role, .js .hero-aff, .js .hero-bio { animation: rise 1.2s var(--ease) both; }
.js .hero-role { animation-delay: .6s; }
.js .hero-aff { animation-delay: .75s; }
.js .hero-bio { animation-delay: .9s; }
@keyframes ink { from { opacity: 0; filter: blur(14px); } to { opacity: 1; filter: blur(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- トップの文字の演出 ---------- */
.is-split .ch { display: inline-block; }
.is-split .word { white-space: nowrap; }
/* 縦書きの中で寝かせた英単語は、縦書き用の広い字間をかけない */
.hero-bio .word { letter-spacing: .02em; }
/* a：空から降りてくる */
.fx-a .hero-role, .fx-a .hero-aff, .fx-a .hero-bio { animation: none; }
.fx-a .ch { animation: char-fall 1.7s cubic-bezier(.2, .7, .2, 1) backwards; }
@keyframes char-fall {
  from { opacity: 0; transform: translate(var(--drift, 0), var(--from, -60vh)) rotate(var(--rot, 0)); }
  35% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
/* b：舞い落ちている文字は、下の作品やリンクの操作をじゃましない */
.is-falling .ch { pointer-events: none; position: relative; z-index: 3; }
/* b：WebGL版の描画面（画面に固定、操作はじゃましない） */
.petal-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 40; pointer-events: none; }
/* b：「縹」を押せることを、さりげなく */
.hero-name.is-toggle { cursor: pointer; }
.hero-name.is-toggle:hover { text-shadow: 0 0 24px rgba(255, 255, 255, .35); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  /* 画面が狭いときは、名前だけ縦書きで残し、肩書きとプロフィールは横書きにする */
  .hero { align-items: flex-end; }
  .hero-body { writing-mode: horizontal-tb; height: auto; margin: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 20px; align-items: start; }
  .hero-name { writing-mode: vertical-rl; grid-row: span 3; font-size: clamp(96px, 26vw, 150px); margin: 0; }
  .hero-role { letter-spacing: .12em; margin: 0 0 4px; }
  .hero-aff { margin: 0 0 18px; padding: 0; letter-spacing: .2em; }
  .hero-bio { grid-column: 1 / -1; margin-top: 24px; font-size: 13px; line-height: 2; letter-spacing: .06em; }
  .hero-bio br { display: none; }
  .work-body { grid-template-columns: 1fr; grid-template-areas: "fig" "text" "links" "note"; }
  .work-text { height: 300px; justify-self: end; }
  .work-year { position: static; margin: 0 0 14px; }
}
@media (max-width: 560px) {
  body { font-size: 14px; }
  .h-header { padding: 12px 16px; }
  .h-nav { gap: 12px; }
  .h-nav a { letter-spacing: .08em; font-size: 11px; }
  .hero-role { font-size: 17px; letter-spacing: .06em; }
  .h-footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .hero-name, .js .hero-role, .js .hero-aff, .js .hero-bio { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .bloom, .braid-end, a.window-frame, .window-frame img.tone { transition: none; }
}
