/*
  site.css
  Main stylesheet for the DigiLetClass project.
  - Defines color variables, fonts, and global styles
  - Styles for layout, navbar, cards, badges, modals, pagination, buttons, and responsive design
  - Organized by component/section for maintainability
*/
:root {
  --primary-color: #800020;
  --primary-color-dark: #4B0010;
  --accent-color-light: #f3e9e1;
  --accent-color-medium: #eaddd7;
  --bg-color: #fdfaf6;
  --card-bg: #ffffff;
  --text-main: #222;
  --text-on-primary: #ffffff;
  --text-on-accent: #800020;
  --card-bg-color: #ee9b00;
  --card-header-color: #ca6702;
  --badge-id-bg: #bb3e03;
  --badge-id-text: #fff;
  --badge-type-bg: #ae2012;
  --badge-type-text: #fff;
  --badge-extid-bg: #9b2226;
  --badge-extid-text: #fff;
}

body {
  background: var(--bg-color);
  color: var(--text-main);
  font-family: 'B612', Arial, sans-serif;
}
.navbar {
  background: var(--primary-color-dark);
  color: var(--text-on-primary);
}
.navbar a, .navbar a:visited {
  color: var(--text-on-primary);
}
.navbar a:hover {
  color: var(--accent-color-light);
}
.card {
  background: var(--card-bg);
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border: 1px solid #ddd;
  transition: all 0.3s ease-in-out;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.card-header {
  background: var(--accent-color-light) !important;
  border-bottom: none !important;
  color: var(--text-on-accent);
}
a, .link {
  color: var(--primary-color);
  text-decoration: underline;
}
a:hover, .link:hover {
  color: #b3003c;
}
footer {
  color: var(--primary-color);
  background: var(--accent-color-light);
  border-top: 1px solid #e0e0e0;
}

/* Badges */
.badge {
  font-family: 'B612', Arial, sans-serif;
  font-size: 0.8em;
  font-weight: 700;
  padding: 0.4em 0.7em;
  border-radius: 0.25rem;
}
.badge-id {
  background: var(--primary-color) !important;
  color: var(--text-on-primary) !important;
}
.badge-type {
  background: var(--accent-color-light) !important;
  color: var(--text-on-accent) !important;
  font-variant: small-caps;
  letter-spacing: 0.03em;
}
.badge-extid, .badge-extid:visited {
  background: var(--accent-color-medium) !important;
  color: var(--text-on-accent) !important;
  text-decoration: none;
}
.badge-extid:hover {
    opacity: 0.85;
    filter: brightness(90%);
}
.badge-unknown {
  background: #e0e0e0 !important;
  color: #800020 !important;
  font-variant: small-caps;
  letter-spacing: 0.03em;
}
.badge-b612 {
  font-family: 'B612', Arial, sans-serif !important;
}
.card-title {
  font-family: 'Baskervville', serif !important;
}
.card-text {
  font-family: 'B612', Arial, sans-serif !important;
}

.baskervville-regular {
    font-family: "Baskervville", serif;
    font-weight: 400;
    font-style: normal;
}
  
.baskervville-regular-italic {
    font-family: "Baskervville", serif;
    font-weight: 400;
    font-style: italic;
}

.navbar-brand {
    font-size: 1.2em;
    font-weight: 600;
}

.navbar-item {
    font-variant: small-caps;
    margin-left: 30px;
}

.body-content {
    padding: 5px;
    font-family: "B612", sans-serif;
}

.main-content-compact h2.display-5 {
    font-family: "Baskervville", serif !important;
}

.navbar-digiletclass {
  background: var(--primary-color-dark);
  box-shadow: 0 2px 8px #e0e0e0;
  font-family: 'B612', Arial, sans-serif;
}

.orgs-card-modern {
  border-radius: 1.2rem;
  transition: box-shadow 0.2s, transform 0.2s;
}
.orgs-card-modern:hover {
  box-shadow: 0 4px 16px #bfa5b8;
  transform: translateY(-2px) scale(1.01);
}
.orgs-card-modern .card-title {
  /* font-family: 'B612', Arial, sans-serif; */
}
@media (max-width: 767px) {
  .orgs-card-modern {
    margin-bottom: 1.5rem;
  }
}

.orgs-card-info {
  font-size: 1.05em;
  font-family: 'B612', Arial, sans-serif;
  color: var(--primary-color-dark);
  background: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0.5em;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2em;
  align-items: center;
}
.orgs-card-info .meta-label {
  font-weight: 600;
  margin-right: 0.2em;
  color: var(--primary-color);
}
.orgs-card-info .meta-value {
  font-weight: 400;
  color: var(--text-main);
}

.card-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}

.card.org-card {
  flex: 1 1 320px;
  min-width: 280px;
  max-width: 32%;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  break-inside: avoid;
  height: auto;
  min-height: 0;
  box-sizing: border-box;
}

@media (max-width: 992px) {
  .card.org-card {
    max-width: 48%;
  }
}
@media (max-width: 768px) {
  .main-content-compact {
    padding: 2vw 2vw 1vw 2vw;
  }
  .card.org-card {
    max-width: 100%;
    min-width: 0;
  }
  .card-container {
    gap: 1rem;
  }
}
.card-body.d-flex.flex-column.h-100 {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}

@media (max-width: 992px) {
  .card-container {
    column-count: 2;
  }
}

@media (max-width: 768px) {
  .card-container {
    column-count: 1;
  }
}

.main-content-compact {
  max-width: 1200px;
  margin: 0 auto;
  background: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  padding: 3.5rem 3.5rem 2.5rem 3.5rem;
}

.container-inner {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.breadcrumb {
  background: transparent;
  font-size: 1.05em;
  margin-bottom: 0.5rem;
  padding-left: 0;
}
.breadcrumb-item + .breadcrumb-item::before {
  content: '>';
  color: var(--primary-color-dark);
  margin: 0 0.4em;
}
.breadcrumb-item {
  color: var(--primary-color-dark);
  font-weight: 500;
}
.breadcrumb-item.active {
  color: var(--primary-color);
  font-weight: 700;
}

.body-content {
    flex: 1 0 auto;
    padding-bottom: 3rem;
}

html, body {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.footer-custom {
    flex-shrink: 0;
}

.footer-custom, .footer-custom h6, .footer-custom p, .footer-custom a {
    font-family: 'B612', sans-serif !important;
}
.footer-custom h6 {
  color: var(--primary-color) !important;
}
.footer-custom p {
  color: #000 !important;
}
.footer-custom a {
  color: #000 !important;
  text-decoration: underline !important;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--primary-color);
}
.footer-custom a:hover, .footer-custom a:focus {
  text-decoration: underline;
  font-weight: 600;
}

/* Footer link visibility */
/* (moved above for specificity) */

/* Footer credits logo sizing and spacing */
.footer-credits-logo {
  max-width: 36rem;
  width: 100%;
  display: block;
  margin: 1rem auto;
}

/* Hero edition image hover cue */
.edizione-link {
  position: relative;
  display: inline-block;
}
.edizione-hover-cue {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.0);
  color: #fff;
  opacity: 0;
  transition: background 0.2s ease, opacity 0.2s ease;
  border-radius: 14px;
  pointer-events: none;
}
.edizione-link:hover .edizione-hover-cue,
.edizione-link:focus-within .edizione-hover-cue {
  background: rgba(0,0,0,0.18);
  opacity: 1;
}
.edizione-hover-cue .cue-pill {
  background: rgba(128,0,32,0.9);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  font-weight: 700;
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

.btn-sameas {
  width: 2em;
  height: 2em;
  min-width: 2em;
  min-height: 2em;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.4em;
  border: 1.5px solid #800020 !important;
  background: #fff !important;
  color: #800020 !important;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  vertical-align: middle;
  line-height: 1;
  text-decoration: none !important;
  box-shadow: none !important;
  outline: none !important;
}
.btn-sameas:hover, .btn-sameas:focus {
  border-color: #800020 !important;
  background: #800020 !important;
  color: #fff !important;
  box-shadow: none !important;
  outline: none !important;
}
.btn-sameas .entity-modal-icon {
  color: inherit !important;
  font-size: 1.15em;
  transition: color 0.2s;
  display: block;
  margin: 0 auto;
}
.btn-sameas:hover .entity-modal-icon, .btn-sameas:focus .entity-modal-icon {
  color: #fff !important;
}
/* Prevent .entity-modal-link from affecting .btn-sameas */
.btn-sameas.entity-modal-link, .btn-sameas.entity-modal-link:visited {
  color: #800020 !important;
}
.btn-sameas:hover.entity-modal-link, .btn-sameas:focus.entity-modal-link {
  color: #fff !important;
}

/* Pagination */
.pagination .page-link {
  color: var(--primary-color);
  background-color: #fff;
  border-color: #ddd;
}
.pagination .page-link:hover {
  background-color: var(--accent-color-light);
  color: var(--primary-color-dark);
}
.pagination .page-item.active .page-link {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}
.pagination .page-item.active .page-link:hover {
  background-color: var(--primary-color-dark);
  border-color: var(--primary-color-dark);
}
.pagination .page-item.disabled .page-link {
  color: #999;
  background-color: #f9f9f9;
  border-color: #ddd;
}

.pagination {
    flex-wrap: wrap;
    justify-content: center;
}

.pagination .page-item {
    margin-bottom: 0.5rem;
}

.org-modal-content a.meta-value,
.org-modal-content a.meta-value:visited {
    color: var(--primary-color);
    text-decoration: underline;
}

.org-modal-content a.meta-value:hover {
    color: var(--primary-color-dark);
}

.org-type-select {
  background: var(--accent-color-light);
  color: var(--primary-color-dark);
  border: 2px solid var(--primary-color);
  border-radius: 0.7em;
  font-family: 'B612', Arial, sans-serif;
  font-size: 1.08em;
  font-weight: 500;
  padding: 0.45em 1.2em 0.45em 0.7em;
  box-shadow: 0 2px 8px rgba(128,0,32,0.07);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.org-type-select:focus, .org-type-select:hover {
  border-color: var(--primary-color-dark);
  box-shadow: 0 4px 16px rgba(128,0,32,0.13);
  outline: none;
}

/* === Entity Modal General Styles === */
.entity-modal {
  font-family: 'B612', Arial, sans-serif;
  color: #222;
}
.entity-modal-title {
  color: #800020;
  font-family: 'Baskervville', serif;
  font-weight: 700;
  font-size: 1.6em;
  margin-bottom: 0.3em;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.entity-modal-section-title {
  color: #800020;
  font-family: 'B612', Arial, sans-serif;
  font-weight: 700;
  font-size: 1.2em;
  margin-bottom: 0.5em;
  display: block;
}
.entity-modal-label {
  color: #800020;
  font-weight: 700;
  font-size: 1em;
  letter-spacing: 0.01em;
  margin-bottom: 0.1em;
  display: inline-block;
  margin-right: 0.5em;
}
.entity-modal-value {
  color: #222;
  font-weight: 400;
  font-size: 1em;
  display: inline;
  word-break: break-word;
  margin: 0;
}
.entity-modal-link, .entity-modal-link:visited {
  color: #222 !important;
  text-decoration: underline;
  font-weight: 500;
}
.entity-modal-link:hover, .entity-modal-link:focus {
  color: #222 !important;
  text-decoration: underline;
}
.entity-modal-icon {
  color: #800020;
  margin-right: 0.3em;
  font-size: 1.1em;
  vertical-align: middle;
  font-weight: bold;
}
.entity-modal-subtitle {
  color: #4B0010;
  font-size: 1.08em;
  font-weight: 500;
  margin-bottom: 0.7em;
  display: flex;
  align-items: center;
  gap: 0.7em;
}
.entity-modal-dot {
  color: #bfa5b8;
  font-size: 1.2em;
  margin: 0 0.4em;
}
.entity-modal-section {
  margin-bottom: 1.2em;
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}

/* Remove badge backgrounds in modals */
.entity-modal .badge, .entity-modal .badge-type, .entity-modal .badge-unknown {
  background: none !important;
  color: inherit !important;
  font-variant: inherit;
  letter-spacing: inherit;
  font-weight: inherit;
  padding: 0;
  border-radius: 0;
}

.btn-sameas.ms-2 {
  margin-left: 0.2em !important;
  vertical-align: middle !important;
  position: static;
}

.entity-search-filter-bar {
  background: var(--accent-color-light);
  border-radius: 1rem;
  box-shadow: 0 2px 8px #e0e0e0;
  gap: 1em;
  margin-bottom: 2em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.entity-search-filter-bar label {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 0;
  margin-right: 0.5em;
}
.entity-search-filter-bar .form-select,
.entity-search-filter-bar .form-control {
  border-radius: 0.5em;
  border: 1px solid var(--primary-color);
  min-width: 160px;
  font-size: 1em;
  box-shadow: none;
}
.entity-search-filter-bar .form-control:focus,
.entity-search-filter-bar .form-select:focus {
  border-color: var(--primary-color-dark);
  box-shadow: 0 0 0 0.1rem var(--primary-color-dark, #80002033);
}
.entity-search-filter-bar .btn-primary {
  background: var(--primary-color);
  border: none;
  border-radius: 0.5em;
  font-weight: 600;
  padding: 0.5em 1.5em;
  transition: background 0.2s;
}
.entity-search-filter-bar .btn-primary:hover {
  background: var(--primary-color-dark);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-color-dark) !important;
  border-color: var(--primary-color-dark) !important;
}
@media (max-width: 600px) {
  .entity-search-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7em;
  }
  .entity-search-filter-bar .form-select,
  .entity-search-filter-bar .form-control {
    min-width: 0;
    width: 100%;
  }
  .entity-search-filter-bar .btn-primary {
    width: 100%;
  }
}

.card .bi-geo-alt {
  color: #800020;
  margin-right: 0.3em;
}

/* === DigiLetClass Buttons: Modern Accessible Redesign === */
.btn-digiletclass-main {
  background: #800020;
  color: #fff;
  border: none;
  border-radius: 0.7rem;
  font-weight: 700;
  padding: 0.7em 2em;
  font-size: 1.08em;
  box-shadow: 0 2px 8px rgba(128,0,32,0.10);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.08s;
  outline: none;
}
.btn-digiletclass-main:hover, .btn-digiletclass-main:focus {
  background: #4B0010;
  color: #fff;
  box-shadow: 0 4px 16px rgba(128,0,32,0.16);
}
.btn-digiletclass-main:active {
  transform: scale(0.97);
  background: #800020;
}
.btn-digiletclass-main:focus-visible {
  outline: 3px solid #f3e9e1;
  outline-offset: 2px;
}

.btn-digiletclass-outline {
  background: #fff;
  color: #800020;
  border: 2px solid #800020;
  border-radius: 0.7rem;
  font-weight: 700;
  padding: 0.7em 2em;
  font-size: 1.08em;
  box-shadow: none;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.08s;
  outline: none;
}
.btn-digiletclass-outline:hover, .btn-digiletclass-outline:focus {
  background: #f3e9e1;
  color: #800020;
  border-color: #4B0010;
  box-shadow: 0 2px 12px rgba(128,0,32,0.10);
}
.btn-digiletclass-outline:active {
  transform: scale(0.97);
  border-color: #800020;
}
.btn-digiletclass-outline:focus-visible {
  outline: 3px solid #f3e9e1;
  outline-offset: 2px;
}
.home-root {
  overflow-x: hidden;
}

.hero-section {
  background: var(--primary-color-dark) !important;
  position: relative;
  min-height: 380px;
  overflow: hidden;
}
.hero-bg-img {
  object-fit: cover;
  opacity: 0.13;
  z-index: 1;
}
.hero-overlay {
  background: transparent;
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 1;
}
.hero-overlay-strong {
  background: rgba(75,0,16,0.7);
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 2;
}
.hero-section .hero-title, .hero-section .hero-lead {
  text-shadow: 0 2px 12px rgba(0,0,0,0.45);
}

/* Make hero lead text smaller and responsive */
.hero-section .hero-lead {
  font-size: clamp(1rem, 2vw, 1.25rem) !important;
  line-height: 1.5;
}

.edizione-section {
  background: var(--accent-color-light);
  border-radius: 2rem;
}
.edizione-img {
  max-width: 320px;
  border-radius: 10px;
  background: var(--bg-color);
  padding: 0.7rem;
}
.edizione-title {
  color: #800020;
  font-size: 1.8rem;
}

.recap-section {
  background: #f3e9e1 !important;
  border-radius: 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}
.bg-white {
  background: #fff !important;
}

.recap-card {
  border-radius: 1.2rem;
  background: #fff;
  transition: box-shadow 0.2s, transform 0.2s;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
}
.recap-card-entities { background: #f3e9e1; }
.recap-card-project { background: #fdfaf6; }
.recap-card-methodology { background: #f3e9e1; }
.recap-card-contact { background: #fdfaf6; }
.recap-card:hover {
  box-shadow: 0 8px 32px rgba(128,0,32,0.10);
  transform: translateY(-4px) scale(1.02);
  background: var(--accent-color-medium);
}
.recap-icon {
  font-size: 2.7rem;
  color: #800020;
  background: #fff;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(128,0,32,0.07);
}
.recap-card-title {
  color: #800020;
}
.recap-btn {
  margin-top: auto;
  font-size: 1.08em;
  padding: 0.5em 1.5em;
}

@media (max-width: 991px) {
  .recap-card { min-height: 260px; }
}
@media (max-width: 767px) {
  .recap-section { border-radius: 1rem; }
  .edizione-section { border-radius: 1rem; }
  .recap-card { min-height: 0; }
}
section, .container-xl {
  margin-bottom: 2.5rem !important;
}

.navbar-modern {
  background: #f9f6f2;
  box-shadow: 0 2px 16px rgba(128,0,32,0.07);
  border-bottom: 1.5px solid #eaddd7;
  min-height: 70px;
  position: sticky;
  top: 0;
  z-index: 1050;
}
.navbar-bg-img {
  pointer-events: none;
  user-select: none;
  opacity: 0.28;
  left: 0;
  right: auto;
  z-index: 0;
  width: 320px;
  min-width: 180px;
  max-width: 40vw;
  height: 100%;
  background: url('../static/lettera-1.png') left center/cover no-repeat;
}
.navbar-modern .navbar-brand {
  font-size: 2rem;
  color: #800020 !important;
  letter-spacing: 0.01em;
  padding-right: 1.5rem;
}
.navbar-modern .navbar-nav .nav-link {
  color: #4B0010 !important;
  font-weight: 600;
  font-family: 'B612', Arial, sans-serif;
  font-size: 1.08em;
  margin-left: 1.2rem;
  transition: color 0.18s;
}
.navbar-modern .navbar-nav .nav-link.active, .navbar-modern .navbar-nav .nav-link:hover, .navbar-modern .navbar-nav .nav-link:focus {
  color: #800020 !important;
  text-decoration: underline;
}

/* Fix dropdown visibility in light navbar */
.navbar .dropdown-menu {
  z-index: 2000;
  max-height: 60vh;
  overflow-y: auto;
}
.navbar .dropdown-menu .dropdown-item,
.navbar .dropdown-menu .dropdown-item:visited {
  color: #4B0010 !important;
  font-family: 'B612', Arial, sans-serif;
}
.navbar .dropdown-menu .dropdown-item:hover,
.navbar .dropdown-menu .dropdown-item:focus {
  color: #800020 !important;
  background-color: var(--accent-color-light);
}

/* Mobile navbar - hamburger button visibility */
.navbar-toggler {
  border: 1.5px solid #800020 !important;
  background-color: rgba(255, 255, 255, 0.9);
}
.navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(128, 0, 32, 0.2);
}
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23800020' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Mobile responsive styles */
@media (max-width: 991px) {
  .navbar-modern .navbar-brand {
    font-size: 1.4rem;
  }
  .navbar-bg-img {
    width: 100%;
    max-width: 100%;
    opacity: 0.2;
  }
  .navbar-collapse {
    margin-top: 0.5rem;
    background-color: transparent;
    padding: 0;
  }
  .navbar-modern .navbar-nav {
    background-color: rgba(255, 255, 255, 0.97);
    padding: 0.5rem 0;
    border-top: 1px solid #eaddd7;
    border-radius: 4px;
  }
  .navbar-modern .navbar-nav .nav-link {
    margin-left: 0;
    padding: 0.6rem 1rem;
    font-size: 1rem;
  }
  .navbar .dropdown-menu {
    background-color: rgba(255, 255, 255, 0.85);
    border: none;
    margin-top: 0;
    padding: 0.25rem 0;
  }
  .navbar .dropdown-menu .dropdown-item {
    padding: 0.5rem 1.5rem;
  }
}

.entity-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1) !important;
}
