:root {
  color-scheme: light;
  --ink: #181a1d;
  --muted: #686d73;
  --line: #d9dde0;
  --soft: #f1f2f3;
  --paper: #ffffff;
  --accent: #165f74;
  --danger: #8b2e2e;
  --ok: #286346;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
}

button, input { font: inherit; }
button { cursor: pointer; }

.site-header {
  background: #151719;
  color: #fff;
  padding: 54px 24px 38px;
}

.header-inner, main { width: min(1480px, calc(100% - 48px)); margin: 0 auto; }
.eyebrow, .project-index { margin: 0 0 8px; color: #a9b5ba; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.site-header h1 { margin: 0; font-size: clamp(30px, 4vw, 58px); line-height: 1.18; letter-spacing: -.04em; }
.lead { max-width: 760px; margin: 14px 0 0; color: #c8ced1; font-size: 15px; }

.summary { display: flex; flex-wrap: wrap; gap: 24px 42px; margin: 30px 0 0; }
.summary div { min-width: 90px; }
.summary dt { color: #8e989d; font-size: 11px; font-weight: 800; }
.summary dd { margin: 2px 0 0; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

main { padding-bottom: 80px; }
.project-tabs-wrap { position: sticky; z-index: 20; top: 0; margin: 0 calc(50% - 50vw); padding: 12px max(24px, calc((100vw - 1480px) / 2)); background: rgba(241,242,243,.97); border-bottom: 1px solid var(--line); }
.project-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.project-tab { min-height: 44px; flex: 1 1 190px; border: 1px solid #c9ced1; background: #fff; color: #34383c; padding: 10px 14px; border-radius: 5px; font-size: 13px; font-weight: 800; }
.project-tab[aria-selected="true"] { background: #202326; border-color: #202326; color: #fff; }

.project-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 420px); gap: 40px; align-items: end; padding: 40px 0 28px; border-bottom: 1px solid #cfd3d6; scroll-margin-top: 116px; }
.project-head h2 { margin: 0; font-size: clamp(26px, 3.2vw, 44px); line-height: 1.25; letter-spacing: -.03em; }
.project-head h2 + p { max-width: 800px; margin: 10px 0 0; color: var(--muted); }
.project-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border: 1px solid var(--line); background: #fff; }
.project-meta div { min-width: 0; padding: 14px; border-right: 1px solid var(--line); }
.project-meta div:last-child { border-right: 0; }
.project-meta dt { color: var(--muted); font-size: 10px; font-weight: 800; }
.project-meta dd { margin: 4px 0 0; font-size: 13px; font-weight: 800; word-break: break-word; }
.project-meta a { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; color: var(--accent); }

.controls { display: grid; grid-template-columns: auto minmax(220px, 380px) minmax(0, 1fr); gap: 14px; align-items: center; padding: 24px 0 12px; }
.search-label { font-size: 12px; font-weight: 800; }
#searchInput { width: 100%; min-height: 44px; border: 1px solid #bdc3c7; border-radius: 4px; background: #fff; padding: 9px 12px; color: var(--ink); }
#searchInput:focus { outline: 3px solid rgba(22,95,116,.18); border-color: var(--accent); }
.group-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.group-filter { min-height: 38px; border: 1px solid #c4c9cc; border-radius: 999px; padding: 7px 12px; background: transparent; color: #4d5256; font-size: 11px; font-weight: 800; }
.group-filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.result-count { margin: 0 0 16px; color: var(--muted); font-size: 12px; font-weight: 700; }

.direction-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.direction-card { min-width: 0; background: var(--paper); border: 1px solid #d0d4d6; border-radius: 6px; overflow: hidden; }
.direction-open { display: block; width: 100%; border: 0; background: transparent; padding: 0; color: inherit; text-align: left; }
.preview { display: grid; grid-template-columns: minmax(0, 256fr) minmax(0, 81fr); align-items: stretch; background: #e4e6e8; border-bottom: 1px solid var(--line); }
.preview.single { grid-template-columns: 1fr; }
.preview figure { position: relative; min-width: 0; margin: 0; overflow: hidden; background: #dfe2e4; }
.preview figure + figure { border-left: 1px solid #fff; }
.preview img { width: 100%; height: auto; aspect-ratio: 16 / 9; display: block; object-fit: contain; object-position: top center; transition: transform .22s ease; }
.preview:not(.single) figure + figure img { height: 100%; aspect-ratio: auto; object-fit: cover; }
.direction-open:hover .preview img { transform: scale(1.015); }
.preview figcaption { position: absolute; left: 8px; bottom: 8px; padding: 4px 7px; background: rgba(21,23,25,.86); color: #fff; font-size: 10px; font-weight: 800; }
.card-copy { padding: 17px 18px 19px; }
.card-topline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.direction-no { color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .07em; }
.group-name { color: #74797e; font-size: 10px; font-weight: 800; }
.status { margin-left: auto; border: 1px solid #c9ced1; border-radius: 999px; padding: 3px 8px; color: #555b60; font-size: 10px; font-weight: 900; }
.status.adopted { border-color: var(--ok); color: var(--ok); }
.status.ng { border-color: var(--danger); color: var(--danger); }
.direction-card h3 { margin: 7px 0 0; font-size: clamp(17px, 1.7vw, 23px); line-height: 1.35; }
.direction-card h3 + p { min-height: 3.3em; margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.open-note { display: block; margin-top: 13px; color: var(--accent); font-size: 11px; font-weight: 900; }
.empty { padding: 50px; background: #fff; text-align: center; color: var(--muted); }

.viewer { width: min(1500px, calc(100vw - 28px)); max-width: none; height: min(94vh, 1200px); max-height: none; padding: 0; border: 0; border-radius: 7px; background: #f4f5f5; color: var(--ink); }
.viewer::backdrop { background: rgba(10,12,13,.86); }
.viewer-shell { min-height: 100%; }
.viewer-head { position: sticky; z-index: 3; top: 0; display: flex; justify-content: space-between; gap: 24px; padding: 19px 22px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
.viewer-head > div { min-width: 0; }
.viewer-head p { margin: 0; color: var(--muted); font-size: 11px; }
.viewer-head h2 { margin: 3px 0 4px; font-size: clamp(19px, 2vw, 30px); line-height: 1.25; }
.viewer-close { min-width: 74px; min-height: 44px; align-self: flex-start; border: 1px solid #9ea5a9; border-radius: 4px; background: #fff; font-weight: 900; }
.viewer-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 22px; }
.viewer-images.single { grid-template-columns: minmax(0, 1fr); }
.viewer-column { display: flex; min-width: 0; flex-direction: column; gap: 18px; }
.viewer-column.phone { width: min(100%, 520px); justify-self: center; }
.viewer-image { min-width: 0; margin: 0; background: #fff; border: 1px solid var(--line); }
.viewer-image img { display: block; width: 100%; height: auto; }
.viewer-image figcaption { padding: 10px 12px; color: #555b60; font-size: 12px; font-weight: 800; }

@media (max-width: 900px) {
  .project-head { grid-template-columns: 1fr; gap: 22px; }
  .controls { grid-template-columns: 1fr; }
  .group-filters { justify-content: flex-start; }
  .direction-grid { gap: 16px; }
  .preview { height: 310px; }
}

@media (max-width: 640px) {
  .site-header { padding: 24px 18px 20px; }
  .header-inner, main { width: min(100% - 28px, 1480px); }
  .lead { margin-top: 9px; }
  .summary { gap: 10px 28px; margin-top: 18px; }
  .project-tabs-wrap { padding: 9px 14px; }
  .project-tab { flex: 1 1 calc(50% - 8px); padding: 8px; font-size: 11px; }
  .project-head { gap: 15px; padding: 20px 0 20px; scroll-margin-top: 176px; }
  .project-meta { grid-template-columns: 1fr 1fr; }
  .project-meta div { border-bottom: 1px solid var(--line); }
  .project-meta div:nth-child(2) { border-right: 0; }
  .project-meta div:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .controls { gap: 9px; padding-top: 17px; }
  .direction-grid { grid-template-columns: 1fr; }
  .preview { height: 330px; }
  .direction-card h3 + p { min-height: 0; }
  .viewer { width: 100vw; height: 100dvh; border-radius: 0; }
  .viewer-head { padding: 14px; }
  .viewer-images { grid-template-columns: 1fr; padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .preview img { transition: none; }
}

#projectDescription, .card-copy p { word-break: auto-phrase; }
.desc-line { display: inline-block; }
