/* reactiongifs — shared stylesheet (design mockups, mobile first) */
:root {
  color-scheme: light dark;
  --bg: #fafaf9;
  --surface: #fff;
  --panel: #eeefef;
  --text: #22252a;
  --muted: #686d75;
  --line: #dedfe2;
  --accent: #315cd5;
  --accent-ink: #fff;
  --tint: #eaf0ff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141618; --surface: #1c1e21; --panel: #202327; --text: #eeeff1; --muted: #a2a8b2;
    --line: #35393f; --accent: #a5bdff; --accent-ink: #172445; --tint: #25314a;
  }
}

/* base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 15px/1.5 Arial, Helvetica, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p { margin-top: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.wrap { width: calc(100% - 32px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; top: 8px; left: 8px; z-index: 9; padding: 10px 16px; background: var(--surface); color: var(--accent); transform: translateY(-200%); }
.skip:focus { transform: none; }
.arrow { display: inline-block; font-size: 0.95em; line-height: 1; }
.icon { display: inline-block; flex: none; width: 17px; height: 17px; vertical-align: -3px; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.top { display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; padding: 4px 0 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 64px; font-size: 22px; font-weight: 700; letter-spacing: -1px; white-space: nowrap; }
.brand .mark { width: 25px; height: 25px; color: var(--accent); }
.mark-play { transform-box: fill-box; transform-origin: 30% 50%; animation: mark-play 8s ease-in-out infinite; }
@keyframes mark-play {
  0%, 88%, 100% { transform: none; }
  91% { transform: translateX(1.6px) scale(1.25); }
  94% { transform: translateX(-.4px) scale(.95); }
  97% { transform: translateX(.6px) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) { .mark-play { animation: none; } }
.brand b { color: var(--accent); font-weight: inherit; }
.random { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; min-height: 44px; font-size: 12px; white-space: nowrap; }
.random .icon { width: 15px; height: 15px; color: var(--muted); }
.random:hover, .footer-nav a:hover { color: var(--accent); }
.search {
  display: flex; align-items: center; gap: 10px; order: 3; flex-basis: 100%;
  border: 1px solid var(--line); border-radius: 7px; padding: 4px 4px 4px 13px; background: var(--bg);
}
.search:focus-within { border-color: var(--accent); }
.search .icon { color: var(--muted); }
.search input { width: 100%; min-width: 0; border: 0; padding: 7px 0; background: transparent; color: var(--text); font-size: 16px; outline: none; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search button { border: 0; border-radius: 4px; min-height: 38px; padding: 8px 16px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 600; }
.cat-bar { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; }
.cats {
  display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none;
  padding: 4px 28px 4px 4px; margin-left: -4px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.cats::-webkit-scrollbar { display: none; }
.cats a {
  flex: none; display: inline-flex; align-items: center; min-height: 34px; padding: 5px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px;
}
.cats a:hover { color: var(--text); border-color: var(--muted); }
.cats a[aria-current="page"] { color: var(--accent); background: var(--tint); border-color: transparent; font-weight: 700; }
.all-cats {
  flex: none; display: inline-flex; align-items: center; gap: 5px; margin-left: auto; min-height: 42px;
  padding-left: 12px; border-left: 1px solid var(--line); font-size: 12px; white-space: nowrap;
}
.all-cats:hover, .all-cats[aria-current="page"] { color: var(--accent); }
.all-cats .long { display: none; }
.all-cats .icon { width: 14px; height: 14px; }
.tags .icon { width: 12px; height: 12px; }
.category-list .icon { width: 14px; height: 14px; color: var(--muted); }

/* page frame */
main { flex: 1; padding: 25px 0 32px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 7px 10px; margin-bottom: 20px; }
.page-head h1 { margin-bottom: 3px; font-size: 22px; line-height: 1.25; letter-spacing: -.6px; }
.page-head p { margin: 0; font-size: 12px; color: var(--muted); }
.eyebrow { display: block; margin-bottom: 5px; font-size: 12px; color: var(--muted); }
.count { flex-basis: 100%; padding-bottom: 1px; font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* card grid: identical 4:3 frames, centred cover crop */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 12px; }
.grid > li { min-width: 0; }
.card { display: block; }
.thumb { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 5px; background: var(--panel); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.card h2, .card h3 { margin: 8px 0 0; font-size: 13px; font-weight: 500; line-height: 1.45; min-height: 2.9em; overflow-wrap: anywhere; }
.card:hover h2, .card:hover h3 { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.card:hover .thumb { outline: 2px solid var(--accent); outline-offset: 2px; }

/* pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; }
.pager > a, .pager > .disabled { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.pager > a:hover { border-color: var(--accent); color: var(--accent); }
.pager > .disabled { color: var(--muted); background: transparent; border-color: transparent; }
.pager .where { font-size: 11px; color: var(--muted); }

/* footer */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 15px; padding: 18px 0; font-size: 12px; color: var(--muted); }
.footer-brand { font-size: 14px; font-weight: 700; letter-spacing: -.4px; color: var(--text); }
.footer-tagline { display: none; }
.footer-nav { display: flex; gap: 17px; }
.footer-nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: 11px; }

/* post page */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; font-size: 12px; color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.post { max-width: 940px; margin-inline: auto; }
.post-head { margin-bottom: 20px; }
.post-head h1 { max-width: 730px; margin-bottom: 10px; font-size: 27px; line-height: 1.22; letter-spacing: -.8px; overflow-wrap: anywhere; text-wrap: balance; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; font-size: 12px; color: var(--muted); }
.meta a { color: var(--accent); font-weight: 600; }
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
.gif-stage {
  margin: 0; min-height: 240px; padding: 22px 14px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel);
}
.gif-stage img { flex: 0 1 auto; width: auto; height: auto; max-width: 100%; border-radius: 2px; }
.file-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin: 9px 0 0; font-size: 11px; color: var(--muted); }
.file-meta a { text-decoration: underline; text-underline-offset: 3px; }
.file-meta a:hover { color: var(--accent); }
.caption { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.post-tools h2 { display: none; font-size: 15px; margin: 0 0 12px; }
.post-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 44px; padding: 11px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--text); font-size: 12px; font-weight: 600;
}
.button:hover { border-color: var(--accent); color: var(--accent); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
.post-actions .copy { grid-column: 1 / -1; }
.download { flex-wrap: wrap; gap: 3px 6px; }
.download > span { white-space: nowrap; }
.post-actions .icon { width: 16px; height: 16px; }
.file-meta .icon { width: 12px; height: 12px; vertical-align: -2px; }
.download small { flex-basis: 100%; text-align: center; font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.primary small { color: inherit; opacity: .8; }
.direct-link { margin-top: 9px; }
.direct-link summary { padding: 4px 0; font-size: 12px; color: var(--muted); cursor: pointer; }
.direct-link input { width: 100%; margin-top: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); font-size: 12px; }
.copy-status { margin: 4px 0 0; font-size: 12px; color: var(--accent); }
.copy-status:empty { display: none; }
.tag-section { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.post-tools .tag-section h2 { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tags a {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 5px 10px;
  border: 1px solid transparent; border-radius: 4px; background: var(--tint); color: var(--accent); font-size: 12px;
}
.tags a:hover { border-color: var(--accent); }
.tags .plain { display: inline-flex; align-items: center; min-height: 36px; padding: 5px 10px; border: 1px dashed var(--muted); border-radius: 4px; color: var(--muted); font-size: 12px; }
.tag-note { margin: 10px 0 0; font-size: 11px; color: var(--muted); }
.description { max-width: 648px; margin-top: 24px; font-size: 15px; line-height: 1.7; }
.description h2, .description h3 { margin: 0 0 7px; font-size: 14px; }
.description h3 { margin-top: 18px; }
.description p { margin-bottom: 12px; color: var(--muted); }
.description p:last-child { margin-bottom: 0; }
.description a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.usage { margin: 12px 0 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--tint); border-radius: 0 4px 4px 0; }
.usage p { margin: 0; color: var(--text); font-size: 14px; }
.clip { max-width: 648px; margin-top: 24px; }
.clip summary { padding: 10px 0; font-size: 14px; color: var(--accent); cursor: pointer; }
.video { aspect-ratio: 16 / 9; }
.video iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 7px; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; }
.prevnext a { display: block; min-width: 0; overflow-wrap: anywhere; }
.prevnext a:hover { color: var(--accent); }
.prevnext small { display: block; margin-bottom: 6px; font-size: 11px; color: var(--muted); }
.prevnext .next { grid-column: 2; text-align: right; }
.recommendations { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.recommendations > h2 { margin-bottom: 18px; font-size: 19px; line-height: 1.3; letter-spacing: -.3px; }

/* category index */
.category-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 22px; }
.category-list a { display: flex; align-items: center; gap: 12px; min-height: 57px; border-bottom: 1px solid var(--line); font-size: 14px; }
.category-list a:hover { color: var(--accent); }
.category-list .number { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.category-list .arrow { color: var(--muted); }

/* empty states: search, 404, random */
.empty { max-width: 580px; margin: 24px auto 48px; padding: 25px 4px; text-align: center; }
.empty h1, .empty h2 { margin-bottom: 10px; font-size: 26px; letter-spacing: -.5px; }
.empty p { font-size: 14px; color: var(--muted); }
.empty .button { margin-top: 6px; padding-inline: 16px; font-size: 13px; }
.error-code { display: block; margin-bottom: 14px; font-size: 68px; font-weight: 700; line-height: 1; letter-spacing: -4px; color: var(--accent); }

/* text pages */
.prose { max-width: 660px; margin: 0 auto 32px; font-size: 15px; line-height: 1.75; }
.prose h1 { margin-bottom: 16px; font-size: 27px; line-height: 1.25; letter-spacing: -.7px; }
.prose h2, .prose h3 { margin: 28px 0 10px; font-size: 17px; }
.prose p, .prose li { color: var(--muted); }
.prose li { margin-bottom: 8px; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose .usage { margin: 0 0 20px; }
.prose img { border-radius: 5px; }

/* 404: a lost reaction that looks around */
.lost { width: min(240px, 70%); margin: 0 auto 18px; }
.lost svg { display: block; width: 100%; height: auto; overflow: visible; }
.lost-frame { fill: var(--panel); stroke: var(--line); stroke-width: 2; }
.lost-brow, .lost-mouth { fill: none; stroke: var(--text); stroke-width: 5; stroke-linecap: round; }
.lost-eye { fill: var(--surface); stroke: var(--text); stroke-width: 3; }
.lost-pupils { fill: var(--text); animation: lost-look 4s ease-in-out infinite; }
.lost-brow-l { transform-origin: 54px 40px; animation: lost-brow 4s ease-in-out infinite; }
.lost-brow-r { transform-origin: 106px 40px; animation: lost-brow 4s ease-in-out infinite reverse; }
.lost-mouth { transform-origin: 80px 90px; animation: lost-mouth 4s ease-in-out infinite; }
.lost-code { fill: var(--accent); font: 700 20px/1 Arial, Helvetica, sans-serif; letter-spacing: -1px; }
@keyframes lost-look { 0%, 20% { transform: translateX(0); } 30%, 45% { transform: translate(-5px, 1px); } 55%, 70% { transform: translate(5px, 1px); } 80%, 100% { transform: translateX(0); } }
@keyframes lost-brow { 0%, 20% { transform: translateY(0); } 30%, 45% { transform: translateY(-4px) rotate(-6deg); } 55%, 70% { transform: translateY(-1px) rotate(4deg); } 80%, 100% { transform: translateY(0); } }
@keyframes lost-mouth { 0%, 20%, 80%, 100% { transform: scaleX(1); } 40%, 60% { transform: scaleX(.7) translateY(2px); } }
@media (prefers-reduced-motion: reduce) { .lost-pupils, .lost-brow-l, .lost-brow-r, .lost-mouth { animation: none; } }

/* narrow phones */
@media (max-width: 370px) {
  .wrap { width: calc(100% - 24px); }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* tablet and up */
@media (min-width: 700px) {
  .wrap { width: min(100% - 64px, 1120px); }
  .top { flex-wrap: nowrap; gap: 24px; min-height: 88px; padding: 0; }
  .brand { min-height: 0; font-size: 23px; letter-spacing: -1.1px; }
  .search { order: 0; flex: 1; flex-basis: auto; max-width: 504px; }
  .search input { font-size: 14px; }
  .search button { min-height: 34px; }
  .random { font-size: 13px; gap: 8px; }
  .cat-bar { gap: 16px; padding-bottom: 14px; }
  .all-cats { min-height: 36px; padding-left: 16px; font-size: 13px; gap: 8px; }
  .all-cats .long { display: inline; }
  main { padding: 32px 0 48px; }
  .page-head { flex-wrap: nowrap; gap: 20px; margin-bottom: 23px; }
  .page-head h1 { font-size: 25px; letter-spacing: -.7px; }
  .page-head p { font-size: 13px; }
  .count { flex-basis: auto; font-size: 12px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 20px; }
  .thumb { border-radius: 7px; }
  .card h2, .card h3 { margin-top: 9px; font-size: 14px; }
  .pager { margin-top: 28px; padding-top: 22px; font-size: 13px; }
  .pager > a, .pager > .disabled { min-width: 115px; padding-inline: 14px; }
  .pager .where { font-size: 12px; }
  .footer-inner { flex-wrap: nowrap; justify-content: flex-start; gap: 20px; min-height: 94px; padding: 0; }
  .footer-tagline { display: inline; }
  .footer-nav { margin-left: auto; gap: 24px; }
  .footer-nav a { font-size: 12px; }
  .breadcrumb { margin-bottom: 24px; }
  .post-head { margin-bottom: 24px; }
  .post-head h1 { font-size: 30px; }
  .post-layout { grid-template-columns: minmax(0, 1fr) 235px; gap: 24px; }
  .gif-stage { min-height: 330px; padding: 28px 20px; }
  .post-tools h2 { display: block; }
  .post-actions { display: block; }
  .post-tools .button { width: 100%; margin-bottom: 8px; padding-inline: 16px; font-size: 13px; }
  .download { flex-wrap: nowrap; justify-content: flex-start; gap: 9px; }
  .download small { flex-basis: auto; margin-left: auto; text-align: right; }
  .tag-section { margin-top: 23px; padding-top: 20px; }
  .tags a, .tags .plain { min-height: 32px; }
  .description { margin-top: 27px; }
  .prevnext { gap: 32px; }
  .recommendations { margin-top: 40px; padding-top: 25px; }
  .recommendations .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .category-list { grid-template-columns: repeat(3, 1fr); column-gap: 40px; }
  .category-list a { font-size: 15px; }
  .empty { margin: 44px auto 72px; padding: 32px; }
  .prose { margin-top: 12px; }
  .prose h1 { font-size: 30px; }
}

/* desktop */
@media (min-width: 1000px) {
  .top { gap: 48px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .post-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 32px; }
}
