/* ==========================================================
   Krang Tech — site styles
   No external requests: fonts are self-hosted in /fonts.
   ========================================================== */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Regular.woff') format('woff');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Bold.woff') format('woff');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #0A0E0B; --bg-alt: #0D120E; --panel: #0F1511; --panel-2: #121814;
  --line: #1F2A22; --line-2: #2E3D32; --line-accent: #23452E;
  --text: #E6EDE7; --soft: #C3CEC5; --muted: #A9B6AC; --faint: #8C9A8F;
  --accent: #4ADE80; --accent-hover: #86EFAC; --on-accent: #06210F; --amber: #FBBF24;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --sans: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius: 12px;
  --max: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--mono); font-weight: 700; line-height: 1.15; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); }
.accent-text { color: var(--accent); }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--on-accent); font-weight: 600;
  padding: 10px 16px; border-radius: 8px;
}
.skip-link:focus { top: 12px; color: var(--on-accent); }

/* ---------- Blinking cursor ---------- */
.cursor { display: inline-block; background: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 14, 11, .88);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 8px; flex: none;
  background: var(--panel-2); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 16px;
}
.brand-mark .cursor { width: 7px; height: 16px; margin-left: 2px; }
.brand-mark.small { width: 34px; height: 34px; font-size: 14px; }
.brand-mark.small .cursor { width: 6px; height: 14px; }
.brand-name { font-family: var(--mono); font-weight: 700; font-size: 18px; letter-spacing: .02em; }

.nav-list { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.nav-list a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  color: var(--soft); font-size: 15px; border-radius: 8px; transition: color .15s, background .15s;
}
.nav-list a:hover { color: var(--text); background: var(--panel-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 12px 20px; border-radius: 8px; font-weight: 500; font-size: 15px;
  border: 1px solid var(--line-2); color: var(--text); background: transparent;
  transition: border-color .15s, background .15s, color .15s, transform .15s;
}
.btn:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero::before {
  /* faint terminal grid */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(74, 222, 128, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 222, 128, .05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 90%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 90%);
}
.hero-grid {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 48px;
  padding-top: 96px; padding-bottom: 96px;
}
.hero-copy { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.eyebrow { font-family: var(--mono); font-size: 14px; color: var(--accent); }
.hero h1 { font-size: clamp(36px, 5.6vw, 58px); letter-spacing: -.02em; line-height: 1.08; }
.lede { font-size: 19px; line-height: 1.65; color: var(--muted); max-width: 560px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; padding-top: 6px; }

.terminal {
  flex: 1 1 420px; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 0 0 1px rgba(74, 222, 128, .04), 0 24px 60px -30px rgba(74, 222, 128, .25);
}
.terminal-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--line-2); }
.terminal-title { margin-left: 10px; font-family: var(--mono); font-size: 12px; color: var(--faint); }
.terminal-body { padding: 20px; font-family: var(--mono); font-size: 14px; line-height: 1.85; color: var(--soft); }
.terminal-body .cmd { color: var(--text); }
.terminal-body .muted { color: var(--faint); }
.terminal-body .ok { color: var(--accent); }
.terminal-body .cursor { width: 8px; height: 16px; vertical-align: -3px; }
.terminal-body p { white-space: pre-wrap; }

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-cmd { font-family: var(--mono); font-size: 13px; color: var(--accent); margin-bottom: 10px; }
.section h2 { font-size: clamp(28px, 3.6vw, 38px); letter-spacing: -.01em; }
.section-intro { color: var(--muted); font-size: 17px; max-width: 680px; margin-top: 14px; }

.split { display: flex; flex-wrap: wrap; gap: 32px 64px; }
.split > :first-child { flex: 1 1 280px; }
.split > .prose { flex: 2 1 480px; min-width: 0; }
.prose p { color: var(--soft); margin-bottom: 16px; }
.pillars { list-style: none; display: grid; gap: 12px; margin-top: 8px; }
.pillars li {
  padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  color: var(--muted); font-size: 16px;
}
.pillars strong { color: var(--text); font-weight: 600; }

.card-grid {
  display: grid; gap: 20px; margin-top: 40px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
.card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--line-accent); transform: translateY(-2px); }
.card-icon { color: var(--accent); margin-bottom: 4px; }
.card-icon.warn { color: var(--amber); }
.card h3 { font-size: 18px; }
.card p { color: var(--muted); font-size: 16px; }
.card-link { margin-top: auto; padding-top: 6px; font-weight: 500; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }

.project-list { display: grid; gap: 14px; margin-top: 40px; }
.project {
  display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: baseline;
  padding: 22px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.project > div { flex: 1 1 360px; min-width: 0; display: grid; gap: 6px; }
.project-tag {
  flex: none; width: 88px; text-align: center;
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  border: 1px solid var(--line-accent); border-radius: 999px; padding: 4px 10px;
}
.project h3 { font-size: 18px; }
.project p { color: var(--muted); font-size: 16px; }

.connect-panel {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 32px;
  padding: 48px; background: var(--panel); border: 1px solid var(--line-accent); border-radius: 16px;
}
.connect-panel > div:first-child { flex: 1 1 380px; min-width: 0; }
.connect-links { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-top: 48px; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; }
.footer-grid > div { flex: 1 1 320px; max-width: 460px; }
.footer-note { color: var(--faint); font-size: 14px; margin-top: 14px; }
.footer-links { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 2px 32px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 40px; color: var(--soft); font-size: 15px; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { padding-top: 32px; padding-bottom: 40px; color: var(--faint); font-size: 13px; }

/* ---------- Article pages (for future tutorials / guides) ---------- */
.article { padding: 72px 0 96px; }
.article .container { max-width: 760px; }
.article h1 { font-size: clamp(30px, 4.4vw, 44px); margin: 10px 0 18px; }
.article h2 { font-size: 26px; margin: 44px 0 14px; }
.article h3 { font-size: 20px; margin: 32px 0 12px; }
.article p, .article li { color: var(--soft); }
.article p { margin-bottom: 18px; }
.article ul, .article ol { padding-left: 22px; margin-bottom: 18px; }
.article code { font-family: var(--mono); font-size: .92em; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.article pre { font-family: var(--mono); font-size: 14px; line-height: 1.7; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; overflow-x: auto; margin: 0 0 22px; }
.article pre code { background: none; border: 0; padding: 0; }
.article-meta { font-family: var(--mono); font-size: 13px; color: var(--faint); }
.breadcrumb { font-size: 14px; color: var(--faint); }

/* ---------- Gentle entrance animation ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hero-copy > *, .terminal { animation: rise .6s ease-out both; }
.hero-copy > :nth-child(2) { animation-delay: .06s; }
.hero-copy > :nth-child(3) { animation-delay: .12s; }
.hero-copy > :nth-child(4) { animation-delay: .18s; }
.terminal { animation-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  html { scroll-padding-top: 136px; } /* header is two rows on phones */
  body { font-size: 16px; }
  .header-row { padding-top: 10px; padding-bottom: 6px; }
  .site-header nav { width: 100%; overflow-x: auto; }
  .nav-list { flex-wrap: nowrap; margin: 0 -12px; }
  .nav-list a { white-space: nowrap; }
  .hero-grid { padding-top: 56px; padding-bottom: 64px; gap: 36px; }
  .lede { font-size: 17px; }
  .section { padding: 64px 0; }
  .connect-panel { padding: 28px 22px; }
  .terminal-body { font-size: 12.5px; padding: 16px; }
  .project-tag { width: auto; }
}
