html {
  scroll-behavior: smooth;
}

/* ベース設定 */
body {
  margin: 0;
  font-family: 'Helvetica Neue', sans-serif;
  color: #333;
}

/* 全体ヘッダー */
header {
  background-color: #222;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* 内側ラッパー */
header .inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ロゴ */
header .logo a {
  color: #fff;
  font-weight: bold;
  text-decoration: none;
  font-size: 1.2rem;
}

/* ナビ */
header .navi {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

header .navi a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
}

/* ハンバーガーアイコン（SPのみ表示） */
.sp-navi-toggle {
  display: none;
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
}

.sp-navi-toggle .bar {
  display: block;
  width: 24px;
  height: 2px;
  margin: 4px auto;
  background-color: #fff;
}

.sp-navi-toggle .menu,
.sp-navi-toggle .close {
  font-size: 0.8rem;
  display: none;
}

/* SP時の調整 */
@media screen and (max-width: 768px) {
  header .navi {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.4s ease;
    position: absolute;
    top: 60px;
    right: 0;
    width: 100%;
    background: #222;
    flex-direction: column;
    text-align: center;
    padding: 1rem 0;
  }

  header .navi.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .sp-navi-toggle {
    display: block;
  }

  .sp-navi-toggle .menu {
    display: inline;
  }

  .sp-navi-toggle.active .menu {
    display: none;
  }

  .sp-navi-toggle.active .close {
    display: inline;
  }
}

/* アニメーション定義 */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}


/* モバイルメニューのアニメーション */
.sp-navi-box {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: translateY(-10px);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #fff;
  z-index: 999;
}

html.sidebar-is-open .sp-navi-box {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

html.sidebar-is-closing .sp-navi-box {
  animation: fadeSlideOut 0.3s ease-in forwards;
}

/* メインビジュアル */
#mainVisual {
    position: relative;
    height: 60vh;
    background: url('../img/mainvisual.jpg') center center / cover no-repeat;
  }
  
  /* テキストラッパー */
  .nameWrapper {
    position: absolute;
    bottom: 30px;
    left: 30px;
    color: white;
  }
  
  /* 日本語名と英語名のスタイル */
  .nameWrapper .jp {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 0;
  }
  
  .nameWrapper .en {
    font-size: 1.5rem;
    margin: 0;
  }

  /* スキルセクション全体 */

  h2{
    font-size: 2.5em;
    text-align: center;
  }

  #skill {
    padding: 4rem 2rem;
    background-color: #f7f7f7;
  }
  
  .skill-list {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(320px,1fr));
    gap: 2rem;
    max-width: 960px;
    margin: 0 auto;
  }
  
  .skill-section-heading {
    font-size: 1.4rem;
    margin: 3rem auto 1rem;
    border-left: 4px solid #333;
    padding-left: 0.6rem;
    color: #333;
    max-width: 960px;
  }
  
  .skill-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* ← 2カラムに固定 */
    gap: 1.5rem;
    max-width: 960px;
    margin: 0 auto;
  }

  .skill-item {
    display: flex; /* ← これがないと横並びにならない */
    justify-content: space-between;
    align-items: flex-start;
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  }

  .skill-item.school-skill {
    background: #eef5ff; /* 青系 */
  }
  
  .skill-item.design-skill {
    background: #fff6ee; /* オレンジ系 */
  }

  
  /* 左：スキル説明 ／ 右：星 */
  .skill-text {
    flex: 1;
  }
  
  .skill-rating {
    display: flex;
    gap: 0.2rem;
    margin-left: auto;
  }

  .skill-item h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  
  .stars {
    margin-top: 0.5rem;
  }
  
  .star {
    font-size: 1.8rem;
    color: #ccc;
    display: inline-block;
    transform: scale(0);
    opacity: 0;
  }

  /* アクティブになった時にアニメーション適用 */
  .star.animate {
    animation: popIn 1.2s ease forwards;
    animation-delay: calc(var(--i) * 0.2s);
  }
  
  /* filledクラスには星が点灯 */
  .star.filled {
    color: gold;
  }
  
  /* ポップインアニメーション */
  @keyframes popIn {
    to {
      transform: scale(1);
      opacity: 1;
    }
  }
  
  /* ホバーでキラリ効果 */
  .star.filled:hover {
    animation: shine 0.3s ease;
  }
  
  @keyframes shine {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
  }
  
  /* 学習ベース（淡い青系） */
  .school-skill {
    background-color: #f4f8ff;
    border-left: 4px solid #6fa8dc;
  }
  
  /* デザイン系（淡いオレンジ系） */
  .design-skill {
    background-color: #fff7f0;
    border-left: 4px solid #f6b26b;
  }

  /* 制作実績セクション全体 */
  #works {
    padding: 4rem 2rem;
  }

  .work-item {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin:0 auto 2rem;
    padding: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    max-width: 960px;
  }
  
  .work-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #ddd;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
  }
  
  .work-image span {
    position: absolute;
    top: 50%;
    left: -30%;
    transform: rotate(-45deg) translateY(-50%);
    width: 160%;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-weight: bold;
    padding: 0.5em 0;
    font-size: 1.2rem;
  }

  /* 画像あり用 */
  .work-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    object-fit: cover;
    aspect-ratio: 16 / 9;
  }

  /* カテゴリごとの装飾（学校用） */
  .work-category.school .work-item {
    border-left: 5px solid #4b6cb7; /* 学校スキルと同系色に調整 */
    background: #eef5ff
  }
  
  .work-category.design .work-item {
    border-left: 5px solid #f6b26b;
    background: #fff7f0;
  }

  .work-text {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .work-text p{
    margin-top: 0.2em;
    margin-bottom: 0.8em;
  }
  .work-text .caution{
    color: crimson;
    text-align: center;
  }
  .tech-used {
    font-weight: bold;
    color: #555;
  }
  
  .note {
    font-size: 0.9rem;
    color: crimson;
  }

  .section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
  }
  
  .category-title {
    font-size: 1.5rem;
    margin: 2rem auto 1rem;
    border-left: 5px solid #666;
    padding-left: 0.5em;
    color: #333;
    max-width: 960px;
  }
  .work-thumbnail.no-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #ddd;
    overflow: hidden;
  }
  
  .work-thumbnail.no-image span {
    position: absolute;
    top: 50%;
    left: -30%;
    transform: rotate(-45deg) translateY(-50%);
    width: 160%;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-weight: bold;
    padding: 0.5em 0;
    font-size: 1.2rem;
  }

  a.btn {
    display: block;
    text-align: center;
    vertical-align: middle;
    text-decoration: none;
    width: 8rem;
    margin: auto;
    padding: 0.6rem 3rem;
    font-weight: bold;
    border: 2px solid #f06d6d;
    color: #f06d6d;
    border-radius: 100vh;
    transition: 0.5s;
  }
  a.btn:hover {
    color: #fff;
    background: #f06d6d;
  }
  
  .modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
  }
  
  .modal.show {
    display: flex;
    opacity: 1;
    visibility: visible;
  }
  
  .modal-content {
    max-width: 90%;
    max-height: 80%;
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
    border-radius: 8px;
    transform: scale(0.95);
    transition: transform 0.3s ease;
  }
  
  .modal.show .modal-content {
    transform: scale(1);
  }
  
  
  .modal-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: white;
    font-size: 2rem;
    cursor: pointer;
  }

  .contact-content {
    text-align: center;
    padding: 2rem 1rem;
  }
  
  .mail-link a {
    font-size: 1.2rem;
    color: #4b6cb7; /* 学習カテゴリカラーを流用 */
    text-decoration: none;
    font-weight: bold;
    word-break: break-all;
  }
  
  .mail-link a:hover {
    text-decoration: underline;
  }

  .footer {
    text-align: center;
    background: #f5f5f5;
    color: #666;
    font-size: 0.9rem;
    padding: 1.5rem 1rem;
    margin-top: 3rem;
    border-top: 1px solid #ccc;
  }
  
  .scroll-top-btn {
    position: fixed;
    right: 1rem;
    bottom: 2rem;
    background: #4b6cb7;
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 999;
  }
  
  .scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
  }
  
  
  @media screen and (min-width: 768px) {
    .work-item {
      flex-direction: row;
      align-items: flex-start;
    }
  
    .work-image {
      flex: 1;
    }
  
    .work-text {
      flex: 2;
      padding-left: 1rem;
    }
  }
  
  


  @media (max-width: 768px) {
    #mainVisual {
      height: 50vh;
      background-position: center 30%;
    }
  
    .nameWrapper {
      bottom: 20px;
      left: 20px;
    }
  
    .nameWrapper .jp {
      font-size: 1.8rem;
    }
  
    .nameWrapper .en {
      font-size: 1.2rem;
    }
    
    .skill-group {
      grid-template-columns: 1fr; /* ← スマホでは1カラムに */
    }
    
    .skill-item {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .skill-rating {
      margin-top: 0.5rem;
      margin-left: 0;
    }
  }