/* スタッフアーカイブ：一覧グリッド・モーダル（骨格）
   Breakpoint: PC 768px+ / SP 767px- */

.staff-archive__section {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--content-inner-padding-inline);
  padding-bottom: var(--space-xl, 1.5rem);
}

/* Hero 画像なし時のみトップ余白を付与（画像あり時は hero.css の content-section--after-hero-image に任せる） */
.staff-archive__section:not(.content-section--after-hero-image) {
  padding-top: var(--space-xl, 1.5rem);
}

.staff-archive__area-block {
  margin-bottom: var(--space-2xl, 2rem);
}

.staff-archive__area-block:last-of-type {
  margin-bottom: 0;
}

.staff-archive__area-heading {
  font-size: var(--fs-section-heading-sm);
  font-weight: 900;
  margin: 0 0 var(--space-lg, 1.5rem);
  letter-spacing: 0.03em;
}

.staff-archive__area-heading::after {
  content: '';
  display: block;
  width: 100px;
  height: 3px;
  background: var(--color-corporate);
  margin-top: var(--space-xs);
}

/* PC: 768px+ — 3列・最終行は中央寄せ（flex） */
.staff-archive__grid {
  --staff-grid-gap: var(--space-lg, 1.5rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--staff-grid-gap);
}

.staff-archive__card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 8px;
  padding: var(--space-md, 1rem);
  background: var(--color-bg, #fff);
  transition: box-shadow 200ms ease-out, transform 200ms ease-out, border-color 200ms ease-out;
}

/* 左上コーナー：青系グラデーションの三角形装飾（黒テキストが乗っても読めるトーン） */
.staff-archive__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  height: 200px;
  background: var(--gradient-corner-accent);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  z-index: 0;
}

.staff-archive__card:hover,
.staff-archive__card:focus-visible {
  outline: none;
  border-color: var(--color-corporate);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.staff-archive__card:active {
  transform: scale(0.98);
}

.staff-archive__card-thumb {
  position: relative;
  z-index: 1;
  margin-bottom: var(--space-sm, 0.5rem);
}

.staff-archive__card-thumb img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.staff-archive__card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm, 0.5rem);
  margin-top: auto;
}

.staff-archive__card-text {
  min-width: 0;
}

.staff-archive__name {
  font-size: var(--fs-xl);
  margin: 0 0 var(--space-xs, 0.25rem);
}

.staff-archive__area {
  font-size: 0.875rem;
  color: var(--color-text-muted, #666);
  margin: 0 0 var(--space-sm, 0.5rem);
}

.staff-archive__card-arrow {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: block;
  transition: transform 200ms ease-out;
}

.staff-archive__card:hover .staff-archive__card-arrow,
.staff-archive__card:focus-visible .staff-archive__card-arrow {
  transform: translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
  .staff-archive__card,
  .staff-archive__card-arrow,
  .staff-modal__close {
    transition-duration: 0.01ms;
  }
}

.staff-archive__content {
  font-size: 0.875rem;
  line-height: 1.5;
}

/* SP: 767px以下 — 2列、gap はデバイス左右余白（padding-inline）と同じに */
@media (max-width: 767px) {
  .staff-archive__grid {
    --staff-grid-gap: var(--space-sm, 1rem);
  }

  .staff-archive__card {
    width: calc((100% - var(--staff-grid-gap)) / 2);
    min-width: 0;
    padding: var(--space-sm);
  }

  .staff-archive__card::before {
    width: 200px;
    height: 120px;
  }

  .staff-archive__area-heading {
    margin-bottom: var(--space-lg, 1.5rem);
  }

  .staff-archive__name {
    font-size: var(--fs-md);
    margin: 0 0 var(--space-xs, 0.25rem);
  }
}

/* PC: 768px+ — 3列・最終行中央寄せ */
@media (min-width: 768px) {
  .staff-archive__card {
    width: calc((100% - (2 * var(--staff-grid-gap))) / 3);
    min-width: 0;
  }
}

/* モーダル */
.staff-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md, 1rem);
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.2s, opacity 0.2s;
}

.staff-modal--open {
  visibility: visible;
  opacity: 1;
}

.staff-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.staff-modal__panel {
  position: relative;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  background: var(--color-bg, #fff);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  padding: var(--space-xl, 1.5rem);
}

/* 左上コーナー：青系グラデーションの三角形装飾（黒テキストが乗っても読めるトーン） */
.staff-modal__panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  height: 280px;
  background: var(--gradient-corner-accent);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  z-index: 0;
}

/* SP */
@media (max-width: 767px) {
  .staff-modal__panel::before {
    width: 280px;
    height: 200px;
  }
}

@media (min-width: 768px) {
  .staff-modal__panel {
    max-width: 920px;
    height: auto;
    display: flex;
    flex-direction: column;
  }
}

/* タブレット・SP: モーダル高さを確保（左カラム高さに合わせるレイアウトは 992px 以上のみ） */
@media (max-width: 991px) {
  .staff-modal__panel {
    min-height: 85vh;
    max-height: 90vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
  }

  .staff-modal__body {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
  }

  .staff-modal__detail {
    flex-direction: column;
    flex: 0 0 auto;
  }

  .staff-modal__detail-content {
    position: static;
    left: auto;
    top: auto;
    right: auto;
    bottom: auto;
    flex: 0 0 auto;
  }

  .staff-modal__detail-side {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
  }

  .staff-modal__detail-thumb img {
    max-width: 100%;
    width: 100%;
  }
}

.staff-modal__close {
  position: absolute;
  top: var(--space-sm, 0.5rem);
  right: var(--space-sm, 0.5rem);
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text, #333);
  border-radius: 4px;
  transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1), background-color 200ms ease-out, color 200ms ease-out;
}

.staff-modal__close:hover {
  background: var(--color-bg-alt, #f0f0f0);
  color: var(--color-text, #333);
  transform: rotate(360deg);
}

.staff-modal__close:active {
  transform: rotate(360deg) scale(0.98);
}

.staff-modal__body {
  position: relative;
  z-index: 1;
  padding-top: var(--space-md, 1rem);
}

@media (min-width: 992px) {
  .staff-modal__body {
    flex: 0 1 auto;
    min-height: 0;
    overflow: hidden;
  }
}

.staff-modal__detail {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-xl, 1.5rem);
}

@media (min-width: 992px) {
  .staff-modal__detail {
    position: relative;
    flex: 0 0 auto;
  }
}

.staff-modal__detail-side {
  flex: 0 0 200px;
  min-width: 0;
  overflow: hidden;
}

.staff-modal__detail-thumb {
  margin-bottom: var(--space-md, 1rem);
}

.staff-modal__detail-thumb img {
  width: 100%;
  max-width: 200px;
  height: auto;
  display: block;
  border-radius: 4px;
}

/* 992px以上のみ：横並びレイアウトで左カラム幅を 280px に */
@media (min-width: 992px) {
  .staff-modal__detail-side {
    flex: 0 0 280px;
  }

  .staff-modal__detail-thumb img {
    max-width: 280px;
  }
}

/* 991px以下：縦積み。ベースの flex: 0 0 200px を上書き（後続のためここで明示しないと高さ200pxで名前・エリアが隠れる） */
@media (max-width: 991px) {
  .staff-modal__detail-side {
    flex: 0 0 auto;
    overflow: visible;
  }
}

.staff-modal__detail-name {
  font-size: var(--fs-xl);
  margin: 0 0 var(--space-xs, 0.25rem);
}

.staff-modal__detail-area {
  font-size: var(--fs-sm);
  color: var(--color-text-muted, #666);
  margin: 0 0 var(--space-md, 1rem);
}

.staff-modal__detail-content {
  flex: 1 1 0;
  min-width: 0;
  padding: var(--space-md, 1rem);
  font-size: var(--fs-md);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.05em;
  background: var(--color-bg-sub, #f7f7f7);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 6px;
}

@media (min-width: 992px) {
  .staff-modal__detail-content {
    position: absolute;
    left: calc(280px + var(--space-xl, 1.5rem));
    top: 0;
    right: 0;
    bottom: 0;
    min-height: 0;
    overflow-y: auto;
  }
}

@media (max-width: 767px) {
  .staff-modal__detail-side {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
  }

  .staff-modal__detail-content {
    flex: 0 0 auto;
  }

  /* 画像幅を抑え、左寄せ。モーダル幅より狭いときは画像も縮む */
  .staff-modal__detail-thumb img {
    max-width: min(280px, 100%);
    width: auto;
    margin-inline: 0 auto;
    display: block;
  }
}

.staff-archive__modal-sources {
  display: none;
}
