/* Shared header: mobile navigation and post-hero fixed state. */
.brand-logo {
  display: block;
  flex-shrink: 0;
  width: 180px;
  /* SVGの実寸420:85.94を、扱いやすい5:1として管理。幅だけでサイズ調整。 */
  aspect-ratio: 5 / 1;
  background: url('../img/logo.svg') left center / contain no-repeat;
}

.footer-brand {
  width: 210px;
}

@media (min-width: 768px) {
  .header-brand.brand-logo {
    width: 200px;
  }
}

.back-to-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 15;
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
}

.site-footer {
  padding-bottom: 88px;
}

@media (min-width: 768px) {
  .back-to-top {
    right: 24px;
    bottom: 24px;
    width: 52px;
    height: 52px;
  }
}

.header-slot {
  position: relative;
}

.site-header {
  display: block;
  padding: 0;
  width: 100%;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}

.site-header.is-fixed {
  position: fixed;
  top: 0;
  left: 0;
  box-shadow: 0 4px 16px #2032481a;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 80px;
  padding-block: 12px;
}

.header-brand {
  color: var(--primary);
  font-size: clamp(1rem, 4.8vw, 1.25rem);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.site-header .menu-toggle {
  min-width: 48px;
  width: 52px;
  min-height: 52px;
  padding: 7px 4px;
  border: 0;
  background: #edf3f9;
  box-shadow: none;
  flex-direction: column;
  gap: 6px;
  border-radius: 4px;
  color: var(--primary);
}

.menu-label {
  font-size: 10px;
  line-height: 1.3;
}

.burger-lines {
  display: block;
  width: 22px;
  height: 14px;
  border-top: 2px solid;
  border-bottom: 2px solid;
  position: relative;
}

.burger-lines::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 0;
  width: 22px;
  height: 2px;
  background: currentColor;
}

[aria-expanded='true'] .burger-lines {
  border: 0;
}

[aria-expanded='true'] .burger-lines::before,
[aria-expanded='true'] .burger-lines::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 0;
  width: 22px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

[aria-expanded='true'] .burger-lines::after {
  transform: rotate(-45deg);
}

.header-menu {
  width: 100%;
  background: white;
}

.is-enhanced .header-menu {
  position: absolute;
  top: 100%;
  left: 0;
  padding: 20px;
  max-height: calc(100dvh - var(--header-height, 80px) - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 12px 20px #20324826;
  border-top: 1px solid var(--line);
}

.site-header .header-links {
  display: grid;
  gap: 0;
  width: 100%;
}

.site-header .header-links a {
  padding: 14px 0;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.site-header .header-links a:last-child {
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.header-contact {
  display: grid;
  gap: 12px;
  padding-top: 20px;
}

.header-phone {
  display: flex;
  flex-direction: column;
}

.site-header:not(.is-fixed) .header-phone {
  display: none;
}

.header-contact-label,
.header-phone small {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

.header-phone a {
  font-size: 1.6rem;
  font-weight: 800;
  text-decoration: none;
  line-height: 1;
}

.header-phone a:not([href]) {
  cursor: default;
}

.header-form,
.site-header .header-line {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  min-width: 0;
  width: 100%;
  padding: 10px 16px;
  font-size: 0.85rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.5;
}

.header-form {
  background: var(--accent);
  color: white;
}

.site-header .header-line {
  flex-direction: row;
  gap: 6px;
  border: 1px solid #06c755;
  background: #06c755;
  color: white;
}


section {
  scroll-margin-top: calc(var(--header-height, 80px) + 24px);
}

.skip-link {
  z-index: 30;
}

@media (min-width: 768px) {
  .header-inner {
    padding-block: 16px;
    gap: 12px 24px;
    flex-wrap: nowrap;
  }

  .site-header .header-menu {
    position: static;
    width: auto;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0;
    max-height: none;
    overflow: visible;
    box-shadow: none;
    border: 0;
  }

  .site-header .header-links {
    display: flex;
    width: auto;
    flex-wrap: nowrap;
    gap: 16px;
    white-space: nowrap;
  }

  .site-header .header-links a,
  .site-header .header-links a:last-child {
    border: 0;
    padding: 8px 0;
    min-height: 40px;
  }

  /* 項目の位置や固定表示状態にかかわらず、TAB/PCでは同じサイズ。 */
  .site-header .header-links a {
    font-size: 0.8rem;
  }

  .header-contact {
    grid-template-columns: auto auto auto;
    align-items: center;
    gap: 16px;
    padding-top: 0;
    white-space: nowrap;
  }

  .site-header:not(.is-fixed) .header-contact {
    grid-template-columns: auto auto;
  }

  .header-phone a {
    font-size: 1.35rem;
  }

  .header-form,
  .site-header .header-line {
    width: auto;
    padding-inline: 20px;
  }
}

.header-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: var(--primary);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 280ms ease, visibility 0s 280ms;
}

@media (max-width: 767px) {
  .header-contact {
    text-align: center;
  }

  .is-enhanced .header-menu {
    clip-path: inset(0 0 100% 0);
    transform: translateY(-12px);
    visibility: hidden;
    pointer-events: none;
    transition: clip-path 280ms ease, transform 280ms ease, visibility 0s 280ms;
  }

  .is-enhanced.is-menu-open .header-menu {
    clip-path: inset(0);
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .header-backdrop.is-visible {
    opacity: 0.8;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-enhanced .header-menu,
  .header-backdrop {
    transition: none;
  }
}

/* バーガー切り替え直前も、固定時の電話番号を含めて1行に収める。 */
@media (min-width: 768px) and (max-width: 1199px) {
  .header-inner.container {
    width: calc(100% - 32px);
    gap: 12px;
  }

  .header-brand.brand-logo {
    width: clamp(120px, 15vw, 175px);
  }

  .site-header .header-menu {
    gap: 12px;
  }

  .site-header .header-links {
    gap: 10px;
  }

  .header-contact {
    gap: 8px;
  }

  .header-phone a {
    font-size: 1rem;
  }

  .header-phone small {
    font-size: 0.6rem;
  }

  .header-form,
  .site-header .header-line {
    padding-inline: 8px;
    font-size: 0.7rem;
  }
}

@media (min-width: 1200px) {
  .header-inner {
    flex-wrap: nowrap;
  }

  .site-header .header-menu {
    width: auto;
    display: flex;
    align-items: center;
    gap: 28px;
  }

  .site-header .header-links {
    width: auto;
    gap: 16px;
  }

  .header-contact {
    padding-top: 0;
    gap: 12px;
  }

  .header-form,
  .site-header .header-line {
    padding-inline: 12px;
  }
}
