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

:root {
  --accent: #2b6777;
  --accent-light: #3d8a9c;
  --accent-dim: rgba(43, 103, 119, 0.08);
  --accent-border: rgba(43, 103, 119, 0.15);
  --bg: #f8f9fa;
  --bg-alt: #ffffff;
  --bg-card: #ffffff;
  --border: #e2e6ea;
  --border-light: #eef0f2;
  --text: #1a1a2e;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 1120px;
  --content-width: 720px;
  --section-padding: 100px 0;
  --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg);
  color: var(--text-secondary);
  line-height: 1.7;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  letter-spacing: -0.03em;
  font-weight: 700;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

p {
  max-width: 640px;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
  display: block;
}

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

section {
  padding: var(--section-padding);
}

/* ===== NAVIGATION ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1.25rem 0;
  transition: background-color 0.4s ease, box-shadow 0.4s ease, padding 0.4s ease;
}

.nav.scrolled {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 0.85rem 0;
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
  letter-spacing: 0.01em;
}

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

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: var(--transition);
  border-radius: 1px;
}

/* ===== BUTTONS ===== */
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.btn-outline svg {
  flex-shrink: 0;
}

/* ===== HERO ===== */
.hero {
  padding: 160px 0 80px;
  position: relative;
  overflow: hidden;
  background: var(--bg-alt);
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-light);
}

.hero-layout {
  display: flex;
  align-items: center;
  gap: 4rem;
}

.hero-photo {
  flex-shrink: 0;
}

.hero-photo img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent-border);
  box-shadow: 0 8px 30px rgba(43, 103, 119, 0.1);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-credentials {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero h1 {
  margin-bottom: 0.5rem;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero-title {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.75rem;
  max-width: 480px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  border: 1px solid var(--accent-border);
}

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

/* ===== BIO SECTION ===== */
.bio-section {
  background: var(--bg);
  position: relative;
}

.bio-content {
  max-width: var(--content-width);
}

.bio-content p {
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--text-secondary);
  max-width: 100%;
}

.bio-content p + p {
  margin-top: 1.25rem;
  color: var(--text-muted);
}

/* ===== LATEST ARTICLES / POSTS GRID ===== */
.latest-articles {
  position: relative;
  background: var(--bg-alt);
}

.latest-articles::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-light);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2.5rem;
}

.section-header .section-label {
  margin-bottom: 0;
}

.view-all {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  transition: color var(--transition);
}

.view-all:hover {
  color: var(--accent-light);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

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

.post-card {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}

.post-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.post-tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.post-date,
.post-read-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.post-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.post-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Post card with image */
.post-card.has-image {
  padding: 0;
  overflow: hidden;
}

.post-card.has-image .post-card-body {
  padding: 1.5rem 2rem 2rem;
}

.post-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.post-card:hover .post-card-image img {
  transform: scale(1.03);
}

/* Article feature image */
.article-feature-image {
  margin-bottom: 2.5rem;
  border-radius: 12px;
  overflow: hidden;
}

.article-feature-image img {
  width: 100%;
  height: auto;
  display: block;
}

.read-more {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: gap var(--transition);
}

.post-card:hover .read-more {
  gap: 0.6rem;
}

/* ===== PAGE HEADER ===== */
.page-header {
  padding: 160px 0 60px;
  position: relative;
  background: var(--bg-alt);
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-light);
}

.page-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 0.75rem;
}

.page-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 480px;
}

.error-page {
  text-align: center;
  padding: 200px 0 120px;
}

.error-page h1 {
  font-size: 6rem;
  color: var(--border);
  margin-bottom: 1rem;
}

/* ===== BLOG LISTING ===== */
.blog-listing {
  padding: 60px 0 100px;
}

.empty-state {
  text-align: center;
  padding: 4rem 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ===== ARTICLE / BLOG POST ===== */
.article {
  padding: 160px 0 80px;
}

.article .container {
  max-width: 800px;
}

.article-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.article-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.25;
  margin-bottom: 1.5rem;
  max-width: 100%;
}

.article-author {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-border);
}

.author-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.author-title {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== ARTICLE BODY (rendered HTML content) ===== */
.article-body {
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--text-secondary);
}

.article-body h2 {
  font-size: 1.6rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-top: 1rem;
}

.article-body h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article-body p {
  margin-bottom: 1.25rem;
  max-width: 100%;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(43, 103, 119, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color var(--transition);
}

.article-body a:hover {
  text-decoration-color: var(--accent);
}

.article-body ul,
.article-body ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

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

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--accent-dim);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text);
}

.article-body blockquote p {
  margin-bottom: 0;
}

.article-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: #f0f2f5;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent);
}

.article-body pre {
  background: #f0f2f5;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text);
}

.article-body img {
  border-radius: 8px;
  margin: 1.5rem 0;
}

/* Inset images — float alongside text */
.article-body figure {
  margin: 1.5rem 0;
}

.article-body figure img {
  border-radius: 8px;
  margin: 0;
}

.article-body figure figcaption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

.article-body figure.inset-right {
  float: right;
  width: 45%;
  margin: 0.5rem 0 1rem 2rem;
}

.article-body figure.inset-left {
  float: left;
  width: 45%;
  margin: 0.5rem 2rem 1rem 0;
}

.article-body figure.full-width {
  width: 100%;
  margin: 2rem 0;
}

.article-body figure.full-width img {
  width: 100%;
}

@media (max-width: 768px) {
  .article-body figure.inset-right,
  .article-body figure.inset-left {
    float: none;
    width: 100%;
    margin: 1.5rem 0;
  }
}

.article-body hr {
  border: none;
  height: 1px;
  background: var(--border-light);
  margin: 2rem 0;
}

.article-body strong {
  color: var(--text);
  font-weight: 600;
}

.article-body em {
  color: var(--text);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

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

.article-body th {
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
}

/* ===== ARTICLE FOOTER ===== */
.article-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.back-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  transition: color var(--transition);
}

.back-link:hover {
  color: var(--accent-light);
}

/* ===== FOOTER ===== */
.footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border-light);
  background: var(--bg-alt);
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.footer-brand {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.footer-title {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  color: var(--text-muted);
  transition: color var(--transition);
  display: flex;
  align-items: center;
}

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

.footer-links svg {
  width: 18px;
  height: 18px;
}

.footer-copy {
  font-size: 0.75rem;
  color: rgba(113, 128, 150, 0.5);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 968px) {
  :root {
    --section-padding: 80px 0;
  }

  .hero-layout {
    flex-direction: column;
    text-align: center;
    gap: 2.5rem;
  }

  .hero-title {
    margin-left: auto;
    margin-right: auto;
  }

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

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

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

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

@media (max-width: 768px) {
  :root {
    --section-padding: 64px 0;
  }

  .container {
    padding: 0 1.5rem;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    z-index: 999;
  }

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

  .nav-links a {
    font-size: 1.2rem;
    color: var(--text);
  }

  .nav-toggle {
    display: block;
    z-index: 1001;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .hero {
    padding: 120px 0 60px;
  }

  .hero-photo img {
    width: 150px;
    height: 150px;
  }

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

  .page-header {
    padding: 120px 0 40px;
  }

  .article {
    padding: 120px 0 60px;
  }

  .footer .container {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }

  .footer-left {
    align-items: center;
  }

  .footer-right {
    align-items: center;
  }
}

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

  h1 {
    font-size: 2.2rem;
  }

  .hero-photo img {
    width: 120px;
    height: 120px;
  }

  .post-card {
    padding: 1.5rem;
  }

  .article-body {
    font-size: 1rem;
  }
}
