/* AI Coding Portfolio — ai-coding.karaithy.com */
:root {
  --bg: #070b12;
  --bg-elevated: #0e1420;
  --bg-card: #121a28;
  --border: #1e2a3d;
  --text: #e8edf5;
  --text-muted: #8b9bb5;
  --accent: #f0b429;
  --accent-dim: #c48f1a;
  --cyan: #3dd6c6;
  --green: #3ecf6e;
  --red: #ff5c5c;
  --radius: 12px;
  --font-sans: "IBM Plex Sans", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Noto Sans Mono", monospace;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --header-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(61, 214, 198, 0.08), transparent),
    linear-gradient(180deg, var(--bg) 0%, #050810 100%);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: rgba(7, 11, 18, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #070b12;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.container {
  width: min(1120px, 100% - 2rem);
  margin-inline: auto;
}

.hero {
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(2rem, 4vw, 3rem);
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1rem;
  max-width: 18ch;
}

.hero-lead {
  color: var(--text-muted);
  max-width: 52ch;
  margin: 0;
  font-size: 1.05rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  padding-bottom: 4rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  min-height: 100%;
}

.project-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.project-card.is-disabled {
  cursor: default;
  opacity: 0.72;
}

.project-card.is-disabled:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.card-thumb {
  aspect-ratio: 16 / 10;
  background: var(--bg-elevated);
  overflow: hidden;
  position: relative;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.card-body {
  padding: 1.1rem 1.25rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-live {
  background: rgba(62, 207, 110, 0.15);
  color: var(--green);
  border: 1px solid rgba(62, 207, 110, 0.35);
}

.badge-soon {
  background: rgba(139, 155, 181, 0.12);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.card-body h2 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: rgba(61, 214, 198, 0.1);
  color: var(--cyan);
  border: 1px solid rgba(61, 214, 198, 0.2);
}

.card-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  flex: 1;
}

/* ---- Content sections ---- */
.content-section {
  margin-bottom: 3.5rem;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.section-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-icon {
  font-size: 1.1rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* ---- Insight cards (homepage) ---- */
.insight-grid {
  display: grid;
  gap: 1.25rem;
}

.insight-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid var(--accent);
}

.insight-card:hover {
  border-color: var(--accent-dim);
  border-left-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.insight-card.is-disabled {
  cursor: default;
  opacity: 0.72;
  border-left-color: var(--border);
}

.insight-card.is-disabled:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.insight-card-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.insight-card-body h3 {
  font-size: 1.2rem;
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
}

.insight-card-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
}

.read-time-badge {
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: rgba(61, 214, 198, 0.1);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.read-more {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--cyan);
  font-weight: 500;
}

.insight-card:hover .read-more {
  text-decoration: underline;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* Detail page */
.detail-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  padding: 1.5rem 0 4rem;
  align-items: start;
}

@media (max-width: 860px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
  .detail-toc {
    position: static !important;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
  }
  .detail-toc a {
    padding: 0.35rem 0.65rem !important;
    border-left: none !important;
    border-radius: 6px;
    background: var(--bg-elevated);
  }
}

.detail-toc {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  font-size: 0.85rem;
}

.detail-toc h2 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.detail-toc nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-toc a {
  display: block;
  padding: 0.4rem 0 0.4rem 0.75rem;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
}

.detail-toc a:hover,
.detail-toc a.is-active {
  color: var(--text);
  border-left-color: var(--accent);
}

.detail-main h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 0.5rem;
}

.detail-intro {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.section-block {
  margin-bottom: 3rem;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.section-block h2 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
}

.prose {
  color: var(--text-muted);
}

.prose p {
  margin: 0 0 1rem;
}

.prose ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose strong {
  color: var(--text);
}

.feature-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0;
}

.feature-table th,
.feature-table td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  text-align: left;
}

.feature-table th {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
}

.demo-frame-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}

.demo-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.demo-toolbar a {
  font-size: 0.8rem;
}

.demo-frame {
  width: 100%;
  height: min(78vh, 820px);
  border: 0;
  display: block;
  background: #000;
}

.callout {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin: 1rem 0;
}

.callout-warn {
  border-color: rgba(240, 180, 41, 0.35);
  background: rgba(240, 180, 41, 0.06);
}

.callout-warn strong {
  color: var(--accent);
}

.skills-list {
  display: grid;
  gap: 0.75rem;
}

.skill-item {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.skill-item h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.skill-item p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}
