:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f5f5f5;
  --surface-warm: #fafafa;
  --fg: #111111;
  --muted: #707072;
  --meta: #9e9ea0;
  --border: #cacacb;
  --border-soft: #e5e5e5;
  --success: #007d48;
  --danger: #d30005;
  --focus-ring: 0 0 0 2px rgba(39, 93, 197, 1);
  --font-display:
    "Helvetica Neue", Helvetica, Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-body:
    "Helvetica Neue", Helvetica, Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --container: 1440px;
  --gutter: 48px;
  --radius-pill: 30px;
  font-family: var(--font-body);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

[hidden] {
  display: none !important;
}

.top-strip {
  padding: 8px 16px;
  background: var(--fg);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.header-inner,
.app-main {
  width: min(var(--container), calc(100% - (var(--gutter) * 2)));
  margin-inline: auto;
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-kicker,
.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.icon-button {
  min-width: 68px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 18px;
  background: transparent;
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
}

.icon-button:hover {
  border-color: var(--fg);
  background: var(--surface);
}

.app-main {
  padding-bottom: 64px;
}

.search-hero {
  display: grid;
  grid-template-columns: minmax(270px, 0.72fr) minmax(560px, 1.45fr);
  gap: 64px;
  align-items: end;
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--border-soft);
}

.hero-copy h2 {
  max-width: 620px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(44px, 5.2vw, 78px);
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: 0.94;
}

.hero-meta {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.hero-meta strong {
  color: var(--fg);
  font-size: 30px;
  letter-spacing: -0.04em;
}

.search-toolbar {
  display: grid;
  gap: 18px;
}

.search-field {
  min-height: 68px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-radius: 34px;
  padding: 8px 8px 8px 22px;
  background: var(--surface);
}

.search-field:focus-within {
  box-shadow: var(--focus-ring);
}

.search-icon {
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
}

.search-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font-size: 17px;
  font-weight: 500;
}

.search-field input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  border-radius: var(--radius-pill);
  padding: 0 22px;
  font-size: 14px;
  font-weight: 700;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.primary-button {
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.primary-button:hover {
  border-color: var(--muted);
  background: var(--muted);
}

.secondary-button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
}

.secondary-button:hover {
  border-color: var(--fg);
  background: var(--surface);
}

.danger-button {
  border: 1px solid #f1b8b2;
  background: #fff5f4;
  color: var(--danger);
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.quick-label {
  margin-right: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.quick-filter-button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 16px;
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
}

.quick-filter-button:hover {
  border-color: var(--fg);
}

.quick-filter-button.is-active {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.filters {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(110px, 1fr))
    minmax(76px, 0.68fr)
    auto;
  align-items: end;
  gap: 10px;
}

.filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.filters select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  outline: 0;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
}

.filters select:hover {
  border-color: var(--muted);
}

.filters select:focus {
  border-color: var(--fg);
}

.results-heading {
  min-height: 116px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 36px 0 24px;
}

.results-heading .eyebrow {
  margin-bottom: 8px;
}

.results-heading h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.loading {
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.notice {
  padding: 36px 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
}

.error-notice {
  color: var(--danger);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 40px 12px;
}

.design-card {
  min-width: 0;
  background: var(--bg);
}

.card-button {
  width: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.thumbnail {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: contain;
  background: var(--surface);
  transition: opacity 180ms ease;
}

.card-button:hover .thumbnail {
  opacity: 0.88;
}

.card-body {
  display: grid;
  gap: 9px;
  padding: 14px 2px 0;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-tags {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.card-title {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.source-tag,
.sport-tag {
  flex: none;
  padding: 5px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.source-tag {
  background: var(--fg);
  color: var(--bg);
}

.sport-tag {
  background: var(--surface);
  color: var(--fg);
}

.card-meta {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 52px;
}

.pagination span {
  min-width: 80px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.detail-dialog {
  width: min(1040px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 0;
  border-radius: 20px;
  padding: 0;
  background: var(--bg);
}

.detail-dialog::backdrop {
  background: rgba(17, 17, 17, 0.72);
}

.dialog-close {
  position: sticky;
  z-index: 3;
  top: 16px;
  float: right;
  min-width: 44px;
  width: 44px;
  margin: 16px 16px 0 0;
  padding: 0;
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
  font-size: 24px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(360px, 56%) minmax(0, 1fr);
}

.detail-media {
  display: grid;
  align-content: start;
  background: var(--surface);
}

.detail-image {
  width: 100%;
  min-height: 560px;
  max-height: 74vh;
  display: block;
  object-fit: contain;
}

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  background: var(--bg);
}

.gallery-button {
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--border-soft);
  border-radius: 0;
  padding: 0;
  background: var(--surface);
}

.gallery-button:hover,
.gallery-button:focus-visible {
  border-color: var(--fg);
}

.gallery-thumbnail {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.detail-body {
  padding: 64px 34px 36px;
}

.detail-body h2 {
  margin: 0 42px 8px 0;
  overflow-wrap: anywhere;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.detail-body > p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
  border-top: 1px solid var(--border-soft);
}

.detail-item {
  min-width: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}

.detail-item dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-item dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.metadata-panel {
  display: grid;
}

.detail-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  margin-top: 26px;
  border-radius: var(--radius-pill);
  padding: 0 20px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.detail-link:hover {
  background: var(--muted);
}

@media (max-width: 1100px) {
  :root {
    --gutter: 24px;
  }

  .search-hero {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .hero-copy h2 {
    max-width: 760px;
  }

  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --gutter: 16px;
  }

  .top-strip {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .header-inner {
    min-height: 68px;
  }

  .brand-kicker {
    display: none;
  }

  .search-hero {
    padding: 40px 0;
  }

  .hero-copy h2 {
    font-size: clamp(42px, 13vw, 62px);
  }

  .search-field {
    grid-template-columns: 24px minmax(0, 1fr);
    border-radius: 20px;
    padding: 14px;
  }

  .search-field .primary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 8px;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-image {
    min-height: 340px;
    max-height: 52vh;
  }

  .detail-body {
    padding: 32px 22px;
  }
}

@media (max-width: 480px) {
  .brand h1 {
    font-size: 16px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .icon-button {
    min-width: 58px;
    padding: 0 14px;
  }

  .hero-meta {
    align-items: center;
  }

  .quick-label {
    width: 100%;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .filters .secondary-button {
    grid-column: 1 / -1;
  }

  .results-heading {
    min-height: 96px;
    padding-top: 28px;
  }

  .results-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .pagination {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pagination span {
    grid-column: 1 / -1;
    grid-row: 1;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
