:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #25302a;
  background: #f7f8f4;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #25302a;
  --muted: #707970;
  --faint: #949c92;
  --line: #e4e8e2;
  --paper: #fff;
  --canvas: #f7f8f4;
  --accent: #5e7a61;
  --accent-dark: #416347;
  --tag: #eef2ea;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgb(94 122 97 / 36%);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.top-rule {
  height: 3px;
  background: var(--accent);
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.header-inner,
.footer-inner {
  display: flex;
  width: min(100% - 64px, 1640px);
  min-height: 68px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--accent);
}

.brand-mark svg {
  display: block;
  width: 31px;
  height: 31px;
}

.brand-name {
  font-size: 15px;
  font-weight: 780;
  letter-spacing: -0.045em;
}

.brand-name span {
  color: var(--accent-dark);
  font-weight: 560;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.random-button,
.submit-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.random-button {
  padding: 0 11px;
  border-color: #e4e0da;
  background: #fff;
  cursor: pointer;
}

.random-button:hover {
  border-color: #d7d2ca;
  background: #f8f6f3;
}

.random-button svg,
.submit-button svg {
  width: 16px;
  height: 16px;
}

.submit-button {
  padding: 0 12px;
  background: var(--accent);
  color: #fff;
}

.submit-button:hover {
  background: var(--accent-dark);
}

.page-shell {
  width: min(100% - 64px, 1640px);
  margin: 0 auto;
  padding: 40px 0 56px;
}

.intro {
  margin: 0 0 26px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: #77736e;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.095em;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.intro h1 {
  margin: 0;
  font-size: clamp(27px, 3.3vw, 40px);
  font-weight: 720;
  letter-spacing: -0.045em;
  line-height: 1.15;
}

.intro-copy {
  max-width: 630px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.collection-bar {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}

.search-box {
  display: flex;
  width: min(100%, 490px);
  height: 43px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid #dfdcd6;
  border-radius: 5px;
  background: var(--paper);
  color: #77736e;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(94 122 97 / 12%);
}

.search-box > svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.search-box input::placeholder {
  color: #96918b;
}

.search-box input:focus-visible {
  outline: 0;
}

.search-shortcut {
  display: grid;
  width: 21px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid #e6e2dc;
  border-radius: 3px;
  background: #faf9f7;
  color: #827d77;
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  place-items: center;
}

.collection-count {
  margin: 0;
  color: #77736e;
  font-size: 12px;
  font-weight: 550;
}

.browser-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}

.tag-sidebar {
  padding: 0 0 17px;
  border-bottom: 1px solid var(--line);
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 9px;
}

.sidebar-heading h2,
.results-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tag-total {
  color: #aaa59e;
  font-size: 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tag-button {
  display: inline-flex;
  max-width: 100%;
  min-height: 31px;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid #e3e8e1;
  border-radius: 999px;
  background: var(--paper);
  color: #4b574d;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.2;
  text-align: left;
}

.tag-button:hover {
  border-color: #cad7ca;
  background: #f5f8f3;
}

.tag-button.is-active {
  border-color: #d7e2d7;
  background: #edf3ed;
  color: #365a3d;
  font-weight: 650;
}

.tag-hash {
  color: var(--accent);
  font-weight: 750;
}

.tag-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-uses {
  margin-left: 2px;
  color: #a29c95;
  font-size: 10px;
}

.all-tags-button {
  margin: 9px 0 0 2px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: #6b6761;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.all-tags-button:hover {
  color: var(--accent-dark);
}

.results-heading {
  display: flex;
  min-height: 50px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.results-heading h2 {
  font-size: 15px;
}

.results-description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.results-count {
  flex: 0 0 auto;
  margin: 2px 0 0;
  color: #89847e;
  font-size: 11px;
}

.gif-masonry {
  column-count: 3;
  column-gap: 17px;
}

.gif-card {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  overflow: hidden;
  break-inside: avoid;
  border: 1px solid #e6e2dc;
  border-radius: 5px;
  background: var(--paper);
  vertical-align: top;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.gif-card:hover,
.gif-card:focus-within {
  transform: translateY(-2px);
  border-color: #d9d3ca;
  box-shadow: 0 5px 16px rgb(39 35 28 / 9%);
}

.gif-media {
  position: relative;
  overflow: hidden;
  background: #f1efeb;
}

.gif-open-link {
  display: block;
  color: inherit;
}

.gif-preview {
  display: block;
  width: 100%;
  height: auto;
  background: #f1efeb;
  object-fit: contain;
}

.preview-fallback {
  display: grid;
  width: 100%;
  min-height: 180px;
  padding: 20px;
  background: #f1efeb;
  color: #77736e;
  font-size: 12px;
  place-items: center;
  text-align: center;
}

.gif-actions {
  position: absolute;
  top: 9px;
  right: 9px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 130ms ease, transform 130ms ease;
}

.gif-card:hover .gif-actions,
.gif-card:focus-within .gif-actions {
  opacity: 1;
  transform: translateY(0);
}

.gif-action {
  display: grid;
  width: 33px;
  height: 33px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 4px;
  background: rgb(32 31 29 / 86%);
  color: #fff;
  cursor: pointer;
  place-items: center;
}

.gif-action:hover {
  background: #111;
}

.gif-action svg {
  width: 18px;
  height: 18px;
}

.gif-card-caption {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 9px;
}

.gif-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #373532;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-tag {
  flex: 0 0 auto;
  max-width: 46%;
  padding: 3px 6px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: var(--tag);
  color: #706a62;
  cursor: pointer;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-tag:hover {
  background: #eee6dd;
  color: #45413c;
}

.empty-state {
  padding: 58px 16px;
  border: 1px dashed #ded9d1;
  border-radius: 5px;
  color: #716c66;
  text-align: center;
}

.empty-mark {
  display: inline-block;
  color: #d4cec5;
  font-size: 34px;
  line-height: 1;
}

.empty-state h3 {
  margin: 9px 0 4px;
  color: #45413c;
  font-size: 15px;
}

.empty-state p {
  margin: 0 0 14px;
  font-size: 12px;
}

.empty-state button {
  padding: 7px 11px;
  border: 1px solid #ded9d1;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.load-more-button {
  display: block;
  min-height: 39px;
  margin: 10px auto 0;
  padding: 0 18px;
  border: 1px solid #dfd9d1;
  border-radius: 4px;
  background: #fff;
  color: #45413c;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.load-more-button:hover {
  border-color: #cec5bb;
  background: #f8f6f3;
}

.media-note {
  margin: 20px 0 0;
  color: #9a958e;
  font-size: 10px;
  text-align: center;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.footer-inner {
  min-height: 49px;
  color: #77736e;
  font-size: 10px;
}

.footer-separator {
  padding: 0 4px;
  color: #c3bdb5;
}

.footer-credit {
  white-space: nowrap;
}

.footer-credit strong {
  color: var(--ink);
  font-weight: 750;
}

.random-dialog {
  width: min(480px, calc(100% - 28px));
  max-height: min(90vh, 820px);
  padding: 20px;
  overflow: auto;
  border: 1px solid #e3dfd8;
  border-radius: 8px;
  background: var(--canvas);
  color: var(--ink);
  box-shadow: 0 18px 60px rgb(27 25 21 / 22%);
}

.random-dialog::backdrop {
  background: rgb(31 30 28 / 40%);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.dialog-heading .eyebrow {
  margin-bottom: 4px;
  font-size: 9px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.dialog-close {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: #625e58;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
  place-items: center;
}

.random-dialog .gif-card {
  margin-bottom: 0;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 5px;
  background: #292724;
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.noscript-message {
  margin: 24px;
  color: #8f2f23;
}

@media (max-width: 1250px) {
  .gif-masonry {
    column-count: 2;
  }
}

@media (max-width: 820px) {
  .header-inner,
  .footer-inner,
  .page-shell {
    width: min(100% - 36px, 1640px);
  }

  .page-shell {
    padding-top: 30px;
  }

  .tag-sidebar {
    padding-bottom: 14px;
  }

  .tag-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px 1px 8px;
    scrollbar-width: thin;
  }

  .tag-button {
    flex: 0 0 auto;
  }

  .all-tags-button {
    margin-top: 2px;
  }
}

@media (max-width: 560px) {
  .header-inner {
    min-height: 60px;
    gap: 8px;
  }

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

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

  .brand-name {
    font-size: 13px;
  }

  .header-actions {
    gap: 6px;
  }

  .random-button,
  .submit-button {
    min-height: 33px;
    padding: 0 8px;
    font-size: 10px;
  }

  .random-button svg,
  .submit-button svg {
    width: 14px;
    height: 14px;
  }

  .page-shell {
    padding-top: 27px;
  }

  .intro {
    margin-bottom: 20px;
  }

  .intro h1 {
    max-width: 440px;
    font-size: clamp(27px, 7vw, 34px);
  }

  .intro-copy {
    margin-top: 8px;
    font-size: 13px;
  }

  .collection-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 18px;
  }

  .search-box {
    width: 100%;
  }

  .collection-count {
    font-size: 10px;
  }

  .gif-masonry {
    column-count: 2;
    column-gap: 11px;
  }

  .gif-card {
    margin-bottom: 11px;
  }

  .gif-card-caption {
    min-height: 38px;
    gap: 5px;
    padding: 7px;
  }

  .gif-title {
    font-size: 10px;
  }

  .card-tag {
    max-width: 48%;
    padding: 2px 4px;
    font-size: 8px;
  }

  .gif-actions {
    top: 6px;
    right: 6px;
    gap: 4px;
  }

  .gif-action {
    width: 30px;
    height: 30px;
  }

  .gif-action svg {
    width: 15px;
    height: 15px;
  }

  .footer-inner {
    min-height: 46px;
    font-size: 9px;
  }
}

@media (hover: none) {
  .gif-actions {
    opacity: 1;
    transform: none;
  }
}

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