/* ============================================
   Kiran Kadam — kirankadam.in
   Base stylesheet (mobile-first, dark mode)
   ============================================ */

/* CSS Custom Properties — Design Tokens */
:root {
  /* Colors */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #93c5fd;
  --accent: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Neutrals */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-rgb: 255, 255, 255;
  --surface-elevated: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --text-heading: #1e293b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 9999px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --max-width: 1200px;
  --header-height: 72px;

  /* Transitions */
  --transition: 0.2s ease-in-out;
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-rgb: 17, 24, 39;
  --surface-elevated: #1f2937;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-heading: #e2e8f0;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.35), 0 8px 10px -6px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}

img, picture, video, svg {
  display: block;
  max-width: 100%;
}

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

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

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1, h2, h3, h4, h5, h6, p {
  margin: 0;
}

h1, h2, h3, h4 {
  color: var(--text-heading);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

p {
  color: var(--text-muted);
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 9999;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

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

.section {
  padding: 4rem 0;
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 2.5rem;
}

.section-title {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background-color: rgba(var(--surface-rgb), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition), border-color var(--transition);
}

[data-theme="dark"] .site-header {
  background-color: rgba(var(--surface-rgb), 0.85);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

.brand-text {
  font-size: 1.25rem;
}

/* Navigation */
.primary-nav {
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  transform: translateX(100%);
  transition: transform var(--transition);
  z-index: 1001;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
}

.primary-nav.open {
  transform: translateX(0);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.nav-list a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: background-color var(--transition), color var(--transition);
}

.nav-list a:hover,
.nav-list a[aria-current="page"] {
  color: var(--primary);
  background-color: rgba(37, 99, 235, 0.08);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

body.nav-open {
  overflow: hidden;
}

/* Mobile Navigation */
.nav-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--text);
  border-radius: 2px;
  transition: transform var(--transition);
}

.hamburger {
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

body.nav-open .hamburger {
  background-color: transparent;
}

body.nav-open .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}

body.nav-open .hamburger::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Theme Toggle */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--text);
  transition: transform var(--transition);
}

.theme-toggle:hover {
  transform: scale(1.05);
}

.theme-icon {
  display: none;
}

[data-theme="light"] .theme-icon.moon,
[data-theme="dark"] .theme-icon.sun,
:root:not([data-theme="dark"]) .theme-icon.moon {
  display: block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  color: #fff;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-sm {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(37, 99, 235, 0.25);
}

.card-title {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  color: var(--text-heading);
}

.card-text {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 3.5rem 0 4rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 90% 10%, rgba(37, 99, 235, 0.12), transparent 35%),
              radial-gradient(circle at 10% 90%, rgba(14, 165, 233, 0.10), transparent 30%);
  z-index: -1;
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

.hero-content {
  max-width: 600px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 2.25rem;
  margin-bottom: 1rem;
}

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

.hero-subtitle {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  max-width: 520px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.hero-meta strong {
  color: var(--text-heading);
  display: block;
  font-size: 1.1rem;
}

.hero-visual {
  display: grid;
  place-items: center;
}

.hero-card {
  background: rgba(var(--surface-rgb), 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  width: 100%;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1.25rem;
  border: 4px solid rgba(37, 99, 235, 0.15);
  background: var(--bg);
}

.hero-search {
  margin-top: 1.5rem;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 0.9rem 1.25rem 0.9rem 2.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.hero-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.hero-search .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Category Cards */
.category-grid {
  display: grid;
  gap: 1.25rem;
}

.category-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.category-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.category-card h3 {
  font-size: 1.1rem;
}

.category-card p {
  font-size: 0.9rem;
}

/* Article Cards */
.article-grid {
  display: grid;
  gap: 1.5rem;
}

.article-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.article-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
}

.article-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.article-tag {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.6rem;
}

.article-title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.article-title a {
  color: var(--text-heading);
}

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

.article-excerpt {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  flex: 1;
}

.article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Tool / Tip Cards */
.tip-grid,
.tool-grid,
.download-grid {
  display: grid;
  gap: 1.25rem;
}

.tip-card h3,
.tool-card h3,
.download-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

/* Newsletter */
.newsletter {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  color: #fff;
  text-align: center;
}

.newsletter h2 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.newsletter p {
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1.5rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
}

.newsletter-form input {
  flex: 1;
  padding: 0.9rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}

.newsletter-form input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.newsletter-form input:focus {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.newsletter-form .btn {
  background: #fff;
  color: var(--primary);
}

.newsletter-form .btn:hover {
  color: var(--primary-dark);
}

/* Testimonials */
.testimonial-grid {
  display: grid;
  gap: 1.5rem;
}

.testimonial-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.testimonial-card blockquote {
  margin: 0 0 1rem;
  font-style: italic;
  color: var(--text);
}

.testimonial-card cite {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: normal;
  font-weight: 600;
}

/* Footer */
.site-footer {
  background: var(--surface-elevated);
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.5rem;
}

.footer-grid {
  display: grid;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand p {
  margin-top: 0.75rem;
  max-width: 320px;
}

.footer-heading {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-heading);
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

.social-links {
  display: flex;
  gap: 0.75rem;
}

.social-links a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition), transform var(--transition);
}

.social-links a:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Back to Top */
.back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 1rem 0;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--border);
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

/* Article Page */
.article-hero {
  padding: 2.5rem 0 2rem;
}

.article-content {
  max-width: 760px;
  margin: 0 auto;
}

.article-content h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem;
  color: var(--text-heading);
}

.article-content h3 {
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
  color: var(--text-heading);
}

.article-content p {
  margin-bottom: 1rem;
}

.article-content ul,
.article-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  list-style: disc;
  color: var(--text-muted);
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content img {
  border-radius: var(--radius);
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

/* Table of Contents */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.toc h2 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: 0.4rem;
}

.toc a {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

/* Share Buttons */
.share-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Code Blocks */
pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  position: relative;
}

code {
  font-family: var(--font-mono);
}

.copy-code {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
}

.copy-code:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Tablet */
@media (min-width: 640px) {
  .hero-title {
    font-size: 2.75rem;
  }

  .section-title {
    font-size: 2rem;
  }

  .newsletter-form {
    flex-direction: row;
  }
}

/* Desktop */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  .primary-nav {
    position: static;
    flex-direction: row;
    width: auto;
    background: transparent;
    border: none;
    padding: 0;
    transform: none;
  }

  .nav-list {
    flex-direction: row;
    gap: 0.25rem;
  }

  .hero-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tip-grid,
  .tool-grid,
  .download-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .testimonial-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (min-width: 1024px) {
  .hero-title {
    font-size: 3.25rem;
  }

  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .article-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .tip-grid,
  .tool-grid,
  .download-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .testimonial-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
