/* =========================================================
   リーガルパレット関西 — home.css（トップページ専用）
   オープニングの「色が灯る躍動感」をサイト全体へ。
   読み込み順：style.css → home.css（opening.css は独立）
   ========================================================= */

/* ---------------------------------------------------------
   Scroll reveal（Intersection Observer / スタッガー）
   --rd は JS が「同時に見えた要素の順番」に応じて付与
   --------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  translate: 0 44px;
  transition:
    opacity 0.9s ease var(--rd, 0ms),
    translate 1.15s var(--ease-out) var(--rd, 0ms),
    transform 0.5s var(--ease-out),
    box-shadow 0.5s ease,
    border-color 0.4s ease,
    background-color 0.4s ease;
}
.js [data-reveal="fade"] { translate: 0 0; }
.js [data-reveal].is-in { opacity: 1; translate: 0 0; }

[data-tilt] {
  --mx: 50%;
  --my: 50%;
  --rx: 0deg;
  --ry: 0deg;
  transform: perspective(1000px) rotateX(var(--rx)) rotateY(var(--ry));
  will-change: transform;
}

/* 巨大アウトライン文字（装飾・パララックス） */
.bg-word {
  position: absolute;
  z-index: -1;
  right: -2vw;
  top: clamp(24px, 5vw, 64px);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(6rem, 21vw, 20rem);
  line-height: 0.9;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px rgba(20, 33, 61, 0.13);
  translate: calc(var(--p, 0) * -9vw) 0;
  pointer-events: none;
  user-select: none;
}
.section-dark .bg-word { -webkit-text-stroke-color: rgba(255, 255, 255, 0.16); }

.home .section { position: relative; isolation: isolate; overflow: hidden; overflow: clip; }   /* hidden は clip 非対応ブラウザ用 */

.section.section-dark { background: var(--color-primary); color: #FAF9F6; }
.section-dark .section-title { color: #fff; }
.section-dark .section-lead { color: rgba(255, 255, 255, 0.74); }
.section-dark .section-eyebrow { color: var(--c-yellow); }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(24px, 6vw, 96px);
  align-items: end;
  margin-bottom: clamp(48px, 7vw, 88px);
}
.section-head .section-title { margin-bottom: 0; }
.section-head .section-lead { margin-bottom: 0; max-width: none; }

/* ---------------------------------------------------------
   Hero
   --------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  margin-top: calc(var(--header-h) * -1);
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  background: var(--color-bg);
  max-width: none;
  padding: 0;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  display: block;
}

/* 紙の質感（オープニングのグレインを継承） */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.55;
  mix-blend-mode: multiply;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .12 0 0 0 0 .13 0 0 0 0 .18 0 0 0 .2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hero-inner {
  position: relative;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: calc(var(--header-h) + clamp(20px, 4.5vh, 72px)) clamp(20px, 4vw, 48px) clamp(72px, 11vh, 120px);
  transform: translate3d(0, calc(var(--hp, 0) * 70px), 0);
  opacity: calc(1 - var(--hp, 0) * 1.15);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--color-primary);
}
.hero-eyebrow::before {
  content: "";
  width: 44px;
  height: 3px;
  border-radius: 3px;
  background: var(--paint-gradient);
}

.hero-title { margin: 22px 0 0; font-weight: inherit; line-height: 1; }

.hero-en {
  display: block;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(3.4rem, min(11.4vw, 21vh), 12rem);
  line-height: 0.92;
  letter-spacing: -0.025em;
  color: var(--color-primary);
}
.hero-en .line {
  display: block;
  overflow: hidden;
  padding: 0.05em 0.08em 0.14em 0;
  margin-bottom: -0.1em;
}
.hero-en .line > span { display: inline-block; }

.paint-text {
  background-image: linear-gradient(90deg, #00B4D8, #2B59C3, #8338EC, #E63973, #C85A32, #2A9D8F, #00B4D8);
  background-size: 760px 100%;
  background-repeat: repeat-x;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: paintFlow 9s linear infinite;
  padding-right: 0.06em;
}
@keyframes paintFlow { to { background-position: 760px 0; } }

.hero-jp {
  display: block;
  margin-top: clamp(22px, 3.2vw, 40px);
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: clamp(1.5rem, min(3.9vw, 6.6vh), 3.4rem);
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--color-primary);
}
.hero-jp .mark {
  background-image: linear-gradient(transparent 64%, rgba(255, 183, 3, 0.62) 64%);
  background-repeat: no-repeat;
  background-size: 0% 100%;
  animation: markGrow 1.2s var(--ease-out) forwards;
  animation-delay: 1.7s;
  padding: 0 0.08em;
}
@keyframes markGrow { to { background-size: 100% 100%; } }

.hero-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: end;
  margin-top: clamp(24px, 4.2vh, 56px);
}

.hero-tagline {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  color: var(--color-accent-ink);
  margin-bottom: 14px;
}

.hero-lead {
  color: var(--color-text);
  max-width: 46ch;
  font-size: 1rem;
  text-shadow: 0 0 18px rgba(250, 249, 246, 0.95), 0 0 6px rgba(250, 249, 246, 0.95);
}

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-scroll {
  position: absolute;
  left: clamp(20px, 4vw, 48px);
  bottom: 26px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.34em;
  color: var(--color-primary);
  opacity: calc(1 - var(--hp, 0) * 4);
}
.hero-scroll i {
  position: relative;
  display: block;
  width: 64px;
  height: 1px;
  background: rgba(20, 33, 61, 0.25);
  overflow: hidden;
}
.hero-scroll i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-primary);
  animation: scrollCue 2.2s var(--ease-out) infinite;
}
@keyframes scrollCue {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

.hero-side {
  position: absolute;
  right: clamp(12px, 2.2vw, 30px);
  top: 50%;
  translate: 0 -50%;
  writing-mode: vertical-rl;
  font-family: var(--font-label);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.5em;
  color: var(--color-text-light);
  pointer-events: none;
}

/* ヒーロー入場アニメーション：オープニングの幕が上がると同時に開始 */
.ha { animation: heroUp 1.2s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 1ms); }
.hero-en .line > span.ha { animation-name: lineUp; animation-duration: 1.3s; }
@keyframes heroUp {
  from { opacity: 0; transform: translate3d(0, 32px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes lineUp {
  from { transform: translate3d(0, 112%, 0) rotate(3deg); }
  to   { transform: none; }
}
html.js-opening:not(.opening-reveal) .ha,
html.js-opening:not(.opening-reveal) .hero-jp .mark,
html.js-opening:not(.opening-reveal) .paint-text { animation-play-state: paused; }

/* ---------------------------------------------------------
   Marquee（無限スクロール帯）
   --------------------------------------------------------- */
.marquee {
  position: relative;
  overflow: hidden;
  background: var(--color-primary);
  color: #FAF9F6;
  padding: clamp(16px, 2.6vw, 30px) 0;
  white-space: nowrap;
  user-select: none;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 46s linear infinite;
  will-change: transform;
}
.marquee--rev .marquee-track { animation-direction: reverse; }
@keyframes marquee { to { transform: translate3d(-50%, 0, 0); } }

.mq-group { display: flex; flex-shrink: 0; align-items: center; }

.mq-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding-right: 0.5em;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(2rem, 5.4vw, 4.6rem);
  line-height: 1.15;
  letter-spacing: 0.01em;
}
.mq-outline {
  color: transparent;
  -webkit-text-stroke: 1.2px rgba(250, 249, 246, 0.85);
}
.mq-paint {
  background-image: linear-gradient(90deg, #00B4D8, #8338EC, #E63973, #FFB703, #00B4D8);
  background-size: 600px 100%;
  background-repeat: repeat-x;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: paintFlow2 7s linear infinite;
  padding-right: 0.05em;
}
@keyframes paintFlow2 { to { background-position: 600px 0; } }

.mq-item i { font-style: normal; font-weight: 400; }
.mq-item i:nth-of-type(1) { color: var(--c-yellow); }
.mq-item i:nth-of-type(2) { color: var(--c-magenta); }
.mq-item i:nth-of-type(3) { color: var(--c-turquoise); }

.marquee--light {
  background: var(--color-bg);
  color: var(--color-primary);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.marquee--light .mq-outline { -webkit-text-stroke-color: rgba(20, 33, 61, 0.7); }
.marquee--light .mq-paint { background-image: linear-gradient(90deg, #00B4D8, #2B59C3, #8338EC, #E63973, #00B4D8); }
.marquee--light .mq-item i:nth-of-type(1) { color: var(--c-turquoise); }
.marquee--light .mq-item i:nth-of-type(2) { color: var(--c-yellow); }
.marquee--light .mq-item i:nth-of-type(3) { color: var(--c-magenta); }

/* ---------------------------------------------------------
   Concept / MVV
   --------------------------------------------------------- */
.home .concept { background: var(--color-bg); }

/* スクロール連動：文字が一文字ずつ「色づく」リード文 */
.lead-scroll {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  line-height: 2.1;
  color: var(--color-text);
}
.lead-scroll .ch {
  color: rgba(31, 36, 45, 0.2);
  transition: color 0.45s ease;
}
.lead-scroll .ch.on { color: var(--color-text); }

.mv-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(18px, 2.4vw, 32px);
  margin-bottom: clamp(56px, 7vw, 88px);
}

.mvv-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: clamp(34px, 4vw, 56px) clamp(26px, 3.4vw, 46px);
  box-shadow: var(--shadow-soft);
  min-height: 300px;
}

/* 水彩のブロブ：ホバーで膨らんで色が滲む */
.mvv-card::before {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 260px;
  height: 260px;
  z-index: -1;
  border-radius: 58% 42% 55% 45% / 48% 56% 44% 52%;
  background: var(--accent);
  opacity: 0.22;
  transition: transform 1.2s var(--ease-out), opacity 0.6s ease;
  animation: blotMorph 10s ease-in-out infinite alternate;
}
.mvv-card:hover::before { transform: scale(1.7); opacity: 0.3; }

@keyframes blotMorph {
  0%   { border-radius: 58% 42% 55% 45% / 48% 56% 44% 52%; }
  50%  { border-radius: 42% 58% 40% 60% / 58% 42% 58% 42%; }
  100% { border-radius: 52% 48% 62% 38% / 40% 60% 46% 54%; }
}

.mvv-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-label);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--color-primary);
  background: var(--color-tint);
  padding: 7px 16px 7px 12px;
  border-radius: 999px;
  margin-bottom: 24px;
}
.mvv-tag::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.mvv-card h3 {
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.6;
  margin-bottom: 16px;
}
.mvv-card p { color: var(--color-text-light); font-size: 0.96rem; }

.values-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-label);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--color-accent-ink);
  margin-bottom: 22px;
}
.values-heading::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }

.values-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2vw, 26px);
}

.value-card {
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 32px 28px 36px;
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s ease;
}
.value-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: var(--accent);
  transform: scaleX(0.16);
  transform-origin: left;
  transition: transform 0.8s var(--ease-out);
}
.value-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-soft); }
.value-card:hover::after { transform: scaleX(1); }

.value-card h3 { font-size: 1.2rem; margin-bottom: 4px; }
.value-en {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 16px;
}
.value-card p:last-child { color: var(--color-text-light); font-size: 0.93rem; }

/* ---------------------------------------------------------
   Recent visits
   --------------------------------------------------------- */
.home .visits { background: var(--color-bg-alt); }

.rv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(18px, 2.4vw, 34px);
  align-items: start;
}
.rv-card:nth-child(2) { margin-top: clamp(0px, 4vw, 56px); }
.rv-card:nth-child(3) { margin-top: clamp(0px, 8vw, 112px); }

.rv-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  isolation: isolate;
}

.rv-media { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: var(--color-tint); }
.rv-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.3s var(--ease-out), filter 0.8s ease;
}
.rv-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 33, 61, 0) 55%, rgba(20, 33, 61, 0.45));
  opacity: 0.7;
  transition: opacity 0.6s ease;
}
.rv-card:hover .rv-media img { transform: scale(1.1); }
.rv-card:hover .rv-media::after { opacity: 1; }

.rv-badge {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 1;
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--color-primary);
  background: rgba(250, 249, 246, 0.92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 6px 14px;
  border-radius: 999px;
}

.rv-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  padding: 26px 26px 30px;
}

.rv-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-text-light);
}
.rv-meta span:first-child { color: var(--color-accent-ink); }

.rv-firm { font-size: 0.84rem; font-weight: 700; color: var(--color-primary); }

.rv-title {
  font-size: 1.1rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rv-excerpt {
  color: var(--color-text-light);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rv-more {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-label);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--color-primary);
}
.rv-more i {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(20, 33, 61, 0.25);
  transition: background 0.4s ease, border-color 0.4s ease, transform 0.6s var(--ease-out);
}
.rv-more i::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 14px;
  height: 1.5px;
  background: currentColor;
  transform: translateY(-50%);
}
.rv-more i::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}
.rv-card:hover .rv-more i {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  transform: translateX(6px);
}

/* パレットの彩りを象徴するアクセントライン：下から浮かび上がる */
.rv-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: var(--paint-gradient);
  transform: translateY(100%) scaleX(0.25);
  transform-origin: left;
  opacity: 0;
  transition: transform 0.9s var(--ease-out), opacity 0.5s ease;
}
.rv-card:hover::after,
.rv-card:focus-visible::after { transform: translateY(0) scaleX(1); opacity: 1; }
.rv-card:hover { box-shadow: 0 34px 60px -30px rgba(20, 33, 61, 0.45); }

.rv-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 36px;
  margin-top: clamp(48px, 6vw, 80px);
  justify-content: center;
}
.text-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 0.96rem;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  padding-bottom: 6px;
}
.text-link::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--paint-gradient);
  transform-origin: left;
  transition: transform 0.6s var(--ease-out);
}
.text-link:hover::before { transform: scaleX(0.35); }
.text-link span { transition: transform 0.5s var(--ease-out); }
.text-link:hover span { transform: translateX(6px); }

/* ---------------------------------------------------------
   For law firms（ダーク転換）
   --------------------------------------------------------- */
.home .for-firms::before {
  content: "";
  position: absolute;
  inset: -15%;
  z-index: -1;
  background:
    radial-gradient(32% 40% at 8% 12%, rgba(0, 180, 216, 0.28), transparent 70%),
    radial-gradient(30% 40% at 92% 20%, rgba(131, 56, 236, 0.3), transparent 70%),
    radial-gradient(34% 40% at 80% 100%, rgba(230, 57, 115, 0.24), transparent 70%),
    radial-gradient(28% 36% at 18% 96%, rgba(255, 183, 3, 0.18), transparent 70%);
  animation: footerDrift 24s ease-in-out infinite alternate;
  pointer-events: none;
}

.firm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2.2vw, 30px);
  margin-bottom: clamp(48px, 6vw, 72px);
  counter-reset: firm;
}

.firm-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  counter-increment: firm;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 40px 30px 42px;
}

/* ポインタに追従するスポットライト */
.firm-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(380px circle at var(--mx) var(--my), var(--accent), transparent 65%);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.firm-card:hover::before { opacity: 0.38; }
.firm-card:hover { border-color: var(--accent); }

.firm-card::after {
  content: counter(firm, decimal-leading-zero);
  position: absolute;
  right: 22px;
  top: 10px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 4.2rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.28);
}

.firm-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 26px;
  transition: transform 0.7s var(--ease-out);
}
.firm-card:hover .firm-icon { transform: rotate(18deg) scale(1.12); }

.firm-card h3 { font-size: 1.15rem; margin-bottom: 14px; color: #fff; }
.firm-card p { color: rgba(255, 255, 255, 0.76); font-size: 0.95rem; }

.firm-cta { text-align: center; }
.firm-cta-note {
  max-width: 60ch;
  margin: 0 auto 28px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.98rem;
}

/* ---------------------------------------------------------
   Type diagnosis（ホバーでイメージカラーが点灯）
   --------------------------------------------------------- */
.home .diagnosis { background: var(--color-bg); }

.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(14px, 1.8vw, 24px);
}

.type-card {
  --vivid: var(--accent);
  --on: #fff;
  --shade: rgba(11, 21, 43, 0.3);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 330px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 34px 26px 32px;
  box-shadow: var(--shadow-soft);
}

/* 右上の絵の具ドロップ → ホバーでカード全面へ広がる */
.type-card::before {
  content: "";
  position: absolute;
  top: -38px;
  right: -38px;
  width: 120px;
  height: 120px;
  z-index: -2;
  border-radius: 50%;
  background: var(--vivid);
  opacity: 0.85;
  transition: transform 1s var(--ease-out);
}
.type-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(165deg, transparent 25%, var(--shade));
  opacity: 0;
  transition: opacity 0.6s ease;
}

.type-card:hover::before,
.type-card.is-lit::before { transform: scale(12); }
.type-card:hover::after,
.type-card.is-lit::after { opacity: 1; }
.type-card:hover,
.type-card.is-lit {
  border-color: transparent;
  box-shadow: 0 36px 60px -26px color-mix(in srgb, var(--vivid) 75%, transparent);
}

.type-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--color-primary);
  background: var(--color-tint);
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  margin-bottom: 22px;
  transition: background 0.5s ease, color 0.5s ease;
}
.type-badge::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--vivid);
  transition: background 0.5s ease;
}
.type-card:hover .type-badge,
.type-card.is-lit .type-badge { background: var(--on); color: var(--vivid); }

.type-card h3 {
  font-size: 1.2rem;
  margin-bottom: 6px;
  transition: color 0.5s ease 0.1s;
}
.type-en {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-accent-ink);
  margin-bottom: 18px;
  transition: color 0.5s ease 0.1s;
}
.type-desc {
  font-size: 0.92rem;
  color: var(--color-text-light);
  transition: color 0.5s ease 0.1s;
}
.type-card:hover h3, .type-card.is-lit h3,
.type-card:hover .type-en, .type-card.is-lit .type-en,
.type-card:hover .type-desc, .type-card.is-lit .type-desc { color: var(--on); }

.diagnosis-cta { text-align: center; margin-top: clamp(44px, 6vw, 72px); }

/* ---------------------------------------------------------
   FAQ
   --------------------------------------------------------- */
.home .faq { background: var(--color-bg-alt); }

.faq-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: clamp(32px, 6vw, 100px);
  align-items: start;
}
.faq-head { position: sticky; top: calc(var(--header-h) + 36px); }
.faq-head .section-title { margin-bottom: 0; }

.faq-list {
  display: flex;
  flex-direction: column;
  counter-reset: faq;
  border-top: 1px solid var(--color-border);
}

.faq-item {
  counter-increment: faq;
  position: relative;
  border-bottom: 1px solid var(--color-border);
  interpolate-size: allow-keywords;
  transition: background 0.4s ease;
}
.faq-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #00B4D8, #8338EC, #E63973, #FFB703);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.6s var(--ease-out);
}
.faq-item[open]::before { transform: scaleY(1); }
.faq-item:hover { background: var(--color-bg); }

.faq-item summary {
  display: flex;
  align-items: baseline;
  gap: 18px;
  cursor: pointer;
  list-style: none;
  padding: 26px 56px 26px 18px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.7;
  position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "Q" counter(faq, decimal-leading-zero);
  flex-shrink: 0;
  font-family: var(--font-label);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--color-accent-ink);
}
.faq-item summary::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 22px;
  height: 22px;
  background:
    linear-gradient(var(--color-primary), var(--color-primary)) center / 100% 2px no-repeat,
    linear-gradient(var(--color-primary), var(--color-primary)) center / 2px 100% no-repeat;
  translate: 0 -50%;
  transition: transform 0.6s var(--ease-out);
}
.faq-item[open] summary::after { transform: rotate(135deg); }

.faq-item::details-content {
  block-size: 0;
  overflow: hidden;
  transition: block-size 0.6s var(--ease-out), content-visibility 0.6s allow-discrete;
}
.faq-item[open]::details-content { block-size: auto; }

.faq-item p {
  color: var(--color-text-light);
  font-size: 0.95rem;
  padding: 0 56px 30px 18px;
  margin-left: 52px;
}
.faq-item p a {
  color: var(--color-accent-ink);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 1024px) {
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-side { display: none; }
}

@media (max-width: 900px) {
  .hero-bottom { grid-template-columns: 1fr; gap: 28px; }
  .section-head { grid-template-columns: 1fr; gap: 24px; align-items: start; }
  .mv-grid, .values-grid, .firm-grid { grid-template-columns: 1fr; }
  .rv-grid { grid-template-columns: 1fr; gap: 22px; }
  .rv-card:nth-child(2), .rv-card:nth-child(3) { margin-top: 0; }
  .faq-layout { grid-template-columns: 1fr; gap: 36px; }
  .faq-head { position: static; }
}

@media (max-width: 768px) {
  /* 背景の巨大英字は画面幅内に収める */
  .bg-word { font-size: 14vw; right: 0; translate: calc(var(--p, 0) * -3vw) 0; }
  .lead-scroll { font-size: 1.02rem; line-height: 2; }
  .hero-jp { font-size: clamp(1.4rem, 6.2vw, 1.9rem); }
  .hero-tagline { font-size: 0.98rem; }
  .hero-lead { font-size: 0.95rem; }
  .mvv-card h3 { font-size: 1.12rem; }
  .mvv-card p, .value-card p:last-child, .firm-card p, .type-desc, .rv-excerpt { font-size: 0.95rem; }
  .firm-card h3, .type-card h3, .value-card h3 { font-size: 1.1rem; }
  .rv-title { font-size: 1.02rem; }
}

@media (max-width: 600px) {
  .hero-en { font-size: clamp(3.2rem, 15vw, 5.8rem); }
  .hero-eyebrow { font-size: 0.76rem; letter-spacing: 0.08em; gap: 10px; }
  .hero-eyebrow::before { width: 28px; flex-shrink: 0; }
  .type-grid { grid-template-columns: 1fr; }
  .type-card { min-height: 0; }
  .hero-actions .btn { width: 100%; }
  .hero-actions { flex-direction: column; }
  .hero-scroll { display: none; }
  .faq-item summary { padding: 22px 48px 22px 6px; gap: 12px; font-size: 1rem; }
  .faq-item summary::after { right: 6px; }
  .faq-item p { margin-left: 0; padding: 0 12px 26px 6px; }
  .bg-word { top: 18px; }
}

@media (hover: none) {
  [data-tilt] { transform: none; will-change: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; translate: 0 0; }
  .marquee-track { animation: none; }
  .ha, .hero-en .line > span.ha { animation: none; opacity: 1; transform: none; }
  .hero-jp .mark { animation: none; background-size: 100% 100%; }
  .lead-scroll .ch { color: var(--color-text); }
  [data-tilt] { transform: none; }
}
