/* Complete redesign with dark professional theme inspired by the design examples */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  /* Primary brand colors - sophisticated blue-gray palette */
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #10b981;
  --accent-hover: #059669;

  /* Dark theme colors */
  --background: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --border-light: #475569;

  /* Text colors */
  --foreground: #f8fafc;
  --muted-foreground: #94a3b8;
  --subtle: #64748b;

  /* Semantic colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  /* Spacing and sizing */
  --radius: 12px;
  --radius-lg: 16px;
  --container-max: 1200px;
  --header-height: 80px;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography scale */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--foreground);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
}
h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}
h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}
h4 {
  font-size: 1.25rem;
}
h5 {
  font-size: 1.125rem;
}
h6 {
  font-size: 1rem;
}

p {
  color: var(--muted-foreground);
  line-height: 1.7;
  text-wrap: pretty;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

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

/* Layout components */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 2rem;
}

.wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 2rem;
  height: var(--header-height);
}

/* Button system */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--primary-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--border-light);
  color: var(--foreground);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-accent {
  background: var(--accent);
}

.btn-accent:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Icon styling */
.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  filter: brightness(0) invert(1);
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  text-decoration: none;
}

.site-title:hover {
  color: var(--primary);
}

.site-nav {
  display: flex;
  gap: 2rem;
}

.site-nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav li {
  margin: 0;
}

.site-nav a {
  color: var(--muted-foreground);
  font-weight: 500;
  transition: color 0.2s ease;
}

.site-nav a:hover {
  color: var(--foreground);
}

/* Main content spacing for fixed header */
#site-main {
  margin-top: var(--header-height);
}

/* Hero section */
.hero {
  padding: 6rem 0 4rem;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
}

.hero-split{
  display: grid;
  /* Text gets the bulk of the width; image stays in a narrow rail */
  grid-template-columns: minmax(560px, 1fr) clamp(220px, 22vw, 320px);
  gap: clamp(16px, 3vw, 48px);
  align-items: start;
}

/* Headline: big but readable; not squished */
.hero-copy h1{
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 24ch;   /* remove or override if you want true full-width */
  margin: 0 0 10px;
}

/* Support text stays comfy width */
.hero-sub{ max-width: 60ch; }
.hero-bullets{ max-width: 65ch; }

.hero-bullets li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--muted-foreground);
}

.hero-bullets li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.hero-portrait{
  align-self: start;
  justify-self: end;
  margin-top: 6px;
}
.hero-portrait img{
  width: 100%;
  max-width: 320px;             /* hard cap so it never dominates */
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
}

/* Credibility strip */
.cred {
  padding: 4rem 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cred-title {
  text-align: center;
  margin-bottom: 3rem;
  color: var(--foreground);
}

.cred-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 3rem;
  text-align: center;
}

.cred-item h3 {
  color: var(--foreground);
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.cred-item p {
  color: var(--muted-foreground);
  font-size: 1rem;
}

/* Content sections */
.latest,
.contact,
.attributes {
  padding: 5rem 0;
}

.latest h2,
.contact h2,
.attributes h2 {
  text-align: center;
  margin-bottom: 3rem;
}

/* Card grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  border-color: var(--border-light);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.card-title a {
  color: var(--foreground);
}

.card-title a:hover {
  color: var(--primary);
}

.card-excerpt {
  margin: 0 0 1rem;
  color: var(--muted-foreground);
  flex: 1;
}

.card-link {
  color: var(--primary);
  font-weight: 500;
  font-size: 0.9rem;
  margin-top: auto;
}

.meta {
  color: var(--subtle);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.more {
  text-align: center;
  margin-top: 3rem;
}

/* Contact form */
.contact {
  background: var(--surface);
  margin-bottom: 2rem;
}

.contact h2 {
  color: var(--foreground);
}

.contact p {
  text-align: center;
  font-size: 1.125rem;
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.contact-form {
  max-width: 600px;
  margin: 0 auto;
  background: var(--background);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.cf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.cf-grid label {
  display: grid;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--foreground);
}

.cf-grid input,
.cf-grid textarea {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  transition: border-color 0.2s ease;
}

.cf-grid input:focus,
.cf-grid textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.cf-span-2 {
  grid-column: span 2;
}

.cf-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.cf-note {
  color: var(--subtle);
  font-size: 0.9rem;
}

.cf-note a {
  color: var(--primary);
}

/* Archive and post headers */
.archive-header,
.post-header {
  text-align: center;
  padding: 6rem 0 4rem;
}

.archive-header h1,
.post-header h1 {
  margin-bottom: 1rem;
}

.archive-header p {
  font-size: 1.25rem;
  max-width: 600px;
  margin: 0 auto;
}

.post-title {
  font-size: clamp(2rem, 4vw, 3.5rem);
  margin: 0 0 1rem;
}

.post-meta {
  color: var(--subtle);
  font-size: 1rem;
}

.post-content,
.post-tags,
.page-content {
  max-width: 800px;
  margin: 3rem auto;
  padding: 0 2rem;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 2.5rem 0 1rem;
}

.post-content p {
  margin-bottom: 1.5rem;
}

.post-tags .tag {
  display: inline-block;
  background: var(--surface);
  color: var(--muted-foreground);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  text-decoration: none;
}

.post-tags .tag:hover {
  background: var(--surface-hover);
  color: var(--foreground);
}

/* ===== Posts grid & cards (bounded, responsive) ===== */
.posts-grid {
  display: grid;
  /* Keep cards at a pleasant width; center when 1–2 cards exist */
  grid-template-columns: repeat(auto-fit, minmax(280px, 360px));
  justify-content: center;
  gap: 20px;
  margin: 0 auto;
}

.post-card {
  width: 100%;
  max-width: 360px;           /* hard cap so one card never stretches full-width */
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
}

.post-card-image {
  width: 100%;
  /* crop consistently regardless of source image sizes */
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.post-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.post-card-title {
  font-size: 1.125rem;
  line-height: 1.3;
  margin: 0;
}

.post-card-title a {
  color: inherit;
  text-decoration: none;
}

.post-card-excerpt {
  margin: 0;
  color: #555;
  /* clamp to avoid runaway text making the card “massive” */
  display: -webkit-box;
  -webkit-line-clamp: 3;      /* ≈3 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  margin-top: auto;           /* pushes meta to bottom so cards match height */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #666;
}

.post-card-link { white-space: nowrap; }

/* Optional: tone down very long titles too */
.post-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;      /* ≈2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  color: var(--subtle);
  text-align: center;
  background: var(--surface);
}

/* Ghost content styles */
.kg-card {
  margin: 2rem auto;
}

.kg-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius);
}

.kg-width-wide {
  width: 85%;
}

.kg-width-full {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* Responsive design */
@media (max-width: 1100px) {
  .container,
  .wrap {
    padding: 0 1.5rem;
  }

  .hero-split{ grid-template-columns: 1fr clamp(180px, 28vw, 260px); }
  .hero-copy h1{ max-width: 28ch; }

  .hero-portrait {
    order: -1;
    max-width: 300px;
    margin: 0 auto;
  }

  .cred-wrap {
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
  }

  .posts-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

@media (max-width: 768px) {
  .container,
  .wrap {
    padding: 0 1rem;
  }

  .cf-grid {
    grid-template-columns: 1fr;
  }

  .cf-span-2 {
    grid-column: span 1;
  }

  .hero-ctas {
    justify-content: center;
  }

  .site-nav {
    display: none; /* Hide nav on mobile, could add hamburger menu */
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .contact-form {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .wrap {
    padding: 0 1rem;
  }

  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
  }

  .hero-ctas {
    flex-direction: column;
    align-items: center;
  }
}
@media (max-width: 900px){
  .hero-split{ grid-template-columns: 1fr; }
  .hero-portrait{ order: -1; justify-self: start; margin: 0 0 10px; }
  .hero-portrait img{ max-width: 220px; }
  .hero-copy h1{ max-width: none; }
}

/* Smooth animations */
@media (prefers-reduced-motion: no-preference) {
  * {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
}

/* Focus styles for accessibility */
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
