/* ===================================
   CSS 変数（デザイントークン）
   色・フォント・間隔などはここで一元管理。
   変更するときはこのブロックだけ編集すればOK。
=================================== */
:root {
  --color-primary:    #000;
  --color-secondary:  #fff;
  --color-accent:     #333;
  --color-muted:      #666;
  --color-light:      #eee;
  --font-primary:     "SF Pro Text", "SF Pro Icons", "AOS Icons", "Helvetica Neue",
                      Helvetica, Arial, sans-serif, system-ui;
  --transition-speed: 0.3s;
  --border-radius:    25px;
  --spacing-xs:  10px;
  --spacing-sm:  20px;
  --spacing-md:  30px;
  --spacing-lg:  50px;
  --spacing-xl:  100px;
}

/* ===================================
   ベーススタイル
=================================== */
body {
  margin: 0;
  place-items: center;
  min-height: 100vh;
  font-family: var(--font-primary);
  overflow-x: hidden;
}

section {
  width: 100vw;
  position: relative;
}

h2 {
  font-size: clamp(2rem, 3vw + 1rem, 8rem);
}

a {
  color: inherit;
  text-decoration: none;
  transition: all var(--transition-speed) ease;
}

/* セクション 1・2 共通のフルスクリーン中央揃えコンテナ */
.section__content {
  min-height: 100vh;
  width: 100vw;
  display: grid;
  place-items: center;
  position: sticky;
  top: 0;
  overflow: hidden;
}

/* ===================================
   Section 1 — Hero（「Haruto Miyai」SVG テキスト）
   height: 200vh でスクロールアニメーション用の余白を確保
=================================== */
section:nth-of-type(1) {
  height: 200vh;
  background: hsl(0 0% 100%);
  color: hsl(0 0% 0%);
}

/* Section 1 のみ 3D パースペクティブを追加（blow-out アニメーション用） */
section:nth-of-type(1) .section__content {
  transform-style: preserve-3d;
  perspective: 100vh;
}

section:nth-of-type(1) svg {
  --opacity: 1;
  font-weight: 600;
  font-size: clamp(2rem, 10vw + 1rem, 10rem);
  transform-origin: 50% 50%;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 50%;
  left: 50%;
  opacity: 0.4;
  transform: translate(-50%, -50%);
  overflow: hidden;
}

svg text {
  font-size: clamp(2rem, 6vw + 1rem, 6rem);
  font-weight: 600;
}

/* ===================================
   Section 2 — タグライン（「私のデザインは常に変化し続ける。」）
=================================== */
section:nth-of-type(2) {
  z-index: 2;
  color: hsl(0 0% 0%);
  min-height: 100vh;
  background: hsl(0 0% 0%);
}

section:nth-of-type(2) p {
  --opacity: 1;
  color: hsl(0 0% 100%);
  font-size: 70px;
  letter-spacing: 0;
  font-weight: bold;
  line-height: 1;
  width: 30ch;
  max-width: calc(100% - 4rem);
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  text-align: center;
  user-select: none;
  pointer-events: none;
}

/* ===================================
   Section 3 — 自己紹介プロフィール（全画面）
=================================== */
section:nth-of-type(3) {
  z-index: 5;
}

.profile-section {
  position: relative;
  padding-top: 100vh;
  background-image:
    linear-gradient(to right,  rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.90) 40%, rgba(0,0,0,0.1) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.28) 42%, rgba(0,0,0,0.10) 100%),
    url('/assets/images/0DCF802A-C503-4C13-9081-9D1F9B3C18CD.jpg');
  background-attachment: fixed, fixed, fixed;
  background-size: cover, cover, cover;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
  min-height: auto;
}

.profile-content {
  position: relative;
  padding: 100px 80px 60px 80px;
  max-width: 700px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-sizing: border-box;
}

.profile-content h2 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  margin: 0 0 36px 0;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.profile-content p {
  font-size: clamp(0.85rem, 0.95vw, 0.95rem);
  line-height: 1.8;
  margin: 0 0 24px 0;
  opacity: 0.93;
}

.profile-content p:last-child {
  margin-bottom: 0;
}

/* ===================================
   WORK セクション（作品カード横スクロール）
   カードを追加・削除するには index.html の
   class="section2" 内の .grid-item を編集する
=================================== */
.section2 {
  min-height: 70vh;
}

.grid-title {
  text-align: center;
  font-size: 48px;
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-sm);
  color: var(--color-accent);
}

.grid-container {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-lg) 10%;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE / Edge */
  transition: transform var(--transition-speed) ease,
              box-shadow var(--transition-speed) ease;
}

.grid-container::-webkit-scrollbar {
  display: none; /* Chrome / Safari */
}

/* カード共通スタイル（.grid-item と .grid-item-1 で共有） */
.grid-item,
.grid-item-1 {
  background-color: var(--color-secondary);
  padding: var(--spacing-sm);
  border-radius: var(--border-radius);
  border: 1px solid var(--color-light);
  min-width: 350px;
  min-height: 300px;
  flex-shrink: 0;
  transition: transform var(--transition-speed) ease,
              box-shadow var(--transition-speed) ease;
}

/* 「全ての記事を見る」カードは中央揃え */
.grid-item-1 {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.grid-item:hover,
.grid-item:focus,
.grid-item-1:hover,
.grid-item-1:focus {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.grid-container a {
  flex-direction: column;
  max-width: 400px;
  height: auto;
  white-space: normal;
  overflow: hidden;
}

.grid-item img,
.grid-item-1 img {
  max-width: 400px;
  height: 230px;
  object-fit: cover;
  border-radius: 10px;
}

.grid-item h3 {
  font-size: 28px;
  color: var(--color-accent);
  text-align: left;
  margin-top: var(--spacing-sm);
}

.grid-item-1 h3 {
  font-size: 28px;
  color: var(--color-accent);
  text-align: center;
  margin: 0;
}

.meta-info {
  display: flex;
  justify-content: flex-start;
  gap: var(--spacing-xs);
  margin: var(--spacing-lg) 0 0 0;
  font-size: 14px;
  color: var(--color-muted);
}

.meta-info .separator {
  color: #ccc;
}

.meta-info .weekday {
  font-weight: bold;
}

.meta-info .tag {
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--color-muted);
  font-weight: bold;
}

/* 左右スクロールボタン（共通） */
.scroll-right,
.scroll-left {
  position: absolute;
  top: 285px;
  background-color: #ddd;
  border: none;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.5;
  z-index: 10;
  transition: transform var(--transition-speed) ease;
}

.scroll-right {
  right: 20px;
  transform: scale(1);
}

.scroll-left {
  left: 20px;
  transform: translateY(-50%);
}

.scroll-right img,
.scroll-left img {
  width: 70%;
  height: 70%;
  pointer-events: none; /* img クリックを親ボタンに委譲 */
}

.scroll-right:hover,
.scroll-left:hover {
  background-color: #888;
}

/* ===================================
   ACTIVITIES セクション（活動紹介カード）
=================================== */
.activities-section {
  background: var(--color-secondary);
  padding-bottom: 80px;
  position: relative;
  z-index: 6;
}

.activities-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-md);
  padding: 0 var(--spacing-xl);
  max-width: 1400px;
  margin: 0 auto;
}

.activity-card {
  background: var(--color-secondary);
  border-radius: var(--border-radius);
  border: 1px solid var(--color-light);
  overflow: hidden;
  display: block;
  transition: transform var(--transition-speed) ease,
              box-shadow var(--transition-speed) ease;
}

.activity-card:hover,
.activity-card:focus {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

/* サムネイル領域（画像追加前はグレー表示） */
.activity-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-light);
  overflow: hidden;
}

.activity-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.activity-body {
  padding: var(--spacing-sm);
}

.activity-platform {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-muted);
  background: var(--color-light);
  padding: 3px 12px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

.activity-body h3 {
  font-size: 22px;
  color: var(--color-accent);
  margin: 12px 0 8px;
}

.activity-body p {
  font-size: 14px;
  line-height: 1.9;
  color: var(--color-muted);
  margin: 0;
}

/* ===================================
   SNS / Contact セクション
=================================== */
.contact-section {
  padding: var(--spacing-xl) 0;
  background-color: var(--color-secondary);
  position: relative;
  z-index: 6;
}

.contact-container {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  padding: 0 var(--spacing-md);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--color-primary);
  transition: transform var(--transition-speed) ease;
}

.social-links svg {
  fill: var(--color-secondary);
  width: 24px;
  height: 24px;
}

.social-links a:hover,
.social-links a:focus {
  transform: scale(1.1);
}

/* ===================================
   フッター
=================================== */
.site-footer {
  color: var(--color-primary);
  text-align: center;
  position: relative;
}

.footer {
  text-align: center;
  color: var(--color-primary);
}

/* ===================================
   ユーティリティ
=================================== */
.display-none {
  display: none;
}

/* ===================================
   スクロールアニメーション
   ブラウザが animation-timeline: scroll() をサポートする場合、
   CSS アニメーションで実装。非対応ブラウザは script.js 内の
   GSAP ScrollTrigger がフォールバックとして動作。
=================================== */
.signature path {
  --draw: 1.025;
  --end:  1.025;
  stroke-dasharray:  var(--end);
  stroke-dashoffset: var(--draw);
}

.signature :is(.eye, .nose) {
  fill: transparent;
}

@supports (animation-timeline: scroll()) {
  section {
    view-timeline-name: --section;
  }

  section:nth-of-type(1) svg {
    transform: unset;
    translate: -50% -50%;
    animation: blow-out both ease-in, fade-in both ease-in;
    animation-timeline: --section;
    animation-range: exit-crossing 10% exit 0%,
                     exit-crossing 10% exit-crossing 25%;
  }

  section:nth-of-type(2) p {
    animation: fade-in both linear, fade-out both linear;
    animation-timeline: --section;
    animation-range: entry 10% entry 35%, exit 0% exit 25%;
  }

  .video-wrap {
    animation: fade-in both linear, fade-out both linear;
    animation-timeline: --section;
    animation-range: entry 0% entry 25%, exit 10% exit 35%;
  }

  .video-wrap::after {
    opacity: 0;
  }

  .signature path {
    animation: draw both linear;
    animation-timeline: --section;
    animation-range: entry 50% entry 80%;
  }

  .signature :is(.eye, .nose) {
    animation: draw both linear, fill both linear;
    animation-timeline: --section;
  }

  .signature :is(.ear, .eye) {
    animation-range: entry 80% entry 90%;
  }

  .signature .nose {
    animation-range: entry 90% entry 100%;
  }

  @keyframes fade {
    to { opacity: 0; }
  }

  @keyframes fade-in {
    to { opacity: var(--opacity, 0.2); }
  }

  @keyframes fade-out {
    to { opacity: 0; }
  }

  @keyframes draw {
    to { stroke-dashoffset: 0; }
  }

  @keyframes fill {
    to { fill: currentColor; }
  }

  @keyframes blow-out {
    0%, 95% { background: transparent; }
    to {
      transform: translateZ(99vh);
      background: black;
    }
  }
}

/* ===================================
   メディアクエリ
=================================== */

/* タブレット（max-width: 900px）: 3列 → 1列 */
@media screen and (max-width: 900px) {
  .activities-grid {
    grid-template-columns: 1fr;
    padding: 0 var(--spacing-md);
  }

}

/* タブレット以下（max-width: 768px） */
@media screen and (max-width: 768px) {
  section:nth-of-type(2) p {
    writing-mode: vertical-rl;
    text-orientation: upright;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-120%, -50%);
    font-size: 40px;
    line-height: 1.5;
    height: auto;
    width: auto;
    text-align: center;
    white-space: nowrap;
  }

  .profile-content {
    padding: 80px 32px 60px 32px;
    max-width: 100%;
  }

  .profile-content h2 {
    font-size: 2.2rem;
  }

  .profile-content p {
    font-size: 1rem;
    line-height: 2;
  }

  /* モバイルはグラデーションを全体的に強く */
  .profile-overlay {
    background:
      linear-gradient(to right,  rgba(0,0,0,0.90) 0%, rgba(0,0,0,0.65) 50%, rgba(0,0,0,0.30) 100%),
      linear-gradient(to bottom, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.40) 50%, rgba(0,0,0,0.18) 100%);
  }
}

/* スマートフォン（max-width: 480px） */
@media screen and (max-width: 480px) {
  svg text {
    font-size: 55px;
  }

  .profile-content {
    padding: 60px 20px 50px 20px;
  }

  .profile-content h2 {
    font-size: 1.9rem;
  }

  .profile-content p {
    font-size: 0.95rem;
    line-height: 2;
  }

  .display-none {
    display: block;
    margin-bottom: 0;
  }

  .activities-grid {
    padding: 0 var(--spacing-xs);
    gap: var(--spacing-sm);
  }

  .activity-body h3 {
    font-size: 18px;
  }

  .activity-body p {
    font-size: 13px;
  }

  .footer {
    font-size: 10px;
  }
}
