/* Digital Agency tokens + Apple-like spacing */
:root {
  --blue: #0017c1;
  --blue-hover: #000c73;
  --blue-weak: #e8eefe;
  --text: #1a1a1c;
  --text-2: #545456;
  --text-3: #757578;
  --line: #d8d8db;
  --bg: #f3f3f6;
  --paper: #ffffff;
  --focus: #ffd700;
  --design: #0017c1;
  --design-bg: #e8eefe;
  --structure: #0b6b4f;
  --structure-bg: #e6f4ef;
  --writing: #8a5600;
  --writing-bg: #fff3d6;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(26, 26, 28, 0.06), 0 8px 24px rgba(26, 26, 28, 0.06);
  --font: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

header.hero {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 48px 0 36px;
}
header.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.lede { margin: 0 0 16px; color: var(--text-2); max-width: 44em; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--text-3); font-size: 14px; }
.meta strong { color: var(--text); font-weight: 600; }

.filters {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 243, 246, 0.92);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.filter-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-3); font-weight: 500; }
select, input[type="search"] {
  font: inherit;
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 180px;
  min-height: 40px;
}
select:focus, input:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
button.ghost {
  font: inherit;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
}
button.ghost:hover { background: var(--blue-weak); border-color: var(--blue); color: var(--blue); }

main { padding: 36px 0 80px; }
section { margin: 0 0 48px; }
section h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
}
.section-lead { margin: 0 0 20px; color: var(--text-2); font-size: 15px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
  width: 100%;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(26,26,28,0.1); }
.thumb {
  background: #ececf0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  position: relative;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.thumb .missing {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kicker { font-size: 12px; color: var(--text-3); letter-spacing: 0.04em; }
.card h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.45; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  letter-spacing: 0.02em;
}
.tag.design { color: var(--design); background: var(--design-bg); }
.tag.structure { color: var(--structure); background: var(--structure-bg); }
.tag.writing { color: var(--writing); background: var(--writing-bg); }
.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 2px;
}
.flow span.step {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
}
.flow span.arrow { color: var(--text-3); font-size: 11px; }

.hidden { display: none !important; }
.empty { color: var(--text-2); padding: 24px 0; }

dialog.viewer {
  width: min(980px, calc(100% - 24px));
  max-height: calc(100vh - 32px);
  border: 0;
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 24px 64px rgba(26,26,28,0.2);
}
dialog.viewer::backdrop { background: rgba(26,26,28,0.45); }
.viewer-inner { padding: 24px 24px 28px; }
.viewer-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.viewer-head h3 { margin: 0 0 4px; font-size: 22px; }
button.close {
  border: 0;
  background: var(--bg);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text);
}
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.tabs button {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--text-2);
}
.tabs button[aria-selected="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.viewer-image {
  background: #ececf0;
  border-radius: 12px;
  overflow: auto;
  max-height: 62vh;
  border: 1px solid var(--line);
}
.viewer-image img { width: 100%; display: block; }
.viewer-image .missing { padding: 48px 16px; text-align: center; color: var(--text-3); }
.why { margin: 16px 0 8px; color: var(--text-2); }
.ext {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}
.ext:hover { text-decoration: underline; }

footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 40px;
  color: var(--text-3);
  font-size: 13px;
}
footer p { margin: 0 0 6px; }

@media (max-width: 640px) {
  .wrap { width: calc(100% - 28px); }
  header.hero { padding: 32px 0 24px; }
  .filters { position: static; }
  select, input[type="search"] { min-width: 100%; }
  .filter-row { flex-direction: column; align-items: stretch; }
  dialog.viewer { width: calc(100% - 12px); }
  .viewer-inner { padding: 16px; }
}
