/* モーダル上部の白帯 */
.modal-header {
  width: 100%;
  background: #fff;
  color: #111;
  text-align: center;
  font-size: 1.05rem;
  font-weight: bold;
  padding: 0.8rem 0.5rem 0.6rem 0.5rem;
  margin: 0;
  border-bottom: 1px solid #eee;
  box-sizing: border-box;
}
/* 全画面ボタン（ピクチャーインピクチャー） */
.fullscreen-btn {
  position: absolute;
  right: 16px;
  bottom: 80px;
  z-index: 1000;
  padding: 0.2em 0.5em;
  background: transparent; /* 背景を透過 */
  border: 2px solid rgba(255,255,255,0.9); /* 動画上で見やすい白系ボーダー */
  border-radius: 6px;
  font-weight: bold;
  font-size: 1.1rem;
  color: #fff; /* 透過時は白いアイコンに */
  cursor: pointer;
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  transition: background 0.2s, color 0.2s;
  line-height: 1;
}
.fullscreen-btn:hover {
  background: rgba(255,255,255,0.95); /* ホバーで白背景にしてコントラストを確保 */
  color: #111;
}
/* === Fullscreen Button for Modal Video === */
/* Global */
:root{ --line:#e5e5e5; --text:#111; --muted:#666; --bg:#fff; }
html{ scroll-behavior:smooth; }
body{
  margin:0; font-family:'Noto Sans JP',system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg); color:var(--text); text-align:center;
  opacity:0; transition:opacity .5s ease; /* フェード */
}
body.fade-in{ opacity:1; }
body.fade-out{ opacity:0; }

/* 基本のメディア要素はコンテナに収まるように（裸の<img>が巨大化するのを防止） */
img, video { max-width: 100%; height: auto; display: block; }

/* Motion reduce */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; scroll-behavior:auto !important }
}

header{ display:flex; justify-content:space-between; align-items:center; padding:1rem 2rem; border-bottom:1px solid var(--line); }
.logo{ font-size:1rem; font-weight:700; }
.header-actions{ display:flex; align-items:center; gap:.75rem; }
.lang-toggle{ border:1px solid var(--line); background:#fff; padding:.4rem .6rem; border-radius:.5rem; cursor:pointer; font-weight:600 }

/* Hamburger */
.hamburger{ cursor:pointer; width:28px; height:20px; position:relative; border:none; background:none }
.hamburger span,.hamburger::before,.hamburger::after{ content:''; position:absolute; left:0; width:100%; height:3px; background:var(--text); transition:all .3s ease; border-radius:2px }
.hamburger span{ top:50%; transform:translateY(-50%) }
.hamburger::before{ top:0 } .hamburger::after{ bottom:0 }

/* Drawer */
.menu{ position:fixed; top:0; right:-100%; width:250px; height:100%; background:#fff; box-shadow:-2px 0 10px rgba(0,0,0,.1); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2rem; transition:right .3s ease-in-out; z-index:1000 }
.menu[aria-hidden="false"]{ right:0; animation:slideIn .3s forwards }
.menu.closing{ animation:slideOut .3s forwards }
@keyframes slideIn{ from{ right:-100%; opacity:0 } to{ right:0; opacity:1 } }
@keyframes slideOut{ from{ right:0; opacity:1 } to{ right:-100%; opacity:0 } }
.close-btn{ position:absolute; top:1.2rem; right:1.2rem; background:none; border:none; font-size:2rem; cursor:pointer; color:var(--text); transition:transform .2s ease,color .2s ease }
.close-btn:hover{ color:var(--muted); transform:rotate(90deg) }

.menu a{ text-decoration:none; color:var(--text); font-weight:600; font-size:1.1rem; position:relative; transition:color .3s ease }
.menu a::after{ content:''; position:absolute; bottom:-4px; left:50%; transform:translateX(-50%) scaleX(0); transform-origin:center; width:80%; height:2px; background:var(--text); transition:transform .3s ease }
.menu a:hover{ color:var(--muted) }
.menu a:hover::after{ transform:translateX(-50%) scaleX(1) }

main{ margin-top:4rem }
h1{ font-size:3rem; margin:.2rem 0 .5rem }
.tagline{ font-size:.95rem; color:var(--muted) }

/* Works */
.works-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); gap:1.5rem; max-width:1000px; margin:2rem auto; padding:0 1rem }
.work-card{ border:1px solid var(--line); border-radius:10px; overflow:hidden; background:#fff; transition:transform .3s ease, box-shadow .3s ease }
.work-card:hover{ transform:translateY(-6px); box-shadow:0 6px 20px rgba(0,0,0,.1) }
.work-card img{ width:100%; height:160px; object-fit:cover }
.work-card h3{ margin:.8rem 0 .4rem }
.work-card p{ font-size:.9rem; color:#555; margin:0 0 1rem }

/* Contact */
.contact-section{ max-width:720px; margin:2rem auto; padding:0 1rem }
.contact-form{ text-align:left; margin:1.5rem auto 0 }
.field{ display:flex; flex-direction:column; gap:.4rem; margin-bottom:1rem }
.field input,.field select,.field textarea{ border:1px solid var(--line); border-radius:.6rem; padding:.7rem .8rem; font-size:1rem }
.btn{ display:inline-block; border:1px solid var(--line); background:#111; color:#fff; padding:.7rem 1rem; border-radius:.6rem; font-weight:700; cursor:pointer }
.form-note{ color:var(--muted); font-size:.85rem; margin-top:.6rem }

/* Focus visible（アクセシブルなフォーカス表示） */
:focus-visible{ outline:2px solid #7c9cff; outline-offset:2px; border-radius:.25rem }
/* モーダル内の video はネイティブコントロールがあるため青枠を外す */
.modal-media video:focus,
.modal-media video:focus-visible{ outline:none; }

/* Responsive */
@media (max-width:640px){ h1{ font-size:2.2rem } .menu{ width:200px } }

.about-section {
  max-width: 800px;
  margin: 2rem auto;
  text-align: center;
  line-height: 1.8;
  font-size: 1rem;
  color: #333;
  padding: 0 1.5rem;
}
    .modal-caption {
      background: #fff !important;
      color: #111 !important;
      text-align: center;
      font-size: 0.95rem;
      padding: 1rem;
      margin: 0;
      box-shadow: none !important;
      border-radius: 0 !important;
      border: none !important;
      display: block;
    }
.lang-toggle .sep{ color:var(--muted); }

.lang-toggle [data-lang-choice]{
  opacity:.55; transition:opacity .2s ease, transform .2s ease;
  padding:0 .1rem;
}
.lang-toggle [data-lang-choice][aria-current="true"]{
  opacity:1; font-weight:800; text-decoration:underline;
}
.lang-toggle:hover [data-lang-choice]:not([aria-current="true"]){
  opacity:.75;
}

/* キーボード/アクセシビリティ */
.lang-toggle:focus-visible{ outline:2px solid #7c9cff; outline-offset:2px; }

/* === Stylish Social Buttons (Contact) === */
.sns-lead{ margin-top:1.25rem; margin-bottom:.25rem; color:var(--muted); font-weight:700; letter-spacing:.4px }

/* Removed original .social-links and .social-btn styles for SNS block replaced */

/* === Simple QR cards for SNS === */
.sns-qr{ display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:18px; max-width:740px; margin:1rem auto 0; padding:0 1rem }
.qr-card{ display:flex; flex-direction:column; align-items:center; gap:.5rem; text-decoration:none; padding:1rem; border:1px solid var(--line); border-radius:16px; background:#fff; transition:transform .15s ease, box-shadow .2s ease }
.qr-card:hover{ transform:translateY(-3px); box-shadow:0 8px 22px rgba(0,0,0,.08) }
.qr-card img{ width:100%; max-width:260px; aspect-ratio:1/1; border-radius:12px; object-fit:cover }
.qr-card .label{ font-weight:800; color:#111 }
.qr-card .handle{ color:var(--muted); font-weight:600 }

/* subtle brand accents on border */
.qr-card.insta{ border-color:#6ecfd0 } /* green tint */
.qr-card.yt{ border-color:#eaa0aa }    /* pink tint */

/* === SNS QR Section (above contact form) === */
.sns-section {
  max-width: 800px;
  margin: 2rem auto 3rem;
  text-align: center;
  padding: 0 1rem;
}

.sns-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.sns-qr-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}

.sns-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sns-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.sns-item img {
  border-radius: 12px;
  max-width: 220px;
  height: auto;
}

.sns-label {
  font-weight: 700;
  margin-top: 0.25rem;
  color: #111;
}

.sns-link {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  word-break: break-all;
  transition: color 0.2s;
}

.sns-link:hover {
  color: #000;
}

/* Subtle accent per brand */
.sns-item:nth-child(1) {
  border-color: #6ecfd0;
}

.sns-item:nth-child(2) {
  border-color: #eaa0aa;
}

@media (max-width: 640px) {
  .sns-qr-grid {
    flex-direction: column;
    align-items: center;
  }
}

/* === Portfolio Grid === */
.portfolio-grid {
  display: grid;
  /* PCで詰まりすぎないようデフォルトを4列に変更 */
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  max-width: 1400px;
  margin: 2.5rem auto 0 auto;
  padding: 0 1rem;
}

#portfolioGrid {
  margin-top: 3rem;
}
#portfolioGrid2 {
  margin-top: 2.5rem;
}

/* 2段目グリッドの上に余白 */
#portfolioGrid2 {
  margin-top: 2.5rem;
}

.portfolio-item {
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #f5f5f5;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.portfolio-item:hover {
  /* PCでのホバーによるレイアウトシフトを弱める */
  transform: scale(1.03) translateY(-8px);
  box-shadow: 0 16px 32px rgba(0,0,0,0.16);
}

.portfolio-item img,
.portfolio-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* aspect-ratio 未対応ブラウザ向けのフォールバック */
@supports not (aspect-ratio: 1) {
  .portfolio-item { position: relative; }
  .portfolio-item::before { content: ''; display: block; padding-top: 100%; }
  .portfolio-item > img,
  .portfolio-item > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
}

.portfolio-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  pointer-events: none;
}

.portfolio-item:hover::after {
  background: rgba(0, 0, 0, 0.1);
}

/* === Modal === */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal[aria-hidden="false"] {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  max-width: calc(92vw - 5px);
  max-height: calc(85vh - 5px);
  background: #fff;
  box-sizing: border-box;
  /* 余白を控えめにして表示領域を広く確保 */
  padding-left: 12px;
  padding-right: 12px;
  padding-top: 12px;
  border-radius: 8px;
  /* ナビゲーションボタンが切れないように可視にする */
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-media {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  max-height: 70vh;
  overflow: auto;
  padding: 0;
}

 .modal-media img,
 .modal-media video,
 .modal-media iframe {
  /* モーダルコンテンツ幅に追従（右側のクリップを防ぐ） */
  width: auto;
  height: auto;
  max-width: calc(100% - 6px); /* 余白をさらに最小限にして最大化 */
  max-height: 70vh;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  overflow: hidden;
 }

 /* YouTubeのiframeは16:9のアスペクト比を保ちつつ画像と同じサイズに */
 .modal-media iframe {
   aspect-ratio: 16 / 9;
   width: 100%;
   max-width: calc(100% - 6px);
   height: auto;
 }

 /* 画像のみ白枠（動画はコントロールと干渉しないよう枠なし） */
 .modal-media img {
   box-shadow: 0 0 0 3px #fff; /* さらに細くして操作ボタンに干渉しにくく */
   margin: 0 auto; /* 中央揃え */
 }
 .modal-media video,
 .modal-media iframe {
   box-shadow: none;
   background: #000; /* 黒地で見やすく */
 }


.modal-close {
  position: absolute;
  top: 16px; /* 余白を少し増やして白枠や角から離す */
  right: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 1.8rem; /* やや小さくして重なりを抑制 */
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-nav {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 1.35rem; /* さらに左右の余白を少し増やす */
  pointer-events: none;
}

.modal-prev,
.modal-next {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.9rem; /* 気持ち小さくして重なりを軽減 */
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  pointer-events: auto;
  z-index: 5; /* メディアより前面 */
}

.modal-prev:hover,
.modal-next:hover {
  background: rgba(255, 255, 255, 0.25);
}

.modal-caption {
  background: #fff !important;
  color: #111 !important;
  padding: 1rem;
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  box-shadow: none !important;
  border-radius: 0 !important;
}

/* Responsive Portfolio Grid */
@media (max-width: 1200px) {
  .portfolio-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
  }
}

@media (max-width: 900px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 640px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
  
  .modal-content {
    max-width: 96vw; /* 余白調整に伴いやや広げる */
    max-height: 62vh;
  }
}

/* 大画面向け（余裕がある場合に5列） */
@media (min-width: 1500px) {
  .portfolio-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}