: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;
}

.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;
  }
}
