/* ==========================================================================
   WordPress overrides
   ==========================================================================

   The ONLY CSS this theme adds. css/styles.css is a byte-for-byte copy of the
   original static stylesheet and must stay that way, so anything WordPress
   needs that the design didn't anticipate goes here.

   Everything below exists for one reason: the block editor wraps content in
   markup the original stylesheet never saw. A paragraph is still a <p>, but an
   image is now <figure class="wp-block-image"><img><figcaption>, and .article
   only ever styled a bare <img>.

   Keep this file short. If it starts growing, that's a sign a design change is
   being smuggled in here instead of into styles.css.
   ========================================================================== */


/* 1. Images and captions
   ========================================================================== */

/* .article img already has the radius and margin. The figure would otherwise
   add a second set of margins on top, doubling the gap. */
.article figure {
  margin: 32px 0;
}

.article figure img {
  margin: 0;
}

.article figcaption,
.article .wp-block-image figcaption {
  margin-top: 12px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--c-muted);
  text-align: center;
}

/* Images inserted at their natural size can be narrower than the column. */
.article .wp-block-image img {
  height: auto;
  max-width: 100%;
}


/* 2. Quotes
   ==========================================================================
   Gutenberg emits <blockquote class="wp-block-quote"> with a <cite>. The
   blockquote rule in styles.css (§19) already applies, so this only needs to
   handle the citation line and the paragraph margin inside it. */

.article .wp-block-quote p {
  font-size: inherit;
  line-height: inherit;
  margin: 0 0 12px;
}

.article .wp-block-quote p:last-of-type {
  margin-bottom: 0;
}

.article .wp-block-quote cite,
.article blockquote cite {
  display: block;
  margin-top: 14px;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--c-muted);
}

/* The pullquote block is a different thing again — centre it. */
.article .wp-block-pullquote {
  margin: 40px 0;
  padding: 0;
  border-left: 0;
  text-align: center;
}


/* 3. Alignment
   ==========================================================================
   The article column is 760px (--wrap-read). Wide and full alignments would
   otherwise break out of it and overflow the page horizontally on mobile. */

.article .alignwide {
  margin-inline: -60px;
  max-width: calc(100% + 120px);
}

.article .alignfull {
  margin-inline: -60px;
  max-width: calc(100% + 120px);
}

.article .alignleft {
  float: left;
  margin: 8px 28px 20px 0;
  max-width: 45%;
}

.article .alignright {
  float: right;
  margin: 8px 0 20px 28px;
  max-width: 45%;
}

.article .aligncenter {
  margin-inline: auto;
}

@media (max-width: 900px) {
  /* Below the point where the negative margins fit, pull everything back in. */
  .article .alignwide,
  .article .alignfull {
    margin-inline: 0;
    max-width: 100%;
  }

  .article .alignleft,
  .article .alignright {
    float: none;
    margin: 32px 0;
    max-width: 100%;
  }
}


/* 4. Other blocks that turn up
   ========================================================================== */

.article .wp-block-separator {
  margin: 48px auto;
  border: 0;
  border-top: 1px solid var(--c-border);
  max-width: 120px;
}

.article .wp-block-buttons {
  margin: 32px 0;
}

.article .wp-block-embed,
.article .wp-block-embed figure {
  margin: 32px 0;
}

.article .wp-block-embed iframe {
  width: 100%;
  border-radius: var(--radius-lg);
}

.article .wp-block-table {
  margin: 32px 0;
  overflow-x: auto;
}

.article .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.article .wp-block-table th,
.article .wp-block-table td {
  padding: 12px 14px;
  border: 1px solid var(--c-border);
  text-align: left;
}

.article .wp-block-code,
.article pre {
  margin: 32px 0;
  padding: 20px 22px;
  background: var(--c-sand);
  border-radius: var(--radius-lg);
  font-size: 14.5px;
  line-height: 1.6;
  overflow-x: auto;
}

/* The editor adds this to every top-level block group. Neutralise it. */
.article > .wp-block-group,
.article > .entry-content {
  margin: 0;
}


/* 5. Blog index pagination
   ==========================================================================
   the_posts_pagination() emits markup the design never had, because the static
   site had one post. Kept deliberately plain — it won't be seen for years. */

.kt-pagination {
  margin: 48px auto 0;
  text-align: center;
}

.kt-pagination .page-numbers {
  display: inline-block;
  min-width: 38px;
  padding: 8px 10px;
  margin: 0 3px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
}

.kt-pagination .page-numbers:hover {
  border-color: var(--c-teal);
  color: var(--c-teal);
}

.kt-pagination .page-numbers.current {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: #fff;
}

.kt-pagination .page-numbers.dots {
  border-color: transparent;
}


/* 6. Empty states and 404
   ==========================================================================
   Reuses .qa-card so a "no posts yet" message looks intentional rather than
   like a broken page. */

.kt-empty {
  grid-column: 1 / -1;
  text-align: center;
}

.kt-empty p {
  margin: 0 0 16px;
}


/* 7. Admin bar
   ==========================================================================
   When she's logged in, WordPress adds a bar at the top of the page and the
   sticky <header> would slide underneath it.

   The offsets mirror WordPress's own breakpoints exactly:
     > 782px   bar is fixed, 32px tall
     601-782px bar is fixed, 46px tall
     <= 600px  bar is ABSOLUTE — it scrolls away, so no offset is needed.
                Adding one here would leave a 46px gap once the page scrolls.

   Visitors never see any of this; it only affects her own logged-in view. */

body.admin-bar header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar header {
    top: 46px;
  }
}

@media screen and (max-width: 600px) {
  body.admin-bar header {
    top: 0;
  }
}
