/*
Theme Name: Atelier
Description: アーティスト公式サイト用ブロックテーマ
Version: 0.1.1
Requires at least: 6.5
Requires PHP: 8.1
Text Domain: atelier
*/

/* WPのグローバルスタイルが .wp-site-blocks 直下の兄弟要素間に自動で入れる
   margin-block-start(既定24px)を無効化する。ナビは position:fixed で高さ0に
   潰れるため、次のセクション側にだけ意図しない余白が乗ってしまうのを防ぐ。
   セクション間の余白は各セクションのCSS(.hero, .works 等)側で管理する。 */
.wp-site-blocks > * {
  margin-block-start: 0;
}

.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
}

/* ログイン時は管理者バー分だけ固定ヘッダーを押し下げる(html への margin-top は position:fixed 要素には効かないため) */
body.admin-bar .site-nav {
  top: var(--wp-admin--admin-bar--height, 32px);
}

@media screen and (max-width: 782px) {
  body.admin-bar .site-nav {
    top: var(--wp-admin--admin-bar--height, 46px);
  }
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--wp--preset--spacing--m);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
}

.site-nav__logo {
  font-family: var(--wp--preset--font-family--display);
  font-size: 1.1rem;
  color: var(--wp--preset--color--hero-text);
  text-decoration: none;
}

.site-nav__logo a {
  color: inherit;
  text-decoration: none;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: var(--wp--preset--spacing--m);
}

.site-nav__links a {
  color: var(--wp--preset--color--hero-text);
  text-decoration: none;
  font-family: var(--wp--preset--font-family--body);
  font-size: 0.95rem;
}

.site-nav__cta {
  border: 1px solid var(--wp--preset--color--hero-text);
  padding: 0.4rem 1rem;
  border-radius: 999px;
}

.site-nav--solid {
  position: sticky;
  background: var(--wp--preset--color--text);
}

.site-nav--solid ~ main {
  padding-top: var(--wp--preset--spacing--l);
}

.site-nav__toggle-input,
.site-nav__toggle {
  display: none;
}

@media (max-width: 480px) {
  .site-nav__toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
    cursor: pointer;
    z-index: 11;
  }

  .site-nav__toggle span {
    display: block;
    height: 2px;
    background: var(--wp--preset--color--hero-text);
  }

  .site-nav__links {
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    gap: var(--wp--preset--spacing--l);
    background: rgba(0, 0, 0, 0.85);
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }

  .site-nav__links a {
    font-size: 1.2rem;
  }

  .site-nav__toggle-input:checked ~ .site-nav__links {
    transform: translateX(0);
  }
}

.works {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--wp--preset--spacing--l) var(--wp--preset--spacing--m);
}

.works__title {
  font-family: var(--wp--preset--font-family--display);
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 var(--wp--preset--spacing--l);
}

.works__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wp--preset--spacing--s);
  margin-bottom: var(--wp--preset--spacing--l);
}

.works__tab {
  font-family: var(--wp--preset--font-family--body);
  font-size: 0.9rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--wp--preset--color--text);
  border-radius: 999px;
  background: none;
  color: var(--wp--preset--color--text);
  cursor: pointer;
}

.works__tab.is-active {
  background: var(--wp--preset--color--text);
  color: var(--wp--preset--color--background);
}

.works__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--wp--preset--spacing--m);
}

.works__card {
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
}

.works__card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.works__card-title {
  margin: var(--wp--preset--spacing--s) 0 0;
  font-size: 0.95rem;
}

.works__card-category {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--wp--preset--color--muted);
}

.works__play {
  position: absolute;
  top: var(--wp--preset--spacing--s);
  right: var(--wp--preset--spacing--s);
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

@media (max-width: 480px) {
  .works__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.about {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--wp--preset--spacing--l) var(--wp--preset--spacing--m);
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--wp--preset--spacing--l);
}

.about__portrait img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.about__title {
  font-family: var(--wp--preset--font-family--display);
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 var(--wp--preset--spacing--m);
}

.about__lead {
  line-height: 1.8;
  margin: 0 0 var(--wp--preset--spacing--l);
}

.about__history {
  margin: 0;
}

.about__history div {
  display: flex;
  gap: var(--wp--preset--spacing--m);
  padding: var(--wp--preset--spacing--s) 0;
  border-top: 1px solid var(--wp--preset--color--border);
}

.about__history dt {
  flex: 0 0 4rem;
  font-family: var(--wp--preset--font-family--display);
  color: var(--wp--preset--color--muted);
}

.about__history dd {
  margin: 0;
}

@media (max-width: 480px) {
  .about {
    grid-template-columns: 1fr;
  }
}

.contact {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--wp--preset--spacing--l) var(--wp--preset--spacing--m);
}

.contact__title {
  font-family: var(--wp--preset--font-family--display);
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 var(--wp--preset--spacing--m);
}

.contact__lead {
  line-height: 1.8;
  margin: 0 0 var(--wp--preset--spacing--l);
}

.contact__form {
  display: flex;
  flex-direction: column;
  gap: var(--wp--preset--spacing--m);
}

.contact__form[hidden] {
  display: none;
}

.contact__field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.contact__field em {
  font-style: normal;
  color: var(--wp--preset--color--required);
  font-size: 0.75rem;
  margin-left: 0.3rem;
}

.contact__field input,
.contact__field select,
.contact__field textarea {
  font-family: var(--wp--preset--font-family--body);
  font-size: 1rem;
  padding: 0.6rem;
  border: 1px solid var(--wp--preset--color--border);
  border-radius: 4px;
}

.contact__submit {
  align-self: flex-start;
  font-family: var(--wp--preset--font-family--body);
  font-size: 1rem;
  padding: 0.7rem 2rem;
  background: var(--wp--preset--color--text);
  color: var(--wp--preset--color--background);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.contact__submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.contact__honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact__status {
  margin-top: var(--wp--preset--spacing--m);
  padding: var(--wp--preset--spacing--s) var(--wp--preset--spacing--m);
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1.7;
}

.contact__status--success {
  background: color-mix(in srgb, var(--wp--preset--color--success) 12%, transparent);
  color: var(--wp--preset--color--success);
}

.contact__status--error {
  background: color-mix(in srgb, var(--wp--preset--color--required) 12%, transparent);
  color: var(--wp--preset--color--required);
}

.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.hero__slides {
  position: absolute;
  inset: 0;
}

.hero__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
}

.hero__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: calc(var(--hero-x, 0.5) * 100%) calc(var(--hero-y, 0.5) * 100%);
  display: block;
}

@media (max-width: 480px) {
  .hero__slide img {
    object-position:
      calc(var(--hero-x-mobile, var(--hero-x, 0.5)) * 100%)
      calc(var(--hero-y-mobile, var(--hero-y, 0.5)) * 100%);
  }
}

/* 1枚: アニメーションなし、常時表示 */
.hero__slides--1 .hero__slide {
  opacity: 1;
  animation: none;
}

/* 2枚 */
.hero__slides--2 .hero__slide {
  animation: hero-crossfade-2 12s infinite;
}
.hero__slides--2 .hero__slide:nth-child(1) { animation-delay: 0s; }
.hero__slides--2 .hero__slide:nth-child(2) { animation-delay: 6s; }
@keyframes hero-crossfade-2 {
  0%    { opacity: 0; }
  7.5%  { opacity: 1; }
  42.5% { opacity: 1; }
  49.5% { opacity: 0; }
  100%  { opacity: 0; }
}

/* 3枚 */
.hero__slides--3 .hero__slide {
  animation: hero-crossfade-3 18s infinite;
}
.hero__slides--3 .hero__slide:nth-child(1) { animation-delay: 0s; }
.hero__slides--3 .hero__slide:nth-child(2) { animation-delay: 6s; }
.hero__slides--3 .hero__slide:nth-child(3) { animation-delay: 12s; }
@keyframes hero-crossfade-3 {
  0%   { opacity: 0; }
  5%   { opacity: 1; }
  28%  { opacity: 1; }
  33%  { opacity: 0; }
  100% { opacity: 0; }
}

/* 4枚 */
.hero__slides--4 .hero__slide {
  animation: hero-crossfade-4 24s infinite;
}
.hero__slides--4 .hero__slide:nth-child(1) { animation-delay: 0s; }
.hero__slides--4 .hero__slide:nth-child(2) { animation-delay: 6s; }
.hero__slides--4 .hero__slide:nth-child(3) { animation-delay: 12s; }
.hero__slides--4 .hero__slide:nth-child(4) { animation-delay: 18s; }
@keyframes hero-crossfade-4 {
  0%     { opacity: 0; }
  3.75%  { opacity: 1; }
  21.25% { opacity: 1; }
  24.75% { opacity: 0; }
  100%   { opacity: 0; }
}

/* 5枚 */
.hero__slides--5 .hero__slide {
  animation: hero-crossfade-5 30s infinite;
}
.hero__slides--5 .hero__slide:nth-child(1) { animation-delay: 0s; }
.hero__slides--5 .hero__slide:nth-child(2) { animation-delay: 6s; }
.hero__slides--5 .hero__slide:nth-child(3) { animation-delay: 12s; }
.hero__slides--5 .hero__slide:nth-child(4) { animation-delay: 18s; }
.hero__slides--5 .hero__slide:nth-child(5) { animation-delay: 24s; }
@keyframes hero-crossfade-5 {
  0%    { opacity: 0; }
  3%    { opacity: 1; }
  17%   { opacity: 1; }
  19.8% { opacity: 0; }
  100%  { opacity: 0; }
}

.hero__name {
  position: absolute;
  left: var(--wp--preset--spacing--m);
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  font-family: var(--wp--preset--font-family--display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--wp--preset--color--hero-text);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  z-index: 1;
}

.activity {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--wp--preset--spacing--l) var(--wp--preset--spacing--m);
}

.activity__title {
  font-family: var(--wp--preset--font-family--display);
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 var(--wp--preset--spacing--l);
}

.activity__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--wp--preset--spacing--l);
}

.activity__list li {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--wp--preset--spacing--m);
  padding-bottom: var(--wp--preset--spacing--l);
  border-bottom: 1px solid var(--wp--preset--color--border);
}

.activity__list img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.activity__item-title {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.activity__item-title a {
  color: inherit;
  text-decoration: none;
}

.activity__item-date {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: var(--wp--preset--color--muted);
}

.activity__item-excerpt {
  margin: 0;
  line-height: 1.8;
}

.activity__pagination {
  display: flex;
  gap: var(--wp--preset--spacing--s);
  margin-top: var(--wp--preset--spacing--l);
  justify-content: center;
}

.activity__pagination a {
  color: var(--wp--preset--color--text);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
}

.activity__pagination a.is-current {
  font-weight: bold;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .activity__list li {
    grid-template-columns: 1fr;
  }
}

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--wp--preset--spacing--s);
  padding: var(--wp--preset--spacing--l) var(--wp--preset--spacing--m);
  border-top: 1px solid var(--wp--preset--color--border);
  text-align: center;
}

.footer__social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--wp--preset--spacing--m);
}

.footer__copyright {
  margin: 0;
  color: var(--wp--preset--color--muted);
  font-size: 0.8rem;
}
