:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --ink: #1c1d1f;
  --muted: #6b6d70;
  --line: #c9c7c0;
  --hover: #eceae4;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141517; --surface: #1d1f22; --ink: #ecebe6; --muted: #9a9ca0; --line: #3d4044; --hover: #26292d; }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink); line-height: 1.45;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.wrap { width: 100%; margin: 0; padding: 24px 0 64px; }
.name, #search, .controls { margin-left: 20px; margin-right: 20px; }
#search { width: calc(100% - 40px); }
.item { padding: 0 20px; }

.name { display: inline-block; margin-bottom: 20px; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; color: inherit; text-decoration: none; }

input[type="search"], .chip, select {
  font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 0;
}
input[type="search"] { display: block; width: 100%; font-size: 1.05rem; padding: 10px 12px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-top: 10px; margin-bottom: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sort-control { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.sort-control select { padding: 6px 10px; cursor: pointer; }
.chip { font-size: 0.85rem; padding: 6px 12px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}
.box {
  display: flex; flex-direction: column; justify-content: flex-end;
  aspect-ratio: 16 / 10; padding: 18px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--surface); background-size: cover; background-position: center;
  color: inherit; text-decoration: none;
}
.box:hover { background-color: var(--hover); }
.box h2 { margin: 0 0 4px; font-size: 1.15rem; letter-spacing: -0.01em; }
.box p { margin: 0; font-size: 0.9rem; color: var(--muted); }
.empty { border: 1px dashed var(--line); padding: 28px; text-align: center; color: var(--muted); }

.item h1 { margin: 8px 0 6px; font-size: clamp(1.8rem, 5vw, 2.8rem); letter-spacing: -0.03em; line-height: 1.05; text-wrap: balance; }
.item .lead { max-width: 60ch; margin: 0 0 32px; font-size: 1.15rem; color: var(--muted); }
.related h2 { margin: 0 0 10px; font-size: 1rem; }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .box { aspect-ratio: 16 / 10; }
  .name, #search, .controls { margin-left: 14px; margin-right: 14px; }
  #search { width: calc(100% - 28px); }
  .item { padding: 0 14px; }
}
