:root {
  color-scheme: light;
  --bg: #faf9f6;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #5e6470;
  --line: #dfddd6;
  --charcoal: #242529;
  --green: #28c76f;
  --yellow: #ffd84d;
  --cyan: #17bebb;
  --coral: #ff6f61;
  --violet: #7154d9;
  --shadow: 0 18px 48px rgba(23, 23, 23, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

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

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 14px clamp(18px, 5vw, 64px);
  border-bottom: 1px solid rgba(23, 23, 23, 0.08);
  background: rgba(250, 249, 246, 0.9);
  backdrop-filter: blur(16px);
}

.brand,
.header-nav,
.site-footer {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 0.76rem;
}

.header-nav {
  gap: 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.header-nav a:hover,
.site-footer a:hover {
  color: var(--ink);
}

.hero {
  min-height: 520px;
  display: grid;
  align-items: center;
  padding: 80px clamp(18px, 5vw, 64px);
  background:
    linear-gradient(90deg, rgba(250, 249, 246, 0.95) 0%, rgba(250, 249, 246, 0.82) 43%, rgba(250, 249, 246, 0.28) 100%),
    url("assets/hero.png") center / cover no-repeat;
}

.hero-content {
  width: min(680px, 100%);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--violet);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(4rem, 5.6rem, 5.6rem);
  line-height: 0.95;
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 2.75rem, 2.75rem);
  line-height: 1;
}

h3 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.hero-copy {
  max-width: 560px;
  margin: 22px 0 28px;
  color: #30333a;
  font-size: 1.16rem;
  line-height: 1.65;
}

.hero-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: min(610px, 100%);
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 7px 7px 0 var(--ink);
  overflow: hidden;
}

.hero-search input,
.feed-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.hero-search input {
  padding: 16px 18px;
}

.hero-search button {
  border: 0;
  border-left: 2px solid var(--ink);
  background: var(--green);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  padding: 0 22px;
}

.browse-section,
.collections-section {
  padding: 64px clamp(18px, 5vw, 64px);
}

.browse-section {
  background: var(--surface);
}

.section-inner {
  width: min(1160px, 100%);
  margin: 0 auto;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 410px);
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
}

.section-heading p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

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

.segment-control button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f2eb;
  color: #31343a;
  cursor: pointer;
  padding: 0 14px;
  font-weight: 700;
}

.segment-control button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--charcoal);
  color: #ffffff;
}

.feed-search {
  display: block;
  width: min(260px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 13px;
}

.meme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.meme-card,
.collection-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.meme-card {
  display: grid;
  min-height: 250px;
  overflow: hidden;
}

.card-top {
  min-height: 96px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  background: var(--card-bg, #f5f2eb);
}

.card-tag,
.collection-code {
  display: inline-grid;
  min-width: 44px;
  min-height: 32px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.card-signal {
  color: rgba(23, 23, 23, 0.58);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
}

.card-body {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
}

.card-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.card-meta span {
  border-radius: 999px;
  background: #f3f1eb;
  color: #4d535f;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.empty-state {
  margin: 18px 0 0;
  color: var(--muted);
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.collection-item {
  padding: 20px;
}

.collection-item h3 {
  margin-top: 18px;
}

.collection-item p {
  color: var(--muted);
  line-height: 1.6;
}

.site-footer {
  justify-content: center;
  gap: 18px;
  min-height: 76px;
  padding: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
}

@media (max-width: 860px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .header-nav {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .hero {
    min-height: 560px;
    padding-top: 58px;
    background:
      linear-gradient(180deg, rgba(250, 249, 246, 0.98) 0%, rgba(250, 249, 246, 0.88) 48%, rgba(250, 249, 246, 0.42) 100%),
      url("assets/hero.png") center bottom / cover no-repeat;
  }

  h1 {
    font-size: 3.7rem;
  }

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

  .hero-search button {
    min-height: 48px;
    border-left: 0;
    border-top: 2px solid var(--ink);
  }

  .section-heading,
  .toolbar,
  .meme-grid,
  .collection-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
  }

  .feed-search {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .header-nav {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  h1 {
    font-size: 3rem;
  }

  h2 {
    font-size: 1.85rem;
  }

  .browse-section,
  .collections-section {
    padding-top: 48px;
    padding-bottom: 48px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
