/* iwamo.de — 作品が主役。地は墨、文字は生成り、メインは屏風の額の金、サブは落款の朱。
   色は全部ここ（:root）で宣言してから、テーマと「地」で上書きする。 */

:root {
  color-scheme: dark;
  --bg: #141210;          /* 墨 */
  --fg: #e9e2d4;          /* 生成り */
  --muted: #a39b8c;
  --line: rgba(233, 226, 212, .14);
  --accent: #c2a060;      /* メイン：額の金 */
  --seal: #c0513b;        /* サブ：落款の朱（印と細い線まで。面で塗らない） */
  --scrim: rgba(20, 18, 16, .72);

  --sans: "Helvetica Neue", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;

  --pad: clamp(20px, 5vw, 72px);
  --gap-plate: clamp(96px, 18vh, 220px);
  --max: 1440px;
}

/* 明るい表示（切替ボタンで選んだ時だけ。既定は墨） */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3eee4;
  --fg: #1f1b17;
  --muted: #6b6358;
  --line: rgba(31, 27, 23, .14);
  --accent: #86672a;
  --seal: #a3392a;
  --scrim: rgba(243, 238, 228, .8);
}

/* シリーズの地（作品に合わせる。テーマより強い） */
/* 屏風の写真の黒は (0,0,0)〜(0,0,1)。地を同じ黒にして、写真の四辺に段差を出さない（さくら指摘 5） */
body[data-ground="ink"] {
  color-scheme: dark;
  --bg: #000;
  --fg: #e9e2d4;
  --muted: #a39b8c;
  --line: rgba(233, 226, 212, .14);
  --accent: #c2a060;
  --seal: #c0513b;
  --scrim: rgba(0, 0, 0, .72);
}
/* トップの大きい 1 枚（屏風）も黒地なので、暗い表示のトップは地を写真と同じ黒に */
:root:not([data-theme="light"]) body[data-page="home"] { --bg: #000; }
body[data-ground="kinari"] {
  color-scheme: light;
  --bg: #ede7db;
  --fg: #2b2620;
  --muted: #6e665a;
  --line: rgba(43, 38, 32, .14);
  --accent: #86672a;
  --seal: #a3392a;
  --scrim: rgba(237, 231, 219, .8);
}
body[data-ground="white"] {
  color-scheme: light;
  --bg: #fbfbf9;
  --fg: #1d1d1b;
  --muted: #66645e;
  --line: rgba(29, 29, 27, .12);
  --accent: #86672a;
  --seal: #a3392a;
  --scrim: rgba(251, 251, 249, .8);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: .01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  /* 短いページでもフッターを画面の下端に（さくら指摘 10） */
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
}
body > .bar, body > main, body > .foot { width: 100%; }
body > main { flex: 1 0 auto; }
:lang(ja) body, body:lang(ja) { line-height: 1.95; letter-spacing: .04em; }

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.skip {
  position: absolute; left: var(--pad); top: -100px;
  background: var(--bg); color: var(--fg); padding: 10px 14px; z-index: 10;
}
.skip:focus { top: 12px; }

/* ---------- 帯（どのページでも同じ位置・同じ並び） ---------- */

.bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px;
  max-width: var(--max); margin: 0 auto;
  padding: 20px var(--pad);
}
.brand {
  margin-right: auto;
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 44px;
  font-size: 15px; letter-spacing: .18em; text-transform: uppercase; font-weight: 400;
}
.brand img { width: 22px; height: 22px; image-rendering: auto; }

.theme { margin-right: -10px; }
.bar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }

.nav, .langs { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.nav a, .langs button, .theme {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; padding: 0 10px;
  font: inherit; font-size: 14px; letter-spacing: .08em;
  color: var(--muted); background: none; border: 0; cursor: pointer;
}
.nav a:hover, .langs button:hover, .theme:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--accent); }
.langs button[aria-pressed="true"] { color: var(--accent); }
.langs { gap: 0; }
.langs button { min-width: 40px; padding: 0 6px; font-size: 13px; }
.theme svg { width: 18px; height: 18px; }

/* スマホだけ：言語は 1 つの選択に畳んで ◐ の隣へ */
.lang-pick { display: none; }
.lang-pick {
  -webkit-appearance: none; appearance: none;
  min-height: 44px; padding: 0 22px 0 10px;
  font: inherit; font-size: 13px; letter-spacing: .08em;
  color: var(--muted); background-color: transparent; border: 0; border-radius: 2px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 9px center, right 5px center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.lang-pick:hover { color: var(--fg); }
.lang-pick option { color: var(--fg); background: var(--bg); }

/* ---------- トップ ---------- */

.hero {
  margin: 0 auto;
  padding: clamp(12px, 3vh, 40px) 0 0;
  max-width: 1920px;
}
.hero a { display: block; }
.hero img { width: 100%; }
/* 紅白梅図など、元の一番上 1 列が灰色の線になっている写真がある。黒地では線に見えるので 1px 隠す */
.hero img, body[data-ground="ink"] .plate img, body[data-ground="ink"] .lb img { clip-path: inset(1px 0 0 0); }

.intro {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(56px, 12vh, 140px) var(--pad) clamp(40px, 8vh, 96px);
}
.intro h1 {
  margin: 0;
  font-weight: 200; font-size: clamp(34px, 6vw, 72px);
  letter-spacing: .1em; line-height: 1.15;
}
.intro .role { margin: 12px 0 0; color: var(--muted); letter-spacing: .14em; font-size: 14px; }
.intro .lead { margin: 32px 0 0; max-width: 34em; font-size: 17px; }

.section-title {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--pad);
  font-weight: 400; font-size: 13px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--muted);
}

/* 代表写真は全部 3:2 に切り抜いて枠いっぱい（さくら指摘 4）。
   6 列の格子：前の数枚は 2 つずつ大きく（li.wide）、残りは 3 つずつ。端数の 1 つが残らない */
.series-grid {
  list-style: none; margin: 0 auto; padding: 32px var(--pad) clamp(96px, 16vh, 180px);
  max-width: var(--max);
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(56px, 7vw, 96px) clamp(24px, 3vw, 40px);
}
.series-grid > li { grid-column: span 2; }
.series-grid > li.wide { grid-column: span 3; }
.card { display: block; }
.card .frame {
  aspect-ratio: 3 / 2; overflow: hidden;
  transition: opacity .3s ease;
}
.card .frame img { width: 100%; height: 100%; max-width: none; object-fit: cover; }
.card h3 { margin: 14px 0 0; font-weight: 300; font-size: 20px; letter-spacing: .08em; line-height: 1.3; }
.card:hover h3 { color: var(--accent); }
.card:hover .frame { opacity: .88; }

/* ---------- シリーズ ---------- */

.series-head {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(48px, 10vh, 120px) var(--pad) clamp(56px, 12vh, 140px);
}
.series-head h1 { margin: 0; font-weight: 200; font-size: clamp(32px, 5vw, 60px); letter-spacing: .08em; line-height: 1.2; }
.series-head p { margin: 20px 0 0; max-width: 34em; }
.series-head .count { color: var(--muted); font-size: 14px; letter-spacing: .06em; font-variant-numeric: tabular-nums; }

.plates { list-style: none; margin: 0; padding: 0 var(--pad); }
.plates li + li { margin-top: var(--gap-plate); }
.plates figure { margin: 0 auto; max-width: min(100%, var(--maxw)); }
.plate { display: block; cursor: zoom-in; }
.plate img { width: 100%; }
.plates figcaption {
  margin-top: 14px; font-size: 13px; color: var(--muted); letter-spacing: .06em;
  display: flex; gap: 16px; justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

.series-nav {
  max-width: var(--max); margin: var(--gap-plate) auto 0; padding: 40px var(--pad) 24px;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center;
  border-top: 1px solid var(--line);
}
.series-nav a { display: flex; flex-direction: column; min-height: 44px; justify-content: center; }
.series-nav small { color: var(--muted); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.series-nav span { font-size: 18px; letter-spacing: .06em; }
.series-nav .next { text-align: right; align-items: flex-end; }
.series-nav .all { font-size: 14px; color: var(--muted); text-align: center; align-items: center; }

/* ---------- About / Contact ---------- */

.page {
  max-width: 880px; margin: 0 auto;
  padding: clamp(48px, 10vh, 120px) var(--pad) clamp(96px, 16vh, 180px);
}
.page h1 { margin: 0 0 clamp(40px, 8vh, 80px); font-weight: 200; font-size: clamp(32px, 5vw, 56px); letter-spacing: .08em; }
.page h2 {
  margin: clamp(56px, 10vh, 96px) 0 20px; font-weight: 400; font-size: 13px;
  letter-spacing: .24em; text-transform: uppercase; color: var(--muted);
}
.page h2:first-of-type { margin-top: 0; }
.page p { margin: 0 0 1.2em; max-width: 36em; font-size: 17px; }

.awards { list-style: none; margin: 0; padding: 0; }
.awards li { display: grid; grid-template-columns: 4.5em 1fr; gap: 16px; padding: 10px 0; }
.awards time { color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: .04em; }

.award-marks { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 40px; align-items: flex-end; }
.award-marks img { height: 96px; width: auto; opacity: .9; }

.contact-list { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 20px 32px; align-items: baseline; }
.contact-list dt { color: var(--muted); font-size: 13px; letter-spacing: .16em; text-transform: uppercase; }
.contact-list dd { margin: 0; font-size: 20px; letter-spacing: .03em; overflow-wrap: anywhere; }
.mail a { border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.mail a:hover { border-color: var(--accent); }
.copy {
  margin-left: 12px; min-height: 44px; padding: 0 14px;
  font: inherit; font-size: 13px; letter-spacing: .06em;
  color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.copy:hover { color: var(--fg); border-color: var(--muted); }
.copy[data-done] { color: var(--accent); border-color: var(--accent); }

.foot {
  max-width: var(--max); margin: 0 auto; padding: 32px var(--pad) 48px;
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--muted); letter-spacing: .06em;
}
.foot img { width: 16px; height: 16px; }

@media (max-width: 1000px) {
  .series-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .series-grid > li, .series-grid > li.wide { grid-column: span 1; }
  /* 奇数の時は先頭（屏風）を横いっぱいに。最後の 1 つが大きく残らない */
  .series-grid > li:first-child:nth-last-child(odd) { grid-column: span 2; }
}
@media (max-width: 640px) {
  .series-grid { grid-template-columns: minmax(0, 1fr); }
  .series-grid > li, .series-grid > li.wide, .series-grid > li:first-child:nth-last-child(odd) { grid-column: auto; }
}

/* ---------- 全画面（写真を押した時） ---------- */

.lb {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--fg);
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}
.lb::backdrop { background: var(--bg); }
.lb[open] { display: block; }
/* 題は写真の下端のすぐ下に付ける（画面の一番下に離さない。さくら指摘 8） */
.lb .stage {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px clamp(12px, 6vw, 96px) 12px;
}
.lb .view { max-width: 100%; min-height: 0; display: flex; justify-content: center; }
.lb .view img {
  max-width: 100%; max-height: calc(100vh - 150px); max-height: calc(100svh - 150px);
  width: auto; height: auto;
  object-fit: contain; user-select: none; -webkit-user-drag: none;
  transition: opacity .2s ease;
}
.lb .view img[data-loading] { opacity: .35; }
.lb .cap {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px;
  padding: 14px var(--pad) 0; min-height: 50px;
  font-size: 13px; color: var(--muted); letter-spacing: .06em; font-variant-numeric: tabular-nums;
}
.lb .pan-hint { display: none; }
/* スマホ縦で横長（屏風）：高さを取って左右に動かして見る（さくら指摘 3） */
.lb.pan { touch-action: manipulation; }
.lb.pan .stage { padding-left: 0; padding-right: 0; }
.lb.pan .view {
  width: 100%; justify-content: flex-start;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.lb.pan .view::-webkit-scrollbar { display: none; }
.lb.pan .view img { max-width: none; max-height: none; width: auto; height: min(calc(100svh - 170px), 62svh); }
.lb.pan .pan-hint { display: inline; flex-basis: 100%; text-align: center; }
.lb button {
  position: absolute; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0;
}
.lb button:hover { color: var(--fg); }
.lb:focus { outline: none; }
.lb button:focus-visible { outline: none; }
.lb button:focus-visible svg { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 2px; }
.lb button svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.2; }
.lb .close { top: 8px; right: 8px; width: 56px; height: 56px; }
.lb .prev, .lb .next { top: 64px; bottom: 80px; width: clamp(56px, 12vw, 160px); }
.lb.pan .prev, .lb.pan .next { top: auto; bottom: 8px; height: 56px; width: 56px; }
.lb .prev { left: 0; justify-content: flex-start; padding-left: clamp(8px, 2vw, 28px); }
.lb .next { right: 0; justify-content: flex-end; padding-right: clamp(8px, 2vw, 28px); }

body.lb-open { overflow: hidden; }

@media (max-width: 640px) and (orientation: portrait) {
  /* トップの大きい 1 枚：スマホ縦では高さを取って左右を切る（さくら指摘 3） */
  .hero { padding-top: 4px; }
  .hero img { height: min(60svh, 130vw); object-fit: cover; object-position: var(--pos, 50% 50%); }
}

@media (max-width: 640px) {
  .langs { display: none; }
  .lang-pick { display: inline-block; }
  .bar { padding-top: 12px; padding-bottom: 8px; gap: 4px 0; }
  .brand { gap: 10px; letter-spacing: .14em; }
  .bar-right { order: 3; width: 100%; justify-content: space-between; gap: 0; }
  .nav a { padding: 0 8px; }
  .nav { margin-left: -8px; }
  .lb .stage { padding: 56px 0 8px; }
  .lb .prev svg, .lb .next svg { width: 22px; height: 22px; }
  .contact-list { grid-template-columns: 1fr; gap: 6px; }
  .contact-list dd + dt { margin-top: 20px; }
  .copy { margin: 12px 0 0; display: flex; }
  .awards li { grid-template-columns: 3.5em 1fr; gap: 12px; }
  .series-nav span { font-size: 16px; }
}

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