/* ==========================================================================
   Period Tracker: Cycle & Baby - blog pages (blog.php, post.php)
   Loaded after style.css; the cards themselves are styled there because the
   home page uses them too.
   ========================================================================== */

.blog-page {
  padding-top: var(--header-h);
}

/* ── Listing hero ─────────────────────────────────────────────────────── */
.blog-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(48px, 7vw, 88px) 0;
  background: var(--brand-gradient);
  text-align: center;
  color: var(--white);
}

.blog-hero .eyebrow {
  color: #ffe3ec;
}

.blog-hero h1 {
  max-width: 44rem;
  margin: 0 auto 1rem;
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--white);
  text-wrap: balance;
}

.blog-hero p {
  max-width: 40rem;
  margin-inline: auto;
  font-size: 1.12rem;
  color: rgba(255, 255, 255, 0.97);
}

.blog-list-section {
  padding-block: clamp(48px, 7vw, 88px);
  background: var(--rose-50);
}

/* ── Empty / not-found state ──────────────────────────────────────────── */
.blog-empty {
  max-width: 32rem;
  margin-inline: auto;
  padding: clamp(40px, 6vw, 64px) 24px;
  border: 1px dashed var(--rose-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  text-align: center;
}

.blog-empty--page {
  margin-block: clamp(48px, 8vw, 96px);
}

.blog-empty > .icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: var(--rose-400);
  stroke-width: 1.5;
}

.blog-empty h2 {
  margin-bottom: 0.5rem;
  font-size: 1.6rem;
}

.blog-empty .btn {
  margin-top: 1.4rem;
}

/* ── Pagination ───────────────────────────────────────────────────────── */
.blog-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 44px;
}

.blog-pagination a {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding-inline: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  font-family: var(--font-head);
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.blog-pagination a:hover,
.blog-pagination a.active {
  border-color: var(--rose-600);
  background: var(--rose-600);
  color: var(--white);
  text-decoration: none;
}

/* ── Single post: head ────────────────────────────────────────────────── */
.preview-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 12px var(--gutter);
  background: #fff4d6;
  font-size: 0.95rem;
  color: #6b4a00;
}

.preview-banner .icon {
  width: 1.2rem;
  height: 1.2rem;
}

.blog-post-head {
  padding: clamp(28px, 4vw, 48px) 0 clamp(28px, 4vw, 44px);
  background: var(--rose-50);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-head);
  font-weight: 600;
}

.back-link .icon {
  width: 1.1rem;
  height: 1.1rem;
  stroke-width: 2.2;
}

.blog-post-head-inner {
  max-width: 52rem;
  margin-top: 1.4rem;
}

.blog-card-tag.inline {
  position: static;
  display: inline-block;
  background: var(--rose-100);
}

.blog-post-head h1 {
  margin: 0.9rem 0 1rem;
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.blog-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  color: var(--muted);
}

.blog-post-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.blog-post-meta .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.blog-post-cover {
  margin-top: clamp(24px, 4vw, 44px);
}

.blog-post-cover img {
  width: 100%;
  max-height: 520px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: var(--shadow);
}

/* ── Single post: layout + table of contents ──────────────────────────── */
.blog-post-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: start;
  gap: clamp(28px, 5vw, 64px);
  padding-block: clamp(36px, 5vw, 64px);
}

.blog-post-layout--single {
  grid-template-columns: minmax(0, 46rem);
  justify-content: center;
}

.blog-toc-col {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

.blog-toc {
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--rose-50);
}

.blog-toc-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  font-size: 1.05rem;
}

.blog-toc-title .icon {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--rose-600);
}

.blog-toc li + li {
  margin-top: 2px;
}

.blog-toc a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-left: 2px solid transparent;
  border-radius: 0 10px 10px 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--text);
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.blog-toc .toc-h3 a {
  padding-left: 1.5rem;
  font-size: 0.9rem;
}

.blog-toc a:hover,
.blog-toc a.active {
  border-left-color: var(--rose-600);
  background: var(--white);
  color: var(--rose-600);
  text-decoration: none;
}

/* ── Single post: article typography ──────────────────────────────────── */
.blog-post-body {
  font-size: 1.12rem;
  line-height: 1.8;
  overflow-wrap: break-word;
}

.blog-post-body > * + * {
  margin-top: 1.2em;
}

.blog-post-body h2,
.blog-post-body h3,
.blog-post-body h4 {
  margin-top: 1.9em;
  font-family: var(--font-head);
  line-height: 1.25;
  color: var(--ink);
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.blog-post-body h2 {
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
}

.blog-post-body h3 {
  font-size: 1.35rem;
}

.blog-post-body h4 {
  font-size: 1.15rem;
}

.blog-post-body > :first-child {
  margin-top: 0;
}

.blog-post-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.blog-post-body ul,
.blog-post-body ol {
  padding-left: 1.4em;
}

.blog-post-body ul {
  list-style: disc;
}

.blog-post-body ol {
  list-style: decimal;
}

.blog-post-body li + li {
  margin-top: 0.45em;
}

.blog-post-body li::marker {
  color: var(--rose-500);
}

.blog-post-body blockquote {
  margin-inline: 0;
  padding: 1rem 1.4rem;
  border-left: 4px solid var(--rose-400);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--rose-50);
  color: var(--ink);
}

.blog-post-body img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.blog-post-body hr {
  height: 1px;
  border: 0;
  background: var(--line);
}

.blog-post-body code {
  padding: 0.15em 0.4em;
  border-radius: 6px;
  background: var(--rose-100);
  font-size: 0.92em;
}

.blog-post-body pre {
  overflow-x: auto;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-sm);
  background: var(--berry-950);
  color: #ffe8ef;
}

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

.blog-post-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.blog-post-body th,
.blog-post-body td {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line);
  text-align: left;
}

.blog-post-body th {
  background: var(--rose-50);
  color: var(--ink);
}

.blog-post-note {
  margin-top: 2.2rem;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--rose-50);
  font-size: 0.92rem;
  color: var(--muted);
}

.blog-post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 1.6rem;
}

.blog-tag {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rose-600);
}

/* ── Single post: app promo ───────────────────────────────────────────── */
.blog-app-cta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px 22px;
  margin-top: 2.4rem;
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--radius-lg);
  background: var(--brand-gradient);
  color: var(--white);
  box-shadow: var(--shadow);
}

.blog-app-cta-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(60, 4, 28, 0.35);
}

.blog-app-cta h2 {
  margin-bottom: 0.25rem;
  font-size: 1.4rem;
  color: var(--white);
}

.blog-app-cta p {
  color: rgba(255, 255, 255, 0.97);
}

.blog-app-cta-badges {
  display: grid;
  gap: 8px;
}

.blog-app-cta .store-badge img {
  height: 44px;
}

/* ── Single post: previous / next ─────────────────────────────────────── */
.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 2.4rem;
}

.post-nav-card {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

a.post-nav-card:hover {
  border-color: var(--rose-200);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transform: translateY(-2px);
}

.post-nav-empty {
  visibility: hidden;
}

.post-nav-next {
  text-align: right;
}

.post-nav-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rose-600);
}

.post-nav-next .post-nav-label {
  justify-content: flex-end;
}

.post-nav-arrow .icon {
  width: 1rem;
  height: 1rem;
  stroke-width: 2.4;
}

.post-nav-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.post-nav-next .post-nav-inner {
  justify-content: flex-end;
}

.post-nav-thumb {
  flex: none;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: 14px;
}

.post-nav-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-nav-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.post-nav-date {
  font-size: 0.82rem;
  color: var(--muted);
}

.post-nav-title {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.blog-post-cta {
  margin-top: 2rem;
}

.blog-post-cta .icon {
  width: 1.1rem;
  height: 1.1rem;
  stroke-width: 2.2;
}

/* ── Single post: more articles ───────────────────────────────────────── */
.blog-more {
  padding-block: clamp(48px, 7vw, 88px);
  background: var(--rose-50);
}

.blog-more-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.blog-more-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.blog-more-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-head);
  font-weight: 600;
  white-space: nowrap;
}

.blog-more-all .icon {
  width: 1.1rem;
  height: 1.1rem;
  stroke-width: 2.2;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .blog-post-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .blog-toc-col {
    position: static;
  }

  .blog-toc {
    max-height: none;
  }
}

@media (max-width: 700px) {
  .blog-app-cta {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .blog-app-cta-badges {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, auto);
    justify-content: start;
  }

  .post-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-nav-empty {
    display: none;
  }

  .post-nav-next {
    text-align: left;
  }

  .post-nav-next .post-nav-label,
  .post-nav-next .post-nav-inner {
    justify-content: flex-start;
  }
}
