:root {
  --bg: #f4f2ef;
  --fg: #161616;
  --muted: #5c5856;
  --accent: #ff4d00;
  --panel: rgba(255, 255, 255, 0.92);
  --font: "Manrope", system-ui, sans-serif;
  --display: "Manrope", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

html[data-theme='spark'] {
  --bg: #f3efe8;
  --fg: #161616;
  --muted: #5c5856;
  --accent: #ff4d00;
  --font: "Kanit", Manrope, system-ui, sans-serif;
  --display: "Kanit", Manrope, system-ui, sans-serif;
}

html[data-theme='cornerstone'] {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #5a5a5a;
  --accent: #fc4c02;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Manrope", system-ui, sans-serif;
}

html[data-theme='hub'] {
  --bg: #111110;
  --fg: #f7f4ef;
  --muted: #b7b1a8;
  --accent: #ff4d00;
  --font: "Manrope", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

body {
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.theme-spark {
  background:
    radial-gradient(1100px 640px at 90% -8%, rgba(255, 77, 0, 0.2), transparent 55%),
    radial-gradient(800px 480px at -5% 105%, rgba(232, 163, 23, 0.16), transparent 50%),
    linear-gradient(165deg, #f8f3eb 0%, #efe8de 50%, #f3efe8 100%);
}

body.theme-cornerstone {
  background:
    radial-gradient(900px 520px at 100% 0%, rgba(252, 76, 2, 0.1), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #fff8f4 100%);
}

body.is-hub {
  background:
    radial-gradient(800px 500px at 20% 0%, rgba(255, 77, 0, 0.35), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(255, 120, 40, 0.18), transparent 55%),
    #111110;
}

.shell {
  width: min(440px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding: 20px 20px calc(28px + var(--safe-b));
}

/* —— Top logo —— */
.top-logo {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.top-logo img {
  display: block;
  height: 44px;
  width: auto;
  max-width: 72%;
  object-fit: contain;
}

body.is-hub .top-logo img {
  height: 36px;
  filter: brightness(0) invert(1);
}

/* —— Hub —— */
.hub h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.6rem, 5vw, 2rem);
  letter-spacing: -0.02em;
  margin: 28px 0 10px;
  text-align: center;
}

.hub .lede {
  text-align: center;
  color: var(--muted);
  margin: 0 0 28px;
  font-size: 0.98rem;
}

.hub-grid {
  display: grid;
  gap: 14px;
}

.hub-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  row-gap: 2px;
  align-items: center;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}

.hub-card:hover,
.hub-card:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.hub-card img {
  grid-row: 1 / span 2;
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
}

.hub-card strong {
  font-size: 1.15rem;
  font-weight: 700;
}

.hub-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

/* —— App page stack —— */
.app-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: calc(100dvh - 40px - var(--safe-b));
}

/* —— Carousel —— */
.carousel {
  margin: 4px -4px 0;
  flex-shrink: 0; /* don't let app-page flex clip the screenshot */
}

.carousel-viewport {
  overflow: hidden;
  border-radius: 18px;
  background: transparent;
  margin: 0 auto;
  width: min(100%, 160px); /* half prior size */
}

.carousel-track {
  position: relative;
  width: 100%;
}

/* Active slide is in-flow (sets height); others overlay for crossfade. */
.carousel-slide {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.carousel-slide.is-active {
  position: relative;
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.carousel-slide img {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 12px 24px rgba(22, 22, 22, 0.14));
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.carousel-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: width 0.25s ease, background 0.25s ease;
}

.carousel-dots button[aria-selected='true'] {
  width: 22px;
  background: var(--accent);
}

/* —— Descriptions —— */
.copy {
  text-align: center;
  padding: 0 4px;
}

.copy h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.35rem, 4.6vw, 1.7rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 8px;
}

.lede {
  color: var(--muted);
  margin: 0;
  font-size: 0.98rem;
}

.features {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
  text-align: left;
}

.features li {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

body.theme-cornerstone .features li {
  background: #fff;
  border-color: rgba(252, 76, 2, 0.08);
}

.features strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--fg);
}

.features span {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.status {
  margin: 14px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

/* —— Store bar —— */
.store-bar {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.store-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.store-badge {
  display: block;
  line-height: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.store-badge:hover,
.store-badge:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.store-badge img {
  height: 48px;
  width: auto;
  display: block;
}

.more-link {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.more-link:hover,
.more-link:focus-visible {
  color: var(--accent);
  border-bottom-color: currentColor;
  outline: none;
}

@media (max-width: 360px) {
  .shell {
    padding-inline: 16px;
  }

  .carousel-viewport {
    width: min(100%, 130px);
  }

  .store-badge img {
    height: 44px;
  }
}
