/* migaru — PHOTO WORKS
   色は目視による推定値（元サイトの正確な色コードは未取得） */
:root {
  --bg: #f3efe6;
  --ink: #292822;
  --muted: #6d695d;
  --line: #d9d3c5;
  --accent: #b3261e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", Arial, sans-serif;
  --pad: clamp(16px, 4vw, 40px);
  --gap: clamp(6px, 1.4vw, 14px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.7; font-size: 15px; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* header */
.top { display: flex; align-items: baseline; justify-content: space-between; padding: 14px var(--pad); }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 26px; letter-spacing: -0.02em; line-height: 1; }
.brand-sub { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.top-nav { display: flex; gap: 18px; font-size: 13px; }
.top-nav a { text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent; }
.top-nav a:hover { border-color: var(--ink); }

/* hero */
.hero { padding: 0 var(--pad); }
.hero-fig { margin: 0; position: relative; height: min(78svh, 900px); min-height: 360px; background: #e6e0d2; overflow: hidden; }
.hero-fig img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; opacity: 0; transition: opacity .6s ease; }
.hero-fig img.is-ready { opacity: 1; }
.hero-meta { display: flex; align-items: center; gap: 14px; padding: 10px 0 0; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.hero-meta p { margin: 0; }
.hero-tag { margin-left: auto !important; }
.hero-next { border: 1px solid var(--line); background: transparent; border-radius: 999px; width: 32px; height: 32px; line-height: 1; font-size: 15px; }
.hero-next:hover { border-color: var(--ink); }

/* intro */
.intro { padding: 48px var(--pad) 8px; max-width: 760px; }
.intro p { margin: 0 0 6px; font-size: 15px; }
.intro-sub { color: var(--muted); font-size: 13px !important; }

/* archive */
.archive { padding: 40px var(--pad) 0; }
.archive-head { display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--ink); padding-top: 14px; }
.archive-head h2 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(22px, 5vw, 40px); letter-spacing: 0.02em; line-height: 1.1; }
.count { margin: 0; font-family: var(--serif); font-size: clamp(22px, 5vw, 40px); line-height: 1; }
.count-unit { font-size: 12px; font-family: var(--sans); letter-spacing: 0.12em; color: var(--muted); }

.bar { position: sticky; top: 0; z-index: 20; display: flex; gap: 8px; padding: 10px 0; margin-top: 14px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ink); background: transparent; border-radius: 999px; padding: 7px 14px; font-size: 13px; text-decoration: none; line-height: 1.3; white-space: nowrap; }
.btn:hover { background: var(--ink); color: var(--bg); }
.btn-solid { background: var(--ink); color: var(--bg); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); }
.btn-auto { margin-left: auto; }
.btn-auto[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.btn-auto[aria-pressed="true"]:hover { background: var(--accent); color: var(--bg); }
.auto-icon { font-size: 10px; }
.status { margin: 2px 0 10px; font-size: 12px; color: var(--muted); min-height: 1.4em; }
.status b { color: var(--accent); font-weight: 600; }

.filters { padding: 4px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.filters-note { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.filter-group { margin-bottom: 12px; }
.filter-label { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.18em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 11px; font-size: 12px; }
.chip small { color: var(--muted); margin-left: 4px; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .7; }
.search input { width: 100%; max-width: 420px; border: 1px solid var(--line); background: #fbf9f4; border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 16px; color: var(--ink); }
.search input:focus { border-color: var(--ink); outline: none; }

/* grid（列ごとに並べて、追加読み込みしても位置が動かない） */
.grid { display: flex; gap: var(--gap); align-items: flex-start; }
.col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.tile { display: block; width: 100%; padding: 0; border: 0; background: #e6e0d2; position: relative; overflow: hidden; aspect-ratio: 3 / 4; }
.tile.is-loaded { aspect-ratio: auto; background: transparent; }
.tile img { width: 100%; height: auto; opacity: 0; transition: opacity .45s ease, transform .5s ease; }
.tile.is-loaded img { opacity: 1; }
@media (hover: hover) { .tile:hover img { transform: scale(1.025); } }
.tile.is-missing { display: none; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }
.more-wrap { display: flex; justify-content: center; padding: 28px 0 8px; }
#sentinel { height: 1px; }

/* about */
.about { margin-top: 72px; padding: 40px var(--pad) 8px; border-top: 1px solid var(--ink); max-width: 760px; }
.about h2 { margin: 0 0 12px; font-family: var(--serif); font-size: clamp(22px, 5vw, 36px); }
.about-lead { font-family: var(--serif); font-size: 18px; margin: 0 0 8px; }
.about p { margin: 0 0 8px; }
.about-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* footer */
.foot { margin-top: 64px; padding: 0 var(--pad) calc(0px + var(--safe-b)); overflow: hidden; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 12px; letter-spacing: 0.1em; color: var(--muted); padding-bottom: 6px; }
.foot-links a { text-decoration: none; border-bottom: 1px solid var(--line); }
.foot-links a:hover { color: var(--ink); border-color: var(--ink); }
.foot-word { margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(70px, 24vw, 420px); line-height: .78; letter-spacing: -0.045em; white-space: nowrap; user-select: none; transform: translateY(0.07em); }

/* picker（代表写真の候補一覧。#picker で開く） */
.picker { position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow-y: auto; padding: 20px var(--pad) 60px; }
.picker-head h2 { margin: 0 0 6px; font-family: var(--serif); }
.picker-head p { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.picker-pick { color: var(--accent) !important; font-weight: 600; user-select: all; min-height: 1.4em; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 16px; }
.picker-grid button { border: 0; padding: 0; background: #e6e0d2; aspect-ratio: 3/4; overflow: hidden; }
.picker-grid img { width: 100%; height: 100%; object-fit: cover; }
.picker-grid button[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: -3px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; background: #0b0b0a; color: #eeeae0; display: flex; flex-direction: column; padding-bottom: var(--safe-b); }
.modal-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); font-size: 12px; letter-spacing: .14em; }
.modal-pos { margin: 0; }
.modal-close { background: transparent; border: 0; font-size: 32px; line-height: 1; width: 44px; height: 44px; color: inherit; }
.modal-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.modal-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 72px; border: 0; background: transparent; color: #fff; font-size: 40px; opacity: .7; z-index: 2; }
.nav:hover { opacity: 1; }
.nav-prev { left: 0; } .nav-next { right: 0; }
.modal-thumbs { display: flex; gap: 6px; justify-content: center; padding: 8px 12px 0; }
.modal-thumbs button { width: 44px; height: 44px; border: 1px solid transparent; padding: 0; background: #222; opacity: .55; }
.modal-thumbs button[aria-current="true"] { opacity: 1; border-color: #eeeae0; }
.modal-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.modal-info { padding: 10px 16px 14px; }
.modal-title { margin: 0 0 6px; font-family: var(--serif); font-size: 17px; min-height: 1.2em; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.modal-tags span { font-size: 11px; border: 1px solid #4a4840; border-radius: 999px; padding: 2px 10px; color: #cfcabb; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; font-size: 12px; color: #aaa595; }
.modal-credit { margin: 0; }
.modal-src { color: #eeeae0; }
body.is-locked { overflow: hidden; }

@media (min-width: 720px) {
  body { font-size: 16px; }
  .brand-name { font-size: 32px; }
  .hero-fig { height: min(80svh, 820px); }
  .modal-stage img { max-height: calc(100svh - 190px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile img, .hero-fig img { transition: none; }
}
