/* ============================================================
   KhaiLabs landing page — Direction E ("Brand True")
   Framework-agnostic reference styles.
   Design canvas width: 1440px. Page scales fluidly below that
   via max-width + the .page wrapper; breakpoints are suggestions.
   ============================================================ */

:root {
  /* Brand (sampled from the KhaiLabs app icon) */
  --brand-cyan:  #31bdde;
  --brand-blue:  #1779d4;
  --brand-blue-deep: #1565c0;
  --brand-blue-press: #1267bf;

  /* Accents */
  --accent-coral: #ff6b4a;
  --accent-amber: #f5a300;

  /* Ink / text */
  --ink:        #0e2c4f;  /* headings, primary text */
  --ink-soft:   #46658a;  /* body copy */
  --ink-muted:  #6b86a6;  /* labels, meta */

  /* Surfaces */
  --bg:         #eff6ff;  /* page background */
  --surface:    #ffffff;  /* cards */
  --border:     #dceaf7;  /* hairline borders */
  --border-2:   #e6f0fa;

  /* Type */
  --font-display: 'Fredoka', sans-serif;     /* headings, numbers, buttons — weight 600 */
  --font-body:    'Hanken Grotesk', sans-serif;

  --radius-pill: 999px;
  --radius-card: 24px;
  --radius-tile: 20px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  margin: 0;
}

a { color: inherit; }

/* ---------- Nav ---------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 60px;
  position: relative;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  color: var(--ink);
}
.brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 6px 16px -4px rgba(23, 121, 212, 0.45);
}
.navlinks {
  display: flex;
  gap: 32px;
  align-items: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-soft);
}
.navlinks a { text-decoration: none; }
.navcta {
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-blue));
  color: #fff;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 8px 18px -5px rgba(23, 121, 212, 0.55);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 46px 60px 56px;
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 46px;
  align-items: center;
  overflow: hidden;
}
/* Soft blurred color glows */
.hblob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  pointer-events: none;
  z-index: 0;
}
.hblob-cyan  { background: var(--brand-cyan);  width: 320px; height: 320px; top: -90px;  right: 110px; opacity: 0.16; }
.hblob-coral { background: var(--accent-coral); width: 230px; height: 230px; bottom: -120px; left: -70px;  opacity: 0.10; }
/* Faint brand-mark watermark */
.wm { position: absolute; opacity: 0.06; object-fit: contain; z-index: 0; pointer-events: none; }
.wm-a { width: 380px; height: 380px; right: -30px; top: -20px; transform: rotate(8deg); }
/* Confetti accent shapes */
.shape { position: absolute; z-index: 0; pointer-events: none; }
.shape-1 { width: 18px; height: 18px; border-radius: 50%; background: var(--accent-coral); top: 70px;  left: 46%; }
.shape-2 { width: 13px; height: 13px; border-radius: 4px;  background: var(--accent-amber); top: 150px; left: 51%; transform: rotate(22deg); }

.htext { position: relative; z-index: 2; }
.hero h1 { font-size: 98px; margin-top: 0; color: var(--ink); }
.hero h1 .c1 { color: var(--brand-blue); }
.hero h1 .c2 { color: var(--accent-coral); }
.hero h1 .c3 { color: var(--brand-cyan); }
.hero .sub {
  font-size: 20px;
  color: var(--ink-soft);
  max-width: 470px;
  margin: 24px 0 0;
  line-height: 1.55;
  font-weight: 500;
}
.heroctas { display: flex; gap: 14px; margin-top: 34px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 16px 30px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  border: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-blue));
  color: #fff;
  box-shadow: 0 12px 26px -10px rgba(23, 121, 212, 0.6);
}
.btn-ghost {
  background: #fff;
  border: 1.5px solid #cfe0f0;
  color: var(--ink);
}

/* Hero stats */
.hstats {
  display: flex;
  gap: 40px;
  margin-top: 46px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.hstats .n { font-family: var(--font-display); font-weight: 600; font-size: 40px; }
.hstats div:nth-child(1) .n { color: var(--brand-blue); }
.hstats div:nth-child(2) .n { color: var(--accent-coral); }
.hstats div:nth-child(3) .n { color: var(--accent-amber); }
.hstats .l { font-size: 13px; color: var(--ink-muted); font-weight: 700; margin-top: 3px; }

/* Flagship card */
.hcard {
  position: relative;
  z-index: 2;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  padding: 18px;
  box-shadow: 0 30px 60px -30px rgba(7, 40, 80, 0.28);
}
.hcard .sticker {
  position: absolute;
  top: 30px;
  right: 30px;
  z-index: 3;
  background: var(--accent-coral);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  transform: rotate(6deg);
  box-shadow: 0 8px 18px -6px rgba(255, 74, 74, 0.5);
}
.hcard .shot {
  width: 100%;
  border-radius: 15px;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #dceefb;
}
.hcard .row { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 0 6px 6px; }
.hcard .row .gameicon { width: 50px; height: 50px; border-radius: 13px; flex: none; }
.hcard .rmeta { min-width: 0; }
.hcard .fn { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--ink); white-space: nowrap; }
.hcard .fg { color: var(--ink-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.hcard .fstrip { margin-left: auto; display: flex; gap: 14px; flex: none; }
.hcard .fstrip > div { text-align: center; }
.hcard .fstrip .v { font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 1; }
.hcard .fstrip > div:nth-child(1) .v { color: var(--brand-blue); }
.hcard .fstrip > div:nth-child(2) .v { color: var(--accent-coral); }
.hcard .fstrip > div:nth-child(3) .v { color: var(--brand-cyan); }
.hcard .fstrip .k { color: var(--ink-muted); font-size: 10px; font-weight: 700; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.02em; }

/* ---------- Catalog ---------- */
.section { padding: 58px 60px 30px; }
.shead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 30px;
}
.shead h2 {
  font-size: 54px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  white-space: nowrap;
}
.shead h2 .flaskicon {
  width: 46px;
  height: 46px;
  fill: none;
  stroke: var(--brand-blue);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.shead .viewall {
  color: var(--brand-blue);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-tile);
  overflow: hidden;
  box-shadow: 0 12px 26px -16px rgba(7, 40, 80, 0.3);
}
/* Placeholder art — replace .art background-image with real key art.
   Color derived from each tile's --hue via oklch(). */
.tile .art {
  /* Match the Play Store feature graphic ratio (1024x500) so the whole
     banner shows with no cropping. Falls back to the gradient when no art. */
  aspect-ratio: 1024 / 500;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  box-shadow: inset 0 26px 34px -18px rgba(255, 255, 255, 0.4);
  background: linear-gradient(150deg, oklch(0.82 0.13 var(--hue)), oklch(0.68 0.16 var(--hue)));
}
.tile .ico {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: oklch(0.6 0.19 var(--hue)); /* replace with real game icon <img> */
  box-shadow: 0 6px 16px rgba(7, 40, 80, 0.22);
}
.tile .body { padding: 14px 16px 18px; }
.tile .gname { font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--ink); }
.tile .gmeta { color: var(--ink-muted); font-size: 13px; font-weight: 700; margin-top: 3px; }

/* ---------- Contact CTA ---------- */
.cta {
  position: relative;
  margin: 46px 24px 56px;
  border-radius: 30px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-blue-deep));
  padding: 62px 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
}
.cta .wm {
  position: absolute;
  right: 40px;
  top: -60px;
  width: 280px;
  height: 280px;
  opacity: 0.15;
  object-fit: contain;
  transform: rotate(8deg);
}
.cta .ctaeyebrow {
  position: relative;
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 14px;
}
.cta h2 { position: relative; color: #fff; font-size: 52px; max-width: 620px; }
.cta p {
  position: relative;
  color: #e8f5ff;
  font-size: 18px;
  margin-top: 14px;
  max-width: 480px;
  line-height: 1.5;
  font-weight: 500;
}
.cta .btn-primary { position: relative; }

/* ---------- Footer ---------- */
.foot {
  padding: 38px 60px 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 600;
  border-top: 1px solid var(--border);
}
.footlinks a { color: var(--ink); text-decoration: none; margin-left: 24px; font-weight: 700; }

/* ---------- Responsive (suggested) ---------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .hero h1 { font-size: 64px; }
  .shead h2 { font-size: 38px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .cta { flex-direction: column; align-items: flex-start; }
  .cta h2 { font-size: 38px; }
}
@media (max-width: 560px) {
  .nav, .hero, .section, .foot { padding-left: 24px; padding-right: 24px; }
  .navlinks { display: none; } /* replace with a mobile menu */
  .grid { grid-template-columns: 1fr; }
  .hcard .fstrip { display: none; } /* or wrap below the name on mobile */
}

/* ============================================================
   Production additions — data-driven catalog
   The catalog grid is rendered from developer_data.json (see
   app.js). The art band keeps the designed gradient placeholder;
   the real Play Store icon is shown in .ico as an <img>.
   ============================================================ */

/* Each tile is a link to its Play Store page. */
.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 34px -18px rgba(7, 40, 80, 0.42);
}

/* Art band: just the banner now (the icon moved into the body). The full
   feature graphic shows because the band matches its 1024x500 ratio. */
.tile .art {
  display: block;
  padding: 0;
}
.tile .art.has-art {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: none; /* drop the placeholder sheen over real art */
}

/* Screenshot fallback: the (portrait) shot shown whole, centered, on a blurred
   fill of itself so the band is filled without any cropping. */
.tile .art.shot-art {
  overflow: hidden;
  box-shadow: none;
}
.tile .art.shot-art .art-blur {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(18px) brightness(0.92);
  transform: scale(1.15);
}
.tile .art.shot-art .art-shot {
  position: relative;
  height: 100%;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

/* Body: icon beside the title + genre. */
.tile .body {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tile .body .meta { min-width: 0; } /* allow text truncation */

/* Game icon, now a small thumbnail next to the name. */
.tile .ico {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  flex: none;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.35); /* shows while the image loads */
}
.tile .ico img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile .gname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .gmeta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Hero flagship image: match the feature-graphic ratio so it shows in full. */
.hcard .shot { aspect-ratio: 1024 / 500; }

/* Suggested hover states from the handoff. */
.btn-primary:hover, .navcta:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -10px rgba(23, 121, 212, 0.7); }
.btn-ghost:hover { background: #f3f8ff; }
.btn, .navcta { transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease; }
.shead .viewall:hover { text-decoration: underline; }
html { scroll-behavior: smooth; }

/* Loading skeleton + empty/error state. */
.tile.skeleton { pointer-events: none; }
.tile.skeleton .art { background: #e4eef9; }
.tile.skeleton .ico { background: rgba(255, 255, 255, 0.6); }
.tile.skeleton .gname, .tile.skeleton .gmeta {
  height: 12px;
  border-radius: 6px;
  background: #e4eef9;
  color: transparent;
}
.tile.skeleton .gname { width: 70%; height: 16px; }
.tile.skeleton .gmeta { width: 45%; margin-top: 8px; }
.tile.skeleton .art, .tile.skeleton .gname, .tile.skeleton .gmeta {
  animation: kl-pulse 1.2s ease-in-out infinite;
}
@keyframes kl-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.grid-msg {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-muted);
  font-weight: 600;
  padding: 30px 0;
}
