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

:root {
  --color-bg: #ffffff;
  --color-text: #1a1a2e;
  --color-text-muted: #555;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-accent: #f59e0b;
  --color-surface: #f8fafc;
  --color-border: #e2e8f0;
  --color-hero-bg: #0f172a;
  --color-hero-text: #f1f5f9;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 1080px;
  --max-width-prose: 720px;
}

html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

img { max-width: 100%; height: auto; }

/* === Header === */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
}
.site-nav { display: flex; gap: 1.5rem; }
.site-nav a {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.15s;
}
.site-nav a:hover, .site-nav a.active { color: var(--color-primary); }

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
  border: 2px solid transparent;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  text-decoration: none;
}
.btn-secondary {
  background: var(--color-accent);
  color: var(--color-text);
}
.btn-secondary:hover {
  filter: brightness(1.1);
  text-decoration: none;
}
.btn-outline {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: transparent;
}
.btn-outline:hover {
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
}

/* === Hero === */
.hero {
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  padding: 5rem 0;
  text-align: center;
}
.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.2;
  max-width: 800px;
  margin: 0 auto 1.5rem;
}
.hero-sub {
  font-size: 1.2rem;
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto 2.5rem;
  opacity: 0.9;
}
.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* === Sections === */
section { padding: 4rem 0; }
section:nth-child(even) { background: var(--color-surface); }

section h2 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* === Card Grid === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem;
}
.card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}
.card p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* === Check List === */
.check-list {
  list-style: none;
  max-width: var(--max-width-prose);
}
.check-list li {
  padding: 0.5rem 0 0.5rem 2rem;
  position: relative;
  font-size: 1.05rem;
}
.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 700;
}

/* === Try It / CTA sections === */
.try-it {
  text-align: center;
}
.try-it p {
  max-width: var(--max-width-prose);
  margin: 0 auto 1.5rem;
  font-size: 1.1rem;
}

/* === Book Details === */
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}
.details-grid ul {
  margin: 1rem 0;
  padding-left: 1.25rem;
}
.details-grid li {
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
}
.book-buy {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
}
.book-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.book-subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}
.book-author {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}
.book-rating {
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.book-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}
.book-note {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

/* === Blog === */
.section-intro {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  max-width: var(--max-width-prose);
}
.post-list {
  display: grid;
  gap: 2rem;
  margin-bottom: 2rem;
}
.post-card {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 2rem;
}
.post-card h2, .post-card h3 {
  margin-bottom: 0.25rem;
}
.post-card h2 a, .post-card h3 a {
  color: var(--color-text);
  text-decoration: none;
}
.post-card h2 a:hover, .post-card h3 a:hover {
  color: var(--color-primary);
}
.post-card time {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 0.75rem;
}
.post-card p { color: var(--color-text-muted); }

/* === Blog Post === */
.blog-post { padding: 3rem 0; }
.post-header { margin-bottom: 2rem; }
.post-header h1 {
  font-size: 2.2rem;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}
.post-header time {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.post-tags {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tag {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.post-body {
  max-width: var(--max-width-prose);
}
.post-body h2 { font-size: 1.5rem; margin: 2.5rem 0 1rem; }
.post-body h3 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }
.post-body p { margin-bottom: 1.25rem; }
.post-body ul, .post-body ol { margin: 1rem 0 1.25rem 1.5rem; }
.post-body li { margin-bottom: 0.5rem; }
.post-body blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--color-surface);
  font-style: italic;
}
.post-body code {
  background: var(--color-surface);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9rem;
}
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
.post-body th, .post-body td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.post-body th { background: var(--color-surface); font-weight: 600; }

.post-footer { margin-top: 3rem; }
.post-cta {
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
}
.post-cta h3 { margin-bottom: 0.75rem; }
.post-cta p { margin-bottom: 1.5rem; opacity: 0.9; }
.post-cta .btn { margin: 0 0.5rem; }

/* === Page Content === */
.page-content { padding: 3rem 0; }
.page-content h1 {
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
}
.page-content .container {
  max-width: var(--max-width-prose);
}
.page-content p { margin-bottom: 1.25rem; }
.page-content ul, .page-content ol { margin: 1rem 0 1.25rem 1.5rem; }
.page-content li { margin-bottom: 0.5rem; }
.page-content h2 { font-size: 1.5rem; margin: 2.5rem 0 1rem; }
.page-content h3 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }
.page-content blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--color-surface);
}
.page-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
.page-content th, .page-content td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.page-content th { background: var(--color-surface); font-weight: 600; }

/* === Latest Posts on Home === */
.latest-posts { text-align: center; }
.latest-posts .post-list { text-align: left; }
.latest-posts .btn-outline { margin-top: 1rem; }

/* === Footer === */
.site-footer {
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.site-footer a {
  color: var(--color-hero-text);
  opacity: 0.8;
}
.site-footer a:hover { opacity: 1; }
.footer-bottom {
  font-size: 0.85rem;
  opacity: 0.6;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  .hero { padding: 3rem 0; }
  .hero h1 { font-size: 1.8rem; }
  .details-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .hero-cta { flex-direction: column; align-items: center; }
  .post-cta .btn { display: block; margin: 0.5rem auto; }
}
