/* 画像生成ポートフォリオ - スタイル
   書体・配色・カード角丸(16px)・ピル型チップは shirokake.com 本体(しろかけごはん、
   src/portfolio.html)に合わせている。Zen Kaku Gothic New は Google Fonts から読み込み、
   Hannari Mincho Web は本体サイトと同じ絶対パス(/assets/fonts/hannari_web.woff2)を参照する
   (本体サイトに組み込んだときに正しく解決する。プレビュー環境やオフラインでは読み込みに
   失敗し、下記フォールバックのシステム書体で表示される)。
*/

:root {
  --bg: #fbfbf9;
  --bg-soft: #f3f4f0;
  --bg-green: #eef4ee;
  --ink: #21231f;
  --ink-soft: #55584f;
  --ink-faint: #6b6e64; /* 実測コントラスト比 5.02:1 (WCAG AA 4.5:1 以上) */
  --line: #e2e4de;
  --line-strong: #c9ccc2;
  --accent: #1f8a4c;
  --accent-dk: #166b3b;
  --accent-bg: #e3efe6;
  --chip-bg: #f0f1eb;
  --shadow: 0 8px 28px rgba(60, 80, 60, 0.1);
  --r-card: 16px;
  --radius-s: 8px;
  --max-w: 1180px;
}

/* Hannari Mincho Web の @font-face はここでは宣言しない。
   本体サイトと同じ絶対パス(/assets/fonts/hannari_web.woff2)を、到達確認してから
   動的に登録する(index.html 冒頭の予備読み込みスクリプト参照)。
   ここで静的に @font-face を宣言すると、このファイルが実在しないプレビュー環境で
   ブラウザが404を自動取得してコンソールエラーを出してしまうため。 */

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

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic UI", "Yu Gothic", "Noto Sans JP", "Meiryo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  overflow-x: hidden;
}

.brand-face {
  font-family: "Hannari Mincho Web", "Hiragino Mincho ProN", serif;
}

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

.wrap {
  width: min(100% - 32px, var(--max-w));
  margin-inline: auto;
}

/* ---------- サイトヘッダー(本体サイトと同一構造) ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 249, 0.96);
}

.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-block: 10px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.logo img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.nav a,
.footer-nav a {
  color: var(--ink-soft);
  font-weight: 500;
  text-decoration: none;
  font-size: 14.5px;
}

.nav a:hover,
.footer-nav a:hover {
  color: var(--ink);
}

/* ---------- ギャラリー・ヒーロー ---------- */

.gallery-hero {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  padding: 24px 0 20px;
}

.back-link {
  margin-bottom: 10px;
}

.back-link a {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
}

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

.hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 860px) {
  .hero {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    align-items: center;
    gap: 32px;
  }
}

.eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-dk);
  margin-bottom: 6px;
}

.gallery-hero h1 {
  font-size: clamp(24px, 3.6vw, 38px);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
}

.lead {
  max-width: 42em;
  color: var(--ink-soft);
  font-size: 16px;
  margin-bottom: 12px;
}

.badge-strong {
  display: inline-block;
  padding: 7px 16px;
  background: var(--accent-bg);
  color: var(--accent-dk);
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
}

.skill-line {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.7;
  max-width: 42em;
  margin-bottom: 14px;
}

.model-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}

.model-summary .label {
  font-size: 14.5px;
  color: var(--ink-faint);
  font-weight: 700;
}

.model-chip {
  display: inline-flex;
  align-items: baseline;
  padding: 5px 14px;
  background: var(--accent-bg);
  color: var(--accent-dk);
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 700;
  white-space: normal;
}

.model-note {
  font-size: 13.5px;
  color: var(--ink-faint);
  margin-top: 6px;
}

/* ---------- hero mosaic(第一画面の代表作) ---------- */

.hero-mosaic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 78px;
  grid-auto-flow: dense;
  gap: 7px;
}

.m-tile {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-s);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  display: block;
  cursor: zoom-in;
  padding: 0;
  width: 100%;
  height: 100%;
  font: inherit;
}

.m-tile.big {
  grid-column: span 2;
  grid-row: span 2;
}

.m-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (min-width: 860px) {
  .hero-mosaic {
    grid-auto-rows: 92px;
  }
}

@media (max-width: 480px) {
  .hero-mosaic {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 62px;
    gap: 6px;
  }
}

/* ---------- section nav ---------- */

.section-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.section-nav .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 0;
}

.section-nav a {
  flex: none;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}

.section-nav a:hover,
.section-nav a:focus-visible {
  background: var(--accent-bg);
  color: var(--accent-dk);
}

/* ---------- main / sections ---------- */

main {
  padding: 32px 0 32px;
}

.gallery-section {
  padding: 28px 0 8px;
  scroll-margin-top: 56px;
}

.gallery-section + .gallery-section {
  border-top: 1px solid var(--line);
}

.section-head h2 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  margin-bottom: 10px;
}

.section-head .section-lead {
  color: var(--ink-soft);
  max-width: 56em;
  margin-bottom: 22px;
  font-size: 16.5px;
}

.project-block {
  margin-bottom: 34px;
}

.project-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.project-head h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
}

.project-head p {
  color: var(--ink-soft);
  font-size: 15.5px;
  max-width: 58em;
}

/* ---------- image grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

figure.tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.tile-frame {
  background: var(--bg-soft);
  aspect-ratio: 4 / 3;
  display: block;
  overflow: hidden;
  border: none;
  padding: 0;
  width: 100%;
  cursor: zoom-in;
  font: inherit;
  text-align: left;
}

.tile-frame.portrait {
  aspect-ratio: 3 / 4;
}

.tile-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

figure.tile figcaption {
  padding: 14px 16px 16px;
  font-size: 16px;
  color: var(--ink);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tile-desc {
  font-size: 16px;
  line-height: 1.7;
}

.tile-meta {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 14.5px;
}

.tile-meta .chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--ink-soft);
  white-space: normal;
  line-height: 1.4;
}

.tile-meta .chip.model {
  background: var(--accent-bg);
  color: var(--accent-dk);
  font-weight: 700;
}

/* ---------- icon-set block ---------- */

.icon-set-block {
  margin-top: 6px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}

.icon-set-block h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.icon-set-block .icon-set-lead {
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
}

.icon-tile {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: var(--radius-s);
  padding: 6px;
  cursor: zoom-in;
  aspect-ratio: 1 / 1;
  display: block;
  width: 100%;
  font: inherit;
}

.icon-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ---------- CTA(ご依頼・ご相談) ---------- */

.cta {
  background: var(--bg-green);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 40px 0;
}

.cta h2 {
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 700;
  margin-bottom: 12px;
}

.cta-lead {
  color: var(--ink-soft);
  font-size: 16px;
  margin-bottom: 14px;
  max-width: 56em;
}

.cta-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  max-width: 44em;
}

.cta-list li {
  font-size: 16px;
  padding-left: 22px;
  position: relative;
}

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

.cta-note {
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.cta-contact {
  margin-top: 14px;
  font-size: 16px;
}

.cta-contact a {
  font-weight: 700;
  color: var(--accent-dk);
}

/* ---------- footer ---------- */

footer.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 26px 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

footer.site-footer p {
  font-size: 15px;
  color: var(--ink-soft);
}

footer.site-footer p.disclaimer {
  font-weight: 700;
  color: var(--ink);
}

.footer-nav {
  display: flex;
  gap: 18px;
}

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #17181a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  touch-action: pan-y;
}

.lightbox[hidden] {
  display: none;
}

.lightbox figure {
  max-width: min(100%, 1100px);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox img {
  max-width: 100%;
  max-height: 74vh;
  width: auto;
  height: auto;
  display: block;
  background: #111;
  border-radius: var(--radius-s);
}

.lightbox figcaption {
  color: #f4f4f0;
  text-align: center;
  font-size: 16px;
  max-width: 68ch;
}

.lightbox figcaption .lb-caption-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
  font-size: 14px;
  color: #cfd2c8;
}

.lightbox figcaption .lb-caption-meta .chip {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.lb-btn {
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-s);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 10px 14px;
}

.lb-btn:hover,
.lb-btn:focus-visible {
  background: rgba(255, 255, 255, 0.24);
}

.lb-close {
  top: 18px;
  right: 18px;
}

.lb-prev {
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-index {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: #cfd2c8;
  font-size: 14px;
}

/* ---------- responsive ---------- */

@media (max-width: 480px) {
  .header-inner {
    min-height: 56px;
    padding-block: 8px;
  }
  .logo {
    font-size: 18px;
  }
  .gallery-hero {
    padding: 18px 0 16px;
  }
  main {
    padding: 24px 0 24px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
  .icon-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  }
  .lb-btn {
    padding: 8px 11px;
    font-size: 18px;
  }
  .lb-prev {
    left: 6px;
  }
  .lb-next {
    right: 6px;
  }
  .lightbox img {
    max-height: 60vh;
  }
  .section-nav a {
    padding: 7px 12px;
    font-size: 14px;
  }
}

@media (min-width: 1100px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

/* フォーカス可視化(キーボード操作対応) */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
