/**
 * Stackforge Academy — Layout
 * Container, grid utilities, and the structural chrome (site header,
 * footer, content wrapper). Mobile-first: single column by default,
 * multi-column from md (768px) up.
 */

.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1 0 auto;
}

.container {
  width: 100%;
  max-width: var(--sf-container-width);
  margin-inline: auto;
  padding-inline: var(--sf-container-pad);
}

.container--narrow { max-width: 760px; }
.container--wide { max-width: 1440px; }

.section {
  padding-block: var(--sf-space-16);
}
.section--tight { padding-block: var(--sf-space-10); }
.section--dark {
  background: var(--sf-ink);
  color: var(--sf-on-ink);
}
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 {
  color: var(--sf-on-ink);
}

.grid {
  display: grid;
  gap: var(--sf-space-6);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
  .grid--2-lg { grid-template-columns: repeat(2, 1fr); }
}

.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--sf-space-4); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sf-space-3);
}

/* ---------- Site header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--sf-z-nav);
  background: rgba(247, 247, 244, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--sf-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sf-space-4);
  min-height: var(--sf-header-height);
}

.site-branding {
  display: flex;
  align-items: center;
  gap: var(--sf-space-2);
}

.site-title {
  font-family: var(--sf-font-display);
  font-size: var(--sf-text-xl);
  font-weight: var(--sf-weight-bold);
  margin: 0;
  letter-spacing: -0.01em;
}
.site-title a { color: var(--sf-ink); text-decoration: none; }
.site-description {
  font-family: var(--sf-font-mono);
  font-size: var(--sf-text-xs);
  color: var(--sf-slate-600);
  margin: 0;
}

/* ---------- Site footer ---------- */
.site-footer {
  background: var(--sf-ink);
  color: var(--sf-on-ink-muted);
  padding-block: var(--sf-space-16) var(--sf-space-8);
}

.footer-grid {
  display: grid;
  gap: var(--sf-space-10);
  grid-template-columns: 1fr;
  padding-bottom: var(--sf-space-10);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 1.4fr repeat(3, 1fr); }
}

.footer-grid h6 { color: var(--sf-on-ink-muted); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li + li { margin-top: var(--sf-space-2); }
.footer-grid a { color: var(--sf-on-ink); text-decoration: none; }
.footer-grid a:hover { color: var(--sf-amber); }

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: var(--sf-space-3);
  padding-top: var(--sf-space-6);
  font-size: var(--sf-text-sm);
}
@media (min-width: 640px) {
  .footer-bottom { flex-direction: row; align-items: center; justify-content: space-between; }
}

.back-to-top {
  position: fixed;
  right: var(--sf-space-5);
  bottom: var(--sf-space-5);
  width: 44px;
  height: 44px;
  border-radius: var(--sf-radius-full);
  background: var(--sf-indigo);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sf-shadow-md);
  border: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--sf-duration-base) var(--sf-ease), transform var(--sf-duration-base) var(--sf-ease);
  z-index: var(--sf-z-nav);
}
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* Entry content width for single post/page reading */
.entry-content {
  max-width: 72ch;
}
.entry-content > * { max-width: 100%; }

/* ---------- Comments ---------- */
.comment-list .comment {
  display: flex;
  gap: var(--sf-space-4);
  padding: var(--sf-space-5) 0;
  border-bottom: 1px solid var(--sf-border);
}
.comment-list .avatar {
  border-radius: var(--sf-radius-full);
  flex-shrink: 0;
}
.comment-author .fn { font-style: normal; font-weight: var(--sf-weight-semibold); }
.comment-metadata {
  font-family: var(--sf-font-mono);
  font-size: var(--sf-text-xs);
  color: var(--sf-slate-400);
  margin-bottom: var(--sf-space-2);
}
.comment-metadata a { color: inherit; text-decoration: none; }
.comment-content p { color: var(--sf-slate-600); }
.comment-list .children { list-style: none; padding-left: var(--sf-space-8); margin: 0; }
.reply a { font-size: var(--sf-text-xs); font-family: var(--sf-font-mono); }
