/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d1117;
  --bg-alt:    #111820;
  --bg-card:   #161b22;
  --border:    #21262d;
  --border-hi: #30363d;

  --text:      #e6edf3;
  --text-muted:#7d8590;
  --text-dim:  #484f58;

  --accent:    #58a6ff;
  --accent-2:  #3fb950;
  --accent-3:  #d2a8ff;
  --accent-4:  #ffa657;

  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: 'Inter', system-ui, sans-serif;

  --radius:    8px;
  --radius-lg: 14px;
  --nav-h:     64px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(13, 17, 23, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
.nav-logo:hover { text-decoration: none; }
.nav-logo .prompt { color: var(--accent-2); margin-right: 4px; }
.nav-logo .cursor {
  color: var(--accent);
  animation: blink 1.2s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
  margin-left: auto;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: color .15s, background .15s;
}
.nav-links a:hover {
  color: var(--text);
  background: var(--bg-card);
  text-decoration: none;
}
.nav-links a.nav-active {
  color: var(--text);
  background: var(--bg-card);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  margin-left: auto;
}

/* ===== Nav controls (sequencer) ===== */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.play-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  background: var(--accent-2);
  color: #0d1117;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.play-btn:hover    { background: #56d364; }
.play-btn.playing  { background: var(--accent-4); }
.play-btn.playing:hover { background: #ffb77a; }

.nav-slider-group {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
}

.nav-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 3px;
  background: var(--border-hi);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.nav-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.nav-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* ===== Step indicator ===== */
.grid-cell.current-step:not(.active):not(.lit) {
  background: hsla(var(--hue), 60%, 55%, 0.13);
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  padding-top: var(--nav-h);
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* Background grid */
#grid-bg {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  display: grid;
  background: var(--bg);
  grid-template-columns: repeat(16, 1fr);
  grid-template-rows: repeat(12, 1fr);
}

.grid-cell {
  border: 1px solid rgba(88, 166, 255, 0.07);
  transition: background 0.06s ease, box-shadow 0.06s ease;
}

.grid-cell.lit,
.grid-cell.active {
  background: hsla(var(--hue), 80%, 58%, 0.85);
  box-shadow:
    0 0 18px 4px hsla(var(--hue), 85%, 62%, 0.45),
    inset 0 0 12px rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 1;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

/* White flash when sequencer hits an active cell */
.grid-cell.active.playing {
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 0 26px 8px rgba(255, 255, 255, 0.45),
    inset 0 0 10px rgba(255, 255, 255, 0.3);
  transition: background 0.03s ease, box-shadow 0.03s ease;
}

/* Measure divider — brighter left border every 4 columns */
.grid-cell.measure-start {
  border-left-color: rgba(255, 255, 255, 0.18);
}

.grid-cell.fading {
  background: transparent;
  box-shadow: none;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

/* subtle grid background */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(88,166,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88,166,255,.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* radial glow */
.hero::after {
  content: '';
  position: absolute;
  top: 20%; left: 50%;
  transform: translate(-50%, -50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(88,166,255,.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  gap: 24px;
  align-items: center;
}

.hero-tag {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-2);
  grid-column: 1;
  letter-spacing: .05em;
}

.hero-title {
  grid-column: 1;
  font-size: clamp(48px, 7vw, 88px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -.03em;
  color: var(--text);
}

.hero-title .accent { color: var(--accent); }

.hero-subtitle {
  grid-column: 1;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: .08em;
}

.hero-description {
  grid-column: 1;
  font-size: 17px;
  color: var(--text);
  max-width: 480px;
  line-height: 1.7;
}

.hero-actions {
  grid-column: 1;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-stats {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 8px;
}

.stat { display: flex; flex-direction: column; }
.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.stat-divider { width: 1px; height: 36px; background: var(--border); }

/* Code block */
.hero-code {
  grid-column: 2;
  grid-row: 1 / 7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.code-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
}

.code-header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.code-filename {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}

.code-body {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.8;
  padding: 20px 24px;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
}

/* Syntax colors */
.kw  { color: var(--accent-3); }
.cls { color: var(--accent-4); }
.fn  { color: var(--accent-2); }
.str { color: var(--accent-4); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: #79c0ff;
  border-color: #79c0ff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-hi);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-card);
}

.btn-lg { padding: 14px 28px; font-size: 16px; }

/* ===== Sections ===== */
.section { padding: 96px 0; position: relative; z-index: 1; }
.section-alt { background: rgba(17, 24, 32, 0.55); }

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-header { margin-bottom: 48px; }

.section-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-2);
  letter-spacing: .1em;
  display: block;
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}

.section-desc {
  font-size: 16px;
  color: var(--text-muted);
}

/* ===== Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}

.card:hover {
  border-color: rgba(120, 200, 255, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(120, 200, 255, 0.15), 0 4px 24px rgba(120, 200, 255, 0.1);
}

.card-placeholder {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-icon {
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
}

.card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

.card-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(88,166,255,.1);
  color: var(--accent);
  border: 1px solid rgba(88,166,255,.2);
  width: fit-content;
}

/* ===== Contact ===== */
.contact-section {
  background: var(--bg);
  text-align: center;
}

.contact-inner { max-width: 600px; margin: 0 auto; padding: 0 24px; }

.contact-desc {
  font-size: 18px;
  color: var(--text-muted);
  margin: 16px 0 32px;
  line-height: 1.7;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  position: relative;
  z-index: 1;
  background: rgba(13, 17, 23, 0.7);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.footer-name { color: var(--text-muted); }
.footer-sep { color: var(--text-dim); }

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    gap: 4px;
  }
  .nav-toggle { display: block; }

  .hero-inner {
    grid-template-columns: 1fr;
    padding: 48px 24px 64px;
  }
  .hero-code { display: none; }
  .hero-title { font-size: clamp(40px, 12vw, 64px); }

  .hero-stats { gap: 16px; }

  .section { padding: 64px 0; }
}
