:root {
  --page: #fff;
  --surface: rgba(255, 255, 255, .78);
  --surface-strong: #fff;
  --ink: #171717;
  --text: #474747;
  --muted: #8a8a87;
  --line: rgba(0, 0, 0, .09);
  --shadow: 0 18px 42px rgba(0, 0, 0, .07), inset 0 1px 0 rgba(255, 255, 255, .9);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.site-header {
  position: sticky;
  z-index: 80;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(18px);
}
.header-inner {
  max-width: 1240px;
  min-height: 78px;
  margin: 0 auto;
  padding: 18px 28px;
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: start;
  gap: 30px;
}
.logo {
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.03em;
}
.site-nav {
  display: flex;
  justify-content: flex-end;
  gap: clamp(22px, 4vw, 54px);
}
.site-nav a {
  position: relative;
  display: grid;
  min-width: 44px;
  gap: 6px;
  padding-bottom: 12px;
  text-align: center;
}
.site-nav strong { font-size: 11px; font-weight: 500; line-height: 1; }
.site-nav span { color: var(--muted); font-size: 10px; line-height: 1; }
.site-nav a.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 24px;
  height: 2px;
  background: var(--ink);
  transform: translateX(-50%);
}

.materials-page {
  width: min(1240px, calc(100% - 56px));
  margin: 0 auto;
  padding: 64px 0 112px;
}
.materials-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: end;
  margin-bottom: 48px;
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.materials-hero h1 {
  margin: 0;
  font-size: clamp(48px, 7vw, 88px);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .95;
}
.intro {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.8;
}
.upload-button,
.download-button,
.error-state button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
}
.upload-button:disabled { cursor: default; opacity: .48; }

.materials-controls {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.search-box {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .82);
}
.search-box svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
}
.search-count { color: var(--muted); font-size: 12px; }
.filter-row,
.filter-group,
.filter-options,
.materials-toolbar,
.toolbar-controls,
.segmented {
  display: flex;
  align-items: center;
}
.filter-row { justify-content: space-between; gap: 20px; }
.filter-group { gap: 14px; min-width: 0; }
.filter-label { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.filter-options { flex-wrap: wrap; gap: 8px; }
.filter-options button,
.filter-toggle,
.clear-filters,
.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, .72);
  color: #565656;
  cursor: pointer;
}
.filter-options button.is-active,
.segmented button.is-active {
  background: var(--ink);
  color: #fff;
}
.filter-toggle { flex: 0 0 auto; }
.filter-empty { color: var(--muted); font-size: 12px; }
.filter-drawer {
  display: grid;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.clear-filters { justify-self: start; }

.materials-toolbar {
  justify-content: space-between;
  gap: 20px;
  margin: 28px 0 22px;
}
.materials-toolbar p { margin: 0; color: var(--muted); font-size: 13px; }
.materials-toolbar strong { color: var(--ink); font-size: 18px; font-weight: 500; }
.toolbar-controls { gap: 12px; }
.segmented {
  overflow: hidden;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .7);
}
.size-control { color: var(--muted); font-size: 12px; }
.size-control select {
  margin-left: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 28px 8px 10px;
  background: #fff;
}

.asset-stage { min-height: 390px; }
.loading-state,
.empty-state,
.error-state {
  min-height: 390px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
}
.empty-mark {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
  color: #b1b1ad;
  font-size: 28px;
}
.empty-state h2,
.error-state h2 { margin: 8px 0 0; color: var(--ink); font-size: 24px; font-weight: 500; }
.empty-state p,
.error-state p { max-width: 560px; margin: 0; line-height: 1.8; }

.asset-collection {
  display: grid;
  gap: 22px;
}
.asset-collection.view-grid { grid-template-columns: repeat(auto-fill, minmax(var(--card-width, 210px), 1fr)); }
.asset-collection.size-small { --card-width: 150px; }
.asset-collection.size-medium { --card-width: 210px; }
.asset-collection.size-large { --card-width: 300px; }
.asset-card {
  overflow: hidden;
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.asset-preview { position: relative; aspect-ratio: 1; overflow: hidden; background: #ebece8; }
.asset-preview img,
.asset-preview video { width: 100%; height: 100%; display: block; object-fit: cover; }
.asset-copy { padding: 14px; }
.asset-copy h3 { margin: 0 0 7px; font-size: 15px; font-weight: 500; }
.asset-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.asset-collection.view-list { grid-template-columns: 1fr; }
.view-list .asset-card { display: grid; grid-template-columns: 170px minmax(0, 1fr); }
.view-list .asset-preview { aspect-ratio: 4 / 3; }
.asset-collection.view-folder { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.folder-group { display: grid; gap: 14px; }
.folder-group > h2 { margin: 0; font-size: 16px; font-weight: 500; }
.folder-assets { display: grid; gap: 14px; }

.detail-backdrop {
  position: fixed;
  z-index: 120;
  inset: 0;
  padding: 34px;
  display: grid;
  place-items: center;
  background: rgba(247, 247, 244, .82);
  backdrop-filter: blur(18px);
}
.detail-modal {
  position: relative;
  width: min(1100px, 100%);
  max-height: calc(100vh - 68px);
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr);
  gap: 28px;
  padding: 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .14);
}
.detail-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  font-size: 23px;
}
.detail-preview { min-height: 480px; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: #ecece8; }
.detail-preview img,
.detail-preview video { width: 100%; height: 100%; max-height: calc(100vh - 110px); object-fit: contain; }
.detail-info { padding: 24px 12px 12px 0; }
.detail-info h2 { margin: 0 0 30px; font-size: 32px; font-weight: 500; }
.detail-info dl { display: grid; gap: 20px; }
.detail-info dl div { display: grid; gap: 6px; }
.detail-info dt { color: var(--muted); font-size: 12px; }
.detail-info dd { margin: 0; overflow-wrap: anywhere; color: var(--text); font-size: 14px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0; }
.detail-tags span { padding: 7px 10px; border-radius: 8px; background: #f2f2ef; color: var(--text); font-size: 12px; }
.download-button { display: inline-flex; }

@media (max-width: 760px) {
  .header-inner { grid-template-columns: 1fr; gap: 14px; padding: 18px 18px 12px; }
  .site-nav { justify-content: flex-start; gap: 18px 24px; overflow-x: auto; padding-bottom: 4px; }
  .materials-page { width: min(100% - 32px, 1240px); padding: 42px 0 90px; }
  .materials-hero { grid-template-columns: 1fr; gap: 24px; }
  .upload-button { justify-self: start; }
  .filter-row,
  .filter-group,
  .materials-toolbar { align-items: flex-start; }
  .filter-row,
  .materials-toolbar { flex-direction: column; }
  .filter-group { flex-direction: column; }
  .toolbar-controls { width: 100%; flex-wrap: wrap; }
  .asset-collection.view-grid { grid-template-columns: 1fr; }
  .view-list .asset-card { grid-template-columns: 112px minmax(0, 1fr); }
  .detail-backdrop { padding: 16px; }
  .detail-modal { max-height: calc(100vh - 32px); grid-template-columns: 1fr; }
  .detail-preview { min-height: 280px; }
  .detail-info { padding: 4px; }
}
