/* ======================
   Blog landing page
   ====================== */

:root {
  /* Easy theming knobs */
  --blog-sidebar-bg: #492537;
  --blog-controls-bg: #9e6a0e;
  --blog-box-bg: #9e6a0e;
  --blog-border: #000000;
  --blog-button-bg: #492537;
  --blog-accent: #c5bd23;
  --blog-accent2: #ed7e54;
  --blog-text: #000;
  --blog-muted: rgba(0, 0, 0, 0.7);
  --blog-gap: 16px;
  --blog-radius: 5px;
  --card-bg: #ffffff9a;
  --back-button-bg: #c78fcb;

  /* Controls scroll height of the cards area */
  --blog-scroll-height: 70vh;
}

.blog-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;

  margin: 40px;
  border: solid black 2px;
  border-radius: 5px;

  height: calc(100vh - 300px);
  grid-template-rows: 1fr;
  overflow: hidden;
  align-items: stretch; /* important: equal height columns */
}

.blog-sidebar {
  background: var(--blog-sidebar-bg);
  padding: 16px;
  position: sticky;
  top: 0;
  height: auto;
}

.blog-sidebar .blog-title {
  color: #ddcbc5;
  font-family: "Jersey 15", sans-serif;
  font-weight: 400;
  font-style: normal;
  font-size: 2.5rem;
  text-align: center;
  line-height: 1;
}

.blog-main {
  border-left: 2px solid var(--blog-border);
  padding: 16px;
  min-width: 0;
  overflow: auto;

  background-color: rgba(227, 208, 201, 0.5);
  background-size: 20px 20px;
  background-image: repeating-linear-gradient(
    0deg,
    #bba299,
    #bba299 1px,
    rgba(227, 208, 201, 0.5) 1px,
    rgba(227, 208, 201, 0.5)
  );
}

.blog-title {
  margin: 0 0 12px 0;
  text-align: left;
}

.blog-box {
  margin-top: 16px;
  padding: 12px;
  border: 2px solid var(--blog-border);
  border-radius: 5px;
  background: var(--blog-box-bg);
}

.blog-box-title {
  margin: 0 0 10px 0;
  font-size: 1.2rem;
}

.blog-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background-color: var(--blog-controls-bg);
}

.blog-btn {
  border: 2px solid var(--blog-border);
  background: var(--blog-button-bg);
  color: var(--blog-text);
  padding: 5px 8px;
  margin: 4px;
  border-radius: 17px;
  cursor: pointer;
  font: inherit;
}

.blog-btn:hover,
.blog-btn:focus-visible {
  background: var(--blog-accent2);
}

.blog-btn[aria-pressed="true"] {
  background: var(--blog-accent);
}

.blog-btn:focus-visible {
  outline: 2px solid #000;
  outline-offset: 3px;
}

.back-button {
  color: var(--back-button-bg);
  padding: 8px 10px;
  border-radius: 15px;
  border: solid black 2px;
  font-size: 1rem;
  margin-left: 40px;
}

.blog-muted {
  color: var(--blog-muted);
}

.post-grid {
  display: grid;
  gap: var(--blog-gap);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ======================
   Post cards
   ====================== */

.post-card {
  position: relative;
  border: 2px solid var(--blog-border);
  border-radius: var(--blog-radius);
  padding: 14px;
  background: var(--card-bg);

  min-height: 220px;

  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-card:hover,
.post-card:focus-within {
  transform: translateY(3px) rotate(-0.3deg);
  color: var(--blog-accent2);
  /* plus any card background change you want */
}

.post-card-title {
  margin: 0;
  font-size: 1.2rem;
}

.post-card-link {
  display: flex;
  flex-direction: column;
  gap: 10px;

  height: 100%;
  width: 100%;
  padding: 14px;
}

/* Prevent global prose-link styles affecting card links */
.post-card-link,
.post-card-link:link,
.post-card-link:visited {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
  background: transparent !important;
}

.post-card-link:hover,
.post-card-link:focus-visible,
.post-card-link:active {
  color: inherit;
  background: transparent !important; /* stops the yellow highlight */
}

.post-card-date {
  margin: 0;
  font-size: 0.95rem;
  color: var(--blog-muted);
}

.post-card-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-card[hidden] {
  display: none !important;
}

.tag-pill {
  display: inline-block;
  border: 2px solid var(--blog-border);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.post-card-summary {
  margin: 0;
  color: var(--blog-muted);
  overflow: hidden;
  /* keep preview neat */
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.post-card-link--stretched::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ensures the actual text is above the clickable overlay */
.post-card-title,
.post-card-date,
.post-card-tags,
.post-card-summary {
  position: relative;
  z-index: 2;
}

/* ======================
   Responsive
   ====================== */

@media (max-width: 720px) {
  .blog-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
    margin: 16px;
  }

  .blog-sidebar {
    position: static; /* stop sticky on mobile */
    top: auto;
  }

  .blog-main {
    overflow: visible;
    border-left: none;
    border-top: 2px solid var(--blog-border); /* optional separator */
  }

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

@media (max-width: 420px) {
  .post-grid {
    grid-template-columns: 1fr;
  }
}
