/* ==========================================================================
   Mouth Arc Lab — blog and post cards
   Loaded after styles.css, which owns the design system: colours, type
   scale, spacing, buttons, .container, .section. Only what the blog adds
   on top lives here.
   ========================================================================== */

:root {
  /* Aliases and the few sizes only the blog uses. */
  --bg-alt:   var(--paper-alt);
  --radius:   var(--r-sm);
  --fs-lg:    1.0625rem;
  --fs-h3-lg: 1.25rem;
  --fs-h1:    clamp(1.75rem, 3.2vw, 2.75rem);
}

/* ---------- Layout pieces the homepage doesn't have ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: .6rem 1rem;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
}

.skip-link:focus { left: 1rem; top: 1rem; }

.center { text-align: center; }

.section-title { margin-bottom: 32px; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
  transition: box-shadow .2s;
}

.card:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, .09); }

.card-body { display: flex; flex: 1; flex-direction: column; padding: 20px 20px 24px; }

.card-body h3 { font-size: 1rem; font-weight: 700; }

.card-body p { margin-bottom: 0; color: var(--muted); font-size: var(--fs-sm); }

.media { width: 100%; height: auto; object-fit: cover; background: var(--bg-alt); }

.btn-sm { min-height: 38px; padding: 6px 16px; font-size: var(--fs-sm); }

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Preview bar ----------
   Shown on every build that isn't production, so nobody mistakes a preview
   (or a draft) for the live site. */

.preview-bar {
  padding: .5rem 1.25rem;
  background: #FFF4CC;
  border-bottom: 1px solid #EBD789;
  color: #5C4A00;
  font-size: var(--fs-xs);
  line-height: 1.5;
  text-align: center;
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--blue); text-decoration: underline; }

/* ---------- Index and category pages ---------- */

.blog-intro { max-width: 760px; margin-bottom: 2.25rem; }

.blog-intro h1 { font-size: var(--fs-h1); font-weight: 600; }

.blog-intro p { font-size: var(--fs-lg); color: var(--muted); }

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.25rem;
}

.category-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 .9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.category-nav a:hover { border-color: var(--blue); color: var(--blue); }

.category-nav a[aria-current="page"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.blog-empty { color: var(--muted); }

.center .btn-row { justify-content: center; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2.5rem;
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* ---------- Post cards ---------- */

.post-card { position: relative; border: 1px solid var(--line); }

.section-alt .post-card { border-color: transparent; }

.media-16x9 { aspect-ratio: 16 / 9; }

.post-card-fallback {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  padding: 1rem;
  background: linear-gradient(115deg, var(--blue-dark) 0%, var(--blue) 100%);
  color: rgba(255, 255, 255, .9);
  font-size: var(--fs-h3-lg);
  font-weight: 700;
  letter-spacing: .06em;
  text-align: center;
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-bottom: .5rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.card-body .post-card-meta { margin-bottom: .5rem; font-size: var(--fs-xs); }

.post-card h3 { margin-bottom: .5rem; }

.post-card-link { color: var(--text); text-decoration: none; }

/* the whole card is the click target, not just the title */
.post-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post-card:hover .post-card-link { color: var(--blue); }

.post-card:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.post-card-link:focus-visible { outline: none; }

.badge-draft {
  padding: 0 .45rem;
  border-radius: 3px;
  background: #FFF4CC;
  color: #5C4A00;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------- Single post ---------- */

.post { padding: 2.75rem 0 3.5rem; }

.post-header h1 {
  font-size: var(--fs-h1);
  font-weight: 700;
  line-height: 1.22;
  margin-bottom: 1rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 2rem;
}

.post-hero {
  max-width: 1000px;
  margin: 0 auto 2.5rem;
}

/* a fixed shape keeps every post consistent whatever gets uploaded */
.post-hero .media { aspect-ratio: 16 / 9; border-radius: 10px; }

/* ---------- Article body ----------
   Everything the CMS editor can produce: headings, lists, quotes, images,
   tables, code and rules. */

.prose {
  font-size: var(--fs-lg);
  line-height: 1.8;
  overflow-wrap: break-word;
}

.prose > :first-child { margin-top: 0; }

.prose h2 {
  font-size: var(--fs-h2);
  margin: 2.5rem 0 .9rem;
}

.prose h3 {
  font-size: var(--fs-h3-lg);
  margin: 2rem 0 .6rem;
}

.prose h4 {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin: 1.75rem 0 .5rem;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose figure,
.prose table,
.prose pre { margin: 0 0 1.35rem; }

.prose ul,
.prose ol { padding-left: 1.4rem; }

/* styles.css resets lists and links for the homepage; articles need them back */
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose a { color: var(--blue); text-decoration: underline; }

.prose li { margin-bottom: .4rem; }
.prose li > ul,
.prose li > ol { margin: .4rem 0 0; }

.prose a { text-underline-offset: 3px; }
.prose a:hover { color: var(--blue-dark); }

.prose img {
  height: auto;
  margin: 2rem auto;
  border-radius: var(--radius);
}

.prose blockquote {
  padding: .25rem 0 .25rem 1.25rem;
  border-left: 3px solid var(--blue);
  color: var(--muted);
  font-style: italic;
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

/* wide tables scroll inside themselves rather than widening the page */
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.prose th,
.prose td {
  padding: .55rem .8rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th { background: var(--bg-alt); font-weight: 600; }

.prose code {
  padding: .1rem .35rem;
  border-radius: 3px;
  background: var(--bg-alt);
  font-size: .9em;
}

.prose pre {
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  background: #14203A;
  color: #E6EAF0;
  overflow-x: auto;
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.prose pre code { padding: 0; background: none; font-size: inherit; }

/* ---------- Responsive ---------- */

@media (max-width: 620px) {
  .post { padding: 2rem 0 2.5rem; }
  .prose { font-size: var(--fs-base); }
  .post-hero { padding: 0; }
  .post-hero .media { border-radius: 0; }
}
