/* ========================================
   DevPulse — Tech/Dev Blog
   Editorial · Readable · Content-first
   Playfair Display (headings) + Inter (body)
   Terracotta accent (#c75c2e) on warm off-white
   ======================================== */

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

/* === Custom Properties === */
:root {
  --bg:       #faf9f6;
  --surface:  #ffffff;
  --border:   #e5e2dd;
  --ink:      #1a1a1a;
  --muted:    #6b6b6b;
  --accent:   #c75c2e;
  --accent-hover:#a94a22;
  --accent-dim:rgba(199, 92, 46, 0.08);
  --green:    #2d8a4e;
  --blue:     #2563eb;

  /* Typography scale (1.250 — Major Third) */
  --fs-xs:    0.8rem;
  --fs-sm:    0.875rem;
  --fs-base:  1rem;
  --fs-md:    1.125rem;
  --fs-lg:    1.25rem;
  --fs-xl:    1.563rem;
  --fs-2xl:   1.953rem;
  --fs-3xl:   2.441rem;
  --fs-4xl:   3.052rem;

  /* Spacing */
  --sp-xs:    0.375rem;
  --sp-sm:    0.5rem;
  --sp-md:    1rem;
  --sp-lg:    1.5rem;
  --sp-xl:    2rem;
  --sp-2xl:   3rem;
  --sp-3xl:   4.5rem;

  /* Layout */
  --max-w:    768px;
  --article-w:680px;
  --radius:   6px;

  /* Transitions */
  --ease:     cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --speed:    0.25s;
}

/* === Base === */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }
ul  { list-style: none; }

/* === Layout === */
.container {
  width: min(90%, var(--max-w));
  margin-inline: auto;
}

.container-wide {
  width: min(92%, 1000px);
  margin-inline: auto;
}

.section {
  padding: var(--sp-3xl) 0;
}

/* === Header === */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

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

.logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.logo span { color: var(--accent); }

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-xl);
}

.nav-link {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  transition: color var(--speed) var(--ease);
}
.nav-link:hover,
.nav-link.active { color: var(--ink); }

/* Hamburger */
.hamburger {
  display: none;
  background: none;
  border: none;
  width: 24px;
  height: 18px;
  position: relative;
}
.hamburger span {
  display: block;
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: var(--speed) var(--ease);
}
.hamburger span:nth-child(1) { inset-block-start: 0; }
.hamburger span:nth-child(2) { inset-block-start: 50%; transform: translateY(-50%); }
.hamburger span:nth-child(3) { inset-block-end: 0; }
.hamburger.open span:nth-child(1) { inset-block-start: 50%; transform: translateY(-50%) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { inset-block-end: auto; inset-block-start: 50%; transform: translateY(-50%) rotate(-45deg); }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--speed) var(--ease);
  text-align: center;
  font-family: 'Inter', sans-serif;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-weight: 600;
}
.btn-ghost i { transition: transform var(--speed) var(--ease); }
.btn-ghost:hover i { transform: translateX(3px); }

/* === Hero (Home) === */
.hero {
  padding: var(--sp-3xl) 0;
  border-bottom: 1px solid var(--border);
}

.hero-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--sp-md);
}

.hero h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.2rem, 5vw, var(--fs-4xl));
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-md);
}

.hero-excerpt {
  font-size: var(--fs-md);
  color: var(--muted);
  max-width: 560px;
  margin-bottom: var(--sp-lg);
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.hero-meta .dot {
  width: 3px;
  height: 3px;
  background: var(--muted);
  border-radius: 50%;
}

/* === Category Tags === */
.tag {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
}
.tag-frontend   { background: rgba(37, 99, 235, 0.08); color: var(--blue); }
.tag-css        { background: rgba(199, 92, 46, 0.08); color: var(--accent); }
.tag-devops     { background: rgba(45, 138, 78, 0.08); color: var(--green); }
.tag-career     { background: rgba(120, 80, 180, 0.08); color: #7850b4; }
.tag-javascript { background: rgba(200, 160, 0, 0.08); color: #8a7000; }

/* === Post Grid === */
.post-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-xl);
}

.post-grid-header h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-2xl);
  font-weight: 700;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-xl);
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-xl);
  transition: all var(--speed) var(--ease);
}
.post-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.post-card .tag { margin-bottom: var(--sp-md); }

.post-card h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--sp-sm);
}

.post-card h3 a {
  transition: color var(--speed) var(--ease);
}
.post-card h3 a:hover { color: var(--accent); }

.post-card-excerpt {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.6;
  margin-bottom: var(--sp-md);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.post-card-meta .dot {
  width: 3px;
  height: 3px;
  background: var(--muted);
  border-radius: 50%;
}

/* === Article Layout === */
.article-header {
  padding: var(--sp-3xl) 0 var(--sp-xl);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-2xl);
}

.article-header .tag { margin-bottom: var(--sp-md); }

.article-header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2rem, 4.5vw, var(--fs-4xl));
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-lg);
  max-width: var(--article-w);
}

.article-byline {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--accent);
}

/* Article body */
.article-body {
  max-width: var(--article-w);
  margin-inline: auto;
  padding-bottom: var(--sp-3xl);
}

.article-body h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-top: var(--sp-2xl);
  margin-bottom: var(--sp-md);
  line-height: 1.25;
}

.article-body h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-top: var(--sp-xl);
  margin-bottom: var(--sp-md);
  line-height: 1.3;
}

.article-body p {
  font-size: var(--fs-md);
  line-height: 1.8;
  margin-bottom: var(--sp-lg);
  color: #2a2a2a;
}

.article-body strong { color: var(--ink); }

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: var(--sp-md) var(--sp-lg);
  margin: var(--sp-xl) 0;
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-body blockquote p {
  font-style: italic;
  color: var(--ink);
  margin-bottom: 0;
}

.article-body ul,
.article-body ol {
  margin-bottom: var(--sp-lg);
  padding-left: var(--sp-xl);
}

.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }

.article-body li {
  font-size: var(--fs-md);
  line-height: 1.8;
  margin-bottom: var(--sp-sm);
  color: #2a2a2a;
}

.article-body code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9em;
  background: var(--accent-dim);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--accent);
}

.article-body pre {
  background: #1a1a1a;
  color: #e8ecf4;
  padding: var(--sp-lg);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: var(--sp-lg);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* === Related Posts === */
.related-posts {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-2xl);
}

.related-posts h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-bottom: var(--sp-xl);
}

/* === Category Page === */
.category-header {
  padding: var(--sp-2xl) 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-2xl);
}

.category-header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-3xl);
  font-weight: 700;
  margin-bottom: var(--sp-sm);
}

.category-header p {
  color: var(--muted);
  font-size: var(--fs-md);
}

/* Post list (for category/archive) */
.post-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xl);
}

.post-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-xl);
  align-items: start;
  padding-bottom: var(--sp-xl);
  border-bottom: 1px solid var(--border);
}

.post-list-item:last-child { border-bottom: none; }

.post-list-item h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--sp-sm);
}

.post-list-item h3 a:hover { color: var(--accent); }

.post-list-item p {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.6;
  margin-bottom: var(--sp-sm);
}

.post-list-meta {
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* === About Page === */
.about-hero {
  padding: var(--sp-3xl) 0;
}

.about-hero h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: var(--sp-lg);
  max-width: 560px;
}

.about-hero p {
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1.7;
  max-width: 560px;
  margin-bottom: var(--sp-md);
}

.about-section {
  padding: var(--sp-2xl) 0;
  border-top: 1px solid var(--border);
}

.about-section h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-bottom: var(--sp-lg);
}

.about-section p {
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1.7;
  margin-bottom: var(--sp-md);
  max-width: 600px;
}

.about-values {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-xl);
  margin-top: var(--sp-xl);
}

.about-value h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: var(--sp-sm);
}

.about-value p {
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* === Contact Page === */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2xl);
  padding: var(--sp-3xl) 0;
}

.contact-section h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: var(--sp-md);
}

.contact-section > p {
  color: var(--muted);
  font-size: var(--fs-md);
  margin-bottom: var(--sp-xl);
  line-height: 1.7;
}

.form-group {
  margin-bottom: var(--sp-lg);
}

.form-group label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--sp-xs);
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-sm);
  color: var(--ink);
  outline: none;
  transition: border-color var(--speed) var(--ease);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group textarea { resize: vertical; min-height: 120px; }

.form-group .error-msg {
  font-size: var(--fs-xs);
  color: #dc2626;
  margin-top: 4px;
  display: none;
}

.form-group.has-error input,
.form-group.has-error textarea {
  border-color: #dc2626;
}
.form-group.has-error .error-msg { display: block; }

.form-success {
  background: rgba(45, 138, 78, 0.08);
  border: 1px solid rgba(45, 138, 78, 0.2);
  border-radius: var(--radius);
  padding: var(--sp-md);
  color: var(--green);
  font-size: var(--fs-sm);
  text-align: center;
  display: none;
}

/* Newsletter */
.newsletter-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-xl);
}

.newsletter-box h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-bottom: var(--sp-sm);
}

.newsletter-box p {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-lg);
  line-height: 1.6;
}

.newsletter-form {
  display: flex;
  gap: var(--sp-sm);
}

.newsletter-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-sm);
  outline: none;
}
.newsletter-form input:focus { border-color: var(--accent); }

.newsletter-success {
  color: var(--green);
  font-size: var(--fs-sm);
  margin-top: var(--sp-md);
  display: none;
}

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--sp-xl) 0;
  margin-top: var(--sp-2xl);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: var(--sp-lg);
}
.footer-links a {
  color: var(--muted);
  transition: color var(--speed) var(--ease);
}
.footer-links a:hover { color: var(--ink); }

/* === Scroll Reveal === */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === Responsive === */
@media (max-width: 768px) {
  .main-nav {
    position: fixed;
    inset: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-xl);
    transform: translateX(100%);
    transition: transform var(--speed) var(--ease);
    z-index: 100;
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav .nav-link { font-size: var(--fs-xl); }
  .hamburger { display: block; }

  .section { padding: var(--sp-2xl) 0; }
  .post-grid { grid-template-columns: 1fr; }
  .contact-layout { grid-template-columns: 1fr; }
  .post-list-item { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: var(--sp-md); text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
