/*
 * Method Images — サイト共通スタイル
 * トーンは /photo-gallery と揃える（ダーク基調・Neue Haas Unica・微グレイン）。
 * レイアウトは Pinterest 風の可変高マソンリー（CSS columns）。
 */

:root {
  --bg: #070809;
  --bg-soft: #0E0F12;
  --ink: #F4F5F6;
  --ink-dim: #9A9CA1;
  --ink-faint: #5B5E66;
  --line: rgba(255, 255, 255, .10);
  --line-soft: rgba(255, 255, 255, .05);
  --accent: #8A9AA6;
  --pad: clamp(16px, 4vw, 56px);
  --font: "neue-haas-unica", system-ui, -apple-system, "Hiragino Sans", sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --header-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0 }

/* hidden 属性を確実に効かせる。
   .tile などに display を指定していると、作者スタイルがブラウザ既定の
   [hidden]{display:none} に勝ってしまい、絞り込んでも消えなくなる。 */
[hidden] { display: none !important }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { min-height: 100%; overscroll-behavior-y: none }
a { color: inherit; text-decoration: none }
img { display: block; max-width: 100% }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer }
::selection { background: var(--accent); color: #06070A }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px }

/* ===== 背景（固定）===== */
.space-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 18% 6%, rgba(40, 58, 72, .28), transparent 55%),
    radial-gradient(90% 70% at 86% 92%, rgba(72, 48, 40, .20), transparent 55%),
    radial-gradient(140% 120% at 50% 50%, #0A0C10 0%, #070809 60%, #050607 100%);
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

@media (max-width: 640px) {
  /* 高DPIではノイズが引き伸ばされて粗く見えるため薄くする */
  .grain { opacity: .03 }
}

.page { position: relative; z-index: 2 }

/* ===== ヘッダー ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  display: flex;
  align-items: center;
  /* 検索ボックス追加に伴い space-between をやめ、検索の margin-left:auto で右寄せする */
  justify-content: flex-start;
  gap: 24px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 8, 9, .82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}

.wordmark {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.wordmark em { font-style: normal; color: var(--ink-dim); font-weight: 400 }

.header-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--ink-dim);
  white-space: nowrap;
}

.header-nav a { transition: color .3s var(--ease) }
.header-nav a:hover { color: var(--ink) }

/* ===== ヘッダー検索 ===== */
.header-search { position: relative; display: flex; align-items: center; margin-left: auto }

.header-search svg {
  position: absolute;
  left: 11px;
  width: 13px;
  height: 13px;
  color: var(--ink-faint);
  pointer-events: none;
}

.header-search input {
  width: clamp(140px, 22vw, 240px);
  height: 32px;
  padding: 0 12px 0 32px;
  font: inherit;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  -webkit-appearance: none;
  appearance: none;
  transition: background .3s var(--ease), border-color .3s var(--ease), width .3s var(--ease);
}

.header-search input::placeholder { color: var(--ink-faint) }
.header-search input:hover { border-color: var(--line) }
.header-search input:focus { background: rgba(255, 255, 255, .08); border-color: var(--line) }
.header-search input::-webkit-search-decoration,
.header-search input::-webkit-search-cancel-button { -webkit-appearance: none }

/* 検索で0件のとき（gallery.js が生成・文言も入れる） */
.search-empty { padding: 8px var(--pad) 48px; font-size: 13px; color: var(--ink-dim) }

@media (max-width: 560px) {
  /* 狭い幅では1段に収まらないため、1段目にロゴ＋ナビ、2段目に検索ボックスを全幅で置く */
  .site-header {
    flex-wrap: wrap;
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    row-gap: 10px;
  }
  .wordmark { font-size: 12px; letter-spacing: .1em }
  .header-nav { margin-left: auto; gap: 14px; font-size: 11px; letter-spacing: .04em }
  .header-search { order: 10; flex: 1 0 100%; margin-left: 0 }
  .header-search input { width: 100%; font-size: 12px }
}

/* ===== 見出しブロック ===== */
/* 幅は見出しとリード文で別々に持たせる。
   見出しは従来どおり詰めた幅で折り返し、リード文だけ1行を長くとる。 */
.masthead {
  padding: clamp(40px, 8vw, 88px) var(--pad) clamp(20px, 3vw, 32px);
}

.masthead h1 {
  /* 幅を em で持たせて、どの画面幅でも同じ位置（AI-generated の後ろ）で折り返させる。
     px 固定だとフォントサイズが変わる幅で1行になったり3行になったりする。 */
  max-width: 9.2em;
  font-size: clamp(30px, 6vw, 54px);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.06;
}

.masthead p {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink-dim);
  max-width: 54ch;
}

@media (min-width: 900px) {
  /* PCでは字を少し小さくし、1行あたりの文字数を増やす。
     ch は半角基準で日本語だと想定より狭くなるため em で指定する。 */
  .masthead p { font-size: 12.5px; max-width: 78em }
}

/* ===== タグフィルタ ===== */
.filter-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 8, 9, .82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}

.filter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.filter-scroll::-webkit-scrollbar { display: none }

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-dim);
  white-space: nowrap;
  transition: color .25s var(--ease), border-color .25s var(--ease), background-color .25s var(--ease);
}

.chip:hover { color: var(--ink); border-color: rgba(255, 255, 255, .22) }

.chip[aria-current="page"] {
  color: #06070A;
  background: var(--ink);
  border-color: var(--ink);
}

.chip .n { font-size: 10px; color: var(--ink-faint); font-variant-numeric: tabular-nums }
.chip[aria-current="page"] .n { color: rgba(6, 7, 10, .5) }

/* ===== マソンリーグリッド ===== */
.grid {
  padding: clamp(20px, 3vw, 34px) var(--pad) clamp(60px, 10vw, 120px);
  column-count: 4;
  column-gap: 14px;
}

@media (max-width: 1400px) { .grid { column-count: 4 } }
@media (max-width: 1100px) { .grid { column-count: 3 } }
@media (max-width: 760px) { .grid { column-count: 2; column-gap: 10px } }

.tile {
  break-inside: avoid;
  margin: 0 0 14px;
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 3px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
}

@media (max-width: 760px) { .tile { margin-bottom: 10px } }

.tile img {
  width: 100%;
  height: auto;
  transition: transform .8s var(--ease), opacity .8s var(--ease);
  opacity: 0;
}

.tile img.is-loaded { opacity: 1 }
.tile:hover img { transform: scale(1.035) }

.tile-veil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  gap: 8px;
  background: linear-gradient(to top, rgba(4, 5, 7, .74) 0%, rgba(4, 5, 7, .18) 42%, transparent 72%);
  opacity: 0;
  transition: opacity .4s var(--ease);
}

.tile:hover .tile-veil, .tile:focus-visible .tile-veil { opacity: 1 }

.tile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.tile-tags span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 8, 9, .5);
}

.grid-empty {
  padding: 80px var(--pad) 120px;
  color: var(--ink-faint);
  font-size: 13px;
  letter-spacing: .06em;
}

/* ===== 広告枠 ===== */
.ad {
  break-inside: avoid;
  margin: 0 0 14px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: rgba(14, 15, 18, .6);
}

/* 幅が縮んでも height 属性(250px)が残って縦に潰れないように */
.ad img { height: auto }

/* SP: 枠・背景なしで Sponsored 表記＋バナーは周囲の画像と同じ幅 */
@media (max-width: 640px) {
  .ad {
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
  }
  .ad a img { width: 100% }
}

.ad-label {
  display: block;
  margin-bottom: 10px;
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.ad-placeholder {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 2px;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ad--detail { margin: 28px 0 0 }

/* ===== 詳細ページ ===== */
.detail {
  padding: clamp(22px, 4vw, 44px) var(--pad) clamp(60px, 10vw, 120px);
  max-width: 1240px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  transition: color .3s var(--ease);
}

.back-link:hover { color: var(--ink) }

.detail-body {
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

@media (max-width: 900px) { .detail-body { grid-template-columns: minmax(0, 1fr) } }

.detail-figure {
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-soft);
}

.detail-figure img { width: 100%; height: auto }

.detail-side { position: sticky; top: calc(var(--header-h) + 24px) }
@media (max-width: 900px) { .detail-side { position: static } }

/* 画面には出さないが読み上げ・検索エンジンには届く見出し */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.detail-meta {
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-dim);
}

.detail-meta div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.detail-meta dt { color: var(--ink-faint); letter-spacing: .08em; text-transform: uppercase; font-size: 10px }
.detail-meta dd { font-variant-numeric: tabular-nums }

.detail-tags { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 7px }

.detail-tags a {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-dim);
  transition: color .25s var(--ease), border-color .25s var(--ease);
}

.detail-tags a:hover { color: var(--ink); border-color: rgba(255, 255, 255, .24) }

/* 記述タグ（Film Grain / Teal Shadow 等）。装飾を抑えて情報として置く */
.detail-keywords {
  margin-top: 14px;
  font-size: 11px;
  line-height: 1.9;
  color: var(--ink-faint);
  letter-spacing: .02em;
}

.download {
  margin-top: 26px;
  display: grid;
  gap: 9px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}

.btn .size { font-size: 10px; letter-spacing: .06em; color: var(--ink-faint); text-transform: none }
.btn:hover { border-color: rgba(255, 255, 255, .3) }

.btn--primary { background: var(--ink); color: #06070A; border-color: var(--ink) }
.btn--primary .size { color: rgba(6, 7, 10, .5) }
.btn--primary:hover { background: #fff; border-color: #fff }

.license-note {
  margin-top: 18px;
  font-size: 11px;
  line-height: 1.8;
  color: var(--ink-faint);
}

.license-note a { color: var(--ink-dim); border-bottom: 1px solid var(--line) }

/* ===== 関連 ===== */
.related { margin-top: clamp(52px, 8vw, 96px) }

.section-label {
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.related .grid { padding: 22px 0 0; column-count: 4 }
@media (max-width: 1100px) { .related .grid { column-count: 3 } }
@media (max-width: 760px) { .related .grid { column-count: 2 } }

/* ===== About ===== */
.prose {
  padding: clamp(40px, 7vw, 80px) var(--pad) clamp(60px, 10vw, 120px);
  max-width: 720px;
}

.prose h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 500; letter-spacing: -.02em }
.prose h2 { margin-top: 44px; font-size: 15px; font-weight: 600; letter-spacing: .02em }
.prose p { margin-top: 14px; font-size: 14px; line-height: 1.9; color: var(--ink-dim) }
.prose .ja { font-size: 13px; color: var(--ink-faint) }
.prose ul { margin-top: 14px; padding-left: 1.1em; font-size: 14px; line-height: 1.9; color: var(--ink-dim) }
/* 本文中のリンクは色を変えず、下線だけで示す */
.prose a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ===== フッター ===== */
.site-footer {
  padding: clamp(36px, 5vw, 56px) var(--pad);
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 20px 40px;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-faint);
}

.footer-note {
  margin-top: 10px;
  max-width: 60ch;
  font-size: 11px;
  line-height: 1.9;
  color: var(--ink-faint);
}

.site-footer nav { display: flex; gap: 22px }
.site-footer a { transition: color .3s var(--ease) }
.site-footer a:hover { color: var(--ink) }

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