/* ==========================================================
   Trilzo's Button: main stylesheet (mobile first)
   ========================================================== */

:root {
  --bg: #fff4cc;
  --bg-dot: #f2dc8f;
  --paper: #ffffff;
  --ink: #161412;
  --muted: #6b6455;
  --red: #ff2d2d;
  --red-dark: #c40f0f;
  --red-deep: #7d0000;
  --yellow: #ffd23f;

  /* Category colors */
  --games: #4f7cff;
  --toys: #ff9f1c;
  --art-music: #b84cfd;
  --mind-blowing: #00b48a;
  --pure-nonsense: #ff4f9a;

  /* Ad placeholders are deliberately plain gray: they must never look like tiles or buttons */
  --ad-bg: #ebe7dd;
  --ad-line: #c2bba9;

  --radius: 14px;
  --shadow: 4px 4px 0 var(--ink);
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: "Arial Black", "Avenir Next Heavy", Impact, var(--font);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 17px/1.55 var(--font);
  overflow-x: hidden;
}
/* On computers, assets/js/dots.js redraws these dots on a canvas so they react to the mouse.
   The dots stay put while the page scrolls over them. */
.has-dots body { background-image: none; }
.dots-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.center { text-align: center; }
.wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 16px; }
:focus-visible { outline: 3px solid var(--games); outline-offset: 3px; }

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 52px; padding-inline: 16px;
  background: var(--paper); border-bottom: 3px solid var(--ink);
}
.logo { display: flex; align-items: center; gap: 8px; font: 900 1.15rem/1 var(--font-display); text-decoration: none; letter-spacing: -0.02em; }
.logo__dot { width: 18px; height: 18px; border-radius: 50%; background: var(--red); border: 3px solid var(--ink); flex: none; display: inline-block; }
.site-nav { display: flex; gap: 4px; align-items: center; }
.site-nav a { font-weight: 700; font-size: 0.92rem; text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.site-nav a:hover { background: var(--bg); }
.site-nav__yt { background: var(--ink); color: var(--paper); }
.site-nav a.site-nav__yt:hover { background: var(--red); }
.hide-sm { display: none; }

/* ---------- Hero + the big red button ---------- */
.hero { text-align: center; padding: 14px 16px 0; }
.title {
  margin: 0; font: 900 clamp(2.1rem, 9vw, 3.6rem)/1 var(--font-display);
  letter-spacing: -0.03em; text-shadow: 3px 3px 0 var(--yellow);
}
.title__red { color: var(--red); text-shadow: 3px 3px 0 var(--ink); }
.tagline { margin: 6px 0 0; font-weight: 700; font-size: 0.95rem; color: var(--muted); }

.button-zone { padding: 12px 0 16px; display: flex; justify-content: center; }
.big-button {
  --size: clamp(150px, 44vw, 190px);
  position: relative; display: grid; place-items: center;
  width: var(--size); height: var(--size); border-radius: 50%;
  background: #3a3530; border: 4px solid var(--ink);
  box-shadow: 0 6px 0 var(--ink), 0 14px 24px rgba(0, 0, 0, 0.25);
  text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.big-button__cap {
  display: grid; place-items: center;
  width: 84%; height: 84%; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #ff8a8a 0, var(--red) 38%, var(--red-dark) 78%);
  border: 4px solid var(--ink);
  box-shadow: 0 10px 0 var(--red-deep), inset 0 -8px 14px rgba(0, 0, 0, 0.25);
  transform: translateY(-10px);
  transition: transform 0.07s ease, box-shadow 0.07s ease;
}
.big-button__cap span {
  color: #fff; font: 900 clamp(1.1rem, 5vw, 1.45rem)/1 var(--font-display); letter-spacing: 0.08em;
  text-shadow: 0 2px 0 var(--red-deep);
}
.big-button:hover { animation: shake 0.5s infinite; }
.big-button:active { animation: none; }
.big-button:active .big-button__cap { transform: translateY(-1px); box-shadow: 0 1px 0 var(--red-deep), inset 0 -4px 10px rgba(0, 0, 0, 0.3); }
.hero__count { margin: 0; font-weight: 800; font-size: 0.9rem; color: var(--muted); }

/* Shakes the whole button (base and cap together) on hover */
@keyframes shake {
  0% { transform: translate(2px, 1px) rotate(0deg); }
  20% { transform: translate(-2px, -1px) rotate(-2deg); }
  40% { transform: translate(-3px, 0) rotate(2deg); }
  60% { transform: translate(2px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  100% { transform: translate(1px, 0) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .big-button:hover { animation: none; }
}

/* ---------- Ad slots ----------
   Heights are reserved here so the page doesn't jump when ads load.
   Plain gray + "Advertisement" label so ads never look like tiles or buttons. */
.ad-zone { padding: 28px 16px; }
.ad-zone:empty { display: none; } /* no ad yet = no gap */
.ad-zone--hero { padding-top: 34px; padding-bottom: 16px; } /* generous gap below the big red button */
.ad { width: 100%; text-align: center; }
.ad__label { font: 700 11px/1 var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ad__box { display: block; margin: 0 auto; width: 300px; height: 250px; max-width: 100%; overflow: hidden; }
.ad__box--placeholder {
  display: flex; align-items: center; justify-content: center; background: var(--ad-bg); border: 1px dashed var(--ad-line);
  color: var(--muted); font-size: 13px;
}
.ad__box--placeholder::after { content: " · 300×250"; white-space: pre; }
.catalog .ad-zone { grid-column: 1 / -1; padding-inline: 0; }

/* ---------- Tiles ---------- */
.catalog { padding-top: 4px; padding-bottom: 24px; }
.catalog__head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.catalog__head h2 { margin: 0; font: 900 1.4rem/1.1 var(--font-display); }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper);
  font-weight: 700; font-size: 0.88rem; white-space: nowrap;
}
.chip { text-decoration: none; }
.chip:hover { background: var(--bg); }
.chip.is-on, .chip.is-on:hover { background: var(--ink); color: var(--paper); }
.category-page__title { font: 900 clamp(2rem, 7vw, 3rem)/1.05 var(--font-display); margin: 26px 0 6px; letter-spacing: -0.02em; }
.category-page .lede { margin: 0 0 14px; }
.category-page__grid { margin-top: 16px; }
.category-page__more { text-align: center; margin: 32px 0 8px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid + .grid { margin-top: 12px; }

.tile {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); text-decoration: none; overflow: hidden;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.tile:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.tile:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.tile__thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; overflow: hidden;
  background: var(--c, var(--pure-nonsense)); border-bottom: 3px solid var(--ink);
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 10px, transparent 10px 20px);
}
.tile__thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile__letter { font: 900 3.2rem/1 var(--font-display); color: #fff; text-shadow: 3px 3px 0 var(--ink); transform: rotate(-6deg); }
.tile:nth-child(3n) .tile__letter { transform: rotate(5deg); }
.tile:nth-child(4n) .tile__letter { transform: rotate(-2deg) scale(1.1); }
.tile__cat { position: absolute; top: 6px; right: 6px; font-size: 1rem; line-height: 1; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 5px; }
.tile__name { padding: 8px 10px 0; font-weight: 800; font-size: 0.95rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile__host { padding: 0 10px 9px; font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-games { --c: var(--games); }
.cat-toys { --c: var(--toys); }
.cat-art-music { --c: var(--art-music); }
.cat-mind-blowing { --c: var(--mind-blowing); }
.cat-pure-nonsense { --c: var(--pure-nonsense); }

/* ---------- Featured slot (for selling to indie devs later) ---------- */
.featured { padding-bottom: 8px; }
.featured__label { margin: 0 0 4px; font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.featured__card { display: block; padding: 14px 16px; background: var(--yellow); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; }

/* ---------- Text content ---------- */
.prose { max-width: 720px; }
.prose h1 { font: 900 clamp(1.9rem, 6vw, 2.6rem)/1.1 var(--font-display); margin: 28px 0 10px; letter-spacing: -0.02em; }
.prose h2 { font: 900 1.35rem/1.2 var(--font-display); margin: 1.8em 0 0.4em; }
.prose a { color: var(--red-dark); font-weight: 700; }
.prose ul { padding-left: 1.2em; }
.prose li + li { margin-top: 0.3em; }
article.prose, section.prose { padding-bottom: 32px; }
.lede { font-size: 1.15rem; }
.intro { padding-top: 12px; padding-bottom: 40px; }
.intro h2 { margin-top: 0.6em; }
.crumbs { margin: 20px 0 0; font-size: 0.9rem; font-weight: 700; }
.crumbs a { text-decoration: none; }
.post-list { list-style: none; padding: 0; }
.post-list li { padding: 14px 0; border-bottom: 2px dashed var(--bg-dot); }
.post-list a { font-size: 1.15rem; }
.empty { padding: 22px; background: var(--paper); border: 2px dashed var(--muted); border-radius: var(--radius); text-align: center; }
.preview-banner { margin: 0; padding: 6px; text-align: center; background: var(--ink); color: var(--yellow); font-weight: 800; }

/* ---------- Buttons (never red: red belongs to the big button) ---------- */
.visit-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px;
  background: var(--yellow); color: var(--ink); border: 3px solid var(--ink); border-radius: 999px;
  box-shadow: var(--shadow); font: 900 1.05rem/1 var(--font-display); text-decoration: none;
}
.prose a.visit-btn { color: var(--ink); }
.visit-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.fav-btn {
  display: inline-grid; place-items: center; width: 46px; height: 46px; flex: none;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 50%; font-size: 1.35rem; line-height: 1;
}
.fav-btn[aria-pressed="true"] { color: var(--red); }

/* ---------- Site pages ---------- */
.site-page__top { display: grid; gap: 18px; margin-top: 14px; }
.site-page__shot { border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
.site-page__shot .tile__letter { font-size: 5rem; }
.site-page__info h1 { margin: 0; font: 900 clamp(1.9rem, 6vw, 2.8rem)/1.05 var(--font-display); letter-spacing: -0.02em; }
.site-page__host { margin: 4px 0 0; color: var(--muted); font-weight: 700; }
.site-page__blurb { font-size: 1.15rem; font-weight: 600; margin: 12px 0 16px; }
.site-page__actions { display: flex; gap: 12px; align-items: center; }
.site-page__writeup { padding-top: 6px; padding-bottom: 0; }
.video { max-width: 720px; padding-bottom: 12px; }
.video h2 { font: 900 1.35rem/1.2 var(--font-display); }
.yt { position: relative; display: block; width: 100%; padding: 0; border: 3px solid var(--ink); border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.yt img { width: 100%; height: 100%; object-fit: cover; }
.yt__play { position: absolute; inset: 0; margin: auto; width: 72px; height: 50px; display: grid; place-items: center; background: var(--red); color: #fff; border-radius: 14px; font-size: 1.4rem; }
.yt__frame { width: 100%; aspect-ratio: 16 / 9; border: 3px solid var(--ink); border-radius: var(--radius); }
.more { padding-bottom: 40px; }
.more h2, .history-head h2 { font: 900 1.35rem/1.2 var(--font-display); }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; }
.page-tool .wrap { padding-bottom: 40px; }
.page-tool h1 { font: 900 2rem/1.1 var(--font-display); margin: 28px 0 4px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #d9d3c4; padding: 28px 0 36px; margin-top: 20px; }
.site-footer__inner { display: grid; gap: 12px; }
.site-footer__brand { margin: 0; display: flex; align-items: center; gap: 8px; color: #fff; font: 900 1.1rem/1 var(--font-display); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer nav a { color: #fff; font-weight: 700; text-decoration: none; padding: 4px 0; }
.site-footer nav a:hover { color: var(--yellow); }
.site-footer .muted { color: #a59f90; font-size: 0.85rem; margin: 0; }

/* ---------- Viewer (/go/) ---------- */
.page-viewer { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; background-image: none; }
/* Kept slim so framed sites (especially games) get as much height as possible */
.viewer-bar {
  flex: none; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 10px;
  background: var(--paper); border-bottom: 3px solid var(--ink);
}
.viewer-bar__back { flex: none; font-weight: 800; text-decoration: none; padding: 5px 10px; border-radius: 10px; background: var(--bg); border: 2px solid var(--ink); font-size: 0.9rem; }
.viewer-bar__now { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.viewer-bar__name { min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar__open { flex: none; font-weight: 700; font-size: 0.85rem; color: var(--muted); }
.viewer-bar__info { flex: none; font-weight: 700; font-size: 0.85rem; }
.viewer-bar .fav-btn { width: 36px; height: 36px; font-size: 1.05rem; border-width: 2px; }
.viewer-bar .full-btn svg { width: 16px; height: 16px; }
.next-btn {
  flex: none; padding: 7px 14px; background: var(--yellow); border: 3px solid var(--ink); border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink); font: 900 0.95rem/1 var(--font-display); white-space: nowrap;
}
.next-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.viewer-stage { flex: 1; position: relative; display: flex; }
.viewer-stage iframe { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-card {
  margin: auto; max-width: 440px; padding: 28px 22px; text-align: center;
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
}
.viewer-card__emoji { font-size: 2.6rem; margin: 0; }
.viewer-card__title { margin: 6px 0; font: 900 1.6rem/1.1 var(--font-display); overflow-wrap: anywhere; }
.page-viewer .viewer-stage { background: var(--bg); background-image: radial-gradient(var(--bg-dot) 1.2px, transparent 1.2px); background-size: 22px 22px; padding: 16px; }
.page-viewer .viewer-stage:has(iframe:not([hidden])) { padding: 0; }

/* ---------- Larger phones ---------- */
@media (min-width: 420px) {
  .grid { gap: 14px; }
}

/* ---------- Tablet ---------- */
@media (min-width: 640px) {
  .hide-sm { display: inline; }
  .tagline { font-size: 1.05rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .catalog__head { flex-direction: row; align-items: center; justify-content: space-between; }
  .site-page__top { grid-template-columns: 1.2fr 1fr; align-items: center; gap: 28px; }
  .viewer-bar { gap: 12px; padding: 0 14px; }
}

/* 728x90 leaderboard when there's room */
@media (min-width: 760px) {
  .ad--billboard .ad__box { width: 728px; height: 90px; }
  .ad--billboard .ad__box--placeholder::after { content: " · 728×90"; }
}

/* ---------- Desktop ---------- */
@media (min-width: 1010px) {
  .site-header { height: 56px; padding-inline: 24px; }
  .hero { padding-top: 16px; }
  .button-zone { padding: 16px 0 18px; }
  .ad-zone--hero { padding-top: 44px; padding-bottom: 18px; }
  .ad--billboard .ad__box { width: 970px; height: 250px; }
  .ad--billboard .ad__box--placeholder::after { content: " · 970×250"; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
  .grid + .grid { margin-top: 16px; }
}

/* Short laptop screens (like 1366x768): smaller hero + 728x90 ad so tiles still peek above the fold */
@media (min-width: 1010px) and (max-height: 820px) {
  .title { font-size: 3rem; }
  .big-button { --size: 160px; }
  .button-zone { padding: 10px 0 14px; }
  .ad-zone--hero { padding-top: 36px; }
  .ad--billboard .ad__box { width: 728px; height: 90px; }
  .ad--billboard .ad__box--placeholder::after { content: " · 728×90"; }
}

/* Dev-only thumbnail review page (/thumbs/) */
.thumbs-review { padding-bottom: 40px; }
.thumbs-review code { font-size: 0.8rem; background: var(--paper); padding: 1px 4px; border-radius: 4px; user-select: all; }
.thumbs-review__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.thumbs-review__card { margin: 0; }
.thumbs-review__card .tile__thumb { border: 3px solid var(--ink); border-radius: 10px; }
.thumbs-review__card figcaption { font-size: 0.85rem; margin-top: 4px; overflow-wrap: anywhere; }
