.case-library, .case-library * { box-sizing: border-box; }
.case-library {
  margin: 0; background: var(--mesh-bg); color: var(--mesh-ink);
  font: 16px/1.5 "Open Sans", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
.case-library a { color: inherit; text-decoration: none; }
.case-library button, .case-library input, .case-library select { font: inherit; color: inherit; }
.case-library button, .case-library select { cursor: pointer; }
.case-library :focus-visible { outline: 3px solid var(--mesh-purple); outline-offset: 3px; }
.case-library [hidden] { display: none; }
.library-header {
  height: 92px; padding: 0 5%; border-bottom: 1px solid var(--mesh-border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.library-brand, .header-tools { display: flex; align-items: center; gap: 24px; }
.library-brand { gap: 10px; }
.library-brand span { border-left: 1px solid var(--mesh-border); padding-left: 16px; margin-left: 6px; }
.library-brand span, .header-tools a { font-size: 14px; color: var(--mesh-muted); }
.header-tools a, .library-footer a { display: inline-flex; min-height: 44px; align-items: center; }
.theme-toggle {
  display: grid; place-items: center; background: transparent; width: 44px; height: 44px;
  border: 1px solid var(--mesh-border); border-radius: 50%; font-size: 20px;
}
.case-library main, .library-footer { width: 90%; max-width: 1440px; margin: 0 auto; }
.library-title { padding: 42px 0 28px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.library-title h1 { margin: 0; font-size: clamp(32px, 3vw, 46px); letter-spacing: -.045em; line-height: 1.16; }
.library-search { position: relative; width: min(340px, 100%); }
.library-search svg { position: absolute; width: 20px; top: 15px; left: 15px; color: var(--mesh-muted); pointer-events: none; }
.library-search input { width: 100%; height: 50px; background: var(--mesh-surface); border: 1px solid var(--mesh-border); border-radius: 5px; padding: 0 12px 0 46px; }
.case-tabs { display: flex; gap: clamp(20px, 3vw, 44px); border-bottom: 1px solid var(--mesh-border); }
.case-tabs a { display: flex; align-items: baseline; gap: 8px; padding: 17px 0 15px; border-bottom: 3px solid transparent; font-size: 22px; font-weight: 700; color: var(--mesh-muted); }
.case-tabs small { font-size: 14px; font-weight: 400; }
.case-tabs [aria-current="page"] { border-color: var(--mesh-green); color: var(--mesh-green); }
.case-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 20px; }
#case-filters, .case-sort { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.case-tools button, .case-sort select { min-height: 44px; font-size: 14px; background: transparent; border: 1px solid transparent; padding: 8px 14px; border-radius: 4px; }
.case-tools button:hover { border-color: var(--mesh-border); }
.case-tools button[aria-pressed=true] { background: var(--mesh-mint); color: #174f42; }
.case-sort { color: var(--mesh-muted); font-size: 14px; }
.case-sort select { background-color: var(--mesh-bg); padding-inline: 6px; }
.case-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 34px 24px; align-items: start; }
.case-tile { position: relative; grid-column: span 4; min-width: 0; }
.case-card { display: block; }

.case-image { position: relative; aspect-ratio: 4 / 3; overflow: hidden; display: grid; place-items: center; background: #17192c; border: 1px solid var(--mesh-border); }

.case-image img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.case-image .case-clay {
  position: absolute; inset: 0; visibility: hidden; pointer-events: none;
  mask-image: linear-gradient(90deg, #000 calc(var(--reveal) - 9px), transparent calc(var(--reveal) + 9px));
}
.case-tile[data-reveal="sweep"] .case-clay { visibility: visible; }
.case-tile[data-reveal="clay"] .case-clay { visibility: visible; mask-image: none; }
.case-clay-toggle, .case-motion-toggle {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  display: grid; place-items: center; padding: 0; width: 44px; height: 44px;
  border-radius: 8px; border: 1px solid #f4f3ff55; background: #17182be6;
}
.case-clay-toggle:hover, .case-clay-toggle[aria-pressed="true"] {
  border-color: #9ee6c2; background: #2c2f49;
}
.case-clay-toggle img { display: block; width: 34px; height: 34px; }
.case-image .enter { position:absolute; right:12px; bottom:12px; padding:6px 12px; font-size:13px; background:var(--mesh-surface); border:1px solid var(--mesh-border); border-radius:3px; opacity:0; transition:opacity .16s; }
.case-card:hover .enter, .case-card:focus-visible .enter { opacity: 1; }
.case-card h2 { margin: 13px 0 3px; font-size: 20px; line-height:1.32; font-weight:600; }

.case-meta { display:flex; justify-content:space-between; gap:12px; color:var(--mesh-muted); font-size:14px; }
.case-meta span:last-child { color:var(--mesh-green); }
.case-empty { text-align: center; padding: clamp(30px, 5vw, 56px) 12px; }
.case-empty img { display: block; margin: 0 auto 16px; object-fit: contain; }
.case-empty h2 { margin: 0; font-size: clamp(19px, 2vw, 24px); }
.case-empty p { color: var(--mesh-muted); margin: 6px 0 20px; }
.case-empty button { background:var(--mesh-green); color:var(--mesh-bg); border:0; border-radius:4px; padding:10px 18px; }
.library-footer { display:flex; justify-content:space-between; align-items:center; margin-top:44px; border-top:1px solid var(--mesh-border); padding:16px 0; color:var(--mesh-muted); font-size:14px; }
@media(max-width:900px) {
  .library-header { height:78px; } .library-brand span { display:none; }
  .case-tile { grid-column:span 6; }

}
@media(max-width:580px) {
  .library-header { height:72px; }  .library-brand { gap:7px; } .header-tools { gap:8px; } .header-tools a { display:none; }
  .library-title { padding:26px 0 12px; flex-direction:column; align-items:start; gap:18px; }
  .library-search {width:100%;} .case-tabs { gap:0; justify-content:space-between; }
  .case-tabs a { flex-direction:column; gap:0; font-size:18px; padding:12px 4px 10px; } .case-tabs small {font-size:12px;}
  .case-tools {flex-wrap:wrap;gap:3px;padding:12px 0;} .case-sort {margin-left:auto;}
  .case-tools button {padding:7px 9px;} .case-grid {grid-template-columns:1fr;gap:22px;}
  .case-tile { grid-column: 1; }

  .case-image .enter {opacity:1;} .library-footer {margin-top:28px;}
}
@media(prefers-reduced-motion:reduce) { .case-image .enter { transition:none; } }

.case-sort { margin-left: auto; }

.case-image .case-motion-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  visibility: hidden;
  pointer-events: none;
}
.case-tile[data-motion-playing] .case-motion-video { visibility: visible; }
.case-library .case-motion-toggle { color: #f4f3ff; }
.case-motion-toggle[hidden] { display: none; }
.case-motion-toggle:not(:disabled):hover, .case-motion-toggle[aria-pressed="true"] {
  border-color: #9ee6c2;
  background: #2c2f49;
}
.case-motion-toggle:disabled { cursor: default; opacity: .5; }
