/* ═══════════════════════════════════════════════════════════
   KAZUKI SEJIMA — Generative Studies  (site mockup v0.1)
   palette: 墨 × 骨白 × 朱 / fonts: Archivo Black + Zen Kaku Gothic New
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #0b0b0c;
  --bg2: #131315;
  --ink: #ece7dd;
  --mut: #8a857a;
  --acc: #ff3d00;
  --line: rgba(236, 231, 221, 0.14);
  --disp: "Archivo Black", "Zen Kaku Gothic New", sans-serif;
  --body: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", sans-serif;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}
html.flat { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 400;
  line-height: 1.9;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--acc); color: var(--bg); }

a { color: inherit; text-decoration: none; }
img, canvas { max-width: 100%; display: block; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── 粒状ノイズ ─────────────────────────────── */
.grain {
  position: fixed; inset: -100px; z-index: 90;
  pointer-events: none; opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-38px, 24px); }
  50% { transform: translate(22px, -30px); }
  75% { transform: translate(-14px, -18px); }
  100% { transform: translate(30px, 12px); }
}
.flat .grain, .no-js .grain { animation: none; }

/* ── スクロール進捗 ─────────────────────────── */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 200; pointer-events: none;
}
.progress span {
  display: block; height: 100%; background: var(--acc);
  transform-origin: 0 0; transform: scaleX(0);
}

/* ── カスタムカーソル ───────────────────────── */
.cursor { display: none; }
.js.has-cursor .cursor { display: block; }
.js.has-cursor,
.js.has-cursor a,
.js.has-cursor button { cursor: none; }
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 9999;
  pointer-events: none; border-radius: 50%;
  will-change: transform;
}
.cursor-dot {
  width: 6px; height: 6px; background: var(--acc);
  margin: -3px 0 0 -3px;
}
.cursor-ring {
  width: 38px; height: 38px;
  margin: -19px 0 0 -19px;
  border: 1px solid var(--ink);
  mix-blend-mode: difference;
  transition: width 0.25s ease, height 0.25s ease, margin 0.25s ease, opacity 0.25s ease;
}
.cursor-ring.big {
  width: 72px; height: 72px; margin: -36px 0 0 -36px; opacity: 0.9;
}

/* ── プリローダー ───────────────────────────── */
.preloader {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
}
.loaded .preloader { transform: translateY(-101%); }
.pre-kanji {
  font-family: var(--body); font-weight: 700;
  font-size: clamp(120px, 30vw, 340px);
  color: transparent;
  -webkit-text-stroke: 1px rgba(236, 231, 221, 0.35);
  line-height: 1;
}
.pre-count {
  position: absolute; right: 5vw; bottom: 4vh;
  font-family: var(--disp);
  font-size: clamp(48px, 9vw, 120px);
  color: var(--ink); line-height: 1;
}
.pre-count em { font-style: normal; color: var(--acc); font-size: 0.4em; }
.pre-note {
  position: absolute; left: 5vw; bottom: 5vh;
  font-size: 10px; letter-spacing: 0.3em; color: var(--mut);
}
.flat .preloader, .no-js .preloader { display: none; }

/* ── ヘッダー ───────────────────────────────── */
.site-head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 28px;
  mix-blend-mode: difference;
}
.head-logo {
  font-family: var(--disp); font-size: 15px; letter-spacing: 0.08em;
  display: inline-block;
}
.head-logo span { color: var(--acc); font-size: 9px; vertical-align: super; margin-left: 4px; }
.head-nav { display: flex; gap: 26px; }
.head-nav a {
  font-size: 11px; letter-spacing: 0.22em; font-weight: 500;
  position: relative; display: inline-block; padding: 4px 0;
}
.head-nav a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: var(--ink);
  transform: scaleX(0); transform-origin: 100% 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.head-nav a:hover::after, .head-nav a:focus-visible::after {
  transform: scaleX(1); transform-origin: 0 0;
}

/* ── 現在セクション表示 ─────────────────────── */
.section-label {
  position: fixed; left: 28px; bottom: 24px; z-index: 95;
  font-size: 10px; letter-spacing: 0.28em; color: var(--mut);
  display: flex; align-items: center; gap: 10px;
}
.section-label::before {
  content: ""; width: 28px; height: 1px; background: var(--acc);
}

/* ── リビール（JS有効時のみ隠す） ───────────── */
.js:not(.flat) .reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.js:not(.flat) .reveal.in { opacity: 1; transform: none; }

.mask { display: inline-block; overflow: hidden; vertical-align: bottom; }
.mask-in { display: inline-block; }
.js:not(.flat) .mask-in {
  transform: translateY(115%);
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.js:not(.flat) .in .mask-in { transform: none; }

/* ═══════════ HERO ═══════════ */
.hero {
  position: relative; height: 100vh; min-height: 560px;
  overflow: hidden;
}
#heroCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.hero-fallback {
  display: none;
  position: absolute; inset: 0;
  align-items: center; justify-content: center;
  font-family: var(--disp);
  font-size: clamp(56px, 16vw, 250px);
  letter-spacing: 0.02em; line-height: 1;
}
.no-js .hero-fallback { display: flex; }
.hero-meta {
  position: absolute; top: 96px; z-index: 5;
  font-size: 10px; letter-spacing: 0.24em; color: var(--mut);
  display: flex; flex-direction: column; gap: 4px;
}
.hero-meta--tl { left: 28px; }
.hero-meta--tr { right: 28px; text-align: right; }
.hero-vertical {
  position: absolute; right: 26px; top: 50%; z-index: 5;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-weight: 700; font-size: clamp(16px, 2vw, 26px);
  letter-spacing: 0.55em; color: var(--ink); opacity: 0.85;
}
.hero-scroll {
  position: absolute; left: 50%; bottom: 26px; z-index: 5;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 9px; letter-spacing: 0.4em; color: var(--mut);
}
.hero-scroll i {
  width: 1px; height: 48px; background: var(--line);
  position: relative; overflow: hidden; display: block;
}
.hero-scroll i::after {
  content: ""; position: absolute; left: 0; top: -50%;
  width: 100%; height: 50%; background: var(--acc);
  animation: scrolldrop 1.8s cubic-bezier(0.76, 0, 0.24, 1) infinite;
}
@keyframes scrolldrop {
  to { top: 110%; }
}
.flat .hero-scroll i::after, .no-js .hero-scroll i::after { animation: none; }

/* ═══════════ MANIFESTO ═══════════ */
.manifesto {
  padding: 26vh 8vw;
  border-top: 1px solid var(--line);
}
.mani-line {
  font-size: clamp(26px, 5vw, 72px);
  font-weight: 700; line-height: 1.55;
  letter-spacing: 0.04em;
}
.mani-line--accent { color: var(--acc); }
.mani-line:nth-child(2) .mask-in { transition-delay: 0.08s; }
.mani-line:nth-child(3) .mask-in { transition-delay: 0.16s; }
.mani-line:nth-child(4) .mask-in { transition-delay: 0.24s; }
.mani-en {
  margin-top: 7vh;
  font-size: 11px; letter-spacing: 0.3em; color: var(--mut);
  max-width: 640px; line-height: 2.2;
}

/* ═══════════ WORKS（横スクロール） ═══════════ */
.works { position: relative; }
.works-sticky {
  position: sticky; top: 0; height: 100vh;
  overflow: hidden;
  display: flex; align-items: center;
  border-top: 1px solid var(--line);
}
.works-track {
  display: flex; align-items: center;
  gap: 7vw; padding: 0 8vw;
  will-change: transform;
}
.work-intro { flex: 0 0 auto; min-width: 46vw; }
.work-intro h2 {
  font-family: var(--disp);
  font-size: clamp(64px, 11vw, 170px);
  line-height: 0.95; letter-spacing: 0.01em;
}
.work-intro h2 span {
  display: block;
  font-family: var(--body); font-weight: 400;
  font-size: 12px; letter-spacing: 0.5em; color: var(--acc);
  margin-top: 18px;
}
.work-intro p {
  margin-top: 4vh; font-size: 11px; letter-spacing: 0.2em;
  color: var(--mut); line-height: 2.2;
}
.work-intro-arrow {
  margin-top: 5vh; font-size: 40px; color: var(--acc);
  animation: arrowx 1.6s ease-in-out infinite;
}
@keyframes arrowx {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(18px); }
}
.flat .work-intro-arrow, .no-js .work-intro-arrow { animation: none; }

.work { flex: 0 0 auto; width: clamp(300px, 34vw, 540px); }
.work-frame {
  position: relative; aspect-ratio: 4 / 5;
  background: linear-gradient(160deg, var(--bg2), var(--bg));
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.work:hover .work-frame { transform: scale(1.02); }
.work-frame canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.work-idx {
  position: absolute; top: 10px; right: 16px;
  font-family: var(--disp); font-size: 64px; line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(236, 231, 221, 0.4);
  pointer-events: none;
}
.work-cap { margin-top: 20px; }
.work-cap h3 {
  font-family: var(--disp); font-size: clamp(20px, 2vw, 30px);
  letter-spacing: 0.02em;
}
.work-cap h3 span {
  font-family: var(--body); font-weight: 400;
  font-size: 12px; letter-spacing: 0.4em; color: var(--acc);
  margin-left: 14px;
}
.work-cap p { font-size: 11px; letter-spacing: 0.12em; color: var(--mut); margin-top: 6px; }

.work-outro { flex: 0 0 auto; padding-right: 10vw; }
.work-outro p {
  writing-mode: vertical-rl;
  font-weight: 700;
  font-size: clamp(22px, 3vw, 40px);
  letter-spacing: 0.32em; line-height: 2.2;
  height: min(64vh, 560px);
}

/* flat / no-js は縦積みに戻す */
.flat .works-sticky, .no-js .works-sticky {
  position: static; height: auto; overflow: visible;
  padding: 12vh 0;
}
.flat .works-track, .no-js .works-track {
  flex-direction: column; align-items: flex-start;
  gap: 12vh; padding: 0 8vw;
  transform: none !important;
}
.flat .work, .no-js .work { width: min(86vw, 540px); }
.flat .work-outro p, .no-js .work-outro p { height: auto; writing-mode: horizontal-tb; letter-spacing: 0.2em; }
.flat .work-outro, .no-js .work-outro { padding-right: 0; }

/* ─────────── MUSIC / ORIGINAL TRACKS ─────────── */
.music {
  position: relative;
  padding: 18vh 8vw 15vh;
  background: #101010;
  color: var(--paper);
}
.music-head {
  display: grid;
  grid-template-columns: 1fr minmax(0, 2fr) auto;
  align-items: end;
  gap: 24px;
  margin-bottom: 11vh;
}
.music-head > p, .music-head > span {
  margin: 0;
  color: var(--mut);
  font-size: 9px;
  letter-spacing: .18em;
}
.music-head > span { text-align: right; }
.music-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 84px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: .09em;
}
.music-cta { display:inline-flex; align-items:center; gap:18px; margin-top:8vh; padding:18px 0; border-top:1px solid #3d3d3d; border-bottom:1px solid #3d3d3d; color:var(--paper); font-size:12px; letter-spacing:.16em; text-decoration:none; }
.music-cta b { color:#d24d29; font-size:22px; font-weight:400; transition:transform .2s ease; }
.music-cta:hover b, .music-cta:focus-visible b { transform:translateX(8px); }
.track-list { border-top: 1px solid #3d3d3d; }
.track {
  display: grid;
  grid-template-columns: 40px 58px minmax(130px, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 25px 0;
  border-bottom: 1px solid #3d3d3d;
}
.track-no { margin: 0; color: #d24d29; font-size: 10px; letter-spacing: .15em; }
.track-cover { display:block; width:58px; aspect-ratio:1; object-fit:cover; background:#222; }
.track h3 { margin: 0; font-size: 15px; font-weight: 500; letter-spacing: .13em; }
.track h3 a { color: inherit; text-decoration: none; }
.track h3 a:hover, .track h3 a:focus-visible { color: #f06a45; outline: 0; }
.track h3 + p { margin: 6px 0 0; color: var(--mut); font-size: 9px; letter-spacing: .12em; }
.track-link {
  color: var(--paper);
  font-size: 9px;
  letter-spacing: .13em;
  text-decoration: none;
  white-space: nowrap;
}
.track-link b { margin-left: 6px; color: #d24d29; font-size: 15px; font-weight: 400; }

/* ═══════════ TICKER ═══════════ */
.ticker-zone {
  padding: 12vh 0; overflow: hidden;
  border-top: 1px solid var(--line);
}
.ticker { overflow: hidden; will-change: transform; }
.ticker-row {
  display: flex; width: max-content;
  font-family: var(--disp);
  font-size: clamp(48px, 8.5vw, 150px);
  line-height: 1.2; white-space: nowrap;
  animation: slide 22s linear infinite;
}
.ticker--rev .ticker-row {
  animation-direction: reverse;
  color: transparent;
  -webkit-text-stroke: 1px rgba(236, 231, 221, 0.5);
}
@keyframes slide {
  to { transform: translateX(-50%); }
}
.flat .ticker-row { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .ticker-row { animation: none; }
  html { scroll-behavior: auto; }
}

/* ═══════════ ABOUT ═══════════ */
.about {
  padding: 22vh 8vw;
  border-top: 1px solid var(--line);
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.7fr;
  gap: 6vh 6vw;
  max-width: 1280px; margin: 0 auto;
}
.about-head h2 {
  font-family: var(--disp);
  font-size: clamp(48px, 7vw, 110px); line-height: 0.95;
}
.about-head h2 span {
  display: block;
  font-family: var(--body); font-weight: 400;
  font-size: 12px; letter-spacing: 0.5em; color: var(--acc);
  margin-top: 16px;
}
.about-lead {
  font-size: clamp(20px, 2.6vw, 34px); font-weight: 700;
  letter-spacing: 0.06em; margin-bottom: 4vh;
}
.about-txt {
  font-size: 14px; font-weight: 300; color: var(--ink);
  max-width: 560px; margin-bottom: 2.6vh;
}
.about-facts {
  list-style: none; margin-top: 5vh;
  border-top: 1px solid var(--line);
}
.about-facts li {
  display: flex; align-items: baseline; gap: 20px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
  font-size: 13px; letter-spacing: 0.06em;
}
.about-facts i {
  font-style: normal; font-size: 10px; letter-spacing: 0.24em;
  color: var(--acc); flex: 0 0 92px;
}
.about-clocks {
  grid-column: 1 / -1;
  display: flex; gap: 6vw; flex-wrap: wrap;
  margin-top: 4vh; padding-top: 6vh;
  border-top: 1px solid var(--line);
}
.clock i {
  font-style: normal; font-size: 10px; letter-spacing: 0.3em; color: var(--mut);
  display: block; margin-bottom: 10px;
}
.clock b {
  font-family: var(--disp); font-weight: 400;
  font-size: clamp(40px, 6vw, 84px); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.clock span {
  display: block; margin-top: 10px;
  font-size: 10px; letter-spacing: 0.24em; color: var(--mut);
}

/* ═══════════ PHILOSOPHY ═══════════ */
.philosophy {
  padding: 26vh 8vw;
  border-top: 1px solid var(--line);
  text-align: center;
}
.philo-big {
  font-size: clamp(30px, 6.4vw, 96px);
  font-weight: 700; line-height: 1.5;
  letter-spacing: 0.05em;
}
.philo-big em { font-style: normal; color: var(--acc); white-space: nowrap; }
.philo-sub {
  margin-top: 6vh;
  font-size: clamp(15px, 1.7vw, 22px);
  font-weight: 300; line-height: 2.4;
  letter-spacing: 0.14em;
}
.philo-keys {
  margin-top: 8vh;
  font-size: 12px; letter-spacing: 0.34em; color: var(--mut);
}
.philo-keys span {
  display: block; margin-top: 12px;
  font-size: 10px; letter-spacing: 0.28em;
}

/* ═══════════ CONTACT ═══════════ */
.contact {
  padding: 24vh 8vw 0;
  border-top: 1px solid var(--line);
  text-align: center;
}
.contact-pre {
  font-size: 12px; letter-spacing: 0.4em; color: var(--mut);
  margin-bottom: 6vh;
}
.contact-mail {
  position: relative; display: inline-block;
  font-family: var(--disp);
  font-size: clamp(52px, 11vw, 180px);
  line-height: 1; letter-spacing: 0.01em;
  white-space: nowrap;
}
.contact-mail-base {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
}
.contact-mail-fill {
  position: absolute; inset: 0; color: var(--acc);
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.6s cubic-bezier(0.76, 0, 0.24, 1);
}
.contact-mail:hover .contact-mail-fill,
.contact-mail:focus-visible .contact-mail-fill {
  clip-path: inset(0 0 0 0);
}
.contact-adr {
  margin-top: 5vh;
  font-size: 12px; letter-spacing: 0.2em; color: var(--mut);
}
.foot {
  margin-top: 18vh;
  padding: 26px 0 90px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap;
  font-size: 10px; letter-spacing: 0.2em; color: var(--mut);
}
.foot a { color: var(--ink); }

/* ═══════════ レスポンシブ ═══════════ */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .site-head { padding: 14px 20px; flex-direction: column; align-items: flex-start; gap: 4px; }
  .head-nav { width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 0 8px; }
  .head-nav a { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; font-size: 10px; letter-spacing: 0.08em; }
  .section-label { left: 20px; bottom: 18px; }
  .hero-meta { top: 112px; }
  .hero-meta--tl { left: 20px; }
  .hero-meta--tr { right: 20px; }
  /* 縦書き名は横書きにして左下へ（絶対配置の衝突回避） */
  .hero-vertical {
    writing-mode: horizontal-tb;
    top: auto; bottom: 108px; right: auto; left: 20px;
    transform: none; letter-spacing: 0.45em;
  }
  .manifesto { padding: 18vh 7vw; }
  /* 孤立行(1〜2文字の折り返し)を避けるサイズに調整 */
  .mani-line { font-size: clamp(17px, 5.6vw, 40px); }
  .work-intro { min-width: 78vw; }
  .work { width: 80vw; }
  .works-track { gap: 10vw; }
  .work-outro p { font-size: 20px; }
  .music { padding: 15vh 7vw 12vh; }
  .music-head { display: block; margin-bottom: 8vh; }
  .music-head > p { margin-bottom: 15px; }
  .music-head h2 { font-size: clamp(34px, 11vw, 58px); }
  .music-head > span { display: block; margin-top: 19px; text-align: left; }
  .track { grid-template-columns: 24px 48px minmax(0, 1fr) auto; gap: 11px; padding: 20px 0; }
  .track-cover { width:48px; }
  .track-link { grid-column: 4; grid-row: 1; }
  .about { padding: 16vh 7vw; }
  .about-clocks { flex-direction: column; gap: 5vh; }
}

/* 狭幅ではヒーローのメタ2つを縦に分離（重なり回避） */
@media (max-width: 380px) {
  .hero-meta--tr { top: 184px; }
  .contact { padding-top: 18vh; }
  .foot { flex-direction: column; align-items: flex-start; padding-bottom: 60px; }
}
