/* ============================================================
   Kredo — Global Stylesheet
   aikredo.com  |  Dark theme, developer-tool aesthetic
   ============================================================ */

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

/* --- Custom Properties -------------------------------------- */
:root {
  --bg-primary:    #0a0a0f;
  --bg-secondary:  #12121a;
  --bg-card:       #12121a;
  --bg-code:       #18181b;
  --border:        #1e1e2e;
  --border-hover:  #2e2e42;

  --text-primary:  #e4e4e7;
  --text-secondary:#a1a1aa;
  --text-muted:    #71717a;

  --accent:        #3b82f6;
  --accent-hover:  #60a5fa;
  --accent-dim:    #2563eb;
  --green:         #22c55e;
  --green-dim:     #16a34a;
  --yellow:        #eab308;
  --red:           #ef4444;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;

  --max-width:     1100px;
  --max-width-narrow: 800px;
  --nav-height:    64px;
  --radius:        8px;
  --radius-lg:     12px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base --------------------------------------------------- */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
}

::selection {
  background: rgba(59, 130, 246, 0.3);
  color: #fff;
}

/* --- Typography --------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin-bottom: 0.75rem;
}

h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

strong { color: var(--text-primary); font-weight: 600; }
em { color: var(--text-secondary); }
small { font-size: 0.875rem; color: var(--text-muted); }

/* --- Links -------------------------------------------------- */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

a:hover { color: var(--accent-hover); }

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Lists -------------------------------------------------- */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

li { margin-bottom: 0.5rem; }
li::marker { color: var(--text-muted); }

/* --- Code --------------------------------------------------- */
code {
  font-family: var(--font-mono);
  background: var(--bg-code);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-size: 0.875em;
  color: var(--accent-hover);
  border: 1px solid var(--border);
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
}

pre code {
  background: none;
  padding: 0;
  border: none;
  color: var(--text-primary);
  font-size: inherit;
}

/* --- Tables ------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

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

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td { color: var(--text-secondary); }
tr:hover td { background: rgba(59, 130, 246, 0.03); }

/* --- Navigation --------------------------------------------- */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  transition: color 0.2s var(--ease);
}

.logo:hover { color: var(--accent); }

.logo-img {
  height: 28px;
  width: auto;
  vertical-align: middle;
  margin-right: 0.35rem;
}

.hero-logo {
  display: block;
  width: 200px;
  height: auto;
  margin: 0 auto 2rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s var(--ease);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s var(--ease);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a.nav-cta {
  color: var(--accent);
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.nav-links a.nav-cta::after { display: none; }

.nav-links a.nav-cta:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* --- Main Content ------------------------------------------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem;
}

main.narrow {
  max-width: var(--max-width-narrow);
}

/* --- Hero Section ------------------------------------------- */
.hero {
  text-align: center;
  padding: 5rem 0 4rem;
  margin-bottom: 4rem;
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 600px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.hero h1 {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.03em;
}

.hero .gradient-text {
  background: linear-gradient(135deg, #e4e4e7 0%, #3b82f6 50%, #22c55e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .subtitle {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0 auto 1.25rem;
  line-height: 1.6;
}

.hero .tagline-small {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.hero-cta {
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* --- Buttons ------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  border: none;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.03);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 0.5rem 0.75rem;
}

.btn-ghost:hover {
  color: var(--accent-hover);
  background: rgba(59, 130, 246, 0.08);
}

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; }

/* --- Cards -------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: all 0.25s var(--ease);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, transparent 40%, rgba(59, 130, 246, 0.2) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card:hover::before { opacity: 1; }

.card h3 { color: var(--text-primary); margin-bottom: 0.5rem; }
.card p { font-size: 0.95rem; margin-bottom: 0; color: var(--text-muted); line-height: 1.6; }
.card p:last-child { margin-bottom: 0; }

/* --- Badges ------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-hover);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-green {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-muted {
  background: rgba(113, 113, 122, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(113, 113, 122, 0.2);
}

/* --- Sections ----------------------------------------------- */
.section { margin-bottom: 5rem; }
.section-header { margin-bottom: 2rem; }
.section-header h2 { margin-bottom: 0.5rem; }
.section-header p { color: var(--text-muted); max-width: 600px; }

/* --- Steps -------------------------------------------------- */
.steps { display: grid; gap: 2rem; margin-bottom: 2rem; }

.step { display: flex; gap: 1.5rem; align-items: flex-start; }

.step-num {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  min-width: 2.5rem;
  font-family: var(--font-mono);
  opacity: 0.7;
}

.step h3 { color: var(--text-primary); }
.step p { color: var(--text-secondary); }

/* --- Feature Grid ------------------------------------------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.feature-grid .card { padding: 2rem; }

/* --- FAQ ---------------------------------------------------- */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 0;
}

.faq-item:first-child { border-top: 1px solid var(--border); }
.faq-item h3 { color: var(--text-primary); margin-bottom: 0.75rem; font-weight: 600; }
.faq-item p { margin-bottom: 0; color: var(--text-secondary); }
.faq-item p + p { margin-top: 0.75rem; }

/* --- Code Block Component ----------------------------------- */
.code-block-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.code-block-wrapper .code-lang {
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.35rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(30, 30, 46, 0.8);
  border-bottom-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  user-select: none;
}

.code-block-wrapper .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 3.5rem;
  padding: 0.3rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  opacity: 0;
}

.code-block-wrapper:hover .copy-btn { opacity: 1; }

.code-block-wrapper .copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.code-block-wrapper pre { margin-bottom: 0; padding-top: 1.75rem; }

/* --- Footer ------------------------------------------------- */
footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  margin-top: 4rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 3rem;
}

.footer-brand .footer-logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: block;
}

.footer-brand .tagline {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 0;
}

.footer-col h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-weight: 600;
}

.footer-col a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0.3rem 0;
  transition: color 0.2s var(--ease);
}

.footer-col a:hover { color: var(--text-primary); }

.footer-bottom {
  max-width: var(--max-width);
  margin: 2rem auto 0;
  padding: 1.5rem 2rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.copyright { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0; }

/* --- Utility Classes ---------------------------------------- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 2rem; }
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mt-6 { margin-top: 3rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-6 { margin-bottom: 3rem; }
.max-w-narrow { max-width: var(--max-width-narrow); margin-left: auto; margin-right: auto; }

/* --- Responsive --------------------------------------------- */
@media (max-width: 768px) {
  body { font-size: 15px; }
  main { padding: 2rem 1.25rem; }
  .nav-inner { padding: 0 1.25rem; }
  .nav-toggle { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(10, 10, 15, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    gap: 0;
  }

  .nav-links.open { display: flex; }

  .nav-links a {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    width: 100%;
  }

  .nav-links a:last-child { border-bottom: none; }
  .nav-links a::after { display: none; }

  .hero { padding: 3rem 0 2.5rem; margin-bottom: 3rem; }
  .hero-cta { flex-direction: column; align-items: center; }
  .cards { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }

  .step { flex-direction: column; gap: 0.75rem; }
  .step-num { font-size: 1.25rem; }

  .footer-inner { grid-template-columns: 1fr; gap: 2rem; }

  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: 1rem 1.25rem 0;
  }

  table { font-size: 0.875rem; }
  th, td { padding: 0.5rem 0.75rem; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.75rem; }
  .hero .subtitle { font-size: 1rem; }
  .btn-lg { padding: 0.7rem 1.5rem; font-size: 0.9rem; }
  .cards { gap: 1rem; }
  .card { padding: 1.25rem; }
}

@media print {
  nav, .hero-glow, .hero-cta, footer { display: none; }
  body { background: #fff; color: #000; font-size: 12pt; }
  a { color: #000; text-decoration: underline; }
  .card { border: 1px solid #ccc; break-inside: avoid; }
}
