/* tachieya.com スタイルシート（レスポンシブ対応） */
:root {
  --bg: #faf7f4;
  --card-bg: #ffffff;
  --text: #33302c;
  --muted: #8a8178;
  --accent: #e2607e;
  --accent-dark: #c94a68;
  --border: #e7ded4;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ---------- ヘッダー ---------- */
.site-header {
  background: linear-gradient(135deg, #fff 0%, #fdeef2 100%);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 16px 16px;
  text-align: center;
}
.site-title {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
}
.site-domain {
  font-size: 1rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.site-tagline { margin: 4px 0 8px; color: var(--muted); font-size: 0.95rem; }
.site-usage { margin: 0 0 10px; color: var(--text); font-size: 0.98rem; font-weight: bold; }
.feature-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 6px;
}
.badge {
  display: inline-block;
  padding: 5px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.88rem;
  font-weight: bold;
  letter-spacing: 0.04em;
}
.header-nav a {
  color: var(--accent-dark);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 8px 4px;
  display: inline-block;
}

/* ---------- 広告プレースホルダ ---------- */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #d8cfc4;
  background: #f3eee8;
  color: #a79b8c;
  font-size: 0.85rem;
  min-height: 90px;
  margin: 12px auto;
  max-width: 1280px;
  width: calc(100% - 24px);
}
.ad-modal { width: 100%; margin: 0 0 10px; min-height: 90px; }
.ad-infeed { grid-column: 1 / -1; width: 100%; margin: 0; min-height: 90px; }
.ad-footer { margin-top: 20px; }

/* レクタングル広告枠（300×250 ミディアムレクタングル相当） */
.ad-rect { aspect-ratio: 300 / 250; min-height: 0; }
.ad-rect-grid {
  /* 広告本来の形（300×250）で、セル内の縦中央に置く。行の高さはカード側で決まるので配置は崩れない */
  width: 100%;
  max-width: none;
  margin: 0;
  align-self: center;
  border-radius: 10px;
}
.ad-rect-modal {
  width: min(300px, 100%);
  margin: 0 auto 14px;
}

/* ---------- 追従バナー ---------- */
.ad-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 2px dashed #d8cfc4;
  background: rgba(243, 238, 232, 0.97);
  color: #a79b8c;
  font-size: 0.85rem;
}
.ad-sticky[hidden] { display: none; }
.ad-sticky-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
@media (min-width: 900px) {
  /* PC: 画面下部中央にフローティング表示 */
  .ad-sticky {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 14px;
    width: 728px;
    max-width: calc(100% - 32px);
    height: 90px;
    border: 2px dashed #d8cfc4;
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(51, 48, 44, 0.18);
  }
}
body.has-sticky { padding-bottom: 60px; }
@media (min-width: 900px) {
  body.has-sticky { padding-bottom: 118px; }
}

/* ---------- ツールバー（検索） ---------- */
.toolbar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 12px 0;
}
.search-box {
  position: relative;
}
#search-input {
  width: 100%;
  height: 48px;
  font-size: 16px; /* スマホでの自動ズーム防止 */
  padding: 0 52px 0 14px; /* 右端のクリアボタン分を空ける */
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #fff;
  outline: none;
}
#search-input:focus { border-color: var(--accent); }
#search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
/* 入力欄の内側右端に置くクリアボタン（テキスト入力時のみ表示） */
.btn-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #f0ebe4;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.search-box.has-text .btn-clear { display: flex; }
.count-line { color: var(--muted); font-size: 0.9rem; margin: 8px 2px 0; }

/* ---------- 絞り込み ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: flex-end;
}
.filter-item {
  flex: 1 1 130px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.filter-label { font-size: 0.78rem; color: var(--muted); padding-left: 4px; }
.filter-item select {
  width: 100%;
  height: 44px;
  font-size: 16px; /* スマホでの自動ズーム防止 */
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.filter-item select:focus { border-color: var(--accent); }
.btn-filter-reset {
  flex: 0 1 auto;
  height: 44px;
  padding: 0 16px;
  font-size: 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- ギャラリーグリッド ---------- */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* スマホ（〜599px）: 2列 */
  gap: 10px;
}
@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
}
@media (min-width: 1280px) {
  .grid { grid-template-columns: repeat(6, 1fr); gap: 16px; }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: left;
  font: inherit;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.card:active { opacity: 0.85; }
.card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: #f0ebe4;
}
.card-body { padding: 8px 10px 10px; }
.card-caption {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-date { margin: 4px 0 0; font-size: 0.72rem; color: var(--muted); }

.no-results { text-align: center; color: var(--muted); padding: 32px 0; }

/* ---------- ページネーション ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 0 4px;
}
.btn-page {
  min-height: 44px;
  padding: 0 18px;
  font-size: 0.95rem;
  border-radius: 22px;
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent-dark);
  cursor: pointer;
}
.btn-page:disabled { opacity: 0.35; cursor: default; }
.page-numbers { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; }
.page-num {
  min-width: 44px;
  height: 44px;
  padding: 0 6px;
  font-size: 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.page-num.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: bold;
  cursor: default;
}
.page-ellipsis { color: var(--muted); padding: 0 2px; }
.page-info { text-align: center; color: var(--muted); font-size: 0.88rem; margin: 6px 0 0; }

/* ---------- このサイトについて / フッター ---------- */
.about {
  max-width: 860px;
  margin: 24px auto;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: calc(100% - 24px);
}
.about h2 { margin-top: 0; font-size: 1.25rem; color: var(--accent-dark); }

.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 24px 16px 32px;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer .ai-notice { font-weight: bold; color: var(--text); }

/* ---------- 詳細モーダル ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 25, 22, 0.72);
}
.modal-card {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 640px;
  margin: 0;
  min-height: 100%;
  padding: 16px 16px 28px;
}
@media (min-width: 700px) {
  .modal { align-items: center; padding: 24px 12px; }
  .modal-card { min-height: 0; border-radius: 14px; margin: auto; }
}
.btn-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 2;
}
.modal-figure { margin: 0; text-align: center; }
.modal-figure img {
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border-radius: 8px;
  background: #f0ebe4;
}
.modal-info { margin-top: 12px; }
.modal-caption { margin: 0 0 14px; font-size: 1.15rem; font-weight: bold; line-height: 1.6; }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btn-nav, .btn-download {
  flex: 1 1 30%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 0.95rem;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-nav { border: 1px solid var(--border); background: #fff; color: var(--text); }
.btn-nav:disabled { opacity: 0.4; cursor: default; }
.btn-download {
  flex: 1 1 100%;
  order: -1;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: bold;
}
@media (min-width: 700px) {
  .btn-download { flex: 1 1 30%; order: 0; }
}

/* ---------- 利用規約ページ ---------- */
.about h3 { margin: 20px 0 8px; font-size: 1.05rem; }
.terms-list { margin: 0 0 8px; padding-left: 1.4em; }
.terms-list li { margin: 6px 0; line-height: 1.7; }
.terms-ok li::marker { content: "○ "; color: var(--accent-dark); font-weight: bold; }
.terms-ng li::marker { content: "× "; color: #c0392b; font-weight: bold; }
.terms-back { margin-top: 24px; }
.terms-back a, .site-footer a { color: var(--accent-dark); }
