/* ============================================================
   Suresh Naidu — personal site & blog
   A clean, editorial theme. Light/dark, responsive, no framework.
   ============================================================ */

:root {
  --bg: #fbf9f4;
  --surface: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #ece7dc;
  --accent: #b4531f;      /* warm terracotta */
  --accent-soft: #f4e6dc;
  --code-bg: #f5f2ec;
  --shadow: 0 1px 2px rgba(31,36,48,.04), 0 8px 24px rgba(31,36,48,.06);
  --maxw: 1080px;
  --readw: 720px;
  --radius: 14px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-head: 'Fraunces', Georgia, 'Times New Roman', serif;
}

:root[data-theme="dark"] {
  --bg: #14161c;
  --surface: #1c1f27;
  --text: #e8eaf0;
  --muted: #9aa1b1;
  --border: #2a2e39;
  --accent: #e0793f;
  --accent-soft: #2a2019;
  --code-bg: #21252f;
  --shadow: 0 1px 2px rgba(0,0,0,.2), 0 12px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }

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

img { max-width: 100%; height: auto; border-radius: 10px; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(180%) blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { font-family: var(--font-head); font-weight: 600; font-size: 1.2rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { color: var(--muted); font-size: .95rem; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }

.theme-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 1rem;
  display: grid; place-items: center; transition: transform .15s ease;
}
.theme-toggle:hover { transform: scale(1.06); }

/* ---------- Hero ---------- */
.hero { padding: 74px 0 40px; }
.hero-inner { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 0 0 14px; }
.hero .accent { color: var(--accent); }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 560px; margin: 0 0 22px; }
.hero .tags { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-size: .8rem; font-weight: 500; color: var(--text);
  background: var(--accent-soft); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px;
}
.avatar {
  width: 132px; height: 132px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-head); font-size: 3rem;
  color: #fff; background: linear-gradient(135deg, var(--accent), #6d3410);
  box-shadow: var(--shadow);
}

/* ---------- Section headings ---------- */
.section { padding: 30px 0 60px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 26px; }
.section-head h2 { font-size: 1.7rem; margin: 0; }
.section-head a { font-size: .92rem; font-weight: 500; }

/* ---------- Post cards ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 34px rgba(31,36,48,.12); text-decoration: none; }
.card-cover { aspect-ratio: 16/9; width: 100%; object-fit: cover; border-radius: 0; }
.card-cover.placeholder { background: linear-gradient(135deg, var(--accent-soft), var(--border)); }
.card-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-meta { font-size: .82rem; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.card h3 { margin: 0; font-size: 1.28rem; color: var(--text); }
.card p { margin: 0; color: var(--muted); font-size: .96rem; }
.card .tags { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .74rem; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 6px; }

/* ---------- Search / filter bar ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.search {
  flex: 1; min-width: 220px; padding: 12px 16px; font-size: .98rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text);
}
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Article page ---------- */
.article { max-width: var(--readw); margin: 0 auto; padding: 40px 0 80px; }
.article-header { margin-bottom: 34px; }
.article-header h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); margin: 0 0 14px; }
.article-meta { color: var(--muted); font-size: .92rem; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.article-cover { width: 100%; aspect-ratio: 16/8; object-fit: cover; border-radius: var(--radius); margin: 8px 0 34px; }
.prose { font-size: 1.08rem; }
.prose > * + * { margin-top: 1.25em; }
.prose h2 { font-size: 1.7rem; margin-top: 1.9em; }
.prose h3 { font-size: 1.35rem; margin-top: 1.6em; }
.prose img { display: block; margin: 1.6em auto; box-shadow: var(--shadow); }
.prose figure { margin: 1.8em 0; text-align: center; }
.prose figcaption { color: var(--muted); font-size: .88rem; margin-top: .6em; }
.prose blockquote {
  border-left: 3px solid var(--accent); padding: 4px 0 4px 20px; margin: 1.6em 0;
  color: var(--muted); font-style: italic;
}
.prose code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--code-bg); padding: 2px 6px; border-radius: 5px; font-size: .88em;
}
.prose pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; overflow-x: auto; font-size: .9rem; line-height: 1.6;
}
.prose pre code { background: none; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.4em 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .92rem; margin-bottom: 24px; }

/* ---------- About block ---------- */
.about { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 34px; box-shadow: var(--shadow); }
.about h2 { margin-top: 0; }
.about ul { padding-left: 20px; color: var(--muted); }
.about li { margin: 6px 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; align-items: center; }
.social { display: flex; gap: 18px; }
.social a { color: var(--muted); }
.social a:hover { color: var(--accent); text-decoration: none; }

/* ---------- Admin editor ---------- */
.admin-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 30px 0 70px; }
.editor-panel, .preview-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; font-size: .96rem; font-family: var(--font-body);
  background: var(--bg); border: 1px solid var(--border); border-radius: 9px; color: var(--text);
}
.field textarea { min-height: 340px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .9rem; line-height: 1.6; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--accent); color: #fff; border: none; font-weight: 600; font-size: .95rem;
  padding: 12px 20px; border-radius: 10px; transition: filter .15s ease;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.hint { font-size: .84rem; color: var(--muted); margin-top: 10px; }
.hint code { background: var(--code-bg); padding: 1px 6px; border-radius: 5px; }

/* ---------- Utility ---------- */
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }

@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; }
  .avatar { display: none; }
  .admin-wrap { grid-template-columns: 1fr; }
}
