/* Rahul Tyagi — refined engineering-terminal theme */

:root {
  --bg:        #0a0b0d;
  --bg-soft:   #101216;
  --panel:     #0f1115;
  --border:    #1d2027;
  --border-hi: #2c313b;
  --text:      #e9e8e2;
  --muted:     #8b8e98;
  --faint:     #565963;
  --accent:    #f0a35e;   /* CRT amber */
  --accent-dim:#7a5630;
  --glow:      rgba(240,163,94,0.10);

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --maxw: 920px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* atmosphere: amber glow up top + faint grid */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--glow), transparent 60%),
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 100% 100%, 56px 56px, 56px 56px;
  background-position: 0 0, 0 0, 0 0;
  background-attachment: fixed, fixed, fixed;
  min-height: 100vh;
}

/* the grid lines should be barely-there */
body::before {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 20%, transparent, var(--bg) 75%);
  pointer-events: none; z-index: 0;
}

/* film grain */
.grain {
  position: fixed; inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
}

.site-head, .site-main, .site-foot { position: relative; z-index: 1; }

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

/* ---------- header ---------- */
.site-head {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand-mark { color: var(--accent); }
.site-nav { display: flex; gap: 22px; }
.site-nav a {
  color: var(--muted);
  font-size: 13.5px;
  transition: color 0.18s ease;
}
.site-nav a:hover { color: var(--accent); }

/* ---------- main ---------- */
.site-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---------- hero ---------- */
.hero { padding: 48px 0 64px; }
.prompt {
  font-size: 13px;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  margin: 0 0 18px;
}
.prompt .dot, .post-meta .dot, .hero-blurb .dot { color: var(--accent-dim); margin: 0 4px; }
.hero-name {
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(56px, 11vw, 116px);
  line-height: 0.92;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--text);
}
.hero-tagline {
  font-family: var(--mono);
  font-size: clamp(22px, 4vw, 32px);
  color: var(--accent);
  margin: 0 0 24px;
}
.hero-blurb {
  max-width: 60ch;
  color: var(--muted);
  font-size: 14.5px;
  margin: 0 0 32px;
}
.hero-links { display: flex; flex-wrap: wrap; gap: 12px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--border-hi);
  border-radius: 2px;
  color: var(--text);
  font-size: 13px;
  background: var(--panel);
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.pill .arr { color: var(--faint); transition: transform 0.18s ease, color 0.18s ease; }
.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  background: var(--bg-soft);
}
.pill:hover .arr { color: var(--accent); transform: translate(2px, -2px); }

/* blinking cursor */
.cursor {
  color: var(--accent);
  font-family: var(--mono);
  animation: blink 1.1s step-end infinite;
}
.brand .cursor { font-size: 0.8em; }
.hero-name .cursor { font-size: 0.5em; vertical-align: 0.12em; margin-left: 0.06em; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- section label ---------- */
.section-label {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0 0 24px;
}

/* ---------- project grid ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.card {
  display: flex;
  flex-direction: column;
  padding: 22px 22px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.card::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 100% 0%, var(--glow), transparent 50%);
  opacity: 0; transition: opacity 0.25s ease;
  pointer-events: none;
}
.card:hover {
  border-color: var(--border-hi);
  transform: translateY(-3px);
  background: var(--bg-soft);
}
.card:hover::after { opacity: 1; }
.card--featured { grid-column: 1 / -1; }

.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-name {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 26px;
  line-height: 1;
  margin: 0;
  color: var(--text);
}
.card:hover .card-name { color: var(--accent); }
.stars {
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.card-desc { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; flex: 1; }
.card--featured .card-desc { max-width: 64ch; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; }
.lang {
  font-size: 11.5px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 3px 8px;
}
.card-arr {
  color: var(--faint);
  font-size: 16px;
  transition: transform 0.2s ease, color 0.2s ease;
}
.card:hover .card-arr { color: var(--accent); transform: translateX(4px); }

.all-link {
  display: inline-block;
  margin-top: 28px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border-hi);
  padding-bottom: 2px;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.all-link:hover { color: var(--accent); border-color: var(--accent); }

.projects { margin-top: 8px; }

/* ---------- documents (about / blog / post) ---------- */
.doc { max-width: 680px; padding-top: 20px; }
.doc-title {
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(40px, 7vw, 60px);
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
  color: var(--text);
}
.back { font-size: 13px; color: var(--muted); display: inline-block; margin-bottom: 18px; }
.back:hover { color: var(--accent); }
.post-meta { color: var(--faint); font-size: 13px; margin: -8px 0 32px; }

.prose { color: #d4d4cf; font-size: 15px; }
.prose p, .prose ul, .prose ol { margin: 0 0 18px; }
.prose h2, .prose h3 {
  font-family: var(--mono);
  font-weight: 400;
  color: var(--text);
  margin: 36px 0 14px;
  line-height: 1.15;
}
.prose h2 { font-size: 30px; }
.prose h3 { font-size: 23px; }
.prose a { border-bottom: 1px solid var(--accent-dim); transition: border-color 0.15s ease; }
.prose a:hover { border-color: var(--accent); }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose blockquote {
  border-left: 2px solid var(--accent-dim);
  margin: 0 0 18px; padding: 2px 0 2px 18px;
  color: var(--muted); font-style: italic;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--accent);
}
.prose pre {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px;
  overflow-x: auto;
  margin: 0 0 20px;
}
.prose pre code { background: none; border: none; padding: 0; color: #d4d4cf; font-size: 13px; }
.prose img { max-width: 100%; border-radius: 4px; border: 1px solid var(--border); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* ---------- blog list ---------- */
.post-list { list-style: none; margin: 8px 0 0; padding: 0; }
.post-item a {
  display: flex; align-items: baseline; gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: padding-left 0.18s ease;
}
.post-item a:hover { padding-left: 8px; }
.post-item time { color: var(--faint); font-size: 12.5px; white-space: nowrap; min-width: 96px; }
.post-title { font-family: var(--mono); font-size: 21px; transition: color 0.18s ease; }
.post-item a:hover .post-title { color: var(--accent); }
.post-empty { color: var(--muted); padding: 16px 0; }

/* ---------- footer ---------- */
.site-foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 24px 48px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  color: var(--faint); font-size: 12px;
}

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(12px); animation: reveal 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
@keyframes reveal { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  .cursor { animation: none; }
  * { transition: none !important; }
}

@media (max-width: 560px) {
  .site-main { padding: 20px 20px 60px; }
  .hero { padding: 24px 0 48px; }
  .post-item a { flex-direction: column; gap: 2px; }
  .post-item time { min-width: 0; }
}
