/* caprix.jp — 動きの演出（html[data-motion="kinetic"]）。JS が動くときだけ .motion-ready が付く */

/* ───────── 共通 ───────── */

/* 見出しを1文字ずつ持ち上げる */
.hero-chars .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}

.hero-chars .ch {
  display: inline-block;
}

.motion-ready .hero-chars .ch {
  transform: translateY(112%);
  animation: ch-in 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: calc(160ms + var(--i, 0) * 36ms);
}

@keyframes ch-in {
  to {
    transform: none;
  }
}

.motion-ready .site-header {
  animation: fade-down 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.motion-ready .hero .mono,
.motion-ready .hero-lead {
  animation: fade-up 1s 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.motion-ready .waves {
  animation: fade-in 1.6s 0.5s ease both;
}

@keyframes fade-down {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* 画面に入ったら出てくる */
.motion-ready .rv {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--d, 0) * 90ms);
}

.motion-ready .rv.is-in {
  opacity: 1;
  transform: none;
}

/* ───────── 文字の動き（kinetic） ───────── */

/* 見出し：文字の太さは JS が --w で変える */
[data-motion="kinetic"] .hero-chars .ch {
  font-weight: var(--w, 300);
}

@media (min-width: 721px) {
  [data-motion="kinetic"] .hero {
    align-items: flex-end;
  }
}

.hero-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 36px;
}

.hero-side .hero-lead {
  margin-bottom: 0 !important;
}

/* くるくる回る丸い文字 */
.spin-badge {
  position: relative;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 50%;
}

.spin-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  will-change: transform;
}

.spin-ring text {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  fill: var(--ink);
}

.spin-arrow {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.spin-badge:hover .spin-arrow {
  transform: scale(1.14);
}

.motion-ready .spin-badge {
  animation: fade-up 1s 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

[data-motion="kinetic"] .waves {
  height: 110px;
  margin-top: 56px;
}

/* 流れるドメイン名（上下の段で逆向き） */
.marquee {
  display: grid;
  gap: 6px;
  margin-top: 24px;
  overflow: hidden;
  border-block: 1px solid var(--rule);
  padding-block: 18px 14px;
}

.marquee-track {
  display: flex;
  width: max-content;
  will-change: transform;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding-right: 0.3em;
  font-size: clamp(56px, 9.5vw, 148px);
  font-weight: 200;
  letter-spacing: -0.045em;
  line-height: 1.02;
  white-space: nowrap;
}

.marquee-item.is-outline {
  color: transparent;
  -webkit-text-stroke: 1px var(--ink);
}

.marquee-track.is-sub .marquee-item {
  font-family: var(--mono);
  font-size: clamp(13px, 1.3vw, 18px);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  gap: 1.4em;
  padding-right: 1.4em;
}

.star {
  width: 0.36em;
  height: 0.36em;
  flex-shrink: 0;
  color: var(--ink);
  animation: star-spin 9s linear infinite;
}

@keyframes star-spin {
  to {
    transform: rotate(360deg);
  }
}

.marquee-sep {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* 見出しの単語：画面に入ると1文字ずつ上がり、乗せると太さが波打つ */
.kin-word {
  display: inline-flex;
  overflow: hidden;
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
}

.kin-word .k {
  display: inline-block;
  font-weight: 300;
  transition:
    transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1),
    font-weight 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 38ms);
}

.motion-ready .rv .kin-word .k {
  transform: translateY(105%);
}

.motion-ready .rv.is-in .kin-word .k {
  transform: none;
}

.display:hover .kin-word .k {
  font-weight: 640;
}

/* 行にカーソルを乗せると、墨色が下から満ちる */
[data-motion="kinetic"] .svc-row.is-link {
  position: relative;
  isolation: isolate;
  transition: color 0.5s cubic-bezier(0.7, 0, 0.2, 1);
}

[data-motion="kinetic"] .svc-row.is-link::before {
  content: "";
  position: absolute;
  inset: -1px calc(var(--pad) * -0.5) 0;
  z-index: -1;
  border-radius: 6px;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform 0.6s cubic-bezier(0.7, 0, 0.2, 1);
}

[data-motion="kinetic"] .svc-row.is-link:is(:hover, :focus-visible)::before {
  transform: scaleY(1);
}

[data-motion="kinetic"] .svc-row.is-link:is(:hover, :focus-visible) {
  color: var(--bg);
}

[data-motion="kinetic"] .svc-row.is-link :is(.svc-desc, .svc-sub, .svc-no) {
  transition: color 0.5s cubic-bezier(0.7, 0, 0.2, 1);
}

[data-motion="kinetic"] .svc-row.is-link:is(:hover, :focus-visible) :is(.svc-desc, .svc-sub, .svc-no) {
  color: rgba(246, 246, 243, 0.7);
}

[data-motion="kinetic"] .svc-row.is-link .svc-domain {
  transition:
    transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
    font-weight 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-motion="kinetic"] .svc-row.is-link:is(:hover, :focus-visible) .svc-domain {
  font-weight: 460;
  transform: translateX(18px);
}

/* 矢印はカーソルに少し引き寄せられる（--ax / --ay は JS） */
[data-motion="kinetic"] .svc-row.is-link .arrow {
  transform: translate(var(--ax, 0px), var(--ay, 0px));
  transition:
    opacity 0.3s ease,
    transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-motion="kinetic"] .svc-row.is-link:is(:hover, :focus-visible) .arrow {
  opacity: 1;
  transform: translate(var(--ax, 4px), var(--ay, 0px)) rotate(-45deg) scale(1.35);
}

/* 指で押したときも満ちる */
@media (hover: none) {
  [data-motion="kinetic"] .svc-row.is-link:active::before {
    transform: scaleY(1);
  }

  [data-motion="kinetic"] .svc-row.is-link:active {
    color: var(--bg);
  }
}

/* 吸い寄せられるボタン（--mx / --my は JS） */
[data-motion="kinetic"] .nav-pill,
[data-motion="kinetic"] .spin-badge {
  translate: var(--mx, 0px) var(--my, 0px);
  transition:
    translate 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 160ms ease,
    color 160ms ease;
}

/* フッターの大きな「Contact」 */
.footer-cta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
}

.footer-cta-label {
  font-family: var(--jp);
  font-size: 13px;
  color: var(--muted);
}

.footer-cta-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-cta-word {
  font-size: clamp(72px, 15vw, 232px);
  font-weight: 200;
  letter-spacing: -0.055em;
  line-height: 0.92;
}

.footer-cta-word .k {
  font-weight: 200;
}

.footer-cta:is(:hover, :focus-visible) .footer-cta-word .k {
  font-weight: 700;
}

.footer-cta-arrow {
  width: clamp(64px, 8vw, 120px);
  height: clamp(64px, 8vw, 120px);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  transition:
    background-color 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
    color 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.footer-cta:is(:hover, :focus-visible) .footer-cta-arrow {
  background: var(--ink);
  color: var(--bg);
  transform: rotate(-45deg);
}

/* スクロールの進み具合 */
.progress {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 95;
  width: 100%;
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* 自前のカーソル */
.cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.cursor.is-hidden {
  opacity: 0;
}

.cursor-dot,
.cursor-ring {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--ink);
  transition: opacity 0.2s ease;
}

.cursor-ring {
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(20, 20, 20, 0.45);
  border-radius: 50%;
  transition:
    width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    height 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    margin 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 0.35s ease,
    border-color 0.35s ease;
}

.cursor-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 0.25s ease,
    transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cursor.is-link .cursor-ring {
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  border-color: var(--ink);
}

.cursor.is-open .cursor-ring {
  width: 108px;
  height: 108px;
  margin: -54px 0 0 -54px;
  border-color: var(--bg);
  background: var(--bg);
}

.cursor.is-open .cursor-label {
  opacity: 1;
  transform: none;
}

.cursor.is-open .cursor-dot,
.cursor.is-down .cursor-dot {
  opacity: 0;
}

.cursor.is-down .cursor-ring {
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
}

@media (pointer: fine) {
  .has-cursor,
  .has-cursor a,
  .has-cursor button {
    cursor: none;
  }

  .has-cursor :is(input, textarea, select) {
    cursor: auto;
  }
}

/* ページの切り替わり（対応しているブラウザだけ） */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: vt-out 0.32s cubic-bezier(0.7, 0, 0.2, 1) both;
}

::view-transition-new(root) {
  animation: vt-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes vt-out {
  to {
    opacity: 0;
    transform: translateY(-14px);
  }
}

@keyframes vt-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
}

/* ───────── スマートフォン ───────── */

@media (max-width: 720px) {
  .marquee {
    padding-block: 14px 10px;
  }

  .hero-side {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
  }

  .spin-badge {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
  }

  .spin-arrow {
    width: 38px;
    height: 38px;
  }

  .footer-cta {
    margin-bottom: 40px;
    padding-top: 32px;
  }
}

/* 動きを減らす設定では、何も動かさない */
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  .star,
  .kin-word .k,
  .hero-chars .ch,
  .rv,
  .marquee-track {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
