/* ============================================
   MagnetVision コーポレートサイト
   デザインシステム + 全スタイル（レスポンシブ込み）
   ============================================ */

/* --- カスタムプロパティ（デザイントークン） --- */
:root {
  --orange: #F28B30;
  --orange-dark: #D97A1E;
  --navy: #1B2A4A;
  --navy-light: #2B6CA3;
  --bg: #F5F5F3;
  --bg-dark: #111113;
  --text: #1A1A1A;
  --text-light: #F5F5F3;
  --gray: #888;
  --gray-light: #c8c8c8;
  --font-en: 'Montserrat', sans-serif;
  --font-jp: 'Noto Sans JP', sans-serif;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- リセット --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-jp);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }

/* --- ノイズテクスチャオーバーレイ（JSで生成し適用） --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background-image: var(--noise, none);
  background-repeat: repeat;
  opacity: 1;
}

/* ============================================
   オープニングアニメーション
   ============================================ */
#opening {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.opening-inner {
  text-align: center;
  position: relative;
}
.opening-anata {
  font-family: var(--font-jp);
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 20px;
  opacity: 0;
  letter-spacing: 0.3em;
}
.opening-blocks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.opening-block {
  padding: 14px 28px;
  color: #fff;
  font-family: var(--font-jp);
  font-weight: 900;
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  letter-spacing: 0.15em;
  opacity: 0;
  white-space: nowrap;
}
.opening-block--orange { background: var(--orange); }
.opening-block--navy { background: var(--navy); }
.opening-cross {
  font-family: var(--font-en);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text);
  margin: 0 8px;
  opacity: 0;
}
.opening-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-family: var(--font-en);
  font-weight: 900;
  font-size: clamp(2.4rem, 7vw, 5rem);
  color: var(--text);
  letter-spacing: 0.02em;
  opacity: 0;
  white-space: nowrap;
}
.opening-logo span {
  color: var(--navy);
}

/* ============================================
   ナビゲーション
   ============================================ */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 0 24px;
  transition: background 0.4s, box-shadow 0.4s, padding 0.4s;
  background: transparent;
}
#navbar.scrolled {
  background: rgba(245, 245, 243, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 12px rgba(0,0,0,0.06);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-logo {
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--text-light);
  letter-spacing: 0.05em;
  transition: color 0.4s;
}
#navbar.scrolled .nav-logo { color: var(--text); }
.nav-links {
  display: flex;
  gap: 32px;
}
.nav-links a {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--text-light);
  position: relative;
  padding: 4px 0;
  transition: color 0.3s;
}
#navbar.scrolled .nav-links a { color: var(--text); }
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--orange);
  transition: width 0.3s var(--ease-out-expo);
}
.nav-links a:hover::after,
.nav-links a:focus-visible::after { width: 100%; }

/* ============================================
   ヒーローセクション
   ============================================ */
#hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(27,42,74,0.6) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(242,139,48,0.15) 0%, transparent 50%),
    linear-gradient(160deg, #0a0e17 0%, #12192a 30%, #0d111c 60%, #080b12 100%);
  background-size: cover;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.2);
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px;
}
.hero-title {
  overflow: hidden;
}
.hero-title-main {
  display: block;
  font-family: var(--font-en);
  font-weight: 900;
  font-size: clamp(2rem, 10vw, 9rem);
  color: var(--text-light);
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(60px);
}
.hero-sub {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: clamp(0.85rem, 2vw, 1.2rem);
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.3em;
  margin-top: 20px;
  opacity: 0;
  transform: translateY(30px);
}
/* スクロールヒント */
.hero-scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}
.hero-scroll-hint span {
  display: block;
  width: 24px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 12px;
  position: relative;
}
.hero-scroll-hint span::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  background: rgba(255,255,255,0.6);
  border-radius: 2px;
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(12px); opacity: 0.3; }
}

/* ============================================
   共通セクションスタイル
   ============================================ */
.section {
  padding: 120px 24px;
  position: relative;
}
.section--light { background: var(--bg); }
.section--dark { background: var(--bg-dark); color: var(--text-light); }
.container {
  max-width: 1100px;
  margin: 0 auto;
}
.section-header {
  text-align: center;
  margin-bottom: 72px;
}
.section-title {
  font-family: var(--font-en);
  font-weight: 900;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1.1;
}
.section-title--light { color: var(--text-light); }
.section-divider {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}
.divider-line {
  width: 40px;
  height: 3px;
  border-radius: 2px;
}
.divider-line--orange { background: var(--orange); }
.divider-line--navy { background: var(--navy); }
.divider-line--navy-light { background: var(--navy-light); }

/* ============================================
   サービスセクション
   ============================================ */
.service-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px 32px;
  max-width: 900px;
  margin: 0 auto;
}
.service-item {
  text-align: center;
  opacity: 0;
  transform: translateY(40px);
}
.service-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  transition: border-color 0.4s, transform 0.4s, box-shadow 0.4s;
  color: var(--text);
}
.service-circle svg {
  width: 44px;
  height: 44px;
}
.service-item:hover .service-circle {
  border-color: var(--orange);
  transform: scale(1.05);
  box-shadow: 0 8px 32px rgba(242,139,48,0.15);
}
.service-name {
  font-family: var(--font-jp);
  font-weight: 900;
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.service-desc {
  font-size: 0.85rem;
  color: var(--gray);
  line-height: 1.6;
}

/* ============================================
   制作実績（Works）
   ============================================ */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.works-item {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateY(30px);
}
.works-item::before {
  content: attr(data-category);
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 3;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
}
.works-thumb {
  position: absolute;
  inset: 0;
  transition: transform 0.6s var(--ease-out-expo);
}
/* グラデーションプレースホルダー（実画像に差し替え可能） */
.works-thumb--1 { background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460); }
.works-thumb--2 { background: linear-gradient(135deg, #2c2c34, #F28B30 180%); }
.works-thumb--3 { background: linear-gradient(135deg, #0d1117, #1B2A4A, #2B6CA3); }
.works-thumb--4 { background: linear-gradient(135deg, #1a1a1a, #2d2d3a, #F28B30 200%); }
.works-thumb--5 { background: linear-gradient(135deg, #1c1c28, #1B2A4A 80%); }
.works-thumb--6 { background: linear-gradient(135deg, #12121a, #3a2a1a, #F28B30 250%); }

.works-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.4s;
}
.works-overlay span {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  transform: translateY(8px);
  transition: transform 0.4s var(--ease-out-expo);
}
.works-item:hover .works-thumb,
.works-item:focus-within .works-thumb { transform: scale(1.08); }
.works-item:hover .works-overlay,
.works-item:focus-within .works-overlay { opacity: 1; }
.works-item:hover .works-overlay span,
.works-item:focus-within .works-overlay span { transform: translateY(0); }

/* ============================================
   会社概要（Company）
   ============================================ */
.company-table {
  max-width: 700px;
  margin: 0 auto;
}
.company-row {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
  padding: 20px 0;
  gap: 24px;
}
.company-row dt {
  flex: 0 0 120px;
  font-weight: 900;
  font-size: 0.9rem;
  color: var(--navy);
}
.company-row dd {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.8;
}
.company-row dd a {
  color: var(--navy-light);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.company-row dd a:hover { border-color: var(--navy-light); }

/* ============================================
   お問い合わせ（Contact）
   ============================================ */
.section--contact { padding: 0; }
.contact-split {
  display: flex;
  min-height: 400px;
}
.contact-half {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  position: relative;
  overflow: hidden;
}
.contact-half--orange {
  background: var(--orange);
  color: #fff;
}
.contact-half--navy {
  background: var(--navy);
  color: #fff;
}
.contact-half-inner {
  text-align: center;
  max-width: 320px;
}
.contact-label {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-bottom: 24px;
  letter-spacing: 0.1em;
}
.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 36px;
  border: 2px solid #fff;
  border-radius: 50px;
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.05em;
  transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
  background: transparent;
  cursor: pointer;
}
.contact-btn:hover,
.contact-btn:focus-visible {
  background: rgba(255,255,255,0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.contact-btn-arrow {
  font-size: 1.2rem;
  transition: transform 0.3s;
}
.contact-btn:hover .contact-btn-arrow { transform: translateX(4px); }

/* ============================================
   モーダル
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}
.modal-body {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 48px 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 1.8rem;
  color: var(--gray);
  line-height: 1;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal-title {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.modal-text {
  font-size: 0.9rem;
  color: var(--gray);
  margin-bottom: 28px;
  line-height: 1.8;
}
.modal-email {
  display: inline-block;
  padding: 14px 32px;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 50px;
  letter-spacing: 0.03em;
  transition: background 0.3s, transform 0.3s;
}
.modal-email:hover {
  background: var(--orange-dark);
  transform: translateY(-2px);
}

/* ============================================
   フッター
   ============================================ */
#footer {
  background: var(--bg-dark);
  color: rgba(255,255,255,0.5);
  padding: 40px 24px;
  text-align: center;
}
.footer-logo {
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 1.2rem;
  color: rgba(255,255,255,0.3);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}
.footer-copy {
  font-size: 0.75rem;
}

/* ============================================
   レスポンシブ: タブレット（〜1023px）
   ============================================ */
@media (max-width: 1023px) {
  .service-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 28px;
  }
  .works-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .section { padding: 80px 20px; }
}

/* ============================================
   レスポンシブ: モバイル（〜767px）
   ============================================ */
@media (max-width: 767px) {
  /* オープニングアニメーション */
  .opening-anata { margin-bottom: 12px; }
  .opening-block {
    padding: 10px 18px;
    font-size: clamp(1.1rem, 5.5vw, 1.6rem);
    letter-spacing: 0.08em;
  }
  .opening-cross { margin: 0 5px; font-size: clamp(1rem, 4.5vw, 1.4rem); }
  .opening-logo { font-size: clamp(2rem, 8vw, 3.5rem); }

  /* ナビ */
  .nav-inner { height: 52px; }
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 0.72rem; }

  /* ヒーロー */
  #hero { min-height: 100svh; }
  .hero-scroll-hint { bottom: 20px; }

  /* セクション */
  .section { padding: 64px 16px; }
  .section-header { margin-bottom: 48px; }

  /* サービス */
  .service-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px 20px;
  }
  .service-circle {
    width: 88px;
    height: 88px;
  }
  .service-circle svg { width: 34px; height: 34px; }
  .service-name { font-size: 0.95rem; }
  .service-desc { font-size: 0.78rem; }

  /* Works */
  .works-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 480px;
    margin: 0 auto;
  }
  .works-item { aspect-ratio: 16/9; }

  /* 会社概要 */
  .company-row {
    flex-direction: column;
    gap: 4px;
    padding: 16px 0;
  }
  .company-row dt { flex: none; font-size: 0.82rem; }
  .company-row dd { font-size: 0.88rem; }

  /* コンタクト */
  .contact-split { flex-direction: column; }
  .contact-half { padding: 56px 24px; min-height: auto; }

  /* モーダル */
  .modal-body { padding: 36px 24px; }
  .modal-email { font-size: 0.88rem; padding: 12px 24px; }
}

/* ============================================
   アクセシビリティ: モーション軽減
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ============================================
   ユーティリティ: 非表示（アニメーション前）
   ============================================ */
.is-hidden {
  opacity: 0;
  visibility: hidden;
}
