/* ── Kartelkoin Design System ───────────────────────────────────── */
:root {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --surface: rgba(250, 213, 10, 0.04);
  --surface-hover: rgba(250, 213, 10, 0.08);
  --border: rgba(250, 213, 10, 0.12);
  --accent: #FAD50A;
  --accent-dim: #C0A607;
  --accent-glow: rgba(250, 213, 10, 0.18);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "SF Pro", "Inter", system-ui, sans-serif;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "SF Pro", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.3s var(--ease-out-back);
}

:root[data-theme="light"],
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #FAFAFA;
    --bg-elevated: #FFFFFF;
    --surface: rgba(0, 0, 0, 0.03);
    --surface-hover: rgba(0, 0, 0, 0.06);
    --border: rgba(0, 0, 0, 0.08);
    --accent: #B8860B;
    --accent-dim: #967309;
    --accent-glow: rgba(184, 134, 11, 0.15);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --text: #0A0A0A;
    --text-dim: #4A4A4A;
    --text-muted: #88888A;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  min-height: 100vh;
  color: #FFFFFF;
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body {
    color: var(--text);
  }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 0;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 56px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.brand-dim { color: var(--text-dim); font-weight: 500; }
.topnav { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}
.icon-btn .icon-moon { display: none; }
:root[data-theme="light"] .icon-btn .icon-moon { display: block; }
:root[data-theme="light"] .icon-btn .icon-sun { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}
.btn.primary {
  background: var(--accent);
  color: #000000;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-glow);
  background: var(--accent-dim);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Hero Section ───────────────────────────────────────────────── */
.hero {
  padding: clamp(3rem, 8vw, 5rem) 0 clamp(2rem, 6vw, 3rem);
  text-align: center;
  position: relative;
}
.hero::after {
  content: "";
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 2rem auto;
  opacity: 0.4;
  max-width: 600px;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}
h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 1.5rem;
  color: #FFFFFF;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) h1 {
    color: var(--text);
  }
}
.hero-sub {
  color: var(--text-dim);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.hero-stats b { color: var(--text); }
.stat-sep { width: 1px; height: 16px; background: var(--border); }

/* ── Projects Section ───────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.chip {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}
.chip[aria-selected="true"] {
  background: var(--accent);
  color: #000000;
  border-color: var(--accent);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .chip[aria-selected="true"] {
    color: #000000;
  }
}

/* ── Category Legend ──────────────────────────────────────────────── */
.legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Reuse category color classes for legend dots */
.legend-dot.cat-apps      { background: #4f9dff; }
.legend-dot.cat-tools     { background: #3ddc97; }
.legend-dot.cat-mint-nft  { background: #c792ea; }
.legend-dot.cat-wallet    { background: #ffb454; }
.legend-dot.cat-solana    { background: #b388ff; }
.legend-dot.cat-live      { background: #f06595; }

/* ── Featured Card ──────────────────────────────────────────────── */
.featured-wrap {
  margin-bottom: 2rem;
}
.featured {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}
.featured::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-glow);
  opacity: 0;
  transition: opacity 0.3s;
}
.featured:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.featured:hover::before {
  opacity: 1;
}
.featured-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.featured h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.featured p {
  color: var(--text-dim);
  font-size: 0.9rem;
  max-width: 500px;
}
.open {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--accent);
  transition: transform 0.3s;
}
.featured:hover .open svg {
  transform: translateX(4px);
}

/* ── Project Grid ───────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding-bottom: 4rem;
}
.card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  animation: card-rise 0.5s var(--ease-out-back) both;
  animation-delay: var(--delay, 0ms);
}
@keyframes card-rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 30px var(--accent-glow);
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.card-cat {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.card-arrow {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.card:hover .card-arrow {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateX(4px);
}
.card h4 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}
.card p {
  color: var(--text-dim);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  flex: 1;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}
.card-foot a {
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: color 0.2s;
}
.card-foot a:hover { color: var(--accent); }

/── Skeleton Loading ─────────────────────────────────────────────── */
.skeleton-card, .skeleton-featured {
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.skeleton-featured {
  height: 110px;
  border-left: 4px solid var(--accent);
}
.skeleton-card { height: 180px; }
.skeleton-card::after, .skeleton-featured::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(250, 213, 10, 0.06), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Footer ─────────────────────────────────────────────────────── */
.footer {
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
}
.footer a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.footer a:hover { color: var(--accent); }
.footer .brand-logo {
  width: 18px;
  height: 18px;
  border-radius: 6px;
}

/* ── Skip Link ──────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -999px;
  top: -999px;
  z-index: 1000;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #000000;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ── Focus States ───────────────────────────────────────────────── */
button:focus, a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus:not(:focus-visible), a:focus:not(:focus-visible) {
  outline: none;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 0 1.5rem; }
  .hero { padding: 4rem 0; }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .grid { grid-template-columns: 1fr; }
  .featured {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  .featured .open {
    order: -1;
    margin-left: auto;
  }
}

/* ── Reduced Motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .card:hover, .featured:hover { transform: none; }
}
/* ── Category color labels ────────────────────────────────────────
   Each project's category gets a distinct, readable color that works
   in both light and dark themes (tinted text + border, soft bg).     */
.card-cat.cat-apps, .cat.cat-apps      { color: #4f9dff; border-color: #4f9dff66; background: #4f9dff14; }
.card-cat.cat-tools, .cat.cat-tools    { color: #3ddc97; border-color: #3ddc9766; background: #3ddc9714; }
.card-cat.cat-mint-nft, .cat.cat-mint-nft { color: #c792ea; border-color: #c792ea66; background: #c792ea14; }
.card-cat.cat-wallet, .cat.cat-wallet  { color: #ffb454; border-color: #ffb45466; background: #ffb45414; }
.card-cat.cat-solana, .cat.cat-solana  { color: #b388ff; border-color: #b388ff66; background: #b388ff14; }
.card-cat.cat-live, .cat.cat-live      { color: #f06595; border-color: #f0659566; background: #f0659514; }
.featured-label .cat { padding: 0.1rem 0.5rem; }
