/* =========================
   Projects（一覧）
========================= */

.projects {
  position: relative;
  /* 見出しの上端をページ上端から230pxにする（ヘッダー下端108px + 122px） */
  padding-top: calc(var(--header-top) + var(--header-height) + 122px);
}

/* 共通コンテナ（1100px + 左右padding 16px / SP 20px） */
.projects-inner {
  position: relative;
  width: 100%;
  max-width: calc(1100px + 32px);
  margin: 0 auto;
  padding: 0 16px 201px;
}

.projects-title {
  margin: 0;
  font-family: var(--font-en);
  font-size: 80px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-text);
}

/* 見出しブロックの高さを127pxにそろえる（見出し 100 + 間隔 8 + 19） */
.projects-kana {
  margin: 8px 0 0;
  line-height: 19px;
}

/* 見出しの右の説明文（管理画面の「一覧ページの説明文」。inc/archive-lead.php）。
   PC は見出し(左)と説明文(右)の2列で、説明文は見出しの上端にそろえる(文章が短くても上に置く)。SP は見出しの下に置く */
.projects-head:has(.projects-lead) {
  display: grid;
  grid-template-columns: auto minmax(0, 480px);
  justify-content: space-between;
  align-items: start;
  column-gap: 40px;

  @media (max-width: 768px) {
    display: block;
  }
}

.projects-head:has(.projects-lead) > :not(.projects-lead) {
  grid-column: 1;
}

.projects-lead {
  /* 背景の装飾(惑星・UFO)と重なる位置なので、手前に出して白い箱に入れ、文字を読めるようにする */
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 20px 24px;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.9);
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.06);
  font-size: 14px;
  line-height: 1.8;

  @media (max-width: 768px) {
    margin-top: 24px;
    padding: 16px 20px;
  }
}

.projects-lead > * {
  margin: 0;
}

.projects-lead > * + * {
  margin-top: 1em;
}

.projects-lead a {
  color: var(--color-pink);
  text-decoration: underline;
}

/* --- 絞り込み・検索 --- */

.projects-filter-form {
  margin-top: 100px;
}

.projects-filter-label {
  margin-top: 0;
  font-size: 12px;
}

.projects-filter-buttons,
.projects-filter-tags {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;

  button {
    font-family: inherit;
    cursor: pointer;
  }
}

/* プロジェクト別: 6列 / ボタン 170 × 49 / 列間 16・行間 12 */
.projects-filter-buttons {
  display: grid;
  grid-template-columns: repeat(6, 170px);
  justify-content: space-between;
  gap: 12px 16px;
}

.projects-filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 49px;
  padding: 16px 36px;
  border: 1px solid var(--color-grey-deep);
  border-radius: 4px;
  background: var(--color-white);
  font-size: 14px;
  font-weight: 700;
  line-height: 17px;
  color: var(--color-text);
  white-space: nowrap;
  transition: border-color 0.2s ease;

  &:hover,
  &.is-active {
    border-color: var(--color-text);
  }
}

.projects-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  margin-top: 40px;
}

.projects-filter-tags-wrap {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.projects-filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;

  /* li の行ボックス分の高さを出さない（タグ高さ 25px） */
  li {
    display: flex;
  }
}

/* タグ: カテゴリーは黒地、対象年齢はグレー地。<label> + チェックボックス(チェックボックス自体は隠す) */
.projects-filter-tag {
  position: relative;
  cursor: pointer;
  padding: 4px 10px;
  border: 0;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  line-height: 17px;
  transition: opacity 0.2s ease;

  &:hover {
    opacity: 0.7;
  }

  &.is-category {
    background: var(--color-text);
    color: var(--color-white);
  }

  &.is-age {
    background: var(--color-grey-deep);
    color: var(--color-text);
  }

  /* 選択中はピンク地で区別する */
  &.is-active,
  &:has(input:checked) {
    background: var(--color-pink);
    color: var(--color-white);
  }

  &:has(input:focus-visible) {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
  }

  input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
}

/* 検索: 382 × 64 / border 1px #e1e1e1 */
.projects-search {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  width: 382px;
  height: 64px;
  padding: 16px 20px;
  border: 1px solid #e1e1e1;
  border-radius: 4px;
  background: var(--color-white);
}

.projects-search-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);

  &::placeholder {
    color: var(--color-grey-deep);
    opacity: 1;
  }
}

.projects-search-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text);
  cursor: pointer;
}

/* --- 一覧: 3列 / カード 324 × 544 / 行間 60 --- */

.projects-list {
  display: grid;
  grid-template-columns: repeat(3, 324px);
  justify-content: space-between;
  row-gap: 60px;
  margin: 120px 0 0;
  padding: 0;
  list-style: none;

  > li[hidden] {
    display: none;
  }
}

/* カード: padding 32 32 64 / 角丸 12 / 枠線 0.75px */
.projects-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 32px 32px 64px;
  border: 0.75px solid var(--color-text);
  border-radius: 12px;
  background: var(--color-white);
  color: var(--color-text);
  transition: box-shadow 0.2s ease;

  &:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  }

  > * {
    width: 260px;
    max-width: 100%;
  }
}

.projects-card-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ステータス: ドット 14px / 募集中はピンク・募集終了は水色 */
.projects-card-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  line-height: 14px;

  &::before {
    content: "";
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-status-open);
  }

  &.is-closed::before {
    background: var(--color-status-closed);
  }

  /* 募集状況が無いカード。画像の位置をそろえるため、高さだけ残して見えなくする */
  &.is-none {
    visibility: hidden;
  }
}

.projects-card-img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  background: #d9d9d9;
}

.projects-card-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.projects-card-title {
  margin: 0;
  font-family: "Zen Kaku Gothic Antique", var(--font-jp);
  font-size: 20px;
  font-weight: 700;
  line-height: 29px;
  text-align: center;
}

/* 氏名・学校名(プロジェクトのカードのみ・任意)。タイトルの下にピンク色で、タイトルに寄せて置く(上の gap 16px を半分に) */
.projects-card-person {
  margin: -8px 0 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-pink);
  text-align: center;
}

.projects-card-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

/* ハッシュタグ: 角丸 50 / 背景ライトグレー / 11px */
.projects-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;

  li {
    padding: 4px 10px;
    border-radius: 50px;
    background: var(--color-grey);
    font-size: 11px;
    line-height: 13px;
  }
}

.projects-no-results {
  margin: 0;
  padding: 40px 0 0;
  text-align: center;
}

/* --- ページ送り: 番号 41 × 40 / 現在ページは青地 --- */

.projects-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 67px;
}

.projects-pagination-list {
  display: flex;
  gap: 8px;
  margin: 0 4px;
  padding: 0;
  list-style: none;
}

.projects-pagination-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 41px;
  height: 40px;
  border-radius: 50px;
  background: var(--color-grey);
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  color: var(--color-text);
  transition: background-color 0.2s ease;

  &:is(a):hover {
    background: var(--color-grey-deep);
  }

  &.is-current {
    background: var(--color-blue);
    color: var(--color-grey);
  }
}

/* 矢印: 16px。次・最後は左向きの SVG を反転 */
.projects-pagination-arrow {
  display: block;
  width: 16px;
  height: 16px;
  background: center / contain no-repeat;

  &.is-first {
    background-image: url("../assets/arrow-pagenation-is-first.svg");
  }

  &.is-prev {
    background-image: url("../assets/arrow-pagenation-prev.svg");
  }

  &.is-next {
    background-image: url("../assets/arrow-pagenation-prev.svg");
    transform: scaleX(-1);
  }

  &.is-last {
    background-image: url("../assets/arrow-pagenation-is-first.svg");
    transform: scaleX(-1);
  }

  &.is-disabled {
    opacity: 0.3;
  }
}

/* 中間幅: プロジェクト別ボタンは折り返す */
@media (max-width: 1131px) {
  .projects-filter-buttons {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .projects-list {
    grid-template-columns: repeat(2, minmax(0, 324px));
    justify-content: space-evenly;
  }
}

@media (max-width: 960px) {
  .projects-title {
    font-size: 48px;
  }
}

/* SP: 左右余白 20px */
@media (max-width: 768px) {
  .projects {
    /* 見出しの上端をページ上端から160pxにする */
    padding-top: calc(var(--header-top) + var(--header-height) + 52px);
  }

  .projects-inner {
    padding: 0 20px 107px;
  }

  /* プロジェクト別: 2列（160 × 49）。160 × 2 + 15 = 335 */
  .projects-filter-buttons {
    grid-template-columns: repeat(2, minmax(0, 160px));
    gap: 12px 15px;
  }

  .projects-filter-btn {
    padding: 16px 0;
  }

  .projects-filter-row {
    flex-direction: column;
  }

  .projects-search {
    width: 100%;
  }

  .projects-list {
    grid-template-columns: minmax(0, 1fr);
    margin: 0 auto;
    margin-top: 100px;
    max-width: max-content;
    width: 100%;
  }

  .projects-pagination {
    margin-top: 40px;
  }
}
