/* TamifuruD Photo Archives — 仮スタイル（ブランドガイドの色と書体を反映）
   色：背景はブランドのブラウン、文字はオフホワイト。ライト／ダークどちらでも同じ見た目にしている。
       パレットにない色（濃い茶・明るいベージュなど）は、ブラウンとベージュを濃く／淡くして作っている
   書体：日本語はすべて Zen Kaku Gothic Antique／見出しの英字 Ovo／英数字の補助情報 Josefin Sans Italic
   レイアウト：１カラム。常時表示の「非公式」帯 → 説明 → このサイトについて → 絞り込みと一覧 → 利用ルール */
:root {
  /* 正規パレット（ブランドガイド） */
  --navy: #25428E;
  --olive: #66722F;
  --turquoise: #4A90A4;
  --beige: #D0B793;
  --brown: #705040;
  --brick: #8A4B40;
  --offwhite: #F8F6E9;

  /* 役割ごとの色 */
  --bg: var(--brown);
  --fg: var(--offwhite);
  --muted: #E5D5BB; /* ベージュを明るくした色（ブラウンの上でも読める濃さ） */
  --line: #957563; /* ブラウンを明るくした区切り線 */
  --surface: #5E4335; /* ブラウンを暗くした面（写真の下地・保存欄） */
  --accent: var(--turquoise); /* 選択中のトグル・主なボタン */
  --accent-fg: var(--offwhite);
  --warn-bg: #2E2019; /* 「非公式」の帯（焦げ茶） */
  --warn-fg: var(--offwhite);
  --focus: #9FD3E0; /* ターコイズを明るくした色 */
  --scrim: rgb(46 32 25 / 0.75);
  --scrim-fg: var(--offwhite);
  --backdrop: rgb(20 14 11 / 0.7);

  --font-display: "Ovo", "Zen Kaku Gothic Antique", serif;
  --font-body: "Zen Kaku Gothic Antique", system-ui, sans-serif;
  --font-sub: "Josefin Sans", "Zen Kaku Gothic Antique", sans-serif;

  /* 「非公式」の札（古い警告看板風）。テーマに関係なく同じ色 */
  --sign-plate: #F1EBD8; /* 日に焼けたオフホワイトの板 */
  --sign-frame: #3E2C22; /* 錆びた鉄枠（ブラウンを暗くした色） */
  --sign-ink: var(--brick);
  --rivet: #B8743F; /* リベット */
  --sign-soot: rgb(78 58 46 / 0.38); /* 板の縁の汚れ */
  --sign-shadow: rgb(0 0 0 / 0.3);
  --sign-grime: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='40'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .44 0 0 0 0 .31 0 0 0 0 .24 1.4 0 0 0 -.72'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark; /* 背景が暗めなので、フォーム部品やスクロールバーも暗い見た目にする */
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.75;
}
/* 見出し：英字は Ovo、日本語は Zen Kaku Gothic Antique の太字。
   Ovo には太字がないので、無理に太らせず細いまま使う（font-synthesis: none） */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-synthesis: none;
}
.site-title {
  font-family: var(--font-display);
  font-weight: 400;
}
/* 英数字だけの補助情報：Josefin Sans Italic（日本語や全角数字に斜体をかけない） */
.viewer-pos {
  font-family: var(--font-sub);
  font-style: italic;
  font-synthesis: none;
}
.copyright { font-family: var(--font-sub); font-style: normal; } /* フッターの © は斜体にしない */
body::before { /* スマホのノッチ部分も帯と同じ色で塗る */
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--warn-bg);
}
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---- 非公式の表示 ---- */
.unofficial-bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-size: 0.85rem;
  line-height: 1.5;
}
.unofficial-bar .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.6rem; padding-block: 0.45rem; }
/* 「非公式」の札：古びた警告看板のような金属プレート。
   実物の看板なので、ライト／ダークどちらでも同じ見た目にしている */
.badge {
  --rivet-dot: radial-gradient(circle, var(--rivet) 0 1.1px, var(--sign-frame) 1.6px, transparent 2.1px);
  display: inline-block;
  padding: 0.08em 0.62em 0.1em 0.72em; /* 字間のぶん右を少し詰める */
  border: 2px solid var(--sign-frame);
  border-radius: 2px;
  background:
    var(--rivet-dot) left 1px top 1px / 5px 5px no-repeat,
    var(--rivet-dot) right 1px top 1px / 5px 5px no-repeat,
    var(--rivet-dot) left 1px bottom 1px / 5px 5px no-repeat,
    var(--rivet-dot) right 1px bottom 1px / 5px 5px no-repeat,
    var(--sign-grime),
    var(--sign-plate);
  box-shadow: inset 0 0 0.45em var(--sign-soot), 0 1px 2px var(--sign-shadow);
  color: var(--sign-ink);
  font-family: "Ovo", serif; /* 看板の「WARNING」。Ovo には太字がないので輪郭を少しだけ足す */
  font-weight: 400;
  font-synthesis: none;
  -webkit-text-stroke: 0.025em currentColor;
  font-size: 0.9em;
  letter-spacing: 0.1em;
  line-height: 1.45;
  white-space: nowrap;
  transform: rotate(-1.5deg);
}

/* ---- ヘッダー・各セクション ---- */
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding-block: 1rem;
}
.site-title { margin: 0; font-size: 1.25rem; letter-spacing: 0.02em; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: 0.9rem; }

section { padding-block: 2.5rem; border-top: 1px solid var(--line); }
section.intro { border-top: 0; padding-block: 0 2.5rem; }
section.intro > .wrap { padding-top: 1.25rem; }
/* ヘッダー画像：開くたびにランダムで１枚。高さは画面の高さの60%・4:3・中央。枠からはみ出た分は切り取る。
   背景として出すので右クリック保存できない */
.hero { width: fit-content; max-width: 100%; margin: 0 auto; }
.hero-image {
  /* 高さ＝画面の高さの60%。縦長のスマホでは横にはみ出さないよう、横幅いっぱい（横幅×3/4）で止める */
  width: auto;
  height: min(60vh, 75vw);
  aspect-ratio: 4 / 3;
  background-color: var(--surface);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  -webkit-touch-callout: none;
  user-select: none;
}
.hero-caption { /* 撮影場所（一番下の階層）を写真の下・写真の右端から少し内側に小さく */
  padding: 0.4rem 0.6rem 0 0;
  text-align: right;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.intro-title { /* 冒頭の見出しは英字も含めて Zen Kaku Gothic Antique */
  font-family: var(--font-body);
  font-size: clamp(1.25rem, 5.2vw, 2rem);
  line-height: 1.45;
  margin: 0 0 1rem;
}
h2 { font-size: 1.3rem; line-height: 1.4; margin: 0 0 1.25rem; text-wrap: balance; }
h3 { font-size: 1rem; margin: 1.75rem 0 0.5rem; }
.prose > * { max-width: 46em; }
.prose ul { padding-left: 1.25em; margin: 0; display: grid; gap: 0.4rem; }
#terms ul { list-style-type: "■ "; padding-left: 1.4em; }
#terms li::marker { font-size: 0.8em; }

/* ---- このサイトについて（見せる用のブロック） ----
   見出し → 宣言文 → ３つの項目（広い画面では横並び）の上下配置。色の帯で前後のセクションと切り分ける */
section.about {
  border-top: 0;
  background: var(--surface);
  padding-block: clamp(3rem, 7vw, 5.5rem);
}
section.about + section { border-top: 0; }
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem;
}
.about-head { display: grid; gap: 0.35rem; align-content: start; }
.about-head h2 { margin: 0; font-size: clamp(1.6rem, 3.6vw, 2.3rem); line-height: 1.3; }
.about-intro { display: grid; gap: 0.6rem; min-width: 0; }
.about-note { margin: 0; max-width: 56em; font-size: 0.85rem; color: var(--muted); } /* 非公式の注意書きは小さめに */
.about-statement {
  margin: 0;
  min-width: 0;
  max-width: 30em;
  font-size: clamp(1.1rem, 2.1vw, 1.4rem);
  line-height: 1.75;
  text-wrap: pretty;
}
.about-points {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem 2.5rem;
}
@media (min-width: 760px) {
  .about-points { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.about-points li {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.about-num {
  font-family: "Ovo", serif;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--beige);
}
.about-points p { margin: 0; line-height: 1.85; }

/* ---- ボタン ---- */
.button {
  font: inherit;
  font-size: 0.92rem;
  padding: 0.55em 1.1em;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
}
.button.secondary { background: transparent; color: var(--fg); border-color: var(--line); }
.button:disabled { opacity: 0.4; cursor: not-allowed; }
.text-button {
  font: inherit;
  background: none;
  border: 0;
  padding: 0 0.25em;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.icon-button {
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg);
  cursor: pointer;
}

/* ---- 絞り込み（トグル） ---- */
.caption-search { display: grid; gap: 0.4rem; margin-bottom: 1.25rem; }
.caption-search input {
  width: 100%;
  min-width: 0;
  max-width: 36rem;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 16px; /* iPhoneで入力時の自動ズームを防ぐ */
}
.caption-search input::placeholder { color: var(--muted); opacity: 1; }
.caption-search p { margin: 0; }
.filters { display: grid; gap: 0.75rem; }
.filter-row { display: grid; gap: 0.4rem; }
.filter-label { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  font: inherit;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  max-width: 100%;
  padding: 0.4em 0.95em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.chip-count { font-size: 0.78rem; opacity: 0.75; font-variant-numeric: tabular-nums; }
.chip-check { font-weight: 700; }
.chip[aria-pressed="false"] .chip-check { display: none; }
.result-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 1.25rem 0 0.75rem; font-variant-numeric: tabular-nums; }

/* ---- 一覧 ---- */
.gallery {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.card {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
  -webkit-touch-callout: none; /* スマホの長押し保存を出さない */
  user-select: none;
}
.card img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.card-label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.2rem 0.45rem;
  background: var(--scrim);
  color: var(--scrim-fg);
  font-size: 0.7rem;
  line-height: 1.4;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty { padding: 2rem 0; color: var(--muted); }
.more { display: block; margin: 1.25rem auto 0; }

/* ---- ダイアログ共通 ---- */
dialog {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  max-height: calc(100dvh - 32px);
}
dialog::backdrop { background: var(--backdrop); }
.dialog-body { padding: 1.25rem; display: grid; gap: 1rem; }
.dialog-body > * { margin: 0; min-width: 0; }
.notice { width: min(560px, calc(100vw - 32px)); }
.notice h2 { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.notice-title { font-family: "Zen Antique Soft", serif; font-weight: 400; } /* 太字がない書体なので400のまま */

/* ---- 拡大表示 ---- */
.viewer { width: min(960px, calc(100vw - 32px)); }
.viewer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.viewer-title { margin: 0; font-weight: 700; min-width: 0; }
.viewer-preview {
  width: 100%;
  max-width: 100%;
  max-height: 60dvh;
  margin-inline: auto;
  display: grid;
  place-items: center;
  background-color: var(--surface);
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  color: var(--muted);
  -webkit-touch-callout: none;
  user-select: none;
}
.viewer-nav { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-variant-numeric: tabular-nums; }
.viewer-caption { white-space: pre-wrap; }
.viewer-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; font-size: 0.9rem; }
.viewer-meta dt { color: var(--muted); }
.viewer-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---- 保存の前の確認 ---- */
.gate { display: grid; gap: 0.75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.gate > * { margin: 0; }
.gate-note { font-size: 0.9rem; }
.gate-check { display: flex; align-items: flex-start; gap: 0.6rem; cursor: pointer; }
.gate-check input { width: 1.2rem; height: 1.2rem; margin: 0.25rem 0 0; flex: none; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---- フッター ---- */
.site-footer { border-top: 1px solid var(--line); font-size: 0.85rem; }
.site-footer .wrap { padding-block: 2rem 3rem; display: grid; gap: 0.5rem; }
.site-footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.25rem; padding-block: 0.5rem; }
.footer-label { font-weight: 700; }
.footer-links ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

