:root {
  --bg: #ebe9e1;
  --ink: #0a0a0a;
  --muted: #73716a;
  --cream: #f6f3eb;
  --cream-2: #f1ede2;
  --line: #ded9cb;
  --yellow: #fde351;
  --yellow-dark: #d5ad1e;
  --black: #0a0a0a;
  --white: #fff;
  --radius: 27px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Funnel Display", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

.top-bar {
  width: 100%;
  height: 14px;
  background: var(--yellow);
}

.page {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

nav {
  display: flex;
  justify-content: center;
  position: sticky;
  top: 18px;
  z-index: 20;
  margin-bottom: 56px;
  pointer-events: none;
}

.nav-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 6px;
  border-radius: 999px;
  background: linear-gradient(#1a1a1a, #090909);
  color: #fff;
  box-shadow:
    inset 0 1px rgba(255,255,255,.08),
    0 7px 18px rgba(0,0,0,.18),
    0 18px 36px rgba(0,0,0,.10);
}

.logo,
.nav-link,
.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}

.logo {
  padding: 0 17px;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.02em;
}

.nav-link {
  padding: 0 15px;
  color: #c9c9c9;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  transition: background .18s ease, color .18s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #fff;
  background: rgba(255,255,255,.08);
}

.nav-cta {
  margin-left: 5px;
  padding: 0 19px;
  color: #111;
  background: var(--yellow);
  border: 1px solid var(--yellow-dark);
  font-size: 14px;
  font-weight: 650;
  box-shadow: inset 0 1px rgba(255,255,255,.65), 0 2px 4px rgba(120,90,0,.18);
  transition: transform .16s ease;
}

.nav-cta:hover { transform: translateY(-1px); }

.nav-cta-short { display: none; }

.hero {
  padding: 28px 12px 54px;
  text-align: center;
}

.headline {
  max-width: 1120px;
  margin: 0 auto 34px;
  font-size: clamp(64px, 9vw, 116px);
  font-weight: 800;
  line-height: .96;
  letter-spacing: -.055em;
  text-wrap: balance;
}

.typed-text { display: inline; }
.type-char { opacity: 0; transition: opacity .14s ease-out; }
.type-char.visible { opacity: 1; }

.typing-caret {
  display: inline-block;
  width: 0;
  height: .77em;
  margin-left: .08em;
  margin-right: -.125em;
  border-right: .045em solid currentColor;
  vertical-align: -.03em;
  animation: caret .72s steps(1, end) infinite;
}

@keyframes caret {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

.subtitle {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: -.012em;
}

.subtitle strong { color: var(--ink); font-weight: 650; }

.scroll-cue {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 30px;
  color: var(--ink);
  text-decoration: none;
}

.scroll-cue-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .16em;
}

.scroll-cue-icon {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  font-size: 17px;
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
  animation: scroll-cue-float 1.55s ease-in-out infinite;
}

.scroll-cue:hover .scroll-cue-icon,
.scroll-cue:active .scroll-cue-icon,
.scroll-cue:focus-visible .scroll-cue-icon {
  background: var(--cream);
  border-color: var(--line);
}

@keyframes scroll-cue-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

.cards-grid {
  display: grid;
  grid-template-columns: 1.14fr .88fr .9fr;
  gap: 15px;
  align-items: stretch;
}

.card {
  position: relative;
  overflow: hidden;
  min-height: 390px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.projects-card {
  padding: 27px 28px;
  background: var(--yellow);
  border-color: rgba(105,80,0,.18);
}

.card-title {
  margin: 0;
  font-size: 33px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: -.04em;
}

.tags {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 16px;
  align-content: center;
  min-height: 320px;
  margin-top: 18px;
  padding: 10px 4px 4px;
}

.tag {
  --tag-rotation: 0deg;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  width: max-content;
  max-width: 100%;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
  transform: rotate(var(--tag-rotation));
  transition: box-shadow .2s ease, filter .2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .tag:hover {
    box-shadow: 0 12px 24px rgba(0,0,0,.13);
    filter: brightness(.98);
  }
}
.tag.black { background: var(--black); color: #fff; }
.tag.white { background: var(--cream); color: var(--ink); border: 1px solid rgba(0,0,0,.08); }

.tag.wishlist { --tag-rotation: -2.5deg; justify-self: start; }
.tag.dakuten { --tag-rotation: 2deg; justify-self: end; }
.tag.emulatorjs { --tag-rotation: 2.5deg; justify-self: start; }
.tag.aamaker { --tag-rotation: -2deg; justify-self: end; }
.tag.chaos-texture { --tag-rotation: 1.5deg; justify-self: start; }
.tag.chaos-maker { --tag-rotation: -2.5deg; justify-self: end; }
.tag.booth-downloader {
  --tag-rotation: 2deg;
  justify-self: center;
  grid-column: 1 / -1;
}

.tag.pinless { --tag-rotation: -1.5deg; justify-self: end; }

.stats-card {
  display: grid;
  grid-template-rows: 1fr 1fr;
  min-height: 390px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}

.stat-half {
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-dark { background: var(--black); color: #fff; }
.stat-light { background: var(--cream); color: var(--ink); }

.stat-number {
  font-size: clamp(47px, 5.3vw, 72px);
  line-height: .9;
  font-weight: 800;
  letter-spacing: -.06em;
}

.stat-desc {
  max-width: 250px;
  margin: 18px 0 0;
  font-size: 13px;
  line-height: 1.38;
}

.stat-dark .stat-desc { color: #aaa; }
.stat-light .stat-desc { color: var(--muted); }

.owner-card {
  min-height: 390px;
  padding: 27px 28px;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.quote-mark {
  font-size: 72px;
  line-height: .7;
  font-weight: 700;
  letter-spacing: -.08em;
}

.owner-copy {
  margin-top: auto;
  padding-top: 40px;
}

.owner-copy p {
  margin: 0;
  font-size: clamp(23px, 2.7vw, 36px);
  line-height: 1.04;
  letter-spacing: -.04em;
  font-weight: 650;
}

.owner-copy p + p { margin-top: 7px; color: var(--muted); }


.owner-copy .ai-credit {
  max-width: 280px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: -.01em;
  font-weight: 550;
}

.owner-copy .ai-credit span {
  color: var(--ink);
  font-weight: 700;
}

.owner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 26px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.owner-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.owner-avatar {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
}

.owner-avatar img {
  width: 46px;
  height: 46px;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  transform-origin: 50% 50%;
  transform: rotate(0deg);
  animation: none;
  box-shadow: 0 0 0 2px var(--cream), 0 0 0 3px var(--line);
}

.owner-id strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.owner-id small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.socials-open {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}


.socials-dialog {
  width: min(560px, calc(100% - 28px));
  max-width: 560px;
  padding: 0;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 28px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0,0,0,.28);
  opacity: 0;
  transform: translateY(14px) scale(.97);
  transition:
    opacity .22s ease,
    transform .32s cubic-bezier(.16, 1, .3, 1);
}

.socials-dialog[open].is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.socials-dialog::backdrop {
  background: rgba(10,10,10,.38);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity .24s ease;
}

.socials-dialog.is-visible::backdrop {
  opacity: 1;
}

.socials-panel {
  padding: 24px;
}

.socials-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.socials-kicker {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .14em;
}

.socials-top h2 {
  margin: 8px 0 0;
  font-size: clamp(34px, 8vw, 54px);
  line-height: .95;
  letter-spacing: -.05em;
}

.socials-close {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--cream-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.socials-list {
  display: grid;
  gap: 9px;
  margin-top: 24px;
}

.social-card {
  min-height: 66px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--cream-2);
  color: var(--ink);
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}


.social-card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--cream);
  border: 1px solid var(--line);
}

.social-card-icon img {
  width: 20px;
  height: 20px;
  display: block;
}

.social-card-letter {
  font-size: 16px;
  font-weight: 800;
}

.social-card-copy {
  min-width: 0;
}

.social-card-copy strong,
.social-card-copy small {
  display: block;
}

.social-card-copy strong {
  font-size: 14px;
}

.social-card-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-card-action {
  font-size: 18px;
}

.social-copy {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}


.social-copy.is-copied {
  background: var(--yellow);
  border-color: var(--yellow-dark);
}

.about-dialog {
  width: min(560px, calc(100% - 28px));
  max-width: 560px;
  padding: 0;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 28px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0,0,0,.28);
  opacity: 0;
  transform: translateY(14px) scale(.97);
  transition:
    opacity .22s ease,
    transform .32s cubic-bezier(.16, 1, .3, 1);
}

.about-dialog[open].is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.about-dialog::backdrop {
  background: rgba(10,10,10,.38);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity .24s ease;
}

.about-dialog.is-visible::backdrop { opacity: 1; }

.about-panel { padding: 24px; }

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

.about-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .14em;
}

.about-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--cream-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  transition: transform .16s ease, background .16s ease;
}

.about-close:hover {
  transform: rotate(5deg);
  background: var(--yellow);
}

.about-dialog h2 {
  margin: 32px 0 0;
  font-size: clamp(38px, 8vw, 62px);
  line-height: .94;
  letter-spacing: -.055em;
}

.about-lead {
  max-width: 470px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.about-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 28px;
}

.about-facts > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--cream-2);
}

.about-facts span,
.about-facts strong { display: block; }

.about-facts span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.about-facts strong {
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.25;
}

.about-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 22px;
}

.about-actions a,
.about-actions button {
  min-height: 45px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.about-actions a {
  border: 1px solid var(--yellow-dark);
  background: var(--yellow);
  color: var(--ink);
}

.about-actions button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 30px 3px 0;
  color: var(--muted);
  font-size: 12px;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid #111;
  outline-offset: 3px;
}

@media (max-width: 980px) {
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .projects-card { grid-column: 1 / -1; min-height: 390px; }
  .tags {
    min-height: 300px;
    gap: 18px 14px;
  }
}

@media (max-width: 680px) {
  .top-bar { height: 10px; }
  .page { width: min(100% - 20px, 1320px); padding-top: 18px; }
  nav { top: 10px; margin-bottom: 42px; }
  .nav-pill {
    width: auto;
    max-width: 100%;
    justify-content: center;
    gap: 2px;
    padding: 5px;
  }
  .logo,
  .nav-link,
  .nav-cta {
    min-height: 36px;
  }
  .logo {
    padding-inline: 10px;
    font-size: 13px;
  }
  .nav-link {
    display: inline-flex;
    padding-inline: 9px;
    font-size: 12px;
  }
  .nav-cta {
    margin-left: 1px;
    padding-inline: 12px;
    font-size: 12px;
  }
  .nav-cta-full { display: none; }
  .nav-cta-short { display: inline; }
  .hero { padding: 22px 6px 44px; }
  .headline { font-size: clamp(56px, 17vw, 86px); margin-bottom: 25px; }
  .subtitle { font-size: 15px; }
  .cards-grid { grid-template-columns: 1fr; }
  .projects-card { grid-column: auto; min-height: 405px; }
  .stats-card,
  .owner-card { grid-column: auto; min-height: 390px; }

  .tags {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 315px;
    column-gap: 8px;
    row-gap: 24px;
    align-content: center;
    padding: 8px 0 4px;
  }

  .tag {
    min-height: 42px;
    max-width: 100%;
    padding-inline: 12px;
    font-size: 11px;
    grid-column: auto !important;
  }

  .tag.black {
    justify-self: start !important;
  }

  .tag.white {
    justify-self: end !important;
  }

  .tag.booth-downloader {
    justify-self: start !important;
  }
  .footer { flex-direction: row; align-items: center; }
  .about-panel { padding: 20px; }
  .about-dialog h2 { margin-top: 26px; }
  .about-facts { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .tags {
    column-gap: 5px;
    row-gap: 22px;
  }

  .tag {
    padding-inline: 10px;
    font-size: 10.5px;
  }


  .logo { padding-inline: 8px; font-size: 12px; }
  .nav-link { padding-inline: 7px; font-size: 11px; }
  .nav-cta { padding-inline: 10px; font-size: 11px; }
}

/* Intro motion at the top, then viewport-triggered reveals for lower sections. */

@media (hover: hover) and (pointer: fine) {
  .socials-open:hover {
    transform: translateY(-2px);
    background: var(--yellow);
    border-color: var(--yellow-dark);
  }

  a.social-card:hover {
    transform: translateY(-2px);
    border-color: var(--yellow-dark);
    background: var(--yellow);
  }

  .social-copy:hover {
    background: var(--yellow);
    border-color: var(--yellow-dark);
  }

}

@media (prefers-reduced-motion: no-preference) {
  .top-bar {
    transform-origin: left center;
    animation: top-bar-in .78s cubic-bezier(.65, 0, .35, 1) both;
  }

  nav {
    animation: nav-in .72s .22s cubic-bezier(.2, 1.35, .35, 1) both;
  }

  .subtitle {
    animation: rise-in .58s .90s cubic-bezier(.16, 1, .3, 1) both;
  }

  .hero-cta {
    animation:
      cta-in .72s 1.03s cubic-bezier(.2, 1.45, .35, 1) both,
      cta-breathe 1.7s 2.2s ease-in-out infinite alternate;
  }

}


@keyframes top-bar-in {
  from { opacity: 0; transform: scaleX(0); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes nav-in {
  from { opacity: 0; transform: translateY(-20px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cta-in {
  from { opacity: 0; transform: translateY(24px) scale(.86); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cta-breathe {
  from { scale: 1; }
  to { scale: 1.025; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .type-char { opacity: 1 !important; transition: none; }
  .typing-caret { display: none; }
  .tag,
  .nav-cta,
  .hero-cta,
  .owner-link,
  .about-dialog,
  .about-dialog::backdrop,
  .socials-dialog,
  .socials-dialog::backdrop { transition: none; }
  .owner-avatar img,
  .scroll-cue-icon { animation: none !important; }
}


.socials-open,
.social-card,
.social-copy,
.socials-close {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: none), (pointer: coarse) {
  .socials-open:active,
  a.social-card:active,
  .social-copy:active,
  .socials-close:active {
    transform: scale(.98);
  }
}


/* v30: scroll cue stays visually neutral when tapped */
.scroll-cue,
.scroll-cue-icon {
  -webkit-tap-highlight-color: transparent;
}

@media (hover: none), (pointer: coarse) {
  .scroll-cue:hover .scroll-cue-icon,
  .scroll-cue:active .scroll-cue-icon,
  .scroll-cue:focus .scroll-cue-icon {
    background: var(--cream);
    border-color: var(--line);
  }
}


/* v31: neutralize Safari's blue dialog focus ring */
.about-dialog,
.socials-dialog,
.about-dialog:focus,
.socials-dialog:focus,
.about-dialog:focus-visible,
.socials-dialog:focus-visible {
  outline: none !important;
  -webkit-focus-ring-color: transparent;
}

/* Keep keyboard focus visible with the site's own neutral style. */
.about-close:focus-visible,
.socials-close:focus-visible,
.social-card:focus-visible,
.social-copy:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}


/* v31: BOOTH Downloader follows the normal desktop/tablet project grid */
@media (min-width: 681px) {
  .tag.booth-downloader {
    grid-column: auto;
    justify-self: start;
  }
}


/* Hosted OSS: Browser.js */
.tag.browserjs {
  --tag-rotation: 1.5deg;
  justify-self: start;
}


/* Hosted OSS projects */
.tag.techmino {
  --tag-rotation: 1.75deg;
  justify-self: start;
}


/* v35: SCROLL DOWN scrolls without changing the URL hash */
button.scroll-cue {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}


/* Hosted OSS: BugShot Roulette */
.tag.bugshot {
  --tag-rotation: -1.75deg;
  justify-self: end;
}


/* YouTube Downloader */
.tag.ytdownloader {
  --tag-rotation: -1.5deg;
  justify-self: end;
}


/* Whitebophir */
.tag.whitebophir {
  --tag-rotation: 1.5deg;
  justify-self: start;
}


/* v42: loose sticker-wall project layout */
.projects-card {
  min-height: 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  justify-content: flex-start;
  gap: 15px 13px;
  min-height: 0;
  margin-top: 24px;
  padding: 10px 4px 14px;
}

.tags .tag {
  --tag-x: 0px;
  --tag-y: 0px;
  flex: 0 0 auto;
  grid-column: auto !important;
  justify-self: auto !important;
  margin: 0;
  transform: translate(var(--tag-x), var(--tag-y)) rotate(var(--tag-rotation));
}

/* Deliberately uneven offsets — like labels stuck on by hand. */
.tags .tag:nth-child(1)  { --tag-x: 2px;   --tag-y: 1px; }
.tags .tag:nth-child(2)  { --tag-x: 14px;  --tag-y: -5px; }
.tags .tag:nth-child(3)  { --tag-x: -3px;  --tag-y: 7px; }
.tags .tag:nth-child(4)  { --tag-x: 8px;   --tag-y: 1px; }
.tags .tag:nth-child(5)  { --tag-x: 19px;  --tag-y: -4px; }
.tags .tag:nth-child(6)  { --tag-x: -6px;  --tag-y: 6px; }
.tags .tag:nth-child(7)  { --tag-x: 10px;  --tag-y: 3px; }
.tags .tag:nth-child(8)  { --tag-x: -4px;  --tag-y: -6px; }
.tags .tag:nth-child(9)  { --tag-x: 17px;  --tag-y: 5px; }
.tags .tag:nth-child(10) { --tag-x: 0px;   --tag-y: -3px; }
.tags .tag:nth-child(11) { --tag-x: 7px;   --tag-y: 6px; }
.tags .tag:nth-child(12) { --tag-x: -7px;  --tag-y: 0px; }
.tags .tag:nth-child(13) { --tag-x: 15px;  --tag-y: -5px; }
.tags .tag:nth-child(14) { --tag-x: -1px;  --tag-y: 5px; }
.tags .tag:nth-child(15) { --tag-x: 10px;  --tag-y: -2px; }


.tag.redlib {
  --tag-rotation: 2deg;
}

/* Keep the collage loose on phones without pushing labels out of the card. */
@media (max-width: 680px) {
  .projects-card {
    min-height: 0;
  }

  .tags {
    display: flex;
    min-height: 0;
    gap: 14px 9px;
    align-content: flex-start;
    padding: 8px 2px 10px;
  }

  .tags .tag {
    grid-column: auto !important;
    justify-self: auto !important;
  }

  .tags .tag:nth-child(3n + 1) { --tag-x: 1px;  }
  .tags .tag:nth-child(3n + 2) { --tag-x: 5px;  }
  .tags .tag:nth-child(3n)     { --tag-x: -2px; }

  .tags .tag:nth-child(odd)  { --tag-y: 2px; }
  .tags .tag:nth-child(even) { --tag-y: -2px; }
}

@media (max-width: 390px) {
  .tags {
    gap: 12px 7px;
  }

  .tags .tag {
    font-size: 10px;
    padding-inline: 10px;
  }
}


/* v43: project buttons + fridge-door sticker pile */
.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;
  align-content: flex-start;
  gap: 7px 1px;
  min-height: 0;
  margin-top: 24px;
  padding: 18px 8px 24px;
}

.tags .tag {
  --tag-x: 0px;
  --tag-y: 0px;
  --tag-scale: 1;
  flex: 0 0 auto;
  grid-column: auto !important;
  justify-self: auto !important;
  margin: var(--tag-mt, 0px) var(--tag-mr, 0px) var(--tag-mb, 0px) var(--tag-ml, 0px);
  border: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transform:
    translate(var(--tag-x), var(--tag-y))
    rotate(var(--tag-rotation))
    scale(var(--tag-scale));
  z-index: var(--tag-z, 1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Deliberately messy: like magnets/stickers slapped onto a fridge. */
.tags .tag:nth-child(1)  { --tag-rotation: -6deg;   --tag-x: 7px;   --tag-y: 7px;   --tag-scale: 1.03; --tag-ml: -3px;  --tag-mr: -8px;  --tag-z: 2; }
.tags .tag:nth-child(2)  { --tag-rotation: 4.5deg;  --tag-x: -3px;  --tag-y: -8px;  --tag-scale: .96;  --tag-ml: -10px; --tag-mr: 2px; }
.tags .tag:nth-child(3)  { --tag-rotation: 7deg;    --tag-x: 11px;  --tag-y: 4px;   --tag-scale: 1.01; --tag-ml: -5px;  --tag-mr: -12px; --tag-z: 3; }
.tags .tag:nth-child(4)  { --tag-rotation: -3.5deg; --tag-x: -8px;  --tag-y: 11px;  --tag-scale: .94;  --tag-ml: -9px;  --tag-mr: 5px; }
.tags .tag:nth-child(5)  { --tag-rotation: 5.5deg;  --tag-x: 5px;   --tag-y: -5px;  --tag-scale: 1.05; --tag-ml: 2px;   --tag-mr: -13px; --tag-z: 4; }
.tags .tag:nth-child(6)  { --tag-rotation: -7deg;   --tag-x: -9px;  --tag-y: 8px;   --tag-scale: .98;  --tag-ml: -12px; --tag-mr: 0px; }
.tags .tag:nth-child(7)  { --tag-rotation: 2.5deg;  --tag-x: 13px;  --tag-y: 2px;   --tag-scale: 1.02; --tag-ml: -4px;  --tag-mr: -10px; --tag-z: 2; }
.tags .tag:nth-child(8)  { --tag-rotation: -5deg;   --tag-x: -5px;  --tag-y: -10px; --tag-scale: .95;  --tag-ml: -10px; --tag-mr: 4px; }
.tags .tag:nth-child(9)  { --tag-rotation: 6.5deg;  --tag-x: 8px;   --tag-y: 10px;  --tag-scale: 1.04; --tag-ml: -3px;  --tag-mr: -13px; --tag-z: 3; }
.tags .tag:nth-child(10) { --tag-rotation: -2deg;   --tag-x: -11px; --tag-y: 1px;   --tag-scale: .97;  --tag-ml: -8px;  --tag-mr: 5px; }
.tags .tag:nth-child(11) { --tag-rotation: 7.5deg;  --tag-x: 12px;  --tag-y: -7px;  --tag-scale: .94;  --tag-ml: -6px;  --tag-mr: -8px; }
.tags .tag:nth-child(12) { --tag-rotation: -5.5deg; --tag-x: -7px;  --tag-y: 12px;  --tag-scale: 1.05; --tag-ml: -11px; --tag-mr: -2px;  --tag-z: 4; }
.tags .tag:nth-child(13) { --tag-rotation: 3.5deg;  --tag-x: 10px;  --tag-y: -3px;  --tag-scale: .98;  --tag-ml: 0px;   --tag-mr: -14px; }
.tags .tag:nth-child(14) { --tag-rotation: -7.5deg; --tag-x: -4px;  --tag-y: 8px;   --tag-scale: 1.02; --tag-ml: -9px;  --tag-mr: 1px;   --tag-z: 2; }

@media (hover: hover) and (pointer: fine) {
  .tags .tag:hover {
    z-index: 20;
    transform:
      translate(var(--tag-x), calc(var(--tag-y) - 4px))
      rotate(calc(var(--tag-rotation) * .45))
      scale(calc(var(--tag-scale) * 1.035));
  }
}

@media (max-width: 680px) {
  .projects-card {
    min-height: 0;
  }

  .tags {
    display: flex;
    min-height: 0;
    gap: 9px 1px;
    padding: 14px 4px 20px;
    justify-content: space-evenly;
  }

  .tags .tag {
    grid-column: auto !important;
    justify-self: auto !important;
    font-size: 10.5px;
    padding-inline: 11px;
  }

  .tags .tag:nth-child(4n + 1) { --tag-x: 5px; }
  .tags .tag:nth-child(4n + 2) { --tag-x: -4px; }
  .tags .tag:nth-child(4n + 3) { --tag-x: 3px; }
  .tags .tag:nth-child(4n)     { --tag-x: -6px; }

  .tags .tag:nth-child(3n + 1) { --tag-y: 5px; }
  .tags .tag:nth-child(3n + 2) { --tag-y: -5px; }
  .tags .tag:nth-child(3n)     { --tag-y: 1px; }
}

/* Project detail modal */
.project-dialog {
  width: min(620px, calc(100% - 28px));
  max-width: 620px;
  padding: 0;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 28px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0,0,0,.28);
  opacity: 0;
  transform: translateY(14px) scale(.97);
  transition:
    opacity .22s ease,
    transform .32s cubic-bezier(.16, 1, .3, 1);
  outline: none !important;
  -webkit-focus-ring-color: transparent;
}

.project-dialog[open].is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.project-dialog::backdrop {
  background: rgba(10,10,10,.38);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity .24s ease;
}

.project-dialog.is-visible::backdrop {
  opacity: 1;
}

.project-panel {
  padding: 24px;
}

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

.project-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .14em;
}

.project-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--cream-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.project-dialog h2 {
  margin: 30px 0 0;
  font-size: clamp(40px, 8vw, 64px);
  line-height: .94;
  letter-spacing: -.055em;
}

.project-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 28px;
}

.project-facts > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--cream-2);
}

.project-facts span,
.project-facts strong {
  display: block;
}

.project-facts span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.project-facts strong {
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.28;
}

.project-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 22px;
}

.project-actions a {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

#project-repo {
  border: 1px solid var(--line);
  background: var(--cream-2);
  color: var(--ink);
}

#project-page {
  border: 1px solid var(--yellow-dark);
  background: var(--yellow);
  color: var(--ink);
}

.project-close:focus-visible,
.project-actions a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .project-close:hover {
    transform: rotate(5deg);
    background: var(--yellow);
  }

  .project-actions a:hover {
    transform: translateY(-2px);
  }
}

@media (max-width: 680px) {
  .project-panel {
    padding: 20px;
  }

  .project-facts {
    grid-template-columns: 1fr;
  }

  .project-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-dialog,
  .project-dialog::backdrop,
  .project-actions a,
  .project-close {
    transition: none !important;
  }
}


/* v46: messy fridge-door layout without sticker overlap */
.tags {
  gap: 18px 12px;
}

.tags .tag {
  margin: 0 !important;
  --tag-x: 0px !important;
  --tag-y: 0px !important;
}

/* Keep only the hand-placed rotation + subtle scale differences. */
.tags .tag:nth-child(1)  { --tag-rotation: -6deg;   --tag-scale: 1.03; }
.tags .tag:nth-child(2)  { --tag-rotation: 4.5deg;  --tag-scale: .96; }
.tags .tag:nth-child(3)  { --tag-rotation: 7deg;    --tag-scale: 1.01; }
.tags .tag:nth-child(4)  { --tag-rotation: -3.5deg; --tag-scale: .94; }
.tags .tag:nth-child(5)  { --tag-rotation: 5.5deg;  --tag-scale: 1.05; }
.tags .tag:nth-child(6)  { --tag-rotation: -7deg;   --tag-scale: .98; }
.tags .tag:nth-child(7)  { --tag-rotation: 2.5deg;  --tag-scale: 1.02; }
.tags .tag:nth-child(8)  { --tag-rotation: -5deg;   --tag-scale: .95; }
.tags .tag:nth-child(9)  { --tag-rotation: 6.5deg;  --tag-scale: 1.04; }
.tags .tag:nth-child(10) { --tag-rotation: -2deg;   --tag-scale: .97; }
.tags .tag:nth-child(11) { --tag-rotation: 7.5deg;  --tag-scale: .94; }
.tags .tag:nth-child(12) { --tag-rotation: -5.5deg; --tag-scale: 1.05; }
.tags .tag:nth-child(13) { --tag-rotation: 3.5deg;  --tag-scale: .98; }
.tags .tag:nth-child(14) { --tag-rotation: -7.5deg; --tag-scale: 1.02; }

@media (hover: hover) and (pointer: fine) {
  .tags .tag:hover {
    z-index: 20;
    transform:
      translateY(-3px)
      rotate(calc(var(--tag-rotation) * .45))
      scale(calc(var(--tag-scale) * 1.035));
  }
}

@media (max-width: 680px) {
  .tags {
    gap: 15px 8px;
  }

  .tags .tag {
    --tag-x: 0px !important;
    --tag-y: 0px !important;
  }
}


/* v48: iPad/tablet layout via input type instead of viewport width.
   iPad landscape can exceed the old 1100px breakpoint. */
@media (hover: none) and (pointer: coarse) and (min-width: 681px) {
  .tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    align-items: center;
    align-content: flex-start;
    gap: 18px 7px;
    padding: 20px 6px 24px;
  }

  .tags .tag {
    flex: 0 0 auto;
    min-height: 42px;
    padding-inline: 12px;
    font-size: 11px;
    margin: 0 !important;
    --tag-x: 0px !important;
    --tag-y: 0px !important;
  }

  /* Keep the random fridge-magnet feeling while guaranteeing no overlap. */
  .tags .tag:nth-child(1)  { --tag-rotation: -6deg;   --tag-scale: 1.03; }
  .tags .tag:nth-child(2)  { --tag-rotation: 4.5deg;  --tag-scale: .96; }
  .tags .tag:nth-child(3)  { --tag-rotation: 7deg;    --tag-scale: 1.01; }
  .tags .tag:nth-child(4)  { --tag-rotation: -3.5deg; --tag-scale: .94; }
  .tags .tag:nth-child(5)  { --tag-rotation: 5.5deg;  --tag-scale: 1.05; }
  .tags .tag:nth-child(6)  { --tag-rotation: -7deg;   --tag-scale: .98; }
  .tags .tag:nth-child(7)  { --tag-rotation: 2.5deg;  --tag-scale: 1.02; }
  .tags .tag:nth-child(8)  { --tag-rotation: -5deg;   --tag-scale: .95; }
  .tags .tag:nth-child(9)  { --tag-rotation: 6.5deg;  --tag-scale: 1.04; }
  .tags .tag:nth-child(10) { --tag-rotation: -2deg;   --tag-scale: .97; }
  .tags .tag:nth-child(11) { --tag-rotation: 7.5deg;  --tag-scale: .94; }
  .tags .tag:nth-child(12) { --tag-rotation: -5.5deg; --tag-scale: 1.05; }
  .tags .tag:nth-child(13) { --tag-rotation: 3.5deg;  --tag-scale: .98; }
  .tags .tag:nth-child(14) { --tag-rotation: -7.5deg; --tag-scale: 1.02; }
}


/* v49: OSS badge in the project detail modal */
.project-title-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.project-title-row h2 {
  margin: 0;
}

.project-type-badge {
  flex: none;
  margin-bottom: 5px;
  padding: 7px 11px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.project-type-badge[hidden] {
  display: none;
}

@media (max-width: 680px) {
  .project-title-row {
    gap: 9px;
  }

  .project-type-badge {
    margin-bottom: 3px;
    padding: 6px 9px;
    font-size: 9px;
  }
}


/* v51: richer open-source badge */
.project-type-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  padding: 8px 12px 8px 10px;
  border: 1px solid rgba(0,0,0,.16);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,255,255,.62)),
    var(--yellow);
  color: var(--ink);
  box-shadow:
    0 7px 18px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.72);
  font-size: 10px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.project-type-badge::before {
  content: "<>";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: -2px 0 -2px -3px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--yellow);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: -.08em;
  box-shadow: 0 2px 0 rgba(255,255,255,.28) inset;
}

.project-type-badge::after {
  content: "OPEN SOURCE";
  letter-spacing: .08em;
}

/* Hide the raw "OSS" text but keep it for accessibility/state. */
.project-type-badge {
  font-size: 0;
}

.project-type-badge::after {
  font-size: 10px;
}

.project-type-badge[hidden] {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .project-type-badge {
    transition: transform .18s ease, box-shadow .18s ease;
  }

  .project-title-row:hover .project-type-badge {
    transform: rotate(-1deg) translateY(-1px);
    box-shadow:
      0 10px 24px rgba(0,0,0,.14),
      inset 0 1px 0 rgba(255,255,255,.72);
  }
}

@media (max-width: 680px) {
  .project-type-badge {
    margin-bottom: 2px;
    padding: 7px 10px 7px 9px;
  }

  .project-type-badge::before {
    width: 21px;
    height: 21px;
    font-size: 8px;
  }

  .project-type-badge::after {
    font-size: 9px;
  }
}


/* v52: Clock project */
.tag.clock {
  --tag-rotation: 5deg;
}

.tags .tag:nth-child(15) {
  --tag-rotation: 5deg;
  --tag-scale: 1.01;
  --tag-x: 0px !important;
  --tag-y: 0px !important;
}


/* v53: Beatbump project */
.tag.beatbump {
  --tag-rotation: -4deg;
}

.tags .tag:nth-child(16) {
  --tag-rotation: -4deg;
  --tag-scale: .99;
  --tag-x: 0px !important;
  --tag-y: 0px !important;
}
