:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #121417;
  --muted: #5c6570;
  --line: #e4e6ea;
  --line-strong: #d5d8de;
  --accent: #0f6b63;
  --accent-hover: #0c574f;
  --accent-soft: #e7f3f1;
  --shadow: 0 1px 2px rgba(18, 20, 23, 0.04), 0 8px 24px rgba(18, 20, 23, 0.06);
  --radius: 12px;
  --header-h: 64px;
  --wrap: 1180px;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

.wrap {
  width: min(var(--wrap), calc(100% - 40px));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
}

.skip:focus {
  top: 12px;
}

/* Header */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 40;
}

.site-header .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand svg {
  width: 28px;
  height: 28px;
}

.brand-name {
  font-weight: 640;
  font-size: 16px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-name small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.header-search {
  position: relative;
  width: min(420px, 100%);
}

.header-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.header-search input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 8px;
  padding: 0 12px 0 36px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.header-search input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Toolbar / filters */

.toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 28px 0 20px;
  position: sticky;
  top: var(--header-h);
  z-index: 30;
}

.toolbar-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.toolbar h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.result-count {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  padding-bottom: 4px;
}

.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover {
  border-color: var(--ink);
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.sort {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  flex-shrink: 0;
}

.sort select {
  appearance: none;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%235c6570' d='M1 1l5 5 5-5'/></svg>") no-repeat right 10px center;
  border: 1px solid var(--line-strong);
  height: 34px;
  padding: 0 28px 0 12px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  color: var(--ink);
}

.sort select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Grid */

main {
  flex: 1;
  padding: 28px 0 64px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 30px rgba(18, 20, 23, 0.1);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #dfe3e8;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card-media img {
  transform: scale(1.04);
}

.card-body {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.card-cat {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.card-body h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  margin-top: 8px;
  align-self: flex-start;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--accent);
}

.btn svg {
  width: 14px;
  height: 14px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 64px 16px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.empty[hidden],
[hidden] {
  display: none !important;
}

/* Detail */

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

.crumb a:hover {
  color: var(--ink);
}

.detail {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 36px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.detail-media {
  aspect-ratio: 16 / 11;
  background: #dfe3e8;
}

.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-copy {
  padding: 36px 36px 36px 8px;
}

.detail-copy .card-cat {
  margin-bottom: 10px;
}

.detail-copy h1 {
  margin: 0 0 12px;
  font-size: 32px;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.lead {
  margin: 0 0 16px;
  font-size: 17px;
  color: var(--ink);
}

.detail-copy .body {
  margin: 0 0 28px;
  color: var(--muted);
}

.not-found {
  text-align: center;
  padding: 80px 20px;
}

.not-found h1 {
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}

.not-found p {
  color: var(--muted);
  margin: 0 0 20px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface);
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* Responsive */

@media (max-width: 980px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .detail-copy {
    padding: 24px;
  }
}

@media (max-width: 680px) {
  .wrap {
    width: min(var(--wrap), calc(100% - 28px));
  }

  .site-header .wrap {
    gap: 12px;
  }

  .brand-name small {
    display: none;
  }

  .toolbar {
    padding-top: 22px;
  }

  .toolbar h1 {
    font-size: 24px;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .chip {
    flex-shrink: 0;
  }

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

  .site-footer .wrap {
    flex-direction: column;
  }

  .detail-copy h1 {
    font-size: 26px;
  }
}
