/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  padding: 8px 16px;
  background: var(--bs-primary);
  color: var(--bs-white);
  text-decoration: none;
  z-index: 100;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

:root {
  --bs-blue: #0d6efd;
  --bs-indigo: #6610f2;
  --bs-purple: #6f42c1;
  --bs-pink: #d63384;
  --bs-red: #dc3545;
  --bs-orange: #fd7e14;
  --bs-yellow: #ffc107;
  --bs-green: #198754;
  --bs-teal: #20c997;
  --bs-cyan: #0dcaf0;
  --bs-white: #fff;
  --bs-gray: #6c757d;
  --bs-gray-light: #f4f4f4;
  --bs-gray-dark: #343a40;
  --bs-primary: #5e60ce;
  --bs-primary-dark: #4a4c9a;
  --bs-primary-darker: #2a2c5a;
  --bs-primary-light: #7e80d1;
  --bs-secondary: #6c757d;
  --bs-success: #198754;
  --bs-info: #0dcaf0;
  --bs-warning: #ffc107;
  --bs-danger: #dc3545;
  --bs-light: #f8f9fa;
  --bs-dark: #212529;
  --bs-link-color: var(--bs-primary);
  --bs-link-hover-color: var(--bs-primary-dark);
  --bs-font-sans-serif: system-ui, -apple-system, "Lato", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  --bs-gradient: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0)
  );
}

a {
  color: var(--bs-link-color) !important;
}

a:hover {
  color: var(--bs-link-hover-color) !important;
}

.bg-primary {
  background-color: var(--bs-primary) !important;
}

.bg-primary-dark {
  background-color: var(--bs-primary-dark) !important;
}

.bg-primary-darker {
  background-color: var(--bs-primary-darker) !important;
}

.bg-gray-light {
  background-color: var(--bs-gray-light) !important;
}

a.btn-primary,
a.btn-primary:hover {
  color: var(--bs-white) !important;
}

.bg-primary-light {
  background-color: var(--bs-primary-light) !important;
}

.text-primary {
  color: var(--bs-primary) !important;
}

.text-primary-dark {
  color: var(--bs-primary-dark) !important;
}

.text-primary-light {
  color: var(--bs-primary-light) !important;
}

.btn-primary {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.btn-primary:hover {
  background-color: var(--bs-primary-dark);
  border-color: var(--bs-primary-dark);
}



.bg-dark {
  background-color: var(--bs-dark) !important;
  color: var(--bs-white);
}

.rounded {
  border-radius: 0.25rem;
}

.rounded-lg {
  border-radius: 1rem;
}

.border-primary {
  border-color: var(--bs-primary) !important;
}

html {
  height: 100%;
}

body {
  font-family: "Lato", sans-serif;
  font-size: 1.2em;
  height: 100%;
}

article {
  font-family: "Lato", sans-serif;
  font-size: 1.2rem;
  color: rgb(41, 41, 41);
}

/* Force Lato on article content - overrides Font Awesome inheritance from icons */
article p,
article li {
  font-family: "Lato", sans-serif !important;
}

article p {
  line-height: 1.6em;
  margin-bottom: 1.5rem;
}

article img {
  display: block;
  margin: 3em auto;
  max-width: 100%;
}

article li {
  margin-bottom: 4px;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: "Nunito", sans-serif;
  font-weight: 700;
}

article h1,
article h2,
article h3,
article h4,
article h5 {
  margin-top: 2.5rem;
}

.block-featured {
  font-family: "Lato", sans-serif;
}

.wrapper {
  position: relative;
  min-height: 100%;
}

.bg-light {
  background-color: #eeeeee !important;
}

.form-group {
  margin-bottom: 1rem;
}

.navbar-top {
  background: rgba(255, 255, 255, 0.9);
}

.navbar-main > li > a {
  text-transform: uppercase;
}

.navbar-light .navbar-toggler:focus {
  outline: none;
}
.navbar-light .navbar-toggler {
  border: none;
}

/* Mobile menu: centered items with more vertical spacing */
@media (max-width: 991.98px) {
  #navbarSupportedContent {
    margin-top: 0.75rem;
  }
  #navbarSupportedContent .navbar-nav {
    align-items: center;
    text-align: center;
  }
  #navbarSupportedContent .navbar-nav .nav-item {
    padding: 0.75rem 0;
  }
}

.navbar-brand .logo {
  height: 35px;
}

.navbar-logo {
  height: 35px;
  width: auto;
}

@media (max-width: 575px) {
  .navbar-logo {
    height: 24px;
    width: auto;
  }
}

.main-content {
  padding-bottom: 630px;
}

@media (min-width: 768px) {
  .main-content {
    padding-bottom: 330px;
  }

  footer {
    height: 330px !important;
  }

  footer h4 {
    margin-top: 0;
  }
}

.main-title {
  padding-bottom: 0.5em;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15) !important;
}

.shadow {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.shadow-sm {
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

.shadow-lg {
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.shadow-none {
  box-shadow: none;
}

.w-full {
  width: 100%;
}

.card {
  border: none !important;
}

.card-link a,
.card-link a:hover {
  color: #000;
  text-decoration: none;
}

.text-reset:hover {
  color: inherit !important;
  text-decoration: none !important;
}

.text-reset:hover .card-title {
  color: var(--bs-primary) !important;
}

.media-small .media-title {
  font-size: 1em;
}

.media-small .media-text {
  font-size: 0.9em;
}

.card-img-top {
  width: 100%;
  height: 25em;
  object-fit: cover;
}

.book-category-list {
  list-style-type: none;
  margin-left: 0;
  padding-left: 0;
}

.book-category-list li {
  padding: 3px 0px 3px;
}

.book-img-top {
  width: 100%;
  height: 10em;
  object-fit: cover;
}

.follow-link {
  text-align: right;
  text-transform: uppercase;
}

/* adds some margin below the link sets  */
.navbar .dropdown-menu div[class*="col"] {
  margin-bottom: 1rem;
}

.navbar .dropdown-menu {
  border: none;
  background-color: rgba(255, 255, 255, 0.9);
}

.bordered-header {
  border-top: 1px solid #dedede;
  border-bottom: 1px solid #dedede;
}

.hero {
  text-align: center;
  position: relative;
  background-size: cover;
  background-position: center;
}

@media screen and (min-width: 768px) {
  .hero {
    padding: 400px 0 60px 0;
    margin: 0 0 40px;
  }

  .navbar-default {
    position: fixed;
    z-index: 1030;
    right: 0;
    left: 0;
    border-radius: 0;
    top: 0;
    border-width: 0 0 1px;
  }
}

.logo-wrapper {
  height: 200px;       
  display: flex;
  align-items: center;  
  justify-content: center; 
  margin-bottom: 15px;
  padding: 10px;
}

.logo-wrapper img {
  max-height: 100%;    
  max-width: 100%;     /* Il logo non uscirà mai dai lati */
  width: auto;
  height: auto;
  object-fit: contain; /* Fondamentale: mantiene le proporzioni senza tagliare */
}

h1.title {
  color: rgb(41, 41, 41);
  font-size: 36px;
}

.subtitle {
  color: rgb(117, 117, 117);
}

.homepage > .hero {
  margin-top: 4em;
  text-align: center;
  position: relative;
  padding: auto;
  background-size: cover;
  background-position: center;
  min-height: auto;
}

.hero-gradient-mask {
  position: absolute;
  width: 100%;
  height: 100%;
  bottom: 0;
  left: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.01) 1%,
    rgba(0, 0, 0, 1) 100%
  );
}

footer {
  font-size: 1rem;
  position: absolute;
  background-color: #2a5c71;
  height: 600px;
  bottom: 0;
  left: 0;
  right: 0;
}

footer h4 {
  color: #fff;
  font-size: 1.2rem;
  margin-top: 10px;
}

footer a {
  color: #fff !important;
  font-size: 1rem;
  text-decoration: none;
}

footer a:hover {
  color: #fff !important;
  text-decoration: underline;
}

footer ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

footer .footer-logo {
  max-width: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.copyright {
  font-size: 0.8em;
  background-color: #244e60;
  color: #fff !important;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.copyright a {
  font-size: 1em;
  color: #fff !important;
}

/* HOMEPAGE */

/* Propaganda section buttons */
.propaganda-section-btn {
  background: linear-gradient(135deg, var(--bs-primary-light) 0%, var(--bs-primary-dark) 100%);
  border-radius: 20px;
  position: relative;
  min-height: 72px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-shadow: 0 4px 14px rgba(94, 96, 206, 0.35);
}

.propaganda-section-btn:hover {
  background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-primary-darker) 100%);
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(74, 76, 154, 0.45);
}

/* Post list item: full-width rectangular image on mobile, square on desktop */
@media (max-width: 767.98px) {
  .post-list-img {
    width: 100% !important;
    height: 180px !important;
    object-fit: cover;
  }
}

/* HOMEPAGE END */

/* breakpoint and up - mega dropdown styles */
@media screen and (min-width: 992px) {
  /* remove the padding from the navbar so the dropdown hover state is not broken */
  .navbar {
    padding-top: 0px;
    padding-bottom: 0px;
  }

  /* remove the padding from the nav-item and add some margin to give some breathing room on hovers */
  .navbar .nav-item {
    padding: 0.5rem 0.5rem;
    margin: 0 0.25rem;
  }

  /* makes the dropdown full width  */
  .navbar .dropdown {
    position: static;
  }

  .navbar .dropdown-menu {
    width: 100%;
    left: 0;
    right: 0;
    /*  height of nav-item  */
    top: 45px;
  }

  /* shows the dropdown menu on hover */
  .navbar .dropdown:hover .dropdown-menu,
  .navbar .dropdown .dropdown-menu:hover {
    display: block !important;
  }

  .navbar .dropdown-menu {
    border: 1px solid rgba(0, 0, 0, 0.15);
    background-color: #fff;
  }
}

.rich-text img {
  max-width: 100%;
  height: auto;
}

.responsive-embed {
  position: relative;
  width: 100%;
}

/* Issuu: fixed height for scrollable documents */
.responsive-embed--issuu iframe {
  width: 100% !important;
  height: 70vh !important;
  min-height: 500px;
  max-height: 700px;
}

/* Issuu wrapper: constrains height so page margin is always visible for scrolling */
.issuu-embed-wrapper {
  position: relative;
  width: 100%;
  height: 65vh;
  max-height: 65vh;
  overflow: hidden;
}

.issuu-embed-wrapper .responsive-embed--issuu {
  height: 100%;
}

.issuu-embed-wrapper .responsive-embed--issuu iframe {
  height: 100% !important;
  min-height: unset !important;
  max-height: unset !important;
}

/* Touch devices: pointer-events none by default so scroll passes through */
@media (hover: none) and (pointer: coarse) {
  .issuu-embed-wrapper .responsive-embed--issuu iframe,
  .responsive-embed--fixed-height iframe {
    pointer-events: none;
  }
  .issuu-embed-wrapper.is-active .responsive-embed--issuu iframe,
  .responsive-embed--fixed-height.is-active iframe {
    pointer-events: auto;
  }
}

@media (max-width: 768px) {
  .responsive-embed {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }

  .issuu-embed-wrapper {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    height: 45vh;
    max-height: 45vh;
  }

  .responsive-embed--issuu iframe {
    height: 80vh !important;
    min-height: 450px;
  }
}

/* Non-Issuu (YouTube, etc.): aspect-ratio box */
/* When Wagtail adds responsive-object wrapper */
.responsive-embed .responsive-object {
  position: relative;
  height: 0;
  overflow: hidden;
}

.responsive-embed .responsive-object iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  min-height: unset !important;
  max-height: unset !important;
}

/* When Wagtail does NOT add responsive-object (direct iframe, e.g. cached embed) */
.responsive-embed:not(.responsive-embed--issuu) {
  aspect-ratio: 16/9;
}

.responsive-embed:not(.responsive-embed--issuu) > iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  min-height: unset !important;
  max-height: unset !important;
}

/* Fixed-height fallback iframe (matches issuu/book-preview-card height) */
.responsive-embed--fixed-height {
  height: 65vh;
  max-height: 65vh;
  overflow: hidden;
}

.responsive-embed--fixed-height iframe {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 768px) {
  .responsive-embed--fixed-height {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    height: 45vh;
    max-height: 45vh;
  }
}

/* Book preview card (gruppoeli, sanomaitalia, lascuola — opens fullscreen modal) */
.book-preview-card {
  position: relative;
  background-color: #4a4c9a;
  height: 65vh;
  max-height: 65vh;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 1rem;
  overflow: hidden;
}

.book-preview-card__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.book-preview-card__btn {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background-color: #fff;
  color: #4a4c9a;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  padding: 0.75rem 2rem;
  border-radius: 2rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  pointer-events: none;
}

.book-preview-card:hover .book-preview-card__btn,
.book-preview-card:focus .book-preview-card__btn {
  background-color: #4a4c9a;
  color: #fff;
  outline: 2px solid #fff;
}

@media (max-width: 768px) {
  .book-preview-card {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    height: 45vh;
    max-height: 45vh;
  }
}

/* Fullscreen book modal */
#bookPreviewModal .modal-content {
  height: 100%;
}

#bookPreviewModal .modal-header {
  min-height: 3.5rem;
  align-items: center;
  flex-shrink: 0;
}

#bookPreviewModal .modal-body {
  overflow: hidden;
  flex: 1 1 0;
  min-height: 0;
}

.book-modal-back {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #fff;
  padding: 0.5rem;
  border-radius: 0.375rem;
  flex-shrink: 0;
  transition: background-color 0.15s;
}

.book-modal-back:hover,
.book-modal-back:focus {
  background-color: rgba(255,255,255,0.15);
  outline: none;
}

.shopify-buy__product__price {
  text-align: center !important;
}

/* =====================
   Live Search
   ===================== */

/* Overlay: copre l'intera navbar sticky */
.search-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  z-index: 200;
  align-items: center;
}

.search-overlay.open {
  display: flex;
}

.search-toggle-btn {
  line-height: 1;
  text-decoration: none !important;
  color: inherit;
}

/* Dropdown: posizionato sotto la navbar (top: 100%) */
.live-search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1050;
  overflow: hidden;
  max-height: 70vh;
  overflow-y: auto;
}

.live-search-dropdown.show {
  display: block;
}

.search-result-item {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 1rem;
  text-decoration: none !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  color: #212529 !important;
  transition: background 0.12s;
}

.search-result-item:hover,
.search-result-item:focus {
  background: var(--bs-gray-light);
  outline: none;
}

.search-result-type {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--bs-primary);
  font-weight: 700;
  line-height: 1.2;
}

.search-result-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #212529;
  line-height: 1.3;
}

.search-result-subtitle {
  font-size: 0.78rem;
  color: var(--bs-secondary);
  line-height: 1.2;
}

.search-results-footer {
  display: block;
  padding: 0.55rem 1rem;
  text-align: center;
  background: var(--bs-gray-light);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--bs-primary) !important;
  text-decoration: none !important;
  transition: background 0.12s;
}

.search-results-footer:hover {
  background: #e2e3f0;
}

.search-no-results {
  padding: 0.75rem 1rem;
  color: var(--bs-secondary);
  font-size: 0.88rem;
}

/* =====================
   SERP
   ===================== */

.search-result-card {
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-result-card:hover {
  border-color: var(--bs-primary) !important;
  box-shadow: 0 2px 8px rgba(94, 96, 206, 0.12);
}

.search-result-thumb {
  width: 80px;
}

.search-result-img {
  width: 80px;
  max-height: 110px;
  object-fit: contain;
  border-radius: 3px;
}

.search-result-img-placeholder {
  width: 80px;
  height: 110px;
  background: var(--bs-gray-light);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* Book card cover container: portrait ratio for book covers */
.book-cover-container {
  overflow: hidden;
  aspect-ratio: 3 / 4;
  width: 100%;
}

/* Publisher page: books first on mobile, posts after */
@media (max-width: 991.98px) {
  .publisher-main-row .order-lg-1 {
    order: 2;
  }
  .publisher-main-row .order-lg-2 {
    order: 1;
  }
}

/* Gallery block — striscia con carosello */
.gallery-strip-outer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gallery-strip {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 0.625rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.gallery-strip::-webkit-scrollbar { display: none; }

.gallery-strip__item {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.gallery-strip__img {
  height: 280px;
  width: auto;
  display: block;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
  max-width: none;
}

.gallery-strip__img:hover {
  opacity: 0.88;
}

.gallery-strip__caption {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
  color: #666;
}

.gallery-strip__arrow {
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
  align-self: center;
}

.gallery-strip__arrow:hover {
  background: rgba(0, 0, 0, 0.8);
}

@media (max-width: 575.98px) {
  .gallery-strip__img {
    height: 200px;
  }
  .gallery-strip__arrow {
    font-size: 2rem;
  }
}

/* Lightbox modal image */
#galleryModal .modal-dialog {
  height: 90vh;
  max-height: 90vh;
}

#galleryModal .modal-content {
  height: 100%;
  overflow: hidden;
}

.gallery-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 20;
}

.gallery-modal-body {
  flex: 1;
  min-height: 0;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#galleryModalImg {
  flex-shrink: 1;
  min-height: 0;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

/* Lightbox modal arrows */
.gallery-modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.45);
  border: none;
  color: #fff;
  font-size: 3rem;
  line-height: 1;
  padding: 0.1em 0.4em;
  border-radius: 0.25rem;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s ease;
  user-select: none;
}

.gallery-modal-arrow:hover {
  background: rgba(0, 0, 0, 0.75);
}

.gallery-modal-arrow--prev { left: 0.5rem; }
.gallery-modal-arrow--next { right: 0.5rem; }

@media (max-width: 575.98px) {
  .gallery-modal-arrow {
    font-size: 2rem;
    padding: 0.1em 0.3em;
  }
}
