@font-face {
  font-family: 'OpenRunde';
  src: url('../fonts/OpenRunde/OpenRunde-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'OpenRunde';
  src: url('../fonts/OpenRunde/OpenRunde-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: 'OpenRunde';
  src: url('../fonts/OpenRunde/OpenRunde-Semibold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'OpenRunde';
  src: url('../fonts/OpenRunde/OpenRunde-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #000000;
  --surface: #161619;
  --fg: #f4f4f5;
  --muted: #8a8a90;
  --faint: #56565c;
  --hairline: rgba(255, 255, 255, 0.10);

  --web3: #6366f1;
  --web3-alt: #8b5cf6;
  --ai: #f97316;
  --tools: #14b8a6;

  --font: 'OpenRunde', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --app-size: 104px;
  --app-overlap: -26px;
  --app-radius: 28px;
  --app-art-bleed: 1px;
  --shadow-blur: 64px;
  --shadow-blur-selected: 108px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* Page shell */

.page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(28px, 5vw, 56px) 0;
}

.stage {
  flex: 1;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(40px, 7vw, 72px);
  padding: clamp(48px, 9vw, 96px) 0;
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Categories */

.categories {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(28px, 6vw, 76px);
}

.category {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.category__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.category--web3 {
  --dot: var(--web3-alt);
  --delay: .08s;
}

.category--ai {
  --dot: var(--ai);
  --delay: .16s;
}

.category--tools {
  --dot: var(--tools);
  --delay: .24s;
}

.apps {
  display: flex;
  align-items: flex-start;
}

/* App tile (overlapping sticker icons) */

.app {
  display: block;
  position: relative;
  margin-left: var(--app-overlap);
  transition: opacity 0.4s ease,
    transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform, opacity;
}

.app:first-child {
  margin-left: 0;
}

/* Web3 pair fanned like playing cards (opposite tilts, still overlapping) */
.category--web3 .app:first-child {
  transform: rotate(-8deg);
}

.category--web3 .app:nth-child(2) {
  transform: rotate(8deg);
}

/* AI pair matches the same fan treatment as Web3. */
.category--ai .app:first-child {
  transform: rotate(-8deg);
}

.category--ai .app:nth-child(2) {
  transform: rotate(8deg);
}

.app__icon {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: var(--app-size);
  height: var(--app-size);
  border-radius: var(--app-radius);
  font-family: var(--font);
  font-weight: 600;
  font-size: 36px;
  letter-spacing: 0;
  color: #fff;
  background-color: var(--c);
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.45s ease;
  will-change: transform;
}

/* When a real icon is supplied (see APPS[].icon), the glyph becomes a fallback
   that the artwork covers; hide it so it can't bleed at the edges. */
.app__icon.has-icon {
  background-color: transparent;
  color: transparent;
}

.app__art {
  position: absolute;
  inset: calc(-1 * var(--app-art-bleed));
  z-index: 1;
  display: block;
  width: calc(100% + 2 * var(--app-art-bleed));
  height: calc(100% + 2 * var(--app-art-bleed));
  border-radius: calc(var(--app-radius) + var(--app-art-bleed));
  object-fit: cover;
  image-rendering: auto;
}

.app__art,
.phone-preview__frame,
.phone-preview__shot,
.footer__logo,
.header_image,
.memoji_image,
.panel__social img {
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

@supports (corner-shape: superellipse(2)) {

  .app__icon,
  .app__art,
  .panel {
    border-radius: 36px;
    corner-shape: superellipse(1.5);
  }
}

/* Anchor the notch on the overlapping front (Index Wallet) card. */
.category--web3 .app:first-child .app__icon {
  --cut-x: 126%;
  --cut-y: 60%;
  --cut-rot: 16deg;
}

/* Anchor the notch on the overlapping front (Kalo) card. */
.category--ai .app:first-child .app__icon {
  --cut-x: 126%;
  --cut-y: 60%;
  --cut-rot: 16deg;
}

.app--web3 {
  --c: var(--web3);
}

.app--web3+.app--web3 {
  --c: var(--web3-alt);
}

.app--ai {
  --c: var(--ai);
}

.app--tools {
  --c: var(--tools);
}

.app {
  --shadow-c: var(--c);
}

.app[data-app="index-swap"],
.app[data-app="index-wallet"] {
  --shadow-c: rgba(34, 197, 94, 0.88);
}

.app[data-app="kalo"] {
  --shadow-c: rgba(239, 68, 68, 0.9);
}

.app:hover,
.app:focus-visible {
  outline: none;
}

/* Hover/press feedback belongs to the main screen only; in the carousel the
   tile transform is driven entirely by JS, so it must not be fought here. */
body:not(.panel-open) .app:hover .app__icon,
body:not(.panel-open) .app:focus-visible .app__icon {
  transform: scale(1.16);
  box-shadow: 0 0 var(--shadow-blur) -4px var(--shadow-c);
}

body:not(.panel-open) .app:active .app__icon {
  transform: scale(1.06);
  transition-duration: 90ms;
}

/* Opened app preview */

.phone-preview {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 30;
  width: min(560px, 72vw);
  aspect-ratio: 1470 / 3000;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  transition:
    opacity 0.16s ease,
    transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform, opacity;
  filter: drop-shadow(0 34px 70px rgba(0, 0, 0, 0.46));
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 42%, rgba(0, 0, 0, 0.84) 54%, rgba(0, 0, 0, 0.22) 72%, transparent 88%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 42%, rgba(0, 0, 0, 0.84) 54%, rgba(0, 0, 0, 0.22) 72%, transparent 88%);
}

body.panel-open .phone-preview.has-shot {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition:
    opacity 0.34s ease 0.08s,
    transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.phone-preview__screen,
.phone-preview__frame {
  position: absolute;
  display: block;
}

.phone-preview__screen {
  left: 4.95%;
  right: 4.95%;
  top: 2.3%;
  bottom: 2.2%;
  z-index: 1;
  overflow: hidden;
  border-radius: 10.6% / 5.2%;
  background: #000;
}

.phone-preview__shot {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.phone-preview__shot.is-ready {
  opacity: 1;
}

.phone-preview__frame {
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.soon {
  position: absolute;
  z-index: 2;
  top: -9px;
  right: -12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #000;
  background: #f4f4f5;
  padding: 3px 7px;
  border-radius: 999px;
}

/* Principle line */

.principle {
  max-width: 620px;
  text-align: center;
  font-size: clamp(14px, 1.6vw, 16px);
  line-height: 1.6;
  color: var(--fg);
  transition: opacity 0.4s ease;
}

.principle strong {
  color: var(--fg);
  font-weight: 600;
}

/* Footer */

.footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  transition: opacity 0.45s ease;
}

.footer__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
}

.footer__logo {
  height: 38px;
  width: auto;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.footer__name {
  font-family: var(--font);
  font-weight: 600;
  font-size: 18px;
  color: var(--fg);
  white-space: nowrap;
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  overflow: hidden;
  transition: max-width 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.4s ease, transform 0.45s ease, margin-left 0.45s ease;
}

.footer__brand:hover .footer__logo,
.footer__brand:focus-visible .footer__logo {
  transform: translateX(-4px) scale(0.86);
}

.footer__brand:hover .footer__name,
.footer__brand:focus-visible .footer__name {
  max-width: 280px;
  opacity: 1;
  transform: none;
  margin-left: 12px;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 4px;
}

.socials a {
  padding: 8px 14px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 999px;
  transition: color 0.22s ease, background 0.22s ease;
}

.socials a:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.06);
}

.copyright {
  font-size: 12px;
  color: var(--faint);
  text-align: center;
}

/* Detail panel */

.panel {
  position: fixed;
  top: clamp(16px, 2.4vw, 26px);
  right: clamp(16px, 2.4vw, 26px);
  bottom: clamp(16px, 2.4vw, 26px);
  z-index: 40;
  width: min(380px, 92vw);
  overflow: hidden;
  background: var(--surface);
  /* border: 1px solid var(--hairline); */
  border-radius: 32px;
  box-shadow: 0 30px 80px -28px rgba(0, 0, 0, 0.82);
  transform: translateX(calc(100% + clamp(16px, 2.4vw, 26px)));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.4s ease;
}

.panel.is-open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.panel__chrome {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
}

.panel__body {
  height: 100%;
  max-height: inherit;
  min-height: 0;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.panel__close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  line-height: 0;
  color: rgba(235, 235, 245, 0.6);
  background: #343438;
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.panel__close svg {
  width: 17px;
  height: 17px;
}

.panel__close:hover {
  color: #fff;
  background: #444448;
}

.panel__close:active {
  transform: scale(0.92);
}

.panel__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-right: 48px;
}

.panel__cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  /* letter-spacing: 0.18em; */
  text-transform: uppercase;
  color: var(--muted);
  margin: 4px 0;
}

.panel__icon {
  --panel-icon-art-bleed: 1px;
  --panel-icon-radius: 20px;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: var(--panel-icon-radius);
  font-family: var(--font);
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  background: var(--panel-accent, var(--surface));
  overflow: hidden;
  margin-bottom: 14px;
  transform: rotate(-5deg);
  will-change: transform;
  box-shadow: 0 0 50px 0 rgba(0, 0, 0, 0.8);
  corner-shape: superellipse(1.2);
}

.panel__icon[data-cat="web3"] {
  --panel-accent: var(--web3-alt);
}

.panel__icon[data-cat="ai"] {
  --panel-accent: var(--ai);
}

.panel__icon[data-cat="tools"] {
  --panel-accent: var(--tools);
}

.panel__icon.has-icon {
  background: transparent;
  color: transparent;
}

.panel__icon-art {
  width: calc(100% + 2 * var(--panel-icon-art-bleed));
  height: calc(100% + 2 * var(--panel-icon-art-bleed));
  margin: calc(-1 * var(--panel-icon-art-bleed));
  display: block;
  border-radius: calc(var(--panel-icon-radius) + var(--panel-icon-art-bleed));
  object-fit: cover;
}

.panel__title {
  margin-top: 0;
  font-family: var(--font);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.panel__desc {
  font-size: 15px;
  line-height: 1.6;
  color: #c4c4c9;
}

.panel__meta {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--hairline);
}

.panel__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
}

.panel__row dt {
  color: var(--muted);
}

.panel__row dd {
  color: var(--fg);
  font-weight: 500;
}

.panel__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #000;
  background: var(--fg);
  border-radius: 999px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.panel__link svg {
  width: 18px;
  height: 18px;
}

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

/* Per-project links (website favicon + social handles) */
.panel__socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel__social {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.panel__social:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.panel__social svg {
  width: 19px;
  height: 19px;
}

.panel__social img {
  width: 21px;
  height: 21px;
  border-radius: 5px;
  object-fit: cover;
}

/* Panel navigation arrows */

.panel-nav {
  position: fixed;
  left: 50%;
  bottom: clamp(28px, 5vw, 44px);
  z-index: 45;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.panel-nav__btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--fg);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(20, 20, 22, 0.5);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.panel-nav__btn svg {
  width: 21px;
  height: 21px;
}

.panel-nav__btn:hover {
  background: rgba(40, 40, 44, 0.7);
  transform: scale(1.06);
}

/* Panel-open state */

body.panel-open .panel-nav {
  opacity: 1;
  pointer-events: auto;
}

body.panel-open .footer {
  opacity: 0;
  pointer-events: none;
}

body.panel-open .principle {
  opacity: 0;
}

/* Focused carousel. The grid keeps its natural layout — every tile is moved to
   its carousel slot by a single JS transform (translate + scale). Nothing here
   touches layout (no gap/flex/margin), so the open/close morph is pure
   compositing: no per-frame reflow, no competing animations, no float/glitch. */
body.panel-open .category__label {
  opacity: 0;
  pointer-events: none;
}

/* The notch heals (fades out) as the cards are pulled apart. */
body.panel-open .cutout::after {
  opacity: 0;
}

body.panel-open .app.is-selected .app__icon {
  box-shadow: 0 0 var(--shadow-blur-selected) -8px var(--shadow-c);
}

/* Entrance reveal */

.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--delay, 0s),
    transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--delay, 0s);
}

.js body.loaded .reveal {
  opacity: 1;
  transform: none;
}

.js body.loaded.panel-open .principle,
.js body.loaded.panel-open .footer {
  opacity: 0;
  transform: none;
}

/* Responsive */

@media (max-width: 600px) {
  :root {
    --app-size: 88px;
    --app-overlap: -22px;
  }

  .categories {
    flex-direction: column;
    align-items: center;
    gap: 40px;
  }

  .app__icon {
    font-size: 32px;
  }

  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: calc(50vh + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }

  .panel__body {
    padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
  }

  .panel.is-open {
    transform: none;
  }

  .panel__title {
    font-size: 30px;
  }

  .panel__icon {
    --panel-icon-radius: 18px;
    width: 62px;
    height: 62px;
    margin-bottom: 12px;
    font-size: 22px;
  }

  .phone-preview {
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 34%, rgba(0, 0, 0, 0.74) 48%, rgba(0, 0, 0, 0.16) 64%, transparent 78%);
    mask-image: linear-gradient(to bottom, #000 0%, #000 34%, rgba(0, 0, 0, 0.74) 48%, rgba(0, 0, 0, 0.16) 64%, transparent 78%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .stage,
  .panel,
  .footer__logo,
  .footer__name,
  .app,
  .app__icon,
  .panel__icon,
  .phone-preview,
  .phone-preview__shot,
  .cutout::after {
    transition: none;
  }

  body:not(.panel-open) .app:hover .app__icon,
  body:not(.panel-open) .app:focus-visible .app__icon {
    transform: scale(1.1);
  }
}