/**
 * Theme Name: Blocksy Child Avery
 * Description: Avery-branded child theme for the WordPress blog. Layers brand styling on top of Blocksy without overriding its layout system.
 * Author: Avery
 * Template: blocksy
 * Version: 2.1.0
 * Text Domain: blocksy
 */

/* ============================================================
   1. DESIGN TOKENS
   Tokens are inert until referenced. Safe to declare globally.
   We also map them onto Blocksy's documented CSS variables so
   the parent theme's typography/colors pick up the brand
   automatically without us forcing element-level overrides.
   ============================================================ */
:root {
  --avery-red:        #ea001c;
  --avery-red-hover:  #c00018;
  --avery-blue:       #0033a0;
  --avery-blue-deep:  #033f9e;
  --avery-blue-soft:  #eff4fb;
  --avery-blue-tint:  #dbe6f5;

  --avery-ink:        #1a1a1a;
  --avery-body:       #242424;
  --avery-muted:      #5b6670;
  --avery-line:       #e5e7eb;
  --avery-canvas:     #fafbfc;

  --avery-font-body:  "CircularXXWeb-Book", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --avery-font-bold:  "CircularXXWeb-Bold", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
}

/* ============================================================
   2. TYPOGRAPHY — scoped to content only, not Blocksy chrome.
   ============================================================ */
body {
  font-family: var(--avery-font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.entry-title,
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
  font-family: var(--avery-font-bold);
  color: var(--avery-ink);
  letter-spacing: -0.01em;
}

/* ============================================================
   3. BUTTONS — Avery red. Scoped to block buttons and Blocksy's
   own primary class only. NOT a global input[type=submit] rule —
   that would clobber search, comment submit, login, etc.
   ============================================================ */
.wp-block-button__link,
.wp-block-button .wp-element-button,
.entry-content .button,
.ct-button-primary {
  background-color: var(--avery-red);
  border: 1px solid var(--avery-red);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--avery-font-bold);
  font-size: 14px;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 12px 24px;
  transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.wp-block-button__link:hover,
.wp-block-button .wp-element-button:hover,
.entry-content .button:hover,
.ct-button-primary:hover {
  background-color: var(--avery-red-hover);
  border-color: var(--avery-red-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(234, 0, 28, .22);
  text-decoration: none;
}

/* Outline variant for block buttons */
.is-style-outline .wp-block-button__link,
.is-style-outline .wp-element-button {
  background: transparent;
  color: var(--avery-blue);
  border: 1px solid var(--avery-blue);
}
.is-style-outline .wp-block-button__link:hover,
.is-style-outline .wp-element-button:hover {
  background: var(--avery-blue);
  color: #fff;
}

/* ============================================================
   4. POST CARDS — light refinement of Blocksy's existing card.
   No global article rule. Hover lift + image zoom + chip colors.
   ============================================================ */
.ct-post-card {
  transition: transform .2s ease, box-shadow .2s ease;
}
.ct-post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(15,23,42,.06), 0 12px 28px rgba(15,23,42,.10);
}
.ct-post-card .ct-image-container img,
.ct-post-card .ct-media-container img {
  transition: transform .4s ease;
}
.ct-post-card:hover .ct-image-container img,
.ct-post-card:hover .ct-media-container img {
  transform: scale(1.02);
}
.ct-post-card .entry-title a:hover { color: var(--avery-red); }

/* Category chips */
.entry-meta .cat-links a,
.entry-meta .ct-meta-element-categories a,
.ct-meta-element-categories a {
  display: inline-block;
  background: var(--avery-blue-soft);
  color: var(--avery-blue);
  font-family: var(--avery-font-bold);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 4px 10px;
  border-radius: 999px;
  text-decoration: none;
}
.entry-meta .cat-links a:hover,
.entry-meta .ct-meta-element-categories a:hover,
.ct-meta-element-categories a:hover {
  background: var(--avery-blue);
  color: #fff;
}

/* ============================================================
   5. SINGLE POST — editorial polish, no width/structural rules
   that would conflict with Blocksy's content-width customizer.
   ============================================================ */
.single-post .entry-content > blockquote,
.page .entry-content > blockquote {
  border-left: 4px solid var(--avery-red);
  background: var(--avery-canvas);
  padding: 16px 24px;
  margin: 32px 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-family: var(--avery-font-bold);
  font-size: 20px;
  color: var(--avery-ink);
  line-height: 1.4;
}
.single-post .entry-content > blockquote p { margin: 0; }

.single-post .entry-content figcaption {
  font-size: 13px;
  color: var(--avery-muted);
  text-align: center;
}

.single-post .entry-content code:not(pre code) {
  background: var(--avery-canvas);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: .9em;
  color: var(--avery-blue-deep);
}

/* ============================================================
   6. LAST-UPDATED + READING-TIME BLOCK
   Injected at the top of single posts via functions.php.
   SVGs hard-pinned to defeat inherited .entry-content img/svg.
   ============================================================ */
.lub-block {
  background: var(--avery-blue-soft);
  border: 1px solid var(--avery-blue-tint);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin: 0 0 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--avery-font-body);
}
.lub-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.lub-icon {
  background: #fff;
  border: 1px solid var(--avery-blue-tint);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lub-block .lub-icon svg,
.entry-content .lub-block .lub-icon svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  stroke: var(--avery-blue);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}
.lub-text {
  font-size: 14px;
  color: var(--avery-body);
  line-height: 1.4;
}
.lub-text strong {
  color: var(--avery-ink);
  font-family: var(--avery-font-bold);
  font-weight: 700;
}
.lub-divider {
  width: 1px;
  height: 28px;
  background: var(--avery-blue-tint);
  align-self: center;
}

/* ============================================================
   7. SOCIAL FOLLOW BLOCK — bottom-of-post
   ============================================================ */
.lub-social {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--avery-line);
  text-align: center;
  font-family: var(--avery-font-body);
}
.lub-social-heading {
  font-family: var(--avery-font-bold);
  font-size: 18px;
  color: var(--avery-ink);
  margin: 0 0 4px;
}
.lub-social-sub {
  font-size: 14px;
  color: var(--avery-muted);
  margin: 0 0 18px;
}
.lub-social-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.lub-social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: var(--avery-blue-soft);
  color: var(--avery-blue);
  border-radius: 50%;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.lub-social-links a:hover {
  background: var(--avery-red);
  color: #fff;
  transform: translateY(-1px);
}
.lub-social-links svg,
.entry-content .lub-social-links svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  fill: currentColor;
  display: block;
}

/* ============================================================
   8. PAGINATION
   ============================================================ */
.ct-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-family: var(--avery-font-bold);
  color: var(--avery-ink);
  background: var(--avery-canvas);
  margin: 0 4px;
  transition: background-color .15s ease, color .15s ease;
  text-decoration: none;
}
.ct-pagination .page-numbers.current {
  background: var(--avery-red);
  color: #fff;
}
.ct-pagination .page-numbers:hover:not(.current) {
  background: var(--avery-blue-soft);
  color: var(--avery-blue);
}

/* ============================================================
   9. BRIGHTEDGE LINK BLOCK
   ============================================================ */
.be-ix-link-block {
  background: var(--avery-blue);
  padding: 20px 0;
}
.be-ix-link-block .be-related-link-container {
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 16px;
}
.be-ix-link-block a { color: #fff !important; }
.be-ix-link-block a:hover { color: rgba(255,255,255,.85) !important; }

/* ============================================================
   10. CUSTOM PHP FOOTER
   Styles ONLY our .site-footer markup from footer.php.
   ============================================================ */
.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 24px;
  gap: 24px;
  background: var(--avery-canvas);
  border-top: 1px solid var(--avery-line);
  position: relative;
  flex-wrap: wrap;
  font-family: var(--avery-font-body);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--avery-blue) 0%, var(--avery-red) 100%);
}
.site-footer__logo { display: inline-flex; align-items: center; }
.site-footer__text { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.site-footer .ft-cpy { font-size: 14px; color: var(--avery-muted); margin: 0; }
.site-footer .footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.site-footer .footer-links a {
  color: var(--avery-muted);
  font-size: 14px;
  text-decoration: none;
}
.site-footer .footer-links a:hover { color: var(--avery-red); }

/* ============================================================
   11. TABLES — content area only
   ============================================================ */
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 24px 0;
  font-size: 14px;
}
.entry-content thead { background: var(--avery-blue); color: #fff; }
.entry-content thead th { color: #fff; }
.entry-content th,
.entry-content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--avery-line);
}
.entry-content tbody tr:nth-child(even) { background: var(--avery-canvas); }

/* ============================================================
   12. EDITORIAL CALLOUT (shortcode)
   ============================================================ */
.avery-callout {
  background: var(--avery-blue-soft);
  border-left: 4px solid var(--avery-blue);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  margin: 24px 0;
}
.avery-callout--red {
  background: #fff5f6;
  border-left-color: var(--avery-red);
}
.avery-callout p:last-child { margin-bottom: 0; }

/* ============================================================
   13. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  /* Safety net: if Blocksy archive layout is configured for 3-col
     with no breakpoint, force a 2-col on tablets. */
  .ct-posts-grid,
  [data-archive-card-type] .entries {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .lub-block {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }
  .lub-divider { display: none; }
  .lub-item { width: 100%; }

  .site-footer {
    padding: 28px 16px;
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  .site-footer .footer-links { gap: 12px; }

  .single-post .entry-content > blockquote {
    font-size: 17px;
    padding: 14px 18px;
  }

  .lub-social-links { gap: 10px; }
  .lub-social-links a { width: 38px; height: 38px; min-width: 38px; }

  /* Archive grid single column on phones */
  .ct-posts-grid,
  [data-archive-card-type] .entries {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .site-footer .footer-links { flex-direction: column; gap: 8px; }
}
