/* ===========================================
   HITOYAMA HIKE MAP ビューワー（/hitoyama-hike-map/）
   WordPress を通さない単独ページのため style.css は読み込まず、必要なトークンだけ持つ
   =========================================== */

/* 値は style.css の :root と揃えること（docs/DESIGN.md §2） */
:root {
  --color-brown: #382626;
  --color-white: #faf8f4;
  --color-tan-light: #f0ebe5;
  --color-tan-mid: #efe7dd;
  --color-tan-warm: #d8bfab;
  --color-muted: #6b5a5a;
  --font-heading: "Shippori Mincho", "游明朝", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --font-base: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Hiragino Kaku Gothic Pro", "Yu Gothic", "游ゴシック", Meiryo, sans-serif;
  --font-base-en: "Inter", "Helvetica Neue", Arial, sans-serif;

  --hike-bar-height: 56px;
  --hike-control-size: 40px;
}

@media (min-width: 768px) {
  :root {
    --hike-bar-height: 64px;
    --hike-control-size: 44px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

.p-hikeMap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--color-tan-light);
  color: var(--color-brown);
  font-family: var(--font-base);
  letter-spacing: 0.04em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.p-hikeMap button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ---------- ヘッダーバー ---------- */

.p-hikeMap__bar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  flex-shrink: 0;
  height: calc(var(--hike-bar-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  background-color: var(--color-white);
  background-image: url("../img/common/texture/bg-texture-body.png");
  background-repeat: repeat;
  border-bottom: 1px solid rgba(56, 38, 38, 0.12);
}

@media (min-width: 768px) {
  .p-hikeMap__bar {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
}

.p-hikeMap__back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: var(--hike-control-size);
  padding: 0 14px 0 8px;
  border: 1px solid var(--color-brown);
  border-radius: 50px;
  background: transparent;
  color: var(--color-brown);
  font-family: var(--font-base-en);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.3s ease;
}

@media (min-width: 768px) {
  .p-hikeMap__back {
    font-size: 14px;
    padding-right: 20px;
    padding-left: 12px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .p-hikeMap__back:hover {
    background-color: rgba(216, 191, 171, 0.2);
  }
}

.p-hikeMap__back:focus-visible,
.p-hikeMap__side:focus-visible,
.p-hikeMap__zoomButton:focus-visible,
.p-hikeMap__stage:focus-visible {
  outline: 2px solid var(--color-brown);
  outline-offset: 2px;
}

.p-hikeMap__backIcon {
  flex-shrink: 0;
}

/* 極小幅ではタイトルと重ならないようアイコンのみ */
@media (max-width: 359px) {
  .p-hikeMap__back {
    width: var(--hike-control-size);
    padding: 0;
    justify-content: center;
  }
  .p-hikeMap__backText {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

.p-hikeMap__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0 8px;
  text-align: center;
  font-weight: 400;
  line-height: 1.3;
}

.p-hikeMap__titleEn {
  font-family: var(--font-base-en);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.p-hikeMap__titleJa {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--color-muted);
}

@media (min-width: 768px) {
  .p-hikeMap__titleEn {
    font-size: 14px;
  }
  .p-hikeMap__titleJa {
    font-size: 13px;
  }
}

.p-hikeMap__barSpacer {
  justify-self: end;
}

/* ---------- ステージ（パン・ズーム領域） ---------- */

.p-hikeMap__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  /* ブラウザ標準のスクロール・ピンチズームを止め、JS 側でジェスチャーを扱う */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  background-color: var(--color-tan-light);
}

.p-hikeMap__stage.is-dragging {
  cursor: grabbing;
}

.p-hikeMap__image {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  max-width: none;
  transform-origin: 0 0;
  box-shadow: 0 6px 30px rgba(56, 38, 38, 0.12);
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: transform;
  -webkit-user-drag: none;
  pointer-events: none;
}

.p-hikeMap__image.is-loaded {
  opacity: 1;
}

.p-hikeMap__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: var(--color-muted);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.p-hikeMap__loading.is-hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.p-hikeMap__hint {
  position: absolute;
  top: 16px;
  left: 50%;
  margin: 0;
  padding: 8px 16px;
  transform: translateX(-50%);
  border-radius: 50px;
  background-color: rgba(56, 38, 38, 0.82);
  color: var(--color-white);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.p-hikeMap__hint.is-visible {
  opacity: 1;
}

/* ---------- 下部ドック（面切替・ズーム） ---------- */

.p-hikeMap__dock {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background-color: var(--color-white);
  background-image: url("../img/common/texture/bg-texture-body.png");
  background-repeat: repeat;
  border-top: 1px solid rgba(56, 38, 38, 0.12);
}

/* 全体表示時にマップへ重ならないよう、PC でもドックはステージの外に置く */
@media (min-width: 768px) {
  .p-hikeMap__dock {
    justify-content: center;
    gap: 32px;
    padding-top: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

.p-hikeMap__sides {
  display: inline-flex;
  height: var(--hike-control-size);
  padding: 3px;
  border: 1px solid var(--color-brown);
  border-radius: 50px;
}

.p-hikeMap__side {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border: 0;
  border-radius: 50px;
  background: transparent;
  transition: background-color 0.3s ease, color 0.3s ease;
}

@media (min-width: 768px) {
  .p-hikeMap__side {
    padding: 0 20px;
  }
}

.p-hikeMap__side.is-active {
  background-color: var(--color-brown);
  color: var(--color-white);
}

@media (hover: hover) and (pointer: fine) {
  .p-hikeMap__side:not(.is-active):hover {
    background-color: rgba(216, 191, 171, 0.3);
  }
}

.p-hikeMap__sideEn {
  font-family: var(--font-base-en);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.p-hikeMap__sideJa {
  font-size: 10px;
  opacity: 0.8;
}

@media (min-width: 768px) {
  .p-hikeMap__sideEn {
    font-size: 13px;
  }
  .p-hikeMap__sideJa {
    font-size: 11px;
  }
}

.p-hikeMap__zoom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.p-hikeMap__zoomButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--hike-control-size);
  height: var(--hike-control-size);
  padding: 0;
  border: 1px solid var(--color-brown);
  border-radius: 50%;
  background: transparent;
  transition: background-color 0.3s ease, opacity 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .p-hikeMap__zoomButton:not(:disabled):hover {
    background-color: rgba(216, 191, 171, 0.3);
  }
}

.p-hikeMap__zoomButton:disabled {
  opacity: 0.3;
  cursor: default;
}

.p-hikeMap__zoomLevel {
  min-width: 3.6em;
  font-family: var(--font-base-en);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

@media (max-width: 359px) {
  .p-hikeMap__zoomLevel {
    display: none;
  }
  .p-hikeMap__side {
    padding: 0 10px;
  }
}

/* 英語表示時は日本語の面ラベルを出さない */
.is-lang-en .p-hikeMap__sideJa {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .p-hikeMap *,
  .p-hikeMap *::before,
  .p-hikeMap *::after {
    transition-duration: 0.01ms !important;
  }
}
