:root {
  --bg: #100f0e;
  --bar: #171514;
  --surface: #1e1c1a;
  --text: #f4f1ec;
  --muted: #a8a29a;
  --line: #2d2a27;
  --paper: #e9dfcd;
  --placeholder: linear-gradient(135deg, #2b2825, #3a3530);
  --radius: 10px;
  --gap: 12px;
  --gutter: clamp(16px, 1.2vw, 24px);
  --topbar: 76px;
  --foot: 56px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; -webkit-user-drag: none; user-select: none; }
h1, h2 { margin: 0; font-weight: 700; }
:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 calc(var(--gutter) + 12px);
  background: var(--bar);
}
.brand { font-family: var(--serif); font-size: 32px; font-weight: 700; letter-spacing: 0.01em; font-style: italic; }
.position { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #211f1d;
  border: 1px solid #383430;
  border-radius: 999px;
  padding: 0 18px;
  width: min(340px, 42vw);
}
.search:focus-within { border-color: #77706a; }
.search svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 16px; padding: 10px 0; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; }

/* Poster cells: image fills the cell, label over a dark fade */
.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--placeholder);
  isolation: isolate;
  min-height: 0;
}
.cell-media { position: absolute; inset: 0; z-index: -1; background: var(--placeholder); }
.cell-media > img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.cell:hover .cell-media > img { transform: scale(1.04); }
.cell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.2) 36%, transparent 58%);
}
.cell-body { display: flex; flex-direction: column; align-items: flex-start; padding: 18px 22px; color: #fff; min-width: 0; max-width: 100%; }
.cell-kicker { font-size: 13px; letter-spacing: 0.24em; color: var(--paper); }
.cell-title { font-size: clamp(20px, 1.7vw, 30px); font-weight: 700; line-height: 1.25; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-desc { font-size: 17px; margin-top: 8px; opacity: 0.92; max-width: 38em; }
.cell-meta { font-size: 14px; margin-top: 4px; opacity: 0.85; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.action {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--paper);
  color: var(--paper);
  font-size: 16px;
  letter-spacing: 0.2em;
  border-radius: 999px;
  padding: 7px 26px 7px 30px;
  transition: background 0.2s, color 0.2s;
}
.action::after { content: "→"; letter-spacing: 0; }
.cell:hover .action { background: var(--paper); color: #171514; }

/* First screen: the big work on the right, four small cells on the left */
.poster {
  height: calc(100svh - var(--topbar) - var(--foot));
  min-height: 520px;
  max-height: 1000px;
  display: grid;
  grid-template-columns: 1fr 1fr 2.55fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--gap);
  padding: var(--gap) var(--gutter) 0;
}
.poster .hero { grid-column: 3; grid-row: 1 / span 2; background: #0b0a0a; }
.poster[data-small="3"] .cell:nth-child(3) { grid-column: 1 / span 2; }
.poster[data-small="2"], .poster[data-small="1"] { grid-template-columns: 1fr 2.55fr; }
.poster[data-small="2"] .hero, .poster[data-small="1"] .hero { grid-column: 2; }
.poster[data-small="1"] .cell:first-child { grid-row: 1 / span 2; }
.poster[data-small="0"] { grid-template-columns: 1fr; }
.poster[data-small="0"] .hero { grid-column: 1; }
.hero .cell-media > img { filter: blur(48px) brightness(0.45) saturate(1.2); transform: scale(1.25); }
.hero:hover .cell-media > img { transform: scale(1.25); }
.hero-frame { position: absolute; inset: 28px 28px 28px 28px; display: flex; align-items: center; justify-content: center; }
.hero-frame img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); transition: transform 0.6s ease; }
.hero:hover .hero-frame img { transform: scale(1.015); }
.hero::before { background: linear-gradient(0deg, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.35) 30%, transparent 52%); }
.hero .cell-body { padding: 0 36px 34px; }
.hero .cell-title { font-size: clamp(34px, 3.4vw, 60px); white-space: normal; }
.hero .cell-kicker { font-size: 15px; margin-bottom: 6px; }
.poster-foot {
  height: var(--foot);
  margin-top: var(--gap);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 calc(var(--gutter) + 16px);
  background: var(--bar);
  color: #d3cdc5;
}
.poster-foot .copyright { font-size: 14px; }
.more { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.more svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform 0.2s; }
.more:hover svg { transform: translateY(3px); }

/* Nothing published yet */
.soon {
  height: calc(100svh - var(--topbar) - var(--foot) - var(--gap));
  min-height: 360px;
  margin: var(--gap) var(--gutter) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
  text-align: center;
  border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 42%, #2a2622 0%, #171514 70%);
}
.soon-frame { width: 132px; height: 96px; border: 2px solid var(--paper); border-radius: 3px; opacity: 0.55; margin-bottom: 18px; box-shadow: 0 0 0 10px rgba(233, 223, 205, 0.06); }
.soon-title { margin: 0; font-size: clamp(30px, 4vw, 50px); font-weight: 700; letter-spacing: 0.08em; }
.soon-note { margin: 0; color: var(--muted); font-size: 16px; }

/* All works: a gallery wall that keeps every work's proportions */
.all { padding: 40px var(--gutter) 24px; scroll-margin-top: 8px; }
.filters { display: flex; align-items: baseline; gap: 14px 22px; flex-wrap: wrap; margin-bottom: 22px; padding: 0 4px; }
.filters h2 { font-size: 30px; }
.count { color: var(--muted); font-size: 15px; margin-left: -10px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; align-self: center; }
.chip { background: #211f1d; border: 1px solid #383430; border-radius: 999px; padding: 5px 20px; cursor: pointer; }
.chip:hover { border-color: #77706a; }
.chip[aria-pressed="true"] { background: var(--paper); color: #171514; border-color: var(--paper); }
.wall { display: flex; gap: 22px; align-items: flex-start; }
.wall-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 26px; }
.card { display: flex; flex-direction: column; gap: 10px; }
.card-media { border-radius: 4px; overflow: hidden; background: var(--placeholder); aspect-ratio: 1; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease, opacity 0.3s; }
.card:hover .card-media img { transform: scale(1.03); }
.card-label { display: flex; flex-direction: column; padding: 0 2px; border-left: 2px solid transparent; transition: border-color 0.2s, padding 0.2s; }
.card:hover .card-label { border-color: var(--paper); padding-left: 10px; }
.card-title { font-size: 18px; font-weight: 700; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { color: var(--muted); font-size: 13px; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }
.empty a { text-decoration: underline; }

.footer { color: var(--muted); font-size: 14px; text-align: center; padding: 16px var(--gutter) 28px; }
body[data-page="home"] .footer { display: none; }
.page { flex: 1; padding: 24px var(--gutter); }

/* View page: the work on a dark stage, the label in a side panel */
.back { display: none; width: 28px; height: 28px; margin-right: -8px; }
.back svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; }
.view { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 26vw, 420px); min-height: calc(100svh - var(--topbar)); }
.stage { position: relative; display: flex; align-items: center; justify-content: center; background: #0a0909; padding: 32px 88px; overflow: hidden; height: calc(100svh - var(--topbar)); position: sticky; top: 0; }
.stage-frame { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; cursor: zoom-in; }
.stage-frame img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.stage.zoomed { overflow: auto; align-items: flex-start; justify-content: flex-start; padding: 0; }
.stage.zoomed .stage-frame { width: auto; height: auto; min-width: 100%; min-height: 100%; cursor: zoom-out; }
.stage.zoomed .stage-frame img { max-width: none; max-height: none; box-shadow: none; }
.stage.zoomed .step { display: none; }
.stage-note { position: absolute; inset: auto 0 0 0; margin: 0; padding: 10px 16px; background: rgba(0, 0, 0, 0.7); color: #eee; text-align: center; }
.step { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(30, 28, 26, 0.7); border: 1px solid #3a3632; transition: background 0.2s; }
.step:hover { background: var(--paper); color: #171514; }
.step svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
.prev { left: 20px; }
.next { right: 20px; }
.panel { background: var(--bar); padding: 36px 32px 24px; display: flex; flex-direction: column; gap: 22px; }
.title { font-size: clamp(28px, 2.2vw, 38px); line-height: 1.25; }
.meta { color: var(--muted); margin: -12px 0 0; font-size: 15px; letter-spacing: 0.04em; }
.description { margin: 0; font-size: 16px; color: #e6e1da; line-height: 1.75; }
.panel h2 { font-size: 13px; font-weight: 600; letter-spacing: 0.24em; color: var(--paper); margin-bottom: 10px; }
.details { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0; font-size: 15px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-variant-numeric: tabular-nums; }
.series-head { display: flex; align-items: baseline; gap: 12px; }
.series-link { margin-left: auto; color: var(--muted); font-size: 14px; }
.series-link:hover { color: var(--text); }
.series-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.thumb { display: block; border-radius: 4px; overflow: hidden; aspect-ratio: 1; opacity: 0.7; transition: opacity 0.2s; }
.thumb:hover, .thumb.current { opacity: 1; }
.thumb.current { outline: 2px solid var(--paper); outline-offset: -2px; }
.thumb-media { width: 100%; height: 100%; background: var(--placeholder); }
.thumb-media img { width: 100%; height: 100%; object-fit: cover; }
.panel-foot { margin: auto 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* Tablet */
@media (max-width: 1100px) {
  .poster { grid-template-columns: 1fr 1fr; grid-template-rows: auto; height: auto; max-height: none; }
  .poster .hero, .poster[data-small] .hero { grid-column: 1 / -1; grid-row: 1; aspect-ratio: 4 / 3; }
  .poster[data-small] { grid-template-columns: 1fr 1fr; }
  .poster[data-small] .cell:not(.hero) { grid-column: auto; grid-row: auto; }
  .poster[data-small="3"] .cell:nth-child(3), .poster[data-small="1"] .cell:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 7; }
  .poster .cell:not(.hero) { aspect-ratio: 4 / 3; }
  .view { grid-template-columns: minmax(0, 1fr); }
  .stage { position: relative; height: min(78svh, 900px); padding: 24px 72px; }
}

/* Phone */
@media (max-width: 720px) {
  :root { --topbar: 60px; --gap: 10px; --gutter: 12px; }
  .topbar { gap: 12px; padding: 0 16px; }
  .brand { font-size: 25px; }
  .search { flex: 1; width: auto; max-width: 210px; padding: 0 14px; }
  .search input { font-size: 15px; padding: 8px 0; }
  .poster .hero, .poster[data-small] .hero { aspect-ratio: 4 / 5; }
  .hero-frame { inset: 18px 18px 120px; }
  .hero .cell-body { padding: 0 20px 22px; }
  .hero .cell-title { font-size: 32px; }
  .hero .cell-desc { display: none; }
  .action { margin-top: 14px; font-size: 15px; padding: 5px 20px 5px 24px; }
  .poster .cell:not(.hero) { aspect-ratio: 1 / 1; }
  .cell-body { padding: 12px 14px; }
  .cell-title { font-size: 19px; }
  .cell-kicker { font-size: 12px; }
  .cell-meta { font-size: 12px; }
  .poster-foot { grid-template-columns: 1fr; justify-items: center; height: auto; padding: 14px 16px; background: transparent; margin-top: 0; }
  .poster-foot .copyright { display: none; }
  body[data-page="home"] .footer { display: block; }
  .soon { height: calc(100svh - var(--topbar) - 120px); }
  .all { padding-top: 16px; }
  .filters { gap: 12px; }
  .filters h2 { font-size: 24px; }
  .count { margin-left: 0; }
  .chips { flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .chip { white-space: nowrap; padding: 4px 16px; }
  .wall { gap: 12px; }
  .wall-col { gap: 18px; }
  .card-title { font-size: 15px; }
  .card-meta { font-size: 12px; }
  .back { display: block; }
  .position { margin-left: auto; }
  body[data-page="view"] .search { display: none; }
  .stage { height: auto; min-height: 56svh; padding: 0; background: #0a0909; }
  .stage-frame img { box-shadow: none; }
  .step { width: 40px; height: 40px; top: auto; bottom: 12px; transform: none; }
  .prev { left: 12px; }
  .next { right: 12px; }
  .panel { padding: 22px 16px 20px; gap: 18px; }
  .title { font-size: 28px; }
}
