/* 作品紹介ギャラリー 共通スタイル。
   ライト / ダークは OS 設定に追従する（トグルは置かない＝ file:// で状態を持ちたくないため）。
   色は必ず :root に既定値を書き、dark では同じ変数を上書きするだけにする。 */

:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #f0ece6;
  --border: #e0d9d0;
  --border-strong: #cdc3b6;
  --text: #23201c;
  --muted: #6f675e;
  --accent: #a9682a;
  --accent-soft: #f3e6d6;
  --on-accent: #fff; /* アクセント色を背景にしたときの文字色 */
  --shadow: 0 1px 2px rgba(35, 32, 28, 0.06), 0 8px 24px rgba(35, 32, 28, 0.06);
  --shadow-hover: 0 2px 4px rgba(35, 32, 28, 0.08), 0 16px 40px rgba(35, 32, 28, 0.12);
  /* 「まだ画像が無い」面に敷く斜線。撮影前と撮影失敗の両方で同じ見た目にする */
  --hatch: repeating-linear-gradient(45deg, transparent 0 10px, rgba(128, 128, 128, 0.06) 10px 20px);
  --radius: 10px;
  --maxw: 1240px;
  --font: system-ui, -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Yu Gothic UI", Meiryo, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1b1e24;
    --surface-2: #22262e;
    --border: #2c313a;
    --border-strong: #3d434f;
    --text: #e7e4df;
    --muted: #98928a;
    --accent: #e0a458;
    --accent-soft: #2e2519;
    --on-accent: #14161a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 16px 40px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

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

.site-head {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-head .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px;
  padding-top: 28px;
  padding-bottom: 24px;
}

.site-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.site-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ---------- フィルタと並び替え ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 20px 0 4px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter {
  padding: 5px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.filter:hover { color: var(--text); border-color: var(--accent); }

.filter[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.sort-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.sort-field select {
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.sort-field select:hover { border-color: var(--accent); }

/* ---------- カードグリッド ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  padding: 24px 0 64px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
}

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.card-thumb img {
  position: relative; /* 下に敷いた .thumb-empty より前面に置く */
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* スマホ幅で撮った縦長の画面は、切り取らず全体を収める */
.card-thumb img.contain,
.shot img.contain {
  object-fit: contain;
  background: var(--surface-2);
}

.shot img.contain { max-height: 620px; }

/* 撮影前・撮影失敗のときに出る差し替え面（レイアウトを崩さない） */
.thumb-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  background: var(--hatch), var(--surface-2);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
  flex: 1;
}

.card-name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

.card-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

/* ---------- バッジ ---------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
  white-space: nowrap;
}

.badge-status { border-color: var(--accent); color: var(--accent); }
.badge-local { background: var(--surface-2); }
.badge-private {
  border-color: #c2554b;
  color: #c2554b;
}

.badge-date { font-variant-numeric: tabular-nums; }

/* ---------- 詳細ページ ---------- */

.back {
  display: inline-block;
  padding: 24px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.back:hover { color: var(--accent); }

.work-head {
  padding: 20px 0 32px;
  border-bottom: 1px solid var(--border);
}

.work-title {
  margin: 0 0 6px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.work-tagline {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 15px;
  max-width: 62ch;
}

.work-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.work-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  font-size: 13px;
  color: var(--muted);
}

.work-facts b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.work-facts code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

/* セクション */

.sec { padding: 36px 0 0; }

.sec > h2 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.sec p,
.prose { margin: 0 0 12px; max-width: 74ch; }

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  max-width: 82ch;
}

.list li {
  position: relative;
  padding-left: 22px;
}

.list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ショット */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}

.shot {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.shot img {
  display: block;
  width: 100%;
  cursor: zoom-in;
  background: var(--surface-2);
}

.shot figcaption {
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}

.shot-missing {
  padding: 40px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--hatch), var(--surface-2);
}

/* アーキテクチャ図 */

.diagram {
  margin: 0 0 12px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.8;
  overflow-x: auto;
}

/* スペック表 */

.spec {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  max-width: 900px;
}

.spec th,
.spec td {
  border: 1px solid var(--border);
  padding: 9px 14px;
  text-align: left;
  vertical-align: top;
}

.spec th {
  width: 190px;
  background: var(--surface-2);
  font-weight: 600;
  white-space: nowrap;
}

/* 注記（撮影不可・非公開の説明など） */

.note {
  margin: 0 0 12px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  font-size: 13.5px;
  max-width: 74ch;
}

.foot {
  margin-top: 56px;
  padding: 24px 0 56px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}

/* 画像の拡大表示 */

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, 0.82);
  cursor: zoom-out;
  z-index: 50;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

/* ---------- 狭い画面 ---------- */

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .grid { grid-template-columns: 1fr; gap: 18px; }
  .shots { grid-template-columns: 1fr; }
  .work-title { font-size: 25px; }
  .spec th { width: auto; white-space: normal; }
  .spec,
  .spec tbody,
  .spec tr,
  .spec th,
  .spec td { display: block; }
  .spec tr { margin-bottom: -1px; }
  .spec td { border-top: none; }
}
