/* 固定ページテンプレート「フロアマップ」専用 */
/* 共通の固定アンカー余白との二重加算を避け、各階の実測余白を使う。 */
html:has(.floor-map-page) {
  scroll-padding-top: 0;
}

.floor-map-page {
  --floor-nav-height: 90px;
}

.floor-map__building-switch { display: none; }

.page-content .floor-map__legend {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  max-width: 960px;
  margin: 32px auto 16px;
  padding: 0;
  list-style: none;
  border-top: 1px solid #aaa;
  border-left: 1px solid #aaa;
}

.page-content .floor-map__legend li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 16px 4px;
  border-right: 1px solid #aaa;
  border-bottom: 1px solid #aaa;
  font-size: 14px;
  text-align: center;
}

.floor-map__legend-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
}

.page-content .floor-map__legend-icons img {
  display: block;
  width: 28px;
  height: 32px;
  object-fit: contain;
}

.floor-map__nav {
  position: sticky;
  top: var(--site-header-offset, 0px);
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 32px;
  padding: 16px 0;
  background: #fff;
  border-bottom: 1px solid #e1e8eb;
}

.floor-map__nav-group {
  --floor-color: #278721;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.floor-map__nav-group--annex {
  --floor-color: #1759a5;
}

.floor-map__links {
  display: flex;
  gap: 5px;
}

.floor-map__building-label,
.floor-map__links a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 44px;
  padding: 4px 8px;
  border: 1px solid var(--floor-color);
  border-radius: 8px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.floor-map__building-label {
  color: #fff;
  background: var(--floor-color);
}

.floor-map__links a {
  color: var(--floor-color);
  background: #fff;
  text-decoration: none;
}

.floor-map__links a:hover,
.floor-map__links a:focus-visible {
  color: #fff;
  background: var(--floor-color);
}

.floor-map__links a:focus-visible,
.floor-map__floor:focus-visible {
  outline: 3px solid #1759a5;
  outline-offset: 3px;
}

.floor-map__floor {
  margin: 32px 0;
  scroll-margin-top: calc(var(--site-header-offset, 0px) + var(--floor-nav-height) + 16px);
}

.page-content .floor-map__image {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 767px) {
  .floor-map-page { --floor-nav-height: 112px; }
  .page-content .floor-map__legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 76%;
    margin: 26px auto 32px;
  }
  .page-content .floor-map__legend li { min-height: 102px; padding: 14px 4px; }
  .floor-map__legend::after { content: ""; border-right: 1px solid #aaa; border-bottom: 1px solid #aaa; }
  .page-content .floor-map__legend-icons img { width: 32px; }
  .floor-map__nav { display: grid; gap: 8px; padding: 10px 0; }
  .floor-map__nav-group { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: start; }
  .floor-map__links { flex-wrap: wrap; }
  .floor-map__building-label,
  .floor-map__links a { min-width: 44px; padding: 4px 6px; font-size: 14px; }

  .site-main.floor-map-page--nav-ready { padding-top: var(--floor-nav-height); }
  .floor-map-page--nav-ready .floor-map__nav {
    position: fixed;
    left: 0;
    right: 0;
    padding: 12px 16px 14px;
    gap: 8px;
    justify-content: stretch;
    box-shadow: 0 3px 5px rgb(0 0 0 / 16%);
  }
  .floor-map-page--nav-ready .floor-map__building-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .floor-map__switch {
    --switch-color: #2da323;
    appearance: none;
    min-width: 0;
    min-height: 38px;
    padding: 4px 8px;
    border: 1px solid var(--switch-color);
    border-radius: 11px;
    background: #fff;
    color: var(--switch-color);
    font: inherit;
    font-size: 18px;
    line-height: 1.4;
    cursor: pointer;
  }
  .floor-map__switch--annex { --switch-color: #1c5da8; }
  .floor-map__switch[aria-pressed="true"] { background: var(--switch-color); color: #fff; }
  .floor-map__switch:focus-visible { outline: 3px solid #333; outline-offset: 2px; }
  .floor-map-page--nav-ready .floor-map__nav-group { display: block; }
  .floor-map-page--nav-ready .floor-map__nav-group[data-active="false"] { display: none; }
  .floor-map-page--nav-ready .floor-map__building-label { display: none; }
  .floor-map-page--nav-ready .floor-map__links { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .floor-map-page--nav-ready .floor-map__nav-group--annex .floor-map__links { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
  .floor-map-page--nav-ready .floor-map__links a {
    min-width: 0;
    min-height: 30px;
    padding: 3px 0;
    border-radius: 5px;
    background: #79c66d;
    border-color: #2da323;
    color: #fff;
    font-size: clamp(14px, 4.6vw, 20px);
    font-weight: 500;
  }
  .floor-map-page--nav-ready .floor-map__nav-group--annex .floor-map__links a { background: #5197d5; border-color: #1c5da8; }
  .floor-map-page--nav-ready .floor-map__links a:hover,
  .floor-map-page--nav-ready .floor-map__links a:focus-visible { background: var(--floor-color); }
}

.floor-map__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #174c34;
  font: inherit;
  cursor: zoom-in;
}
.floor-map__hint { display: block; padding: 10px; text-align: center; text-decoration: underline; }
.floor-map__open:focus-visible,
.floor-map-viewer button:focus-visible,
.floor-map-viewer__viewport:focus-visible { outline: 3px solid #195caa; outline-offset: -3px; }
.floor-map-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  box-sizing: border-box;
  border: 0;
  background: #fff;
  color: #222;
}
.floor-map-viewer[open] { display: flex; flex-direction: column; }
.floor-map-viewer::backdrop { background: #0009; }
.floor-map-viewer__header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }
.floor-map-viewer__header h2 { margin: 0; padding: 0; border: 0; font-size: 18px; line-height: 1.5; }
.floor-map-viewer button { min-height: 48px; padding: 8px 12px; border: 1px solid #486d59; border-radius: 6px; background: #fff; color: #174c34; font: inherit; font-weight: 700; cursor: pointer; }
.floor-map-viewer__header button { flex-shrink: 0; }
.floor-map-viewer button:disabled { opacity: .4; cursor: default; }
.floor-map-viewer__help { margin: 0; padding: 0 12px 8px; font-size: 14px; }
.floor-map-viewer__viewport { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; background: #eef1ef; }
.floor-map-viewer__canvas { display: grid; place-items: center; }
.floor-map-viewer__canvas img { display: block; max-width: none; max-height: none; margin: 0; user-select: none; }
.floor-map-viewer__controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px 12px; border-top: 1px solid #ccd5cf; }
.floor-map-viewer__controls output { grid-column: 1 / -1; text-align: center; font-size: 14px; }
@media print {
  .floor-map-viewer, .floor-map__hint { display: none !important; }
  .site-main.floor-map-page--nav-ready { padding-top: 0; }
  .floor-map__nav { display: none; }
  .floor-map__floor { break-inside: avoid; }
}
