.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  box-sizing: border-box;
  width: 100vw;
  max-width: 100vw;
  margin-top: 0;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* ページ全体の背景（HEROマスク色から生成） */
html:has(body.has-hero-page-bg),
body.has-hero-page-bg {
  background: var(--hero-page-bg) !important;
  min-height: 100%;
}

body.has-hero-page-bg #container,
body.has-hero-page-bg #wrapper,
body.has-hero-page-bg #content,
body.has-hero-page-bg #content-in,
body.has-hero-page-bg .content-in.wrap,
body.has-hero-page-bg #main,
body.has-hero-page-bg #main.main,
body.has-hero-page-bg article.post,
body.has-hero-page-bg article.page,
body.has-hero-page-bg .entry-content,
body.has-hero-page-bg .article-body,
body.has-hero-page-bg .main-body,
body.has-hero-page-bg .post-body {
  background: transparent !important;
  background-color: transparent !important;
}

/* 先頭 HERO 記事：Cocoon 等の外側コンテナ・記事ヘッダーの上余白を除去 */
body.has-hero-first .article-header.entry-header,
body.has-hero-first .entry-header.article-header {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

body.has-hero-first #content,
body.has-hero-first #content-in,
body.has-hero-first .content-in.wrap {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

body.has-hero-first #main,
body.has-hero-first #main.main {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

body.has-hero-first article.post,
body.has-hero-first article.page {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

body.has-hero-first .entry-content {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

body.has-hero-first .entry-content > p:empty:first-child {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
}

body.has-hero-first .entry-content > .wp-block-custom-hero.hero {
  margin-block-start: 0 !important;
  margin-top: 0 !important;
}

/* :has() フォールバック（body クラス未付与時） */
.entry-content > .wp-block-custom-hero.hero:first-child,
.entry-content > .hero.wp-block-custom-hero:first-child,
.article .entry-content > .wp-block-custom-hero.hero:first-child {
  margin-block-start: 0;
}

.entry-content:has(> .wp-block-custom-hero.hero:first-child),
.entry-content:has(> .hero.wp-block-custom-hero:first-child) {
  padding-top: 0;
}

:root :where(.is-layout-flow) > .wp-block-custom-hero.hero:first-child {
  margin-block-start: 0;
}

.article:has(> .entry-content > .wp-block-custom-hero.hero:first-child) > .article-header.entry-header,
.article:has(> .entry-content > .wp-block-custom-hero.hero:first-child) > .entry-header {
  display: none;
}

.hero.hero--height-fixed {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero.hero--height-fixed.hero--valign-bottom {
  justify-content: flex-end;
}

.hero.hero--height-fixed .hero-inner {
  width: 100%;
  flex-shrink: 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.hero-noise {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.06;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}

@media (prefers-reduced-motion: reduce) {
  .hero-bg--parallax {
    background-attachment: scroll !important;
  }
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.hero-inner.hero--align-center {
  text-align: center;
}

.hero-inner.hero--align-left {
  text-align: left;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  margin-bottom: 20px;
  width: 100%;
}

.hero-inner.hero--align-center .hero-badges,
.hero-inner.hero--align-center .hero-actions {
  justify-content: center;
}

.hero-inner.hero--align-left .hero-badges,
.hero-inner.hero--align-left .hero-actions {
  justify-content: flex-start;
}

.hero-inner.hero--align-right {
  text-align: right;
}

.hero-inner.hero--align-right .hero-title,
.hero-inner.hero--align-right .hero-description {
  text-align: right;
}

.hero-inner.hero--align-right .hero-badges,
.hero-inner.hero--align-right .hero-actions {
  justify-content: flex-end;
}

.hero-inner.hero--width-narrow {
  max-width: 680px;
}

.hero-inner.hero--width-half .hero-title,
.hero-inner.hero--width-half .hero-description {
  max-width: 36rem;
}

.hero.hero--valign-bottom {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero.hero--valign-bottom .hero-inner {
  width: 100%;
  flex-shrink: 0;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  border: none;
  transition: opacity 0.2s ease;
}

a.hero-badge {
  text-decoration: none;
  cursor: pointer;
}

a.hero-badge:hover {
  opacity: 0.88;
  color: inherit;
  text-decoration: none;
}

.hero-title {
  margin: 0 0 16px;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
}

.hero-inner.hero--align-center .hero-title,
.hero-inner.hero--align-center .hero-description {
  text-align: center;
}

.hero-inner.hero--align-left .hero-title,
.hero-inner.hero--align-left .hero-description {
  text-align: left;
}

.hero-description {
  margin: 0 0 24px;
  font-size: 1.125rem;
  line-height: 1.7;
  opacity: 0.9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.hero-actions .btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border: 2px solid transparent;
  backdrop-filter: blur(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.hero-actions .btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  filter: brightness(1.05);
  text-decoration: none;
}

/* 旧プリセットスタイル（再保存前の記事向けフォールバック） */
.hero-actions .btn.primary {
  background: #48b84f;
  color: #fff;
}

.hero-actions .btn.secondary {
  background: rgba(255, 255, 255, 0.9);
  color: #333;
}

/* --- Tablet (768–1023px) --- */
@media (max-width: 1023px) {
  .hero-inner {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* --- Mobile (≤767px) — solarpunk_mobile_layout_sample 準拠 --- */
@media (max-width: 767px) {
  .hero {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    overflow: hidden;
    isolation: isolate;
    padding: 48px 18px 52px !important;
    align-items: center;
    justify-content: center;
  }

  .hero.hero--height-fixed,
  .hero.hero--valign-bottom {
    height: auto !important;
    min-height: 400px !important;
    display: flex;
    justify-content: center;
  }

  .hero::after {
    content: "";
    position: absolute;
    inset: auto -8% -70px -8%;
    height: 150px;
    background: linear-gradient(180deg, rgba(102, 209, 179, 0), #f7fff7 72%);
    z-index: 1;
    pointer-events: none;
  }

  .hero-bg {
    background-size: cover !important;
    background-position: center 34% !important;
  }

  .hero-overlay {
    opacity: 1 !important;
    background: linear-gradient(
      180deg,
      rgba(31, 125, 150, 0.18) 0%,
      rgba(102, 209, 179, 0.82) 68%,
      rgba(102, 209, 179, 0.92) 100%
    ) !important;
  }

  .hero-bg--parallax {
    background-attachment: scroll !important;
  }

  .hero-inner,
  .hero-inner.hero--align-left,
  .hero-inner.hero--align-right,
  .hero-inner.hero--align-center {
    position: relative;
    z-index: 2;
    width: min(100%, 520px);
    max-width: 520px;
    text-align: center;
    padding-left: 0;
    padding-right: 0;
    transform: translateY(14px);
  }

  .hero-inner.hero--align-left .hero-title,
  .hero-inner.hero--align-right .hero-title,
  .hero-inner.hero--align-center .hero-title,
  .hero-inner.hero--align-left .hero-description,
  .hero-inner.hero--align-right .hero-description,
  .hero-inner.hero--align-center .hero-description {
    text-align: center;
  }

  .hero-inner.hero--align-left .hero-badges,
  .hero-inner.hero--align-right .hero-badges,
  .hero-inner.hero--align-center .hero-badges,
  .hero-inner.hero--align-left .hero-actions,
  .hero-inner.hero--align-right .hero-actions,
  .hero-inner.hero--align-center .hero-actions {
    justify-content: center;
  }

  .hero-title {
    margin: 0;
    font-size: clamp(2.15rem, 9vw, 3.1rem);
    line-height: 1.08;
    letter-spacing: 0.02em;
    text-shadow: 0 4px 18px rgba(0, 55, 70, 0.28);
    overflow-wrap: anywhere;
  }

  .hero-description {
    margin: 18px auto 0;
    max-width: 420px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.72;
    text-shadow: 0 2px 12px rgba(0, 55, 70, 0.28);
    overflow-wrap: anywhere;
  }

  .hero-badges {
    gap: 9px;
    margin-top: 20px;
    margin-bottom: 0;
    justify-content: center;
  }

  .hero-badge {
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.24);
    font-size: 0.88rem;
    font-weight: 800;
  }

  /* スマホではボタン非表示（目次カードへ誘導） */
  .hero-actions {
    display: none !important;
  }

  .hero-inner.hero--width-half .hero-title,
  .hero-inner.hero--width-half .hero-description {
    max-width: none;
  }
}
