/* ============================================================
   BLOG LAYOUT — visual language borrowed from fizaankhan.com.
   Colours and fonts come exclusively from theme.css variables.
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(48rem, 100% - 3rem);
  margin-inline: auto;
}

a { color: var(--text); text-decoration-color: var(--grey-400); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; }

/* ---------- header (blog landing) ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 3.75rem;
}

.brand {
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05rem;
  margin-right: auto;   /* pins the rest to the right edge */
}

.header-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

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

.header-links a:hover { color: var(--text); }

.theme-toggle {
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1;
  padding: 0.45rem 0.55rem;
  transition: border-color 0.15s ease;
}

.theme-toggle:hover { border-color: var(--border); }

/* ---------- hero ---------- */

.hero { padding-block: 5rem 2.5rem; }

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 700;
}

.hero .tagline {
  margin-top: 1rem;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 38em;
}

/* ---------- post previews ---------- */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 3.5rem;
}

.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.6rem 1.8rem;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.post-card:hover { border-color: var(--grey-400); transform: translateY(-2px); }

.post-card .date {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.post-card h2 { font-size: 1.3rem; margin-top: 0.35rem; }

.post-card .summary { color: var(--text-muted); font-size: 0.95rem; margin-top: 0.5rem; }

.post-card .read-more {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.88rem;
  font-weight: 500;
}

/* ---------- post page ---------- */

/* iOS-style back chevron, pinned top-left */
.back-arrow {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.back-arrow:hover {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.back-arrow svg { width: 1.3rem; height: 1.3rem; }

/* floating theme toggle, top-right, mirrors the back arrow */
.post-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
}

.post { padding-block: 6rem 4rem; }

.post-header h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); }

.post-header .date {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- markdown body ---------- */

.post-body { margin-top: 2.5rem; }

.post-body h2 { font-size: 1.45rem; margin: 2.2em 0 0.6em; }
.post-body h3 { font-size: 1.15rem; margin: 1.8em 0 0.5em; }
.post-body p { margin-block: 1.1em; }
.post-body ul, .post-body ol { margin: 1.1em 0 1.1em 1.4em; }
.post-body li + li { margin-top: 0.35em; }

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.35em 1.2em;
  margin-block: 1.4em;
  color: var(--text-muted);
  font-style: italic;
}

.post-body code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.3em;
  padding: 0.1em 0.4em;
}

.post-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  margin-block: 1.4em;
}

.post-body pre code { background: none; border: none; padding: 0; }

.post-body img {
  max-width: 100%;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: 2.5em;
}

.post-body a { text-decoration: underline; }

/* error / empty states */
.notice { color: var(--text-muted); padding-block: 2rem; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }

/* ---------- responsive ---------- */

@media (max-width: 40rem) {
  .hero { padding-block: 3.5rem 2rem; }
  .post { padding-block: 5rem 3rem; }
  .post-card { padding: 1.3rem 1.4rem; }
}
