/* ===============================
   Page: Patterns Archive
=============================== */

.patterns-archive {
  padding: 0 0 80px;
}

.patterns-archive__lead {
  margin-bottom: 40px;
}

/* ===============================
   Patterns Filter
=============================== */

.patterns-filter {
  margin: 40px 0 32px;
}

.patterns-filter__list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.patterns-filter__item {
  margin: 0;
  padding: 0;
}

.patterns-filter__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  color: var(--color-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease,
    opacity 0.2s ease;
}

.patterns-filter__link:hover,
.patterns-filter__link.is-current {
  border-color: rgba(202, 168, 76, 0.55);
  background: #fffaf0;
  color: var(--color-text);
}

/* ===============================
   Patterns Gallery
=============================== */

.patterns-gallery {
  width: 100%;
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  background: transparent;
}

.pattern-card {
  min-width: 0;
}

.pattern-card__button {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.pattern-card__image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-bg-soft);
}

.pattern-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform 0.45s ease,
    filter 0.45s ease;
}

.pattern-card__button:hover .pattern-card__image img {
  transform: scale(1.04);
  filter: brightness(1.03);
}

.pattern-card__image::after {
  content: "拡大";
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--color-body);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.pattern-card__button:hover .pattern-card__image::after {
  opacity: 1;
  transform: translateY(0);
}

.pattern-card__category {
  display: none;
}

.pattern-card__noimage {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
}

/* ===============================
   Patterns Modal
=============================== */

.pattern-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  opacity: 0;
  pointer-events: none;
}

.pattern-modal.is-open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.pattern-modal__overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.045), transparent 42%),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(2px);
  cursor: pointer;
  animation: patternModalFade 0.42s ease both;
}

.pattern-modal__stage {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(56px, 1fr) minmax(0, auto) minmax(56px, 1fr);
  grid-template-rows: minmax(24px, 1fr) minmax(0, auto) auto minmax(24px, 1fr);
  align-items: center;
  justify-items: center;
  padding: 32px;
  box-sizing: border-box;
  animation: patternModalStageIn 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pattern-modal__image-wrap {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(62vw, 920px);
  max-height: 82dvh;
}

.pattern-modal__image-wrap::before {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: -1;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.06), transparent 62%);
  pointer-events: none;
}

.pattern-modal__image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 82dvh;
  object-fit: contain;
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.42),
    0 2px 14px rgba(0, 0, 0, 0.24);
  opacity: 1;
  transition:
    opacity 0.32s ease,
    filter 0.32s ease;
}

.pattern-modal__image.is-changing {
  opacity: 0;
  filter: blur(0.6px);
}

.pattern-modal__close {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.88);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.pattern-modal__close:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(202, 168, 76, 0.48);
  color: #fff;
  transform: translateY(-1px);
}

.pattern-modal__nav {
  grid-row: 2;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 54px;
  height: 86px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  font-family: var(--font-serif);
  font-size: 58px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.45);
  transition:
    color 0.24s ease,
    opacity 0.24s ease,
    transform 0.24s ease;
}

.pattern-modal__nav:hover {
  color: rgba(255, 255, 255, 0.96);
  transform: translateY(-1px);
}

.pattern-modal__nav--prev {
  grid-column: 1;
}

.pattern-modal__nav--next {
  grid-column: 3;
}

.pattern-modal__tools {
  grid-column: 2;
  grid-row: 3;
  width: min(62vw, 920px);
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px 16px;
  margin-top: 18px;
}

.pattern-modal__category {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  letter-spacing: 0.12em;
}

.pattern-modal__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 22px;
  border: 1px solid rgba(202, 168, 76, 0.58);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: rgba(202, 168, 76, 0.95);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.pattern-modal__copy:hover {
  background: rgba(202, 168, 76, 0.12);
  border-color: rgba(202, 168, 76, 0.88);
  color: #e6c875;
  transform: translateY(-1px);
}

.pattern-modal__copy-message {
  min-width: 7em;
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  letter-spacing: 0.08em;
}

body.is-pattern-modal-open {
  overflow: hidden;
}

@keyframes patternModalFade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes patternModalStageIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===============================
   PC
=============================== */

@media screen and (min-width: 768px) {
  .patterns-archive {
    padding-bottom: 120px;
  }

  .patterns-archive__lead {
    margin-bottom: 56px;
  }

  .patterns-filter {
    margin: 56px 0 48px;
  }

  .patterns-filter__list {
    gap: 12px;
  }

  .patterns-filter__link {
    min-height: 40px;
    padding: 9px 18px;
    font-size: 14px;
  }

  .patterns-gallery {
    margin-top: 56px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
}

@media screen and (min-width: 1280px) {
  .patterns-gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
  }
}

/* ===============================
   SP Modal
=============================== */

@media screen and (max-width: 767px) {
  .pattern-modal__stage {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-rows: minmax(24px, 1fr) minmax(0, auto) auto minmax(24px, 1fr);
    padding: 20px 14px;
  }

  .pattern-modal__image-wrap {
    max-width: 100%;
    max-height: 76dvh;
  }

  .pattern-modal__image {
    max-height: 76dvh;
  }

  .pattern-modal__close {
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    font-size: 26px;
  }

  .pattern-modal__nav {
    width: 40px;
    height: 68px;
    font-size: 42px;
  }

  .pattern-modal__tools {
    width: 100%;
    grid-template-columns: 1fr;
    justify-items: center;
    margin-top: 14px;
  }

  .pattern-modal__category {
    text-align: center;
  }

  .pattern-modal__copy-message {
    min-width: 0;
    text-align: center;
  }
}

/* ===============================
   Pattern Single
=============================== */

.pattern-single {
  padding: 64px 0 96px;
  background:
    linear-gradient(180deg, #fff 0%, #fbfaf6 100%);
}

.pattern-single__header {
  margin-bottom: 32px;
}

.pattern-single__label {
  margin: 0 0 10px;
  font-family: var(--font-en);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.8;
  letter-spacing: 0.32em;
  color: var(--color-muted);
}

.pattern-single__category {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.8;
  letter-spacing: 0.06em;
}

.pattern-single__image {
  width: min(720px, 100%);
  margin: 0 auto;
}

.pattern-single__image img {
  display: block;
  width: 100%;
  height: auto;
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.12),
    0 2px 10px rgba(0, 0, 0, 0.08);
}

.pattern-single__actions {
  width: min(720px, 100%);
  margin: 28px auto 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.pattern-single__copy {
  padding: 7px 18px;
  border: 1px solid rgba(202, 168, 76, 0.55);
  border-radius: 999px;
  background: #fff;
  color: #b88b1c;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.pattern-single__copy:hover {
  background: var(--color-accent);
  color: #fff;
  transform: translateY(-1px);
}

.pattern-single__copy-message {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
}

.pattern-single__back {
  width: min(720px, 100%);
  margin: 48px auto 0;
}

.pattern-single__back a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
  transition: color 0.2s ease;
}

.pattern-single__back a::before {
  content: "←";
}

.pattern-single__back a:hover {
  color: var(--color-text);
}

@media screen and (min-width: 768px) {
  .pattern-single {
    padding: 88px 0 128px;
  }

  .pattern-single__header {
    width: min(720px, 100%);
    margin: 0 auto 40px;
  }

  .pattern-single__category {
    font-size: 26px;
  }
}