/* ============================================================
   Projects page — projects.css
   (Astroスコープ外の外部CSSとしてimportすることでJS生成要素にも確実に適用)
   ============================================================ */

:root {
  --pj-bg: #FFFDF5;
  --pj-black: #232323;
  --pj-orange: #FF9933;
  --pj-darkorange: #F46D17;
  --pj-white: #ffffff;
  --pj-noto: 'Noto Sans JP', sans-serif;
  --pj-roboto: 'Roboto', sans-serif;
}

html, body {
  background-color: #FFFDF5 !important;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  color: var(--pj-black);
  font-family: var(--pj-noto);
}

.pj-wrap {
  background-color: #FFFDF5;
  width: 100%;
}

/* ── パンくず ── */
.pj-breadcrumb-bar {
  align-self: stretch;
  height: 58px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 88px;
  box-sizing: border-box;
  margin-top: 125px;
}
.pj-breadcrumb-inner {
  flex: 1;
  font-size: 16px;
  letter-spacing: 0.05em;
  line-height: 38px;
  color: var(--pj-black);
  font-family: var(--pj-noto);
}
.pj-breadcrumb-inner a { color: inherit; text-decoration: none; }
.pj-breadcrumb-inner a:hover { opacity: 0.7; }
.pj-breadcrumb-current { color: inherit; }

/* ── 検索結果表示 ── */
.pj-search-result {
  width: 100%;
}
.pj-search-result-text {
  margin: 0;
  font-size: 21px;
  font-family: var(--pj-noto);
  letter-spacing: 0.05em;
  color: var(--pj-black);
  line-height: 1.5;
}

/* ── ヒーローセクション ── */
.pj-hero {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 88px;
  padding: 48px 88px 48px;
  max-width: 1920px;
  margin: 0 auto;
  box-sizing: border-box;
}
.pj-hero-left {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.pj-title {
  margin: 0;
  font-size: 108px;
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1;
  font-family: var(--pj-roboto);
  color: var(--pj-black);
}
.pj-subtitle {
  margin: 0;
  font-size: 33px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.4;
  color: var(--pj-black);
  font-family: var(--pj-noto);
}
.pj-desc {
  margin: 0;
  padding-top: 16px;
  font-size: 21px;
  font-weight: 400;
  line-height: 38px;
  letter-spacing: 0.05em;
  color: var(--pj-black);
  font-family: var(--pj-noto);
  max-width: 680px;
  flex-shrink: 1;
}

/* ── 検索 + フィルター ── */
.pj-controls {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  padding: 0 88px 98px;
  max-width: 1920px;
  margin: 0 auto;
  box-sizing: border-box;
}
.pj-search-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 823px;
  flex-shrink: 1;
  min-width: 0;
}
.pj-search-form {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 68px;
  border: 1px solid #D7D7D7;
  padding: 0 24px;
  background: #ffffff;
  min-width: 0;
}
.pj-search-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.45;
}
.pj-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 21px;
  font-family: var(--pj-noto);
  letter-spacing: 0.05em;
  color: var(--pj-black);
  min-width: 0;
}
.pj-search-input::placeholder {
  color: #CBCBCB;
  letter-spacing: 0.05em;
}

/* ── フィルタータブ ── */
.pj-filter-tabs {
  display: flex;
  gap: 0;
  align-items: center;
  flex-shrink: 0;
}
.pj-tab {
  position: relative;
  padding: 6px 24px 8px;
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--pj-black);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--pj-noto);
  transition: color 0.2s;
  white-space: nowrap;
}
.pj-tab:hover { color: var(--pj-orange); }
.pj-tab.active { color: var(--pj-orange); }
.pj-tab::after {
  content: '';
  display: block;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 1.5px;
  background: var(--pj-orange);
  transition: width 0.2s;
}
.pj-tab.active::after { width: 88px; }

/* ── カードグリッドラッパー ── */
.pj-grid-wrap {
  padding: 0 88px 80px;
  max-width: 1920px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ── グリッドコンテナ ── */
.pj-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 56px 36px;
  width: 100%;
  min-width: 0;
}

/* ── センチネル / スピナー ── */
.pj-sentinel {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}
.pj-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid #E0E0E0;
  border-top-color: var(--pj-orange);
  border-radius: 50%;
  animation: pj-spin 0.8s linear infinite;
  display: none;
}
.pj-spinner.active { display: block; }
@keyframes pj-spin { to { transform: rotate(360deg); } }
.pj-end-msg { font-size: 13px; color: #B0B0B0; letter-spacing: 0.05em; display: none; }
.pj-end-msg.visible { display: block; }

/* ── カード ── */
.pj-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}
.pj-img-wrap {
  width: 100%;
  min-width: 0;
  aspect-ratio: 538 / 328;
  position: relative;
  overflow: hidden;
}
/* 黒半透明オーバーレイ（18%）— 外部画像含め全てに適用 */
.pj-img-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  z-index: 1;
  pointer-events: none;
}
.pj-img-wrap .pj-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.pj-card:hover .pj-bg { transform: scale(1.05); }

.pj-img-overlay {
  position: absolute;
  top: auto;
  bottom: 10px;
  left: 18px;
  width: calc(100% - 36px);
  padding: 0;
  background: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}
.pj-img-name {
  width: auto;
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.05em;
  line-height: 1.4;
  font-family: var(--pj-noto);
}
.pj-arrow {
  width: 18px;
  height: 22px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.pj-card:hover .pj-arrow { transform: translateX(8px); }

.pj-card-meta {
  margin-top: 14px;
  font-size: 16px;
  line-height: 33px;
  letter-spacing: 0.08em;
  font-weight: 300;
  color: var(--pj-black);
  font-family: var(--pj-noto);
}
.pj-card-meta .meta-tags {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pj-card-meta .meta-year {
  display: block;
}
.pj-card-desc {
  margin-top: 2px;
  font-size: 16px;
  line-height: 33px;
  letter-spacing: 0.08em;
  color: var(--pj-black);
  font-family: var(--pj-noto);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pj-card-body-sp { display: none; }

/* ── レスポンシブ：タブレット（1200px以下）── */
@media screen and (max-width: 1200px) {
  .pj-breadcrumb-bar { padding: 0 44px; }
  .pj-hero { padding: 40px 44px 44px; gap: 40px; }
  .pj-title { font-size: 80px; }
  .pj-subtitle { font-size: 26px; }
  .pj-desc { font-size: 18px; line-height: 34px; }
  .pj-controls { padding: 0 44px 98px; }
  .pj-grid-wrap { padding: 0 44px 80px; }
  .pj-grid { gap: 44px 28px; }
  .pj-search-form { height: 60px; }
  .pj-search-input { font-size: 18px; }
  .pj-search-result-text { font-size: 18px; }
  .pj-tab { font-size: 18px; padding: 6px 18px 8px; }
}

/* ── レスポンシブ：2カラム（1024px以下）── */
@media screen and (max-width: 1024px) {
  .pj-title { font-size: 64px; }
  .pj-hero { flex-direction: column; gap: 24px; }
  .pj-desc { padding-top: 0; max-width: 100%; }
  .pj-controls { flex-direction: column; align-items: flex-start; gap: 16px; }
  .pj-search-col { max-width: 100%; }
  .pj-search-form { max-width: 100%; }
  .pj-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── レスポンシブ：SP（767px以下）── */
@media screen and (max-width: 767px) {
  .pj-breadcrumb-bar { margin-top: 80px; padding: 0 18px; height: 40px; }
  .pj-breadcrumb-inner { font-size: 13px; line-height: 1.5; }
  .pj-hero { flex-direction: column; padding: 24px 18px 28px; gap: 14px; }
  .pj-hero-left { flex-direction: row; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .pj-title { font-size: 28px; }
  .pj-subtitle { font-size: 15px; }
  .pj-desc { font-size: 16px; line-height: 28px; max-width: 100%; padding-top: 0; }
  .pj-controls { padding: 0 18px 24px; gap: 14px; flex-direction: column; align-items: flex-start; }
  .pj-search-form { max-width: 353px; height: 53px; padding: 0 14px; gap: 10px; }
  .pj-search-icon { width: 21px; height: 21px; }
  .pj-search-input { font-size: 16px; }
  .pj-search-col { max-width: 353px; }
  .pj-search-result-text { font-size: 16px; }
  .pj-filter-tabs { gap: 0; }
  .pj-tab { font-size: 16px; padding: 6px 10px 8px; }
  .pj-tab.active::after { width: 48px; }
  .pj-grid-wrap { padding: 0 18px 60px; }
  .pj-grid { grid-template-columns: 1fr; gap: 18px; }
  .pj-card { flex-direction: row; align-items: flex-start; gap: 14px; }
  .pj-img-wrap { width: 118px; flex-shrink: 0; aspect-ratio: 118 / 88; }
  .pj-img-overlay,
  .pj-card-meta,
  .pj-card-desc { display: none; }
  .pj-card-body-sp {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 2px;
    min-width: 0;
  }
  .pj-card-year-sp {
    font-size: 13px;
    letter-spacing: 0.05em;
    line-height: 1.4;
    color: #888;
    font-family: var(--pj-noto);
  }
  .pj-card-name-sp {
    font-size: 16px;
    letter-spacing: 0.08em;
    line-height: 21px;
    color: var(--pj-black);
    font-family: var(--pj-noto);
    font-weight: 500;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}
