/* =========================
   Base (Desktop-only)
   ========================= */

/* スクロールスナップ（必要ならオン） */
/*
.container {
  overflow: auto;
  scroll-snap-type: y mandatory;
  height: 100vh;
}
*/

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

/* 使い回し変数・安全領域 */
:root {
  --grid-size: 28px;
  --grid-line: rgba(115, 115, 115, 0.533);
  --grid-bg: #ffffff;

  --header-h: 64px;         /* PCヘッダー高さ */
  --safe-pad: 24px;         /* セクション内の安全パディング */
  --round-lg: 30px;
  --shadow-md: 0 1px 10px rgba(0,0,0,.4);
  --font-body: "Zen Maru Gothic", sans-serif;

  /* iOSノッチ等 */
  --safe-top: max(env(safe-area-inset-top, 0px), 0px);
  --safe-bot: max(env(safe-area-inset-bottom, 0px), 0px);
}

/* ===== ヘッダー / ナビ ===== */
header {
  position: fixed;
  inset: 0 0 auto 0;
  height: calc(var(--header-h) + var(--safe-top));
  width: 100%;
  background: rgba(255,255,255,1.0);
  box-shadow: 0 4px 6px rgba(0,0,0,.1);
  z-index: 1000;
  padding-top: var(--safe-top);
}

nav {
  height: calc(100% - var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  box-sizing: border-box;
}

.nav-name{
  font-family: "Rampart One", sans-serif;
  font-weight: 400;
  font-size: 25px;
  font-style: normal;
}

nav ul {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav ul li { margin: 0 15px; }

nav ul li a {
  text-decoration: none;
  color: #333;
  font-weight: bold;
  padding: 10px 15px;
  transition: color .3s ease-in-out;
}

/* Hover 色分け */
.nav-name li:nth-child(1) a:hover { color: #ff6f91; }
.nav-name li:nth-child(2) a:hover { color: #9acd32; }
.nav-name li:nth-child(3) a:hover { color: #4fa3e3; }
.nav-name li:nth-child(4) a:hover { color: #b57edc; }

/* ===== セクション共通 ===== */
section {
  min-height: 100svh; /* iOS/Androidのツールバーを考慮 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding:
    calc(var(--safe-pad) + var(--header-h) + var(--safe-top)) var(--safe-pad)
    calc(var(--safe-pad) + var(--safe-bot));
  text-align: center;
  position: relative;
  box-sizing: border-box;
}

/* ===== トップ（動画背景＆パターン） ===== */
/* トップセクションを動画の器に（固定はしない） */
#home, #top, section:first-of-type {
  position: relative;
  min-height: 100svh;
  padding: 0;
  margin: 0;
  background: transparent;
}

/* 斜線パターン（必要に応じて） */
.top-pattern {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,.2),
    rgba(255,255,255,.2) 10px,
    transparent 10px,
    transparent 20px
  );
  z-index: 0;
}

/* 動画＝セクション内いっぱい。常時固定はしない */
#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;          /* 切らずに収める（上下黒帯） */
  object-position: center center;
  background: #000;             /* 黒帯色 */
  z-index: -1;                  /* パターンやテキストより背面 */
  filter: brightness(60%);
  pointer-events: none;         /* スクロール阻害しない */
}

/* 背景グリッド */
#about, #works, #contact {
  background:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--grid-size) - 1px),
      var(--grid-line) calc(var(--grid-size) - 1px),
      var(--grid-line) var(--grid-size)
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--grid-size) - 1px),
      var(--grid-line) calc(var(--grid-size) - 1px),
      var(--grid-line) var(--grid-size)
    ),
    var(--grid-bg);
  background-blend-mode: normal;
}

/* ===== 自己紹介 ===== */
#about {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.about-box {
  background: #ffffffa5;
  border-radius: var(--round-lg);
  box-shadow: var(--shadow-md);
  border: 4px solid #4a92ff;
  font-family: var(--font-body);
  color: #333;

  display: grid;
  grid-template-columns: 2fr 3fr;
  grid-template-rows: auto 1fr;
  gap: 30px 50px;
  padding: 60px 80px;
  text-align: left;
  max-width: 1000px;
  width: min(90vw, 1000px);
  box-sizing: border-box;
  margin: 0 auto;
}

.about-box h2 {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 2rem;
  margin: 0;
  color: #222;
  letter-spacing: .05em;
}

.about-image {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

/* 円枠 */
.circle-frame {
  width: 380px;
  height: 380px;
  border-radius: 50%;
  border: 6px solid #ffb7c5;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 6px 14px rgba(0,0,0,.1);
  background: #fff;
}

.circle-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.about-text {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  color: #333;
  font-size: 1.25rem;
  line-height: 2;
  letter-spacing: .03em;
  font-weight: 400;
  max-width: 90%;
  text-align: left;
}

/* ===== 作品 ===== */
#works {
  position: relative;
  z-index: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#works::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom right,
    rgba(255,225,233,.9),
    rgba(162,255,213,.522)
  );
  z-index: -1;
}

.works-box {
  background: #fff;
  border-radius: var(--round-lg);
  box-shadow: var(--shadow-md);
  border: 4px solid #ffa702;
  margin-top: 60px;
  font-family: var(--font-body);
  color: #333;

  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 32px;
  text-align: center;
  width: min(95vw, 1100px);
  box-sizing: border-box;
  overflow-x: clip;
}

.works-box h2 {
  font-size: 2rem;
  margin-bottom: 28px;
  color: #222;
  letter-spacing: .05em;
}

/* ギャラリー */
#video-gallery {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, max-content));
  justify-content: center;
  justify-items: center;
  align-items: start;
  gap: 20px;
  padding: 20px 0;
  margin: 0 auto;
  box-sizing: border-box;
  text-align: center;
}

.video-card {
  width: 220px;
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transition: transform .3s ease, box-shadow .3s ease;
  box-sizing: border-box;
  text-decoration: none;
  color: inherit;
}

.video-card img,
.video-card iframe {
  width: 100%;
  height: 120px;
  object-fit: cover;
  /* border-bottom: 3px solid #ffb7c5;  必要なら復活 */
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.video-meta {
  color: #333;
  font-family: var(--font-body);
  font-size: .85rem;
  padding: 6px 8px 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-badge {
  background: #ffb7c5;
  color: #fff;
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 8px;
  margin: 5px 0;
}

.pagination {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

/* ===== お問い合わせ ===== */
#contact {
  position: relative;
  z-index: 0;
  padding: 80px 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-direction: column;
  background: linear-gradient(
    to bottom right,
    rgba(255,231,50,.9),
    rgba(195,92,255,.6)
  );
  background-attachment: fixed; /* スマホでは後述メディアクエリでscrollに切替 */
}

#contact::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to right, transparent 0, transparent 27px, rgba(0,0,0,.08) 27px, rgba(0,0,0,.08) 28px
    ),
    repeating-linear-gradient(
      to bottom, transparent 0, transparent 27px, rgba(0,0,0,.08) 27px, rgba(0,0,0,.08) 28px
    );
  opacity: .4;
  z-index: -1;
  mix-blend-mode: multiply;
}

.contact-box {
  background: #fff;
  border-radius: 24px;
  border: 4px solid #4a92ff;
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
  width: min(92vw, 760px);
  margin: 0 auto;
  padding: 28px 26px;
  box-sizing: border-box;
}

#contact h1 {
  text-align: center;
  font-size: 1.8rem;
  margin: 0 auto 24px;
  color: #222;
  width: 100%;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px; overflow: hidden;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: .95rem;
  margin-bottom: 6px;
}

#contact input[type="text"],
#contact input[type="email"],
#contact textarea {
  width: 100%;
  border: 1.5px solid #d6d9e0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  box-sizing: border-box;
  transition: border-color .2s ease, box-shadow .2s ease;
}

#contact input:focus,
#contact textarea:focus {
  outline: none;
  border-color: #4a92ff;
  box-shadow: 0 0 0 4px rgba(74,146,255,.15);
}

.actions { display: flex; justify-content: center; margin-top: 12px; }

.btn-primary {
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  font-weight: 700;
  background: #4a92ff;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(74,146,255,.25);
  transition: transform .06s ease, filter .2s ease;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: translateY(1px); }

/* ===== フッター ===== */
footer {
  background: #5f5f5f;
  text-align: center;
  padding: 25px 20px;
  color: #fff;
  font-size: 14px;
  width: 100%;
  position: relative;
  bottom: 0;
  margin-top: 0;
  box-sizing: border-box;
  line-height: 1.6;
  border-top: 3px solid rgba(255,255,255,.4);
}

/* ===== 動作軽減（任意） ===== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* =========================================================
   Responsive Add-on（モバイル〜タブレット最適化）
   ========================================================= */

/* タッチ端末では :hover を限定（誤反応防止） */
@media (hover: none) {
  .nav-name li a { transition: none; }
  .nav-name li a:active { opacity: .8; }
}

/* ====== 1200px以下：ゆるく圧縮 ====== */
@media (max-width: 1200px) {
  .about-box {
    gap: 24px 36px;
    padding: 48px 56px;
    width: min(92vw, 960px);
  }
  .circle-frame { width: 340px; height: 340px; }
  .about-text { max-width: 100%; }
}

/* ====== 992px以下：タブレット最適化 ====== */
@media (max-width: 992px) {
  :root { --header-h: 60px; }

  nav { justify-content: space-between; }
  .nav-name { font-size: 22px; }

  /* ナビが折り返しても崩れないように */
  nav ul {
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  nav ul li { margin: 0; }
  nav ul li a { padding: 8px 10px; }

  .about-box {
    grid-template-columns: 1fr 1.2fr;
    padding: 40px 44px;
    gap: 22px 30px;
  }
  .circle-frame { width: 300px; height: 300px; }
  .about-text { font-size: 1.1rem; line-height: 1.9; }

  /* 作品カードを流動幅に */
  #video-gallery {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }
  .video-card {
    width: 100%;
    max-width: 360px;
    height: auto;
  }
  .video-card img,
  .video-card iframe {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    display: block;
    object-fit: cover;
  }
}

/* ====== 768px以下：スマホ基準 ====== */
@media (max-width: 768px) {
  :root {
    --safe-pad: 18px;
    --round-lg: 22px;
  }

  /* ヘッダー */
  header { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
  nav { padding: 0 12px; }
  .nav-name { font-size: 20px; }

  /* 横スクロールナビで崩れ防止（ハンバーガー不要版） */
  nav ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    max-width: 100%;
  }
  nav ul::-webkit-scrollbar { display: none; }
  nav ul li { flex: 0 0 auto; }
  nav ul li a { padding: 10px 12px; font-weight: 600; }

  /* トップ動画：黒帯保持で視認性確保 */
  #video { filter: brightness(65%); }

  /* 自己紹介：1カラムに */
  .about-box {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 28px 22px;
    gap: 18px;
    width: min(94vw, 640px);
    text-align: center;
  }
  .about-box h2 { font-size: clamp(1.4rem, 2.8vw + 1rem, 1.8rem); }
  .about-image { grid-column: 1; grid-row: 2; justify-content: center; }
  .circle-frame { width: 240px; height: 240px; }
  .about-text {
    grid-column: 1; grid-row: 3;
    text-align: left;
    font-size: 1rem; line-height: 1.8;
    max-width: 100%;
    margin: 0 auto;
  }

  /* 作品：カード詰めすぎ回避 */
  .works-box {
    padding: 24px 16px;
    width: min(96vw, 720px);
    margin-top: 36px;
  }
  .works-box h2 { font-size: clamp(1.3rem, 2.5vw + 1rem, 1.7rem); }
  #video-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .video-meta { font-size: .8rem; padding: 6px 6px 10px; }
  .pagination { gap: 8px; margin-top: 14px; }

  /* お問い合わせ：背景のfixedはiOSでカクつくため解除 */
  #contact { background-attachment: scroll; padding: 56px 0; }
  .contact-box {
    width: min(94vw, 620px);
    padding: 22px 18px;
    border-radius: 18px;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #contact input[type="text"],
  #contact input[type="email"],
  #contact textarea {
    font-size: 16px; /* iOSズーム防止 */
    padding: 12px;
  }
  .btn-primary {
    padding: 12px 22px;
    font-size: 16px;
    box-shadow: 0 6px 12px rgba(74,146,255,.24);
  }

  /* フッター：タップしやすく */
  footer { padding: 20px 16px; font-size: 13px; }
}

/* ====== 600px以下：小型スマホ ====== */
@media (max-width: 600px) {
  :root { --grid-size: 22px; } /* 背景グリッドを細かくし過ぎない */

  .circle-frame { width: 210px; height: 210px; }
  #video-gallery { grid-template-columns: 1fr; }
  .video-card { max-width: 520px; margin-inline: auto; }

  /* ナビの文字サイズ微調整 */
  nav ul li a { font-size: 0.95rem; }
}

/* ====== 480px以下：極小端末・折り畳み ====== */
@media (max-width: 480px) {
  :root { --safe-pad: 14px; }

  header { box-shadow: 0 2px 6px rgba(0,0,0,.08); }
  .nav-name { font-size: 18px; }
  nav ul li a { padding: 8px 10px; }

  .about-box { padding: 22px 16px; }
  .circle-frame { width: 190px; height: 190px; }
  .about-text { font-size: .98rem; line-height: 1.75; }

  .works-box { padding: 18px 12px; }
  .video-meta { font-size: .78rem; }

  .contact-box { width: 92vw; padding: 18px 14px; }
}

/* ====== 視覚効果を軽量化（小画面＋低性能） ====== */
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
  .video-card { transition: transform .18s ease, box-shadow .18s ease; }
}
