/* ===========================================================================
   燕三条 工場の祭典 2026 — やちふぁみの回りかた
   ---------------------------------------------------------------------------
   デザインの方針（あとで触る人向けのメモ）
   ---------------------------------------------------------------------------
   ・これは読み物ではなく「立ったまま片手で使う道具」。
     金谷城のしおりが座って読むページだったのに対し、こちらは
     歩きながら親指で操作する前提で、当たり判定を最低 44px 取っている。
   ・地の色は工場の鉄と紙。差し色だけ、祭典の公式のピンクを借りている。
     ピンクが出ているところは「押せる」「今ここ」のどちらかに限る。
   ・エリアの6色（燕西・燕東・三条市街地・三条北・三条南・下田）は
     公式サイトが各エリアに割り当てている色をそのまま持ってきている。
     現地で配られる紙のマップと色が揃うので、照合しやすい。
   ・書体は家族サイト本体・金谷城のしおりと同じ Zen Maru Gothic ＋
     Zen Kaku Gothic New。シリーズ物として繋がりが分かるように。
   ・ダークモードは作っていない。日中の屋外で見るものなので、
     白地・高コントラストに寄せたほうが読める。
   =========================================================================== */

:root {
  /* 鉄と紙 */
  --ink-900: #24282c;
  --ink-700: #444a50;
  --ink-500: #6c757d;
  --line: #dcd8d2;
  --paper: #ffffff;
  --band: #f4f2ef;

  /* 祭典の差し色。「押せる」「今ここ」だけに使う */
  --fes-pink: #e4007f;
  --fes-pink-weak: #fde6f2;
  --fire: #ff6b35;

  /* 未定の箇所（金谷城のしおりと同じ約束） */
  --todo: #c14c2c;
  --todo-line: #ff7a59;

  /* エリア色 — 公式サイトの割り当てをそのまま使う */
  --area-A: #76ab54; /* 燕西 */
  --area-B: #9e6c98; /* 燕東 */
  --area-D: #d06071; /* 三条市街地 */
  --area-F: #4a94bd; /* 三条北 */
  --area-E: #d8843c; /* 三条南 */
  --area-C: #a89c00; /* 下田 */

  --display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;

  --tap: 44px; /* 指で押せる最小の高さ */
  --radius: 10px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink-900);
  background: var(--paper);
  line-height: 1.7;
  overflow-wrap: anywhere; /* 長い社名・URLで横スクロールが出ないように */
}

h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.35;
  margin: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

/* 未定の箇所。オレンジの斜体＋点線で、埋め忘れが一目で分かる */
.fill {
  display: inline;
  color: var(--todo);
  font-style: italic;
  border-bottom: 2px dashed var(--todo-line);
  padding-bottom: 1px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ===========================================================================
   特設ページ（index.html）
   =========================================================================== */

.hero {
  padding: 40px 16px 32px;
  background: linear-gradient(160deg, #2b3034 0%, #3c3229 60%, #4a3340 100%);
  color: #fff;
}

.hero__inner {
  max-width: 34em;
  margin: 0 auto;
}

.hero__eyebrow {
  font-family: var(--display);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  color: var(--fes-pink);
  margin: 0 0 10px;
}

.hero h1 {
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: 700;
}

.hero__dates {
  margin: 14px 0 0;
  font-size: 1.05rem;
  font-weight: 500;
}

.hero__note {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
}

.section {
  padding: 32px 16px;
}

.section--band {
  background: var(--band);
}

.section__inner {
  max-width: 34em;
  margin: 0 auto;
}

.section h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.section__lead {
  color: var(--ink-500);
  font-size: 0.92rem;
  margin: 0 0 20px;
}

/* 2つの入口 */
.doors {
  display: grid;
  gap: 12px;
}

.door {
  display: block;
  padding: 26px 22px;
  border: 2px solid var(--ink-900);
  border-radius: var(--radius);
  background: var(--paper);
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.door:hover,
.door:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--ink-900);
}

.door__title {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.door__title::after {
  content: "→";
  color: var(--fes-pink);
  margin-left: auto;
  font-size: 1.2em;
}

/* 旅程 */
.plan {
  margin: 0;
}

.plan div {
  display: grid;
  grid-template-columns: 5.5em 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.plan dt {
  font-weight: 700;
  color: var(--ink-700);
  font-size: 0.9rem;
}

.plan dd {
  margin: 0;
}

.facts {
  margin: 0;
  padding-left: 1.2em;
}

.facts li {
  margin-bottom: 6px;
}

.footer {
  padding: 28px 16px 40px;
  background: var(--ink-900);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.85rem;
}

.footer__inner {
  max-width: 34em;
  margin: 0 auto;
}

.footer a {
  color: #fff;
}

/* ===========================================================================
   地図ページ（map.html）
   ---------------------------------------------------------------------------
   画面は上から「操作の帯」「地図またはリスト」。
   地図とリストは同じ絞り込み結果の2つの見方なので、状態は1つしか持たない。
   =========================================================================== */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.bar {
  flex: none;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px 0;
}

.bar__top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar__home {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  text-decoration: none;
  font-size: 1.1rem;
}

.search {
  flex: 1;
  min-width: 0;
  height: var(--tap);
  padding: 0 12px;
  font: inherit;
  font-size: 16px; /* iOS がフォーカス時に拡大しない下限 */
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--band);
}

.search:focus {
  outline: 2px solid var(--fes-pink);
  outline-offset: -2px;
  background: var(--paper);
}

/* フィルタの行。横に流して、指で弾いて選ぶ */
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chips__label {
  flex: none;
  align-self: center;
  font-size: 0.72rem;
  color: var(--ink-500);
  padding-right: 2px;
  white-space: nowrap;
}

.chip {
  flex: none;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  white-space: nowrap;
  font-size: 0.85rem;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--fes-pink);
  border-color: var(--fes-pink);
  color: #fff;
  font-weight: 500;
}

/* 地図のピンの色が何を指すのか、凡例がどこにも無かった。チップ自身に持たせる */
.chip--area::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot);
  margin-right: 5px;
  vertical-align: 1px;
}

.chip--area[aria-pressed="true"]::before {
  box-shadow: 0 0 0 1.5px #fff;
}

.chip__count {
  opacity: 0.55;
  font-size: 0.78em;
  margin-left: 4px;
}

/* 現在地まわり。縦を地図に譲りたいので1行に収める。
   上のチップ行と同じ見た目だと1つの絞り込みに見えるので、罫線で切る */
.near {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  margin-top: 2px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.near::-webkit-scrollbar {
  display: none;
}

.near > * {
  flex: none;
}

/* 「詳しく絞る」は絞り込みそのものではなく開け閉めなので、
   チップと同じ形にしない。点線で「これは条件ではない」と分かるようにする */
.more {
  flex: none;
  /* 横に流れる行の末尾に置くと、狭い画面では画面外に出て見つからない。
     行に貼り付けて常に右端に見えるようにする */
  position: sticky;
  right: 0;
  margin-left: auto;
  padding-left: 8px;
  box-shadow: -8px 0 8px -4px var(--paper);
  background: var(--paper);
  min-height: 30px;
  padding: 2px 10px;
  border: 1px dashed var(--ink-500);
  border-radius: var(--radius);
  color: var(--ink-700);
  font: inherit;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
}

.more[aria-pressed="true"] {
  background: var(--ink-900);
  border-style: solid;
  border-color: var(--ink-900);
  color: #fff;
}

/* 半径は独立したチップではなく、起点とひと続きの目盛り。
   隙間を詰めて連結した形にすることで、上の丸いチップと別物に見せる */
.near__radius {
  display: flex;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--band);
}

.near__radius .chip {
  min-height: 30px;
  padding: 2px 10px;
  font-size: 0.8rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.near__radius .chip + .chip {
  border-left: 1px solid var(--line);
}

/* 起点を決めていないうちは半径に意味がない */
.near__radius[data-off="true"] {
  opacity: 0.4;
}

.near__radius .chip:disabled {
  cursor: default;
}

/* 伝えることが無いときは高さも取らない */
.notice {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: #9c2b2b;
}

.notice:empty {
  display: none;
}

/* 件数とタブ */
.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 8px;
}

.status__count {
  font-size: 0.85rem;
  color: var(--ink-700);
}

.status__count b {
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--ink-900);
}

.views {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.views button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  background: var(--paper);
  cursor: pointer;
  font-size: 0.85rem;
}

.views button[aria-pressed="true"] {
  background: var(--ink-900);
  color: #fff;
}

.reset {
  border: 0;
  background: none;
  color: var(--fes-pink);
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
}

/* 地図とリストの入れ物 */
.stage {
  flex: 1;
  min-height: 0;
  position: relative;
}

#map {
  position: absolute;
  inset: 0;
}

.list {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--band);
  padding: 10px 12px 24px;
  margin: 0;
  list-style: none;
}

.stage[data-view="map"] .list,
.stage[data-view="list"] #map {
  display: none;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 5px solid var(--card-area, var(--line));
  border-radius: var(--radius);
  margin-bottom: 8px;
  padding: 12px 14px;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: left;
}

.card__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.card__no {
  font-family: var(--display);
  font-size: 0.78rem;
  color: var(--ink-500);
  flex: none;
}

.card__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
}

.card__dist {
  margin-left: auto;
  flex: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--fes-pink);
}

.card__meta {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--ink-500);
}

.card__tags {
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--band);
  color: var(--ink-700);
}

.tag--item {
  background: var(--fes-pink-weak);
  color: #9c0057;
}

.tag--area {
  background: var(--tag-area, var(--band));
  color: #fff;
}

.empty {
  text-align: center;
  color: var(--ink-500);
  padding: 40px 16px;
  font-size: 0.9rem;
}

/* 地図のピン */
.pin {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--display);
}

/* 位置が大字どまりのものは中を抜いて、確からしさの差を見た目に出す */
.pin--approx {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.55) 0 3px,
    transparent 3px 6px
  );
}

.pin--pick {
  width: 34px;
  height: 34px;
  font-size: 0.7rem;
  border-width: 3px;
  box-shadow: 0 0 0 3px var(--fes-pink), 0 1px 5px rgba(0, 0, 0, 0.4);
}

.here {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fes-pink);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--fes-pink);
}

/* 地図の中心を起点にしているときは、GPS の現在地と同じ見た目にしない。
   「本当にそこにいる」と「そこを指した」は別のことなので、中を抜いて十字にする */
.here--center {
  position: relative;
  background: #fff;
  border-color: var(--ink-900);
  box-shadow: 0 0 0 2px var(--ink-900);
}

.here--center::before,
.here--center::after {
  content: '';
  position: absolute;
  background: var(--ink-900);
}

.here--center::before {
  top: -5px;
  bottom: -5px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
}

.here--center::after {
  top: 50%;
  left: -5px;
  right: -5px;
  height: 2px;
  margin-top: -1px;
}

/* 選んでいる半径の円。刻みを選ぶには、その範囲が見えている必要がある。
   地図とピンを隠さないよう塗りはごく薄くする */
.ring {
  fill: var(--fes-pink);
  fill-opacity: 0.06;
  stroke: var(--fes-pink);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.ring--center {
  fill: var(--ink-900);
  stroke: var(--ink-900);
}

/* 詳細シート — 下から出す */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82dvh;
  background: var(--paper);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transform: translateY(101%);
  transition: transform 0.22s ease;
}

.sheet[data-open="true"] {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .sheet {
    transition: none;
  }
}

.sheet__grab {
  flex: none;
  padding: 8px 0 4px;
  display: grid;
  place-items: center;
}

.sheet__grab::before {
  content: "";
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}

.sheet__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  background: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--ink-500);
}

.sheet__body {
  overflow-y: auto;
  padding: 4px 16px calc(16px + env(safe-area-inset-bottom));
}

.sheet h2 {
  font-size: 1.25rem;
  padding-right: 44px;
}

.sheet__sub {
  margin: 2px 0 10px;
  font-size: 0.82rem;
  color: var(--ink-500);
}

.sheet__actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 12px 0;
}

.btn {
  min-height: var(--tap);
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--ink-900);
  background: var(--ink-900);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 0 14px;
}

.btn--ghost {
  background: var(--paper);
  color: var(--ink-900);
}

.btn--star[aria-pressed="true"] {
  background: var(--fes-pink);
  border-color: var(--fes-pink);
  color: #fff;
}

.sheet dl {
  margin: 0;
  border-top: 1px solid var(--line);
}

.sheet dl > div {
  display: grid;
  grid-template-columns: 5.5em 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.sheet dt {
  color: var(--ink-500);
  font-size: 0.82rem;
}

.sheet dd {
  margin: 0;
}

.sheet__event {
  margin: 14px 0 0;
  font-size: 0.9rem;
  background: var(--band);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.sheet__event h3 {
  font-size: 0.85rem;
  color: var(--ink-500);
  margin-bottom: 4px;
}

.warn {
  background: #fff6ed;
  border: 1px solid #ffd9b8;
  color: #8a4b12;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.82rem;
  margin: 10px 0 0;
}

.closed {
  background: #fdecec;
  border-color: #f6c6c6;
  color: #9c2b2b;
}

/* 画面が広いときは、リストを2列にして一度に見渡せるようにする。
   columns だと高さの決まった枠の中で段が横に伸び、横スクロールになってしまう。
   grid なら列が増えてもスクロールは縦のまま */
@media (min-width: 720px) {
  .list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 10px;
    align-content: start;
  }
  .card {
    margin-bottom: 0;
  }
  .empty {
    grid-column: 1 / -1;
  }
  .sheet {
    left: auto;
    right: 16px;
    bottom: 16px;
    width: 380px;
    max-height: 78dvh;
    border-radius: 16px;
  }
  .doors {
    grid-template-columns: 1fr 1fr;
  }
}
