/*
Theme Name: PoeTheme
Theme URI: https://example.com/poetheme
Author: Cosè Murciano
Author URI: https://example.com
Description: Tema WordPress moderno con supporto completo per Gutenberg, accessibilità e SEO ottimizzata.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: poetheme
Tags: blog, accessibility-ready, custom-logo, custom-menu, rtl-language-support, translation-ready
*/

/* Tailwind CSS is loaded via CDN. Use this file for additional custom styles and accessibility enhancements. */

:root {
  --poetheme-focus-color: #1e40af;
  --poetheme-site-width: 1200px;
}

.poetheme-container {
  width: min(var(--poetheme-site-width), 100%);
  max-width: var(--poetheme-site-width);
  margin-left: auto;
  margin-right: auto;
}

.poetheme-layout-full .poetheme-container {
  width: 100%;
  max-width: none;
}

[x-cloak] {
  display: none !important;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0.5rem;
  background: #111827;
  color: #f9fafb;
  padding: 0.75rem 1rem;
  z-index: 100;
  transform: translateY(-150%);
  opacity: 0;
  transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.skip-link:focus {
  transform: translateY(0);
  opacity: 1;
  outline: 3px solid var(--poetheme-focus-color);
}

a:focus,
button:focus,
input:focus,
textarea:focus {
  outline: 3px solid var(--poetheme-focus-color);
  outline-offset: 2px;
}

.nav-primary a:focus {
  outline: 3px solid var(--poetheme-focus-color);
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.screen-reader-text:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  padding: 1rem;
  clip: auto;
  background: #111827;
  color: #f9fafb;
}

.breadcrumbs {
  font-size: 0.875rem;
  color: #4b5563;
}

.breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus {
  text-decoration: underline;
}

.poetheme-subheader {
  padding: 1.5rem 0;
}

.poetheme-subheader__inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.poetheme-subheader--stack .poetheme-subheader__inner,
.poetheme-subheader--title-only .poetheme-subheader__inner {
  align-items: flex-start;
  text-align: left;
}

.poetheme-subheader--align-center .poetheme-subheader__inner {
  align-items: center;
  text-align: center;
}

.poetheme-subheader--align-right .poetheme-subheader__inner {
  align-items: flex-end;
  text-align: right;
}

.poetheme-subheader__breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.poetheme-subheader--align-center .poetheme-subheader__breadcrumbs {
  justify-content: center;
}

.poetheme-subheader--align-right .poetheme-subheader__breadcrumbs {
  justify-content: flex-end;
}

.poetheme-subheader--split .poetheme-subheader__inner {
  gap: 1rem;
}

@media (min-width: 768px) {
  .poetheme-subheader--split .poetheme-subheader__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
  }

  .poetheme-subheader--split.poetheme-subheader--title-left .poetheme-subheader__title {
    flex: 0 1 60%;
    text-align: left;
  }

  .poetheme-subheader--split.poetheme-subheader--title-left .poetheme-subheader__breadcrumbs {
    flex: 0 1 40%;
    justify-content: flex-end;
  }

  .poetheme-subheader--split.poetheme-subheader--title-right .poetheme-subheader__title {
    order: 2;
    flex: 0 1 40%;
    text-align: right;
  }

  .poetheme-subheader--split.poetheme-subheader--title-right .poetheme-subheader__breadcrumbs {
    order: 1;
    flex: 0 1 60%;
    justify-content: flex-start;
  }
}

.poetheme-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.poetheme-breadcrumbs__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.poetheme-breadcrumbs__link {
  color: inherit;
  text-decoration: none;
}

.poetheme-breadcrumbs__link:hover,
.poetheme-breadcrumbs__link:focus {
  text-decoration: underline;
}

.poetheme-breadcrumbs__current {
  color: inherit;
}

.breadcrumbs__separator {
  display: inline-flex;
  align-items: center;
  color: #9ca3af;
  font-size: 0.75rem;
  margin: 0 0.25rem;
}

.breadcrumbs__separator-text {
  display: inline-block;
}

article {
  margin-bottom: 3rem;
  padding: 1.5rem 0;
}

article header h1,
article header h2 {
  font-size: 1.875rem;
  font-weight: 700;
}

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

/* RTL support */
body.rtl {
  direction: rtl;
  text-align: right;
}

body.rtl .breadcrumbs {
  direction: rtl;
}

body.rtl .skip-link {
  left: auto;
  right: 0;
}

body.admin-bar #wpadminbar {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.8125rem;
}

body.admin-bar #wpadminbar * {
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.poetheme-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.poetheme-nav--desktop li.is-open > [data-poetheme-submenu="true"] {
  display: block;
}

.poetheme-nav--desktop [data-poetheme-submenu="true"] {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.poetheme-nav--mobile[data-ready="true"] [data-poetheme-submenu="true"] {
  display: none;
}

.poetheme-nav--mobile[data-ready="true"] li.is-open > [data-poetheme-submenu="true"] {
  display: block;
}

.poetheme-nav--mobile .poetheme-submenu-indicator {
  transition: transform 0.2s ease;
}

.poetheme-nav--mobile li.is-open .poetheme-submenu-indicator {
  transform: rotate(180deg);
}

.poetheme-nav-link--level-0 {
  padding: 7px 10px;
}

.poetheme-nav-link--submenu {
  display: flex;
  width: 100%;
}

.poetheme-nav--desktop .sub-menu > li {
  width: 100%;
}

.poetheme-nav--desktop .sub-menu > li > a.poetheme-nav-link--submenu {
  width: 100%;
}

/* --------------------------------------------------------------
 * Contenuti multimediali e allineamenti
 * -------------------------------------------------------------- */

.entry-content img,
.entry-content figure img,
.entry-summary img,
.entry-summary figure img,
.page-content img,
.page-content figure img,
.wp-block-image img,
.gallery img,
.wp-block-gallery img {
  max-width: 100%;
  height: auto;
}

.entry-content figure,
.entry-summary figure,
.page-content figure,
.wp-block-image,
.wp-block-image figure {
  margin: 0 0 1.5rem;
}

.entry-content .alignleft,
.entry-summary .alignleft,
.page-content .alignleft,
.wp-block-image .alignleft,
.wp-caption.alignleft {
  float: left;
  margin: 0 1.5rem 1rem 0;
  clear: left;
}

.entry-content .alignright,
.entry-summary .alignright,
.page-content .alignright,
.wp-block-image .alignright,
.wp-caption.alignright {
  float: right;
  margin: 0 0 1rem 1.5rem;
  clear: right;
}

.entry-content .aligncenter,
.entry-summary .aligncenter,
.page-content .aligncenter,
.wp-block-image .aligncenter,
.wp-caption.aligncenter {
  display: block;
  margin: 0 auto 1.5rem;
  text-align: center;
  clear: both;
}

.entry-content .aligncenter img,
.entry-summary .aligncenter img,
.page-content .aligncenter img,
.wp-block-image .aligncenter img,
.wp-caption.aligncenter img {
  margin-left: auto;
  margin-right: auto;
}

.wp-caption {
  max-width: 100%;
  text-align: center;
}

.wp-caption-text,
.gallery-caption,
.blocks-gallery-item figcaption {
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.4;
  margin-top: 0.5rem;
}

.entry-content::after,
.entry-summary::after,
.page-content::after {
  content: "";
  display: block;
  clear: both;
}

@media (max-width: 640px) {
  .entry-content .alignleft,
  .entry-summary .alignleft,
  .page-content .alignleft,
  .wp-block-image .alignleft,
  .wp-caption.alignleft,
  .entry-content .alignright,
  .entry-summary .alignright,
  .page-content .alignright,
  .wp-block-image .alignright,
  .wp-caption.alignright {
    float: none;
    margin: 0 auto 1.25rem;
    display: block;
  }
}

/* --------------------------------------------------------------
 * Gallerie di WordPress
 * -------------------------------------------------------------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.gallery.gallery-columns-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.gallery.gallery-columns-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery.gallery-columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery.gallery-columns-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gallery.gallery-columns-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.gallery.gallery-columns-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.gallery.gallery-columns-7 {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.gallery.gallery-columns-8 {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.gallery.gallery-columns-9 {
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

.gallery-item {
  margin: 0;
}

.gallery-icon img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.25rem;
}

.wp-block-gallery,
.wp-block-gallery .blocks-gallery-grid {
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.wp-block-gallery .blocks-gallery-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.wp-block-gallery.columns-1 .blocks-gallery-grid {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.wp-block-gallery.columns-2 .blocks-gallery-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wp-block-gallery.columns-3 .blocks-gallery-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wp-block-gallery.columns-4 .blocks-gallery-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wp-block-gallery.columns-5 .blocks-gallery-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.wp-block-gallery.columns-6 .blocks-gallery-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.wp-block-gallery .blocks-gallery-item,
.wp-block-gallery figure {
  margin: 0;
}

.wp-block-gallery .blocks-gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.25rem;
}

/* --------------------------------------------------------------
 * Modale lightbox immagini
 * -------------------------------------------------------------- */

.poetheme-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(2px);
  z-index: 9999;
}

.poetheme-lightbox.is-active {
  display: flex;
}

.poetheme-lightbox__content {
  position: relative;
  max-width: min(1024px, 100%);
  max-height: 100%;
  outline: none;
}

.poetheme-lightbox__image {
  display: block;
  max-width: min(1024px, calc(100vw - 3rem));
  max-height: calc(100vh - 3rem);
  width: auto;
  height: auto;
  border-radius: 0.75rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

.poetheme-lightbox__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: none;
  background: rgba(17, 24, 39, 0.85);
  color: #f9fafb;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.poetheme-lightbox__close:hover,
.poetheme-lightbox__close:focus {
  background: rgba(30, 64, 175, 0.95);
  color: #ffffff;
}

body.poetheme-lightbox-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .poetheme-lightbox {
    padding: 1rem;
  }

  .poetheme-lightbox__image {
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 4rem);
    border-radius: 0.5rem;
  }

  .poetheme-lightbox__close {
    top: 0.25rem;
    right: 0.25rem;
  }
}

