/* =====================================================================
   Prose: κοινή τυπογραφία περιεχομένου για τις εσωτερικές σελίδες (14/11/2026)
   Φορτώνεται από single-municipality.php, page.php και single.php μέσω $template_styles.
   Σκοπός: στήλη κειμένου ως 760px (65-80 χαρακτήρες), ρυθμός παραγράφων/επικεφαλίδων,
   εικόνες σε πλέγμα, πίνακες με scroll σε κινητό. Το περιεχόμενο στη βάση δεν αλλάζει:
   το πλέγμα εικόνων και το wrapper πινάκων μπαίνουν στην έξοδο (inc/prose-content.php).
   ===================================================================== */

/* ----- Κεφαλίδα σελίδας: κρεμ μπάντα με breadcrumbs + τίτλο (αντί για 200px μπάντα και breadcrumbs από κάτω) ----- */
.sf-page-header {
  padding: 22px 0 30px;
  background: var(--sf-cream);
}

.sf-page-header #breadcrumbs {
  justify-content: center;
  margin: 0 0 10px;
}

/* μακρύς τίτλος άρθρου στο breadcrumb: κόβεται με αποσιωπητικά αντί να πιάνει 2-3 γραμμές */
.sf-page-header #breadcrumbs .item-current {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sf-page-header .single-post-title {
  margin: 0;
  color: #24354b;
  font-size: clamp(26px, 1.2vw + 20px, 36px);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

/* Άρθρα (single.php): η μπάντα κρατά μόνο τα breadcrumbs· ο τίτλος μπαίνει στο σώμα, πάνω από την ημερομηνία,
   γιατί οι τίτλοι των ανακοινώσεων είναι μακριοί και κεντραρισμένοι στην μπάντα διαβάζονταν άσχημα */
.sf-page-header--slim {
  padding: 14px 0;
}

.sf-page-header--slim #breadcrumbs {
  margin: 0;
}

.sf-article-title {
  max-width: 760px;
  margin: 0 0 10px;
  color: #24354b;
  font-size: clamp(23px, 0.9vw + 18px, 31px);
  font-weight: 700;
  line-height: 1.25;
}

/* ----- Κείμενο ----- */
.sf-prose {
  max-width: 760px;
  color: var(--sf-text);
  font-size: 17px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.sf-prose > :first-child {
  margin-top: 0;
}

/* το spacer block που έχουν στην αρχή οι σελίδες της μετάπτωσης */
.sf-prose > .wp-block-spacer:first-child {
  display: none;
}

.sf-prose p {
  margin: 0 0 1.15em;
}

/* εισαγωγική παράγραφος */
.sf-prose > p:first-of-type {
  color: var(--sf-brand-ink);
  font-size: 19px;
  line-height: 1.6;
}

.sf-prose h1,
.sf-prose h2,
.sf-prose h3,
.sf-prose h4,
.sf-prose h5 {
  margin: 1.7em 0 0.6em;
  color: var(--sf-brand-dark);
  font-weight: 700;
  line-height: 1.25;
}

.sf-prose h1,
.sf-prose h2 {
  padding-left: 14px;
  border-left: 4px solid var(--sf-accent);
  font-size: 24px;
}

.sf-prose h3 {
  font-size: 20px;
}

.sf-prose h4,
.sf-prose h5 {
  font-size: 17.5px;
}

.sf-prose strong,
.sf-prose b {
  color: #1f2d4a;
  font-weight: 700;
}

.sf-prose a:not(.btn) {
  color: var(--sf-brand-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.sf-prose a:not(.btn):hover {
  color: var(--sf-navy);
  text-decoration-thickness: 2px;
}

.sf-prose ul,
.sf-prose ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
}

.sf-prose li {
  margin-bottom: 0.4em;
}

.sf-prose li::marker {
  color: var(--sf-accent);
}

.sf-prose blockquote {
  margin: 1.5em 0;
  padding: 14px 20px;
  background: var(--sf-surface-alt);
  border-left: 4px solid var(--sf-brand-light);
  border-radius: 0 var(--sf-radius) var(--sf-radius) 0;
}

.sf-prose blockquote p:last-child {
  margin-bottom: 0;
}

.sf-prose hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--sf-border);
}

/* inline στυλ από τη μετάπτωση: κρατάμε τη γραμματοσειρά του site */
.sf-prose [style*="font-family"] {
  font-family: inherit !important;
}

/* ----- Εικόνες ----- */
.sf-prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--sf-radius);
}

.sf-prose figure {
  margin: 1.6em 0;
}

.sf-prose figure.wp-block-image img {
  display: block;
  margin-inline: auto;
}

.sf-prose figcaption {
  margin-top: 0.5em;
  color: var(--sf-text-muted);
  font-size: 13.5px;
  line-height: 1.4;
  text-align: center;
}

/* διαδοχικές εικόνες → πλέγμα ίσων πλακιδίων (wrapper από inc/prose-content.php) */
.sf-prose .sf-figure-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 1.8em 0;
}

.sf-prose .sf-figure-grid figure {
  margin: 0;
  min-width: 0;
}

.sf-prose .sf-figure-grid figure.wp-block-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.sf-prose .sf-figure-grid figcaption {
  font-size: 12.5px;
}

/* Gutenberg gallery (π.χ. Ιστορία: 7 εικόνες σε columns-4 is-cropped): πλέγμα ίσων τετράγωνων πλακιδίων
   σε 3 στήλες, με ολόκληρη την εικόνα μέσα (contain) πάνω σε κρεμ, ώστε να μην κόβονται τα πορτρέτα/γκραβούρες.
   Ο αριθμός των εικόνων καθορίζει αν το πρώτο/τελευταίο πλακίδιο πιάνει 2 στήλες, για να μη μένει ορφανό. */
.sf-prose .wp-block-gallery {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px !important;
  margin: 1.8em 0;
}

.sf-prose .wp-block-gallery > figure {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  min-width: 0;
}

.sf-prose .wp-block-gallery > figure img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--sf-cream);
  border-radius: var(--sf-radius);
}

/* πλήθος 3n+2 (5, 8, …): το πρώτο πιάνει 2 στήλες */
.sf-prose .wp-block-gallery > figure:first-child:nth-last-child(3n+2):not(:nth-last-child(2)) {
  grid-column: span 2;
}

/* πλήθος 3n+1 (4, 7, …): πρώτο και τελευταίο πιάνουν 2 στήλες */
.sf-prose .wp-block-gallery > figure:first-child:nth-last-child(3n+1):not(:only-child),
.sf-prose .wp-block-gallery > figure:first-child:nth-last-child(3n+1):not(:only-child) ~ figure:last-child {
  grid-column: span 2;
}

.sf-prose .wp-block-gallery > figure[style*="span"] img,
.sf-prose .wp-block-gallery > figure:first-child:nth-last-child(3n+2):not(:nth-last-child(2)) img,
.sf-prose .wp-block-gallery > figure:first-child:nth-last-child(3n+1):not(:only-child) img,
.sf-prose .wp-block-gallery > figure:first-child:nth-last-child(3n+1):not(:only-child) ~ figure:last-child img {
  aspect-ratio: 2 / 1;
}

/* 2 εικόνες: δύο στήλες· 1 εικόνα: όλο το πλάτος */
.sf-prose .wp-block-gallery:has(> figure:nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sf-prose .wp-block-gallery:has(> figure:only-child) {
  grid-template-columns: minmax(0, 1fr);
}

.sf-prose .wp-block-gallery figcaption {
  font-size: 12.5px;
}

/* ----- Πίνακες ----- */
.sf-prose .sf-table-scroll {
  margin: 1.6em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sf-prose figure.wp-block-table {
  margin: 1.6em 0;
  overflow: visible;
}

.sf-prose figure.wp-block-table .sf-table-scroll {
  margin: 0;
}

.sf-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.45;
}

/* Gutenberg «fixed layout»: 5 ίσες στήλες στρίμωχναν το κείμενο του θέματος λέξη-λέξη· οι στήλες παίρνουν πλάτος από το περιεχόμενο */
.sf-prose table.has-fixed-layout,
.sf-prose .wp-block-table .has-fixed-layout {
  table-layout: auto !important;
}

/* μέσα σε πίνακα οι λέξεις δεν σπάνε γράμμα-γράμμα (το .sf-prose έχει overflow-wrap:anywhere για το κείμενο)·
   αν ο πίνακας χρειάζεται περισσότερο πλάτος, το δίνει το οριζόντιο scroll του wrapper */
/* (το block-library βάζει word-break:break-word στα .has-fixed-layout td, γι' αυτό το !important) */
.sf-prose table,
.sf-prose th,
.sf-prose td,
.sf-prose .wp-block-table .has-fixed-layout td,
.sf-prose .wp-block-table .has-fixed-layout th {
  overflow-wrap: normal !important;
  word-break: normal !important;
  hyphens: none;
}

.sf-prose .sf-table-scroll table {
  min-width: 100%;
  width: max-content;
  max-width: 100%;
}

.sf-prose th,
.sf-prose td {
  padding: 10px 12px;
  border: 1px solid var(--sf-border);
  text-align: left;
  vertical-align: top;
}

.sf-prose thead th,
.sf-prose tr:first-child th {
  background: var(--sf-cream);
  color: var(--sf-brand-ink);
}

.sf-prose tbody tr:nth-child(even) td {
  background: #fafafa;
}

/* ----- Ενσωματώσεις (YouTube κ.λπ.) ----- */
.sf-prose iframe {
  max-width: 100%;
  border: 0;
  border-radius: var(--sf-radius);
}

.sf-prose iframe[src*="youtube"],
.sf-prose iframe[src*="youtu.be"],
.sf-prose iframe[src*="vimeo"] {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

/* ----- Σελίδες χωρίς πλαϊνό μενού (page.php): κεντραρισμένη στήλη ----- */
.sf-prose-page {
  padding: 40px 0 56px;
}

.sf-prose-page .sf-prose {
  margin-inline: auto;
}

/* ----- Κινητό ----- */
@media (max-width: 767.98px) {
  .sf-page-header {
    padding: 16px 0 22px;
  }

  .sf-prose {
    font-size: 16px;
  }

  .sf-prose > p:first-of-type {
    font-size: 17.5px;
  }

  .sf-prose h1,
  .sf-prose h2 {
    font-size: 21px;
  }

  .sf-prose h3 {
    font-size: 18.5px;
  }

  .sf-prose .sf-figure-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .sf-prose .wp-block-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .sf-prose .wp-block-gallery > figure {
    grid-column: auto !important;
  }

  .sf-prose .wp-block-gallery > figure img {
    aspect-ratio: 1 / 1 !important;
  }

  .sf-prose-page {
    padding: 24px 0 40px;
  }
}
