/**
 * hero-ai.css
 * 中原ポートフォリオ — トップFV「中小企業のWebとAI」ヒーロー（2026-11 刷新）
 *
 * 読み込み: functions.php（フロントページのみ / main.css の後）
 * 対になるJS: js/hero-ai.js
 *
 * 既存 main.css の #top / .hero-* ルールと衝突しないよう、
 * 新ヒーローは .ai-hero / .aih-* のクラスで完結させています。
 *
 * @package nakahara-portfolio
 */

#top.ai-hero {
  --aih-bg: #06080c;
  --aih-coral: #ff5a36;
  --aih-gold: #f5c842;
  --aih-violet: #6c5ce7;
  --aih-lime: #c6f135;
  --aih-mono: ui-monospace, "Cascadia Mono", "Consolas", SFMono-Regular, Menlo, Consolas, monospace;
  --mx: 70%;
  --my: 40%;

  position: relative;
  width: 100%;
  height: auto;
  min-height: 100vh;
  min-height: 100svh;
  margin-top: 0;
  padding: calc(var(--nav-h, 76px) + 44px) var(--section-px, 100px) 168px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--aih-bg);
  color: #fff;
  isolation: isolate;
  max-width: none;
}

/* ============================================================
   背景レイヤー
============================================================ */
.aih-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.aih-aurora {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(40% 35% at 72% 42%, rgba(108, 92, 231, 0.32), transparent 70%),
    radial-gradient(30% 30% at 85% 75%, rgba(255, 90, 54, 0.22), transparent 70%),
    radial-gradient(35% 30% at 20% 85%, rgba(198, 241, 53, 0.07), transparent 70%);
  filter: blur(40px);
  animation: aih-aurora 18s ease-in-out infinite alternate;
}

@keyframes aih-aurora {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(-3%, 2%, 0) rotate(6deg) scale(1.06); }
  100% { transform: translate3d(2%, -2%, 0) rotate(-4deg) scale(1.02); }
}

.aih-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.6s;
}
.aih-canvas.is-on { opacity: 1; }

/* 足元のパースグリッド */
.aih-grid {
  position: absolute;
  left: -25%;
  right: -25%;
  bottom: -6%;
  height: 46%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(600px) rotateX(62deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 85%);
  mask-image: linear-gradient(to top, #000 0%, transparent 85%);
  animation: aih-grid 9s linear infinite;
  opacity: 0.6;
}
@keyframes aih-grid {
  to { background-position: 0 64px, 0 0; }
}

/* カーソル追従のスポットライト */
.aih-spot {
  position: absolute;
  inset: 0;
  background: radial-gradient(520px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.06), transparent 60%);
}

.aih-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 8, 12, 0.9) 0%, rgba(6, 8, 12, 0.55) 34%, transparent 60%),
    linear-gradient(to bottom, rgba(6, 8, 12, 0.5) 0%, transparent 18%, transparent 75%, rgba(6, 8, 12, 0.85) 100%);
}

/* ============================================================
   テキスト
============================================================ */
.aih-body {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 700px;
}

.aih-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-bottom: 30px;
  font-family: var(--aih-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.78);
}
.aih-kicker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aih-lime);
  box-shadow: 0 0 0 0 rgba(198, 241, 53, 0.6);
  animation: aih-pulse 2s ease-out infinite;
}
@keyframes aih-pulse {
  0% { box-shadow: 0 0 0 0 rgba(198, 241, 53, 0.55); }
  100% { box-shadow: 0 0 0 12px rgba(198, 241, 53, 0); }
}
.aih-kicker-sep { color: rgba(255, 255, 255, 0.3); }
.aih-kicker-sub {
  font-family: var(--font-sans);
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.55);
}

.aih-h1 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(44px, 5.4vw, 88px);
  line-height: 1.14;
  letter-spacing: 0.02em;
  margin: 0 0 22px;
  color: #fff;
}
.aih-line {
  display: block;
  overflow: hidden;
  padding: 0.04em 0 0.1em;
}
.aih-split {
  display: inline-block;
  white-space: nowrap;
}
.aih-ch {
  display: inline-block;
  will-change: transform, opacity, filter;
}
/* 「WebとAI」は黄色（光が走るシーン付き） */
.aih-em,
.aih-em .aih-ch {
  background: linear-gradient(100deg, #f5c842 0%, #ffd84d 30%, #fff4c2 45%, #ffd84d 60%, #f5c842 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: aih-sheen 8s linear infinite;
}
@keyframes aih-sheen {
  to { background-position: 300% 0; }
}

.aih-sub {
  font-family: var(--font-serif);
  font-size: clamp(15px, 1.3vw, 19px);
  line-height: 1.8;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #fff;
  margin-bottom: 14px;
}

.aih-lead {
  font-size: 15px;
  line-height: 2;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.68);
  max-width: 560px;
  margin-bottom: 36px;
}

/* ボタン */
.aih-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.aih-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 19px 34px;
  border-radius: 999px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  will-change: transform;
}
.aih-lead-link {
  color: #fff;
  font-weight: 500;
  text-decoration: none;
  background: linear-gradient(90deg, var(--aih-coral), var(--aih-gold)) left bottom / 100% 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size 0.3s, color 0.3s;
}
.aih-lead-link:hover { color: var(--aih-gold); }

/* オレンジのボタン */
.aih-btn--primary {
  background: linear-gradient(120deg, var(--aih-coral) 0%, #ff7a2f 100%);
  color: #fff;
  box-shadow: 0 14px 40px rgba(255, 90, 54, 0.35);
}
.aih-btn--primary:hover { color: var(--ink, #0d1117); }
.aih-btn-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, var(--aih-gold), #ffe27a);
  border-radius: inherit;
  transform: translateY(101%);
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}
.aih-btn--primary:hover .aih-btn-fill { transform: translateY(0); }
.aih-btn--ghost {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: border-color 0.3s, background 0.3s;
}
.aih-btn--ghost:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.aih-btn-arrow { transition: transform 0.35s; }
.aih-btn:hover .aih-btn-arrow { transform: translateX(5px); }
.aih-btn:focus-visible,
.aih-lead-link:focus-visible {
  outline: 2px solid var(--aih-lime);
  outline-offset: 4px;
}

/* ============================================================
   AI処理ログ（コンソール）
============================================================ */
.aih-console-wrap {
  position: absolute;
  z-index: 3;
  right: 5vw;
  bottom: 150px;
  width: 330px;
}
.aih-console {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(12, 15, 22, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  font-family: var(--aih-mono);
  color: rgba(255, 255, 255, 0.8);
  overflow: hidden;
}
.aih-console-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}
.aih-console-dots { display: flex; gap: 5px; }
.aih-console-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}
.aih-console-dots i:first-child { background: var(--aih-coral); }
.aih-console-title { flex: 1; letter-spacing: 0.06em; }
.aih-console-live {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--aih-lime);
  letter-spacing: 0.14em;
  font-size: 10px;
}
.aih-console-live b {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aih-lime);
  animation: aih-blink 1.2s steps(2) infinite;
}
@keyframes aih-blink { 50% { opacity: 0.2; } }

.aih-console-body { padding: 16px 16px 18px; }
.aih-console-step {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.aih-console-no {
  font-size: 11px;
  color: var(--aih-coral);
}
.aih-console-name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: #fff;
}
.aih-console-line {
  min-height: 3.4em;
  font-family: var(--aih-mono), var(--font-sans);
  font-size: 12px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.72);
}
.aih-prompt { color: var(--aih-lime); }
.aih-caret {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: rgba(255, 255, 255, 0.75);
  animation: aih-blink 0.9s steps(2) infinite;
}
.aih-console-meter {
  margin-top: 12px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.aih-console-meter span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--aih-violet), var(--aih-coral), var(--aih-gold));
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ============================================================
   工程インジケーター
============================================================ */
.aih-steps {
  position: absolute;
  z-index: 3;
  left: var(--section-px, 100px);
  right: var(--section-px, 100px);
  bottom: 50px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.aih-step {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "bar bar"
    "no en"
    "no ja";
  column-gap: 12px;
  row-gap: 2px;
  color: rgba(255, 255, 255, 0.38);
  transition: color 0.5s;
}
.aih-step-bar {
  grid-area: bar;
  position: relative;
  display: block;
  height: 2px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.aih-step-bar span {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--aih-coral), var(--aih-gold));
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.aih-step-no {
  grid-area: no;
  font-family: var(--aih-mono);
  font-size: 11px;
  padding-top: 2px;
}
.aih-step-en {
  grid-area: en;
  font-family: var(--aih-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
}
.aih-step-ja {
  grid-area: ja;
  font-size: 13px;
  letter-spacing: 0.08em;
}
.aih-step.is-active,
.aih-step.is-done { color: rgba(255, 255, 255, 0.92); }
.aih-step.is-done .aih-step-bar span { transform: scaleX(1); }
.aih-step.is-active .aih-step-no { color: var(--aih-coral); }

/* スクロール表示 */
.aih-scroll {
  position: absolute;
  z-index: 3;
  right: 28px;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-family: var(--aih-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.4);
  writing-mode: vertical-rl;
  transform: translateY(-50%);
}
.aih-scroll-line {
  position: relative;
  width: 1px;
  height: 64px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
.aih-scroll-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -100%;
  width: 100%;
  height: 100%;
  background: #fff;
  animation: aih-scroll 2.2s cubic-bezier(0.645, 0.045, 0.355, 1) infinite;
}
@keyframes aih-scroll {
  to { top: 100%; }
}

/* ============================================================
   レスポンシブ
============================================================ */
@media (max-width: 1280px) {
  .aih-console-wrap { width: 290px; right: 4vw; }
}

@media (max-width: 1024px) {
  #top.ai-hero {
    padding: calc(var(--nav-h, 76px) + 48px) 52px 200px;
    align-items: flex-start;
  }
  .aih-console-wrap { display: none; }
  .aih-steps {
    left: 52px;
    right: 52px;
    gap: 12px;
  }
  .aih-vignette {
    background:
      linear-gradient(90deg, rgba(6, 8, 12, 0.85) 0%, rgba(6, 8, 12, 0.4) 60%, transparent 100%),
      linear-gradient(to bottom, rgba(6, 8, 12, 0.4) 0%, transparent 18%, transparent 70%, rgba(6, 8, 12, 0.9) 100%);
  }
}

@media (max-width: 768px) {
  #top.ai-hero {
    padding: calc(var(--nav-h, 64px) + 44vw) 24px 150px;
    min-height: 100svh;
  }
  .aih-vignette {
    background: linear-gradient(to bottom, rgba(6, 8, 12, 0.1) 0%, rgba(6, 8, 12, 0.2) 30%, rgba(6, 8, 12, 0.8) 55%, rgba(6, 8, 12, 0.95) 100%);
  }
  .aih-kicker { font-size: 10px; margin-bottom: 20px; letter-spacing: 0.16em; }
  .aih-h1 { font-size: clamp(36px, 10.6vw, 56px); margin-bottom: 18px; }
  .aih-sub { font-size: 15px; letter-spacing: 0.02em; }
  .aih-kicker-sep { display: none; }
  .aih-kicker-sub { flex-basis: 100%; }
  .aih-lead { font-size: 14px; line-height: 1.9; margin-bottom: 24px; }
  .aih-actions { flex-direction: column; }
  .aih-btn { justify-content: center; padding: 17px 24px; font-size: 14px; }
  .aih-steps {
    left: 24px;
    right: 24px;
    bottom: 40px;
    gap: 8px;
  }
  .aih-step { grid-template-areas: "bar bar" "no no" "ja ja"; }
  .aih-step-bar { margin-bottom: 10px; }
  .aih-step-en { display: none; }
  .aih-step-ja { font-size: 10px; letter-spacing: 0.02em; line-height: 1.4; }
  .aih-scroll { display: none; }
  .aih-grid { height: 30%; }
}

@media (max-width: 374px) {
  #top.ai-hero { padding-left: 16px; padding-right: 16px; }
  .aih-steps { left: 16px; right: 16px; }
}

/* ============================================================
   動きを減らす設定
============================================================ */
@media (prefers-reduced-motion: reduce) {
  .aih-aurora,
  .aih-grid,
  .aih-em,
  .aih-em .aih-ch,
  .aih-kicker-dot,
  .aih-scroll-line::after { animation: none !important; }
}

/* 印刷 */
@media print {
  #top.ai-hero { min-height: 0; padding: 24pt 40pt !important; background: #fff; color: #000; }
  .aih-bg, .aih-console-wrap, .aih-steps, .aih-scroll { display: none !important; }
  .aih-h1, .aih-sub, .aih-lead { color: #000 !important; }
  .aih-em, .aih-em .aih-ch { -webkit-text-fill-color: #000; background: none; }
}
