/* ============================================
   TheLucaBonafede — Astra Theme Replica
   ============================================ */

:root {
  --primary: #cd212a;
  --primary-hover: #008c45;
  --heading: #0F172A;
  --text: #364151;
  --bg: #fff;
  --border: #D1DAE5;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

/* Blur-up image loading effect */
.blur-wrap {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.blur-up {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.blur-up.loaded {
  opacity: 1;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }

h1, h2, h3, h4, h5, h6 {
  color: var(--heading);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 2em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.25em; }

p { margin-bottom: 1em; }

ul, ol { margin-bottom: 1em; padding-left: 1.5em; }
li { margin-bottom: 0.35em; }

blockquote {
  border-left: 4px solid var(--primary);
  margin: 1.5em 0;
  padding: 1em 1.5em;
  font-style: italic;
  color: #555;
  background: #f9f9fb;
}

/* Container */
.ast-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2.5em;
}

.ast-narrow {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 2.5em;
}

/* ============================================
   Header
   ============================================ */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 100;
}

.site-header .ast-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  position: relative;
}

.site-branding {
  text-align: center;
}

.site-branding a { display: inline-block; }

.site-branding img {
  width: 358px;
  height: 60px;
  max-width: 100%;
}

.header-nav {
  position: absolute;
  right: calc(2.5em + 24px + 1.2em);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 1.2em;
}

.header-nav a {
  color: var(--heading);
  font-size: 1.2em;
}

.header-nav a:hover { color: var(--primary); }

/* Burger Button */
.burger-btn {
  position: absolute;
  right: 2.5em;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  width: 24px;
  height: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
}

.burger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--heading);
  transition: background-color 0.2s ease;
}

.burger-btn:hover span { background-color: var(--primary); }

/* Menu Overlay */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

body.is-menu-visible .menu-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Slide-from-right sidebar */
#menu {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1001;
  width: 300px;
  max-width: 80vw;
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  padding: 80px 40px 40px;
}

body.is-menu-visible #menu {
  transform: translateX(0);
}

.menu-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.2s ease;
}

.menu-close:hover { color: var(--primary); }

#menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

#menu a {
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: color 0.2s ease;
}

#menu a:hover { color: var(--primary); }

/* ============================================
   Blog Grid (Homepage + Category)
   ============================================ */
.site-content {
  padding: 2.5em 0;
}

.ast-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2em;
}

.ast-article-post {
  background: var(--bg);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: box-shadow 0.3s;
}

.ast-article-post:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.post-thumb-img-content {
  overflow: hidden;
  aspect-ratio: 4/3;
}

.post-thumb-img-content a { display: block; height: 100%; }

.post-thumb-img-content img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.ast-article-post:hover .post-thumb-img-content img {
  transform: scale(1.05);
}

.post-content {
  padding: 1.25em;
}

.post-content .entry-title {
  font-size: 1.15em;
  margin-bottom: 0.5em;
  line-height: 1.4;
}

.post-content .entry-title a { color: var(--heading); }
.post-content .entry-title a:hover { color: var(--primary); }

.ast-excerpt-container p {
  font-size: 0.92em;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 0.75em;
}

.read-more a {
  font-size: 0.88em;
  font-weight: 600;
  color: var(--primary);
}

.read-more a:hover { color: var(--primary-hover); }

/* ============================================
   Pagination
   ============================================ */
.ast-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5em;
  margin-top: 3em;
  padding: 1em 0;
}

.ast-pagination a,
.ast-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.75em;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.95em;
  color: var(--heading);
  transition: background 0.2s, border-color 0.2s;
}

.ast-pagination a:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.ast-pagination .current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ============================================
   Single Post
   ============================================ */
.ast-single-post-featured-section {
  margin-bottom: 0;
}

.ast-single-post-featured-section img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.ast-single-post-featured-section + .ast-narrow {
  position: relative;
  z-index: 9;
  margin-top: -80px;
  background: var(--bg);
  border-radius: 4px;
  padding-top: 2em;
}

/* Wide featured image on desktop — bleeds past narrow container */
.ast-article-image-container--wide {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 2.5em;
}

.single-post-content .entry-header {
  margin-bottom: 1.5em;
}

.single-post-content .entry-title {
  font-size: 2em;
  line-height: 1.25;
}

.single-post-content .entry-content {
  font-size: 1.05em;
  line-height: 1.75;
}

.single-post-content .entry-content p {
  margin-bottom: 1.2em;
}

.single-post-content .entry-content img {
  border-radius: 4px;
  margin: 1.5em 0;
}

/* Category breadcrumb */
.category-breadcrumb {
  margin-bottom: 1em;
  font-size: 0.88em;
}

.category-breadcrumb a {
  color: var(--primary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.category-breadcrumb .separator {
  color: var(--text);
  margin: 0 0.35em;
}

/* ============================================
   Category Archive
   ============================================ */
.archive-header {
  margin-bottom: 2em;
}

.archive-header h1 {
  font-size: 1.75em;
}

.archive-description {
  color: var(--text);
  margin-top: 0.5em;
}

/* ============================================
   Image Captions (from original custom CSS)
   ============================================ */
figure.wp-block-image {
  position: relative;
  display: inline-block;
  overflow: hidden;
  margin: 1.5em 0;
}

figure.wp-block-image img {
  display: block;
  width: 100%;
  height: auto;
}

figure.wp-block-image figcaption {
  position: relative;
  width: 100%;
  color: var(--text-light, #666);
  padding: 8px 0;
  font-size: 0.85em;
  text-align: center;
  box-sizing: border-box;
  font-style: italic;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 1.5em 0;
  text-align: center;
}

.site-footer p {
  font-size: 0.88em;
  color: var(--text);
  margin: 0;
}

/* ============================================
   Responsive — Astra breakpoint 921px
   ============================================ */
@media (max-width: 921px) {
  .ast-container,
  .ast-narrow,
  .ast-article-image-container--wide {
    padding: 0 1.25em;
  }

  .ast-row {
    grid-template-columns: 1fr;
    gap: 1.5em;
  }

  .site-branding img {
    width: 280px;
    height: auto;
  }

  .header-nav {
    right: calc(1.25em + 24px + 1.2em);
  }

  .burger-btn {
    right: 1.25em;
  }

  .single-post-content .entry-title {
    font-size: 1.6em;
  }

  .ast-article-image-container--wide {
    max-width: 100%;
    padding: 0;
  }

  .ast-single-post-featured-section img {
    aspect-ratio: auto;
    object-fit: contain;
  }

  .ast-single-post-featured-section + .ast-narrow {
    margin-top: 0;
  }

  .ast-pagination {
    flex-wrap: wrap;
  }
}


/* ============================================
   Content Styling (for PocketBase editor output)
   ============================================ */
.entry-content a { text-decoration: underline; }
.entry-content a:hover { text-decoration: none; }

.entry-content h2 { margin: 1.5em 0 0.75em; }
.entry-content h3 { margin: 1.25em 0 0.5em; }

.entry-content strong, .entry-content b { font-weight: 600; }
.entry-content em, .entry-content i { font-style: italic; }

/* Divider (replicated from Elementor) */
.entry-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* Table styling — CSS grid layout */
.entry-content table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1em;
  margin: 1.5em 0;
  border: none !important;
}

.entry-content table colgroup,
.entry-content table thead,
.entry-content table tbody,
.entry-content table tr {
  display: contents;
}

.entry-content th,
.entry-content td {
  display: block;
  border: none !important;
  padding: 0.5em 0.75em;
  text-align: center;
}

.entry-content td p {
  margin: 0;
}

.entry-content td img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

/* Share section */
.share-section {
  margin: 2.5em 0 0;
  text-align: center;
}

.share-heading {
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  margin: 0 0 1em;
}

.share-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6em;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.share-facebook  { background: #1877f2; }
.share-whatsapp  { background: #25d366; }
.share-linkedin  { background: #0a66c2; }
.share-x         { background: #000; }
.share-messenger { background: #0084ff; }
.share-email     { background: #888; }
.share-copy      { background: #555; }

.share-copy.copied {
  background: #25d366;
}

/* Post navigation */
.post-nav-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3em 0 1em;
}

.post-nav-heading {
  text-align: center;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  margin: 0 0 1.5em;
}

.post-navigation {
  display: flex;
  justify-content: space-between;
  margin: 0 0 2em;
  gap: 1em;
}

.post-nav-link {
  display: inline-block;
  padding: 0.75em 1.4em;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  text-decoration: none;
  color: var(--accent);
  max-width: 45%;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
}

.post-nav-link:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
  color: var(--accent);
}

.post-nav-next {
  margin-left: auto;
  text-align: right;
}

.post-nav-label {
  display: block;
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  margin-bottom: 0.3em;
}

.post-nav-title {
  display: block;
}

/* ============================================
   Subscribe Form
   ============================================ */
.subscribe-form {
  margin: 2em 0;
}

.form-group {
  margin-bottom: 1.25em;
}

.form-group label {
  display: block;
  font-size: 0.92em;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 0.4em;
}

.form-group label .required {
  color: var(--primary);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.7em 0.9em;
  font-size: 1em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1em;
}

.subscribe-btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.8em 2.5em;
  font-size: 1em;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.subscribe-btn:hover {
  background: var(--primary-hover);
}

.subscribe-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-message {
  margin-top: 1.5em;
  padding: 1em 1.25em;
  border-radius: 4px;
  font-size: 0.95em;
  line-height: 1.5;
}

.form-success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}

.form-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

@media (max-width: 921px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 544px) {
  .site-header .ast-container {
    flex-wrap: wrap;
    min-height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 6px;
  }

  .site-branding {
    width: 100%;
  }

  .header-nav {
    position: static;
    transform: none;
    width: 100%;
    justify-content: center;
  }

  .burger-btn {
    top: 35px;
    right: 1.25em;
    transform: none;
    width: 20px;
    height: 14px;
  }

  .burger-btn span {
    height: 1.5px;
  }
}
