/* =============================================
   共通スタイル - Ryo Yamashiro Portfolio
============================================= */

html { scroll-behavior: smooth; }

.buddyb-desktop { display: flex; flex-direction: column; }
.buddyb-desktop > :first-child { flex-shrink: 0; }
.buddyb-screen { position: relative; overflow: hidden; background: #fff; }
.buddyb-screen-desktop { flex: 1; min-height: 0; }
.buddyb-screen-mobile { height: 100%; }
.buddyb-capture { display: block; width: 100%; height: auto; max-width: none; animation: buddyb-scroll 100s linear infinite; animation-play-state: paused; }
.buddyb-screen-mobile .buddyb-capture { animation-duration: 130s; }
.buddyb-screen.is-visible .buddyb-capture { animation-play-state: running; }
.buddyb-screen:hover .buddyb-capture,
.buddyb-screen.is-paused .buddyb-capture { animation-play-state: paused; }
.buddyb-preview-control:focus-visible { outline: 2px solid #334155; outline-offset: 5px; }
@keyframes buddyb-scroll {
  0%, 5% { transform: translateY(0); }
  45%, 55% { transform: translateY(calc(-100% + var(--preview-height, 240px))); }
  95%, 100% { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .buddyb-capture { animation: none; }
  .buddyb-preview-control { display: none; }
}

.mono { font-family: 'Courier New', monospace; }

/* ── アニメーション ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(var(--fade-up-distance, 22px)); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes draw {
  from { stroke-dashoffset: 2000; }
  to   { stroke-dashoffset: 0; }
}
@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes rotate-rev {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 1; }
}
@keyframes flicker {
  0%,100% { opacity: 1; }
  92%     { opacity: 1; }
  93%     { opacity: 0.4; }
  94%     { opacity: 1; }
  97%     { opacity: 0.6; }
  98%     { opacity: 1; }
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero テキスト ── */
.hero-text > * {
  opacity: 0;
  animation: fade-up 0.9s cubic-bezier(0.22,1,0.36,1) forwards;
}
.hero-text > *:nth-child(1) { animation-delay: 0.7s; }
.hero-text > *:nth-child(2) { animation-delay: 0.9s; }
.hero-text > *:nth-child(3) { animation-delay: 1.1s; }
.hero-text > *:nth-child(4) { animation-delay: 1.3s; }

/* ── SVG 軌道アニメーション ── */
.arc-draw   { stroke-dasharray:2000; stroke-dashoffset:2000; animation: draw 2.4s cubic-bezier(0.22,1,0.36,1) 0.1s forwards; }
.arc-draw-2 { stroke-dasharray:2000; stroke-dashoffset:2000; animation: draw 3.0s cubic-bezier(0.22,1,0.36,1) 0.3s forwards; }
.arc-draw-3 { stroke-dasharray:2000; stroke-dashoffset:2000; animation: draw 2.0s cubic-bezier(0.22,1,0.36,1) 0.5s forwards; }
.g-spin     { transform-origin:310px 310px; animation: rotate-slow 40s linear infinite; }
.g-spin-rev { transform-origin:310px 310px; animation: rotate-rev  28s linear infinite; }
.core-dot        { animation: pulse-glow 3s ease-in-out infinite; }
.label-flicker   { animation: flicker 8s ease-in-out infinite; }
.label-flicker2  { animation: flicker 11s ease-in-out 2s infinite; }
.orbit-group {
  opacity: 0;
  animation: pop-in 1s cubic-bezier(0.22,1,0.36,1) 1.8s forwards;
}

/* ── グレイン・スキャンライン ── */
.grain {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.030;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
}
.scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom, transparent 0px, transparent 3px,
    rgba(0,0,0,0.012) 3px, rgba(0,0,0,0.012) 4px
  );
}

/* ── FAB ハンバーガー変形 ── */
.bar { transition: transform 0.3s ease, opacity 0.3s ease; transform-origin: center; }
.hamburger.open .bar-top    { transform: translateY(6px) rotate(45deg); }
.hamburger.open .bar-mid    { opacity: 0; transform: scaleX(0); }
.hamburger.open .bar-bottom { transform: translateY(-6px) rotate(-45deg); }

/* ── 言語切替ボタン ── */
.lang-btn {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 4px 10px;
  color: #475569;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}
.lang-btn:hover {
  border-color: #1e293b;
  color: #1e293b;
}
.lang-btn .lang-sep {
  color: #cbd5e1;
  margin: 0 2px;
}
.lang-btn .lang-active {
  font-weight: 700;
  color: #1e293b;
}
.lang-btn .lang-inactive {
  color: #94a3b8;
}

/* ── SP 言語ピル（左下固定）── */
.lang-pill-sp {
  position: fixed;
  bottom: 24px;
  left: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  background: rgba(247,245,242,0.92);
  backdrop-filter: blur(8px);
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 5px 12px;
  color: #475569;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  text-decoration: none;
}
.lang-pill-sp .lang-active  { font-weight: 700; color: #1e293b; }
.lang-pill-sp .lang-inactive { color: #94a3b8; }
.lang-pill-sp .lang-sep     { color: #cbd5e1; margin: 0 2px; }
