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

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  margin-top: 28px;
  padding: 8px 9px 8px 22px;
  border: 1px solid var(--yellow-dark);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 650;
  box-shadow: inset 0 1px rgba(255,255,255,.6), 0 3px 7px rgba(150,115,0,.14);
  transition: transform .16s ease;
}

.hero-cta:hover { transform: translateY(-2px); }

.hero-cta-circle {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 17px;
}

.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 {
  position: relative;
  height: 290px;
  margin-top: 8px;
}

.tag {
  --tag-rotation: 0deg;
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  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: -4deg; top: 10%; left: 9%; }
.tag.dakuten { --tag-rotation: 3deg; top: 31%; right: 8%; }
.tag.emulatorjs { --tag-rotation: 4.5deg; top: 56%; left: 16%; }
.tag.aamaker { --tag-rotation: -3deg; top: 76%; right: 14%; }

.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-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: 39px;
  height: 39px;
  flex: none;
  display: grid;
  place-items: center;
}

.owner-avatar img {
  width: 31px;
  height: 31px;
  display: block;
  transform-origin: 50% 50%;
  transform: rotate(0deg);
  animation: none;
}

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

.owner-link {
  width: 39px;
  height: 39px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  transition: transform .18s ease;
}

.owner-link:hover { transform: rotate(-8deg) scale(1.04); }

.owner-link {
  border: 0;
  cursor: pointer;
}

.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: 350px; }
  .tags { height: 245px; }
  .tag.wishlist { left: 13%; }
  .tag.dakuten { right: 10%; }
  .tag.emulatorjs { left: 20%; }
  .tag.aamaker { right: 16%; }
}

@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,
  .stats-card,
  .owner-card { grid-column: auto; min-height: 390px; }
  .tags { height: 300px; }
  .tag { min-height: 43px; padding-inline: 15px; font-size: 13px; }
  .tag.wishlist { top: 8%; left: 4%; }
  .tag.dakuten { top: 30%; right: 2%; }
  .tag.emulatorjs { top: 55%; left: 7%; }
  .tag.aamaker { top: 77%; right: 8%; }
  .footer { flex-direction: column; }
  .about-panel { padding: 20px; }
  .about-dialog h2 { margin-top: 26px; }
  .about-facts { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .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 (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 { transition: none; }
  .owner-avatar img { animation: none !important; }
}
