/* ============================================================
   BLOG · Frostbond Chronicles
   Sparrow Hawk · Frost Theme · Standalone reading page
   ============================================================ */

:root {
  --bg-dark: #060a0d;
  --bg-panel: #0a0e12;
  --text-primary: #eef4f8;
  --text-secondary: #c0d0dc;
  --text-body: #c8d4dc;
  --text-dim: #8a9aaa;
  --text-muted: #6a7a8a;

  --red: #5a8ab8;
  --orange: #80b8d8;
  --yellow: #b8d8e8;
  --green: #a8d8e0;
  --blue: #6090c8;
  --indigo: #8a8ab8;
  --violet: #b8a8d8;

  --accent: #80b8d8;
  --accent-light: #a8d8f0;
  --accent-border: rgba(128, 184, 216, 0.4);
  --violet-border: rgba(184, 168, 216, 0.35);

  --reading-width: 72ch;
  --white-dim: rgba(238, 244, 248, 0.45);
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(ellipse 1200px 800px at 10% -10%, rgba(96, 144, 200, 0.08), transparent 60%),
    radial-gradient(ellipse 1000px 700px at 100% 100%, rgba(184, 168, 216, 0.06), transparent 60%);
  background-attachment: fixed;
  color: var(--text-body);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 300;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJmIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iLjc0IiBudW1PY3RhdmVzPSIzIiAvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNmKSIgb3BhY2l0eT0iMC4wMzAiIC8+PC9zdmc+');
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   HERO
   ============================================================ */
.blog-hero {
  position: relative;
  z-index: 2;
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 5rem 2rem 1.5rem;
  text-align: center;
}
.blog-hero .kicker {
  font-size: 0.55rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.blog-hero h1 {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 1px;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  background: linear-gradient(90deg, var(--red), var(--orange), var(--yellow), var(--green), var(--blue), var(--indigo), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.blog-hero .subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1rem;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.hero-image {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  margin: 1.5rem auto 0;
  border-radius: 12px;
  border: 1px solid rgba(128, 184, 216, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   TABLE OF CONTENTS
   ============================================================ */
.toc {
  position: relative;
  z-index: 2;
  max-width: var(--reading-width);
  margin: 2.5rem auto 0;
  padding: 1.5rem 2rem;
}
.toc-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 1rem;
}
.toc ol {
  list-style: none;
  counter-reset: toc;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1.5rem;
}
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.3rem 0;
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px dotted rgba(128, 184, 216, 0.15);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.toc a::before {
  content: counter(toc, upper-roman);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--violet);
  flex-shrink: 0;
  min-width: 1.4rem;
}
.toc a:hover {
  color: var(--accent-light);
  border-bottom-color: var(--accent-border);
}

/* ============================================================
   ARTICLE BODY
   ============================================================ */
article.post {
  position: relative;
  z-index: 2;
  max-width: var(--reading-width);
  margin: 2.5rem auto 0;
  padding: 0 2rem;
}

article.post + article.post {
  margin-top: 5rem;
  padding-top: 3.5rem;
  border-top: 1px solid rgba(128, 184, 216, 0.08);
}

article.post h2 {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 400;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  margin-bottom: 1.2rem;
}

article.post h3 {
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-light);
  margin: 2rem 0 0.8rem;
}

article.post p {
  font-size: 0.92rem;
  line-height: 1.85;
  color: var(--text-body);
  margin-bottom: 1.1rem;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

article.post p:first-of-type::first-letter {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3.2rem;
  font-weight: 400;
  float: left;
  line-height: 0.8;
  padding: 0.15rem 0.4rem 0 0;
  color: var(--violet);
}

article.post strong {
  color: var(--text-primary);
  font-weight: 500;
}

article.post em {
  color: var(--accent-light);
  font-style: italic;
}

article.post .highlight {
  color: var(--violet);
  font-style: italic;
  border-bottom: 1px solid var(--violet-border);
}

article.post ul {
  list-style: none;
  padding-left: 0;
  margin: 1rem 0 1.5rem;
}
article.post ul li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-body);
}
article.post ul li::before {
  content: "❄";
  position: absolute;
  left: 0;
  top: 0.05rem;
  color: var(--violet);
  font-size: 0.75rem;
  opacity: 0.8;
}

/* ============================================================
   BLOCKQUOTE / PULL QUOTE
   ============================================================ */
article.post blockquote {
  margin: 2rem 0;
  padding: 1.2rem 1.5rem;
  border-left: 2px solid var(--violet-border);
  background: rgba(184, 168, 216, 0.04);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--accent-light);
  text-align: left;
  border-radius: 0 6px 6px 0;
}

/* ============================================================
   LINKS
   ============================================================ */
article.post a,
article.post a:visited {
  color: var(--accent-light);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-border);
  transition: color 0.2s ease, border-color 0.2s ease;
}
article.post a:hover {
  color: var(--violet);
  border-bottom-color: var(--violet-border);
}

/* ============================================================
   DONATE CTA
   ============================================================ */
.donate-wrap {
  position: relative;
  z-index: 2;
  max-width: var(--reading-width);
  margin: 4rem auto 0;
  padding: 3rem 2rem;
  text-align: center;
  border-top: 1px solid rgba(128, 184, 216, 0.08);
  border-bottom: 1px solid rgba(128, 184, 216, 0.08);
}
.donate-wrap p {
  font-size: 0.85rem;
  color: var(--text-dim);
  max-width: 48ch;
  margin: 0 auto 1.5rem;
}
.donate-button {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-primary);
  background: rgba(184, 168, 216, 0.06);
  border: 1px solid var(--violet-border);
  padding: 0.9rem 2.6rem;
  border-radius: 50px;
  text-decoration: none;
  transition: all 0.3s ease;
}
.donate-button:hover {
  background: rgba(184, 168, 216, 0.14);
  border-color: rgba(184, 168, 216, 0.55);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(184, 168, 216, 0.15);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  position: relative;
  z-index: 2;
  max-width: var(--reading-width);
  margin: 3rem auto 0;
  padding: 2rem 2rem 4rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.55rem;
  letter-spacing: 1px;
  border-top: 1px solid rgba(128, 184, 216, 0.06);
}
.footer .social-media {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}
.social-icon {
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: color 0.25s ease, transform 0.25s ease;
  text-decoration: none;
}
.social-icon:hover {
  color: var(--accent-light);
  transform: translateY(-2px);
}

/* ============================================================
   READING PROGRESS BAR (top of viewport, no header offset)
   ============================================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
  z-index: 49;
  pointer-events: none;
}
.reading-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  box-shadow: 0 0 8px rgba(128, 184, 216, 0.4);
  transition: width 0.1s linear;
}

/* ============================================================
   BACK TO TOP
   ============================================================ */
#backToTop {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: rgba(6, 10, 13, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--accent-light);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
#backToTop.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
#backToTop:hover {
  background: var(--accent);
  color: var(--bg-dark);
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(128, 184, 216, 0.4);
}
#backToTop i { font-size: 0.9rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .blog-hero { padding: 3rem 1.2rem 1rem; }
  .toc { padding: 1rem 1.2rem; }
  .toc ol { grid-template-columns: 1fr; }
  article.post { padding: 0 1.2rem; }
  article.post + article.post { margin-top: 3.5rem; padding-top: 2.5rem; }
  .donate-wrap { padding: 2rem 1.2rem; }
  .footer { padding: 1.5rem 1.2rem 3rem; }
}

@media (max-width: 480px) {
  body { line-height: 1.7; }
  .blog-hero { padding: 2.5rem 1rem 0.8rem; }
  article.post p { font-size: 0.88rem; text-align: left; }
  article.post p:first-of-type::first-letter { font-size: 2.4rem; }
  article.post ul li { font-size: 0.86rem; }
  article.post blockquote { font-size: 0.95rem; padding: 1rem 1.2rem; }
  .donate-button { font-size: 0.6rem; padding: 0.8rem 2rem; letter-spacing: 2px; }
  #backToTop { width: 38px; height: 38px; bottom: 16px; right: 16px; }
}

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