/* =====================================================================
   TYPOGRAPHY
   ===================================================================== */
:root {
    --brand-red: #9E1B34;
    --gray-light: #f5f5f5;
    --header-text: #ffffff;

    --space-sm: 0.25rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --snail-maxwidth: 320px;
}

body {
    font-family: 'Newsreader', serif;
    font-size: 18px;
}

h1, h2, h3, h4, h5, h6, #quote-box {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 700;
}

h3 { font-size: 1.1rem; }
h4 { font-size: 0.9rem; }


/* =====================================================================
   HEADER / NAVIGATION
   ===================================================================== */
#header {
    background-color: var(--brand-red);
    font-family: 'Libre Franklin', sans-serif;
}

/* Make sure the fixed header always sits above Leaflet map layers */
body.header-fixed #header {
  z-index: 2000;  /* higher than Leaflet's panes */
}

/* Keep mobile hamburger + overlay above header and map */
.mobile-menu,
.mobile-menu .button_container,
.mobile-container,
#overlay {
  z-index: 2100;
}

#header > section a {
    color: var(--header-text) !important;
}

#header > section a:hover,
#header > section a:visited,
#header > section a:active {
    background-color: transparent !important;
    color: var(--header-text) !important;
}

#header nav.dropmenu a {
    color: #333 !important;
    background-color: #ffffff !important;
}

#header nav.dropmenu a:hover {
    color: var(--brand-red) !important;
    background-color: var(--gray-light) !important;
}

/* --- Mobile nav & overlay menu --- */
@media (max-width: 840px) {
  /* Hamburger icon bars */
  #toggle span,
  #toggle span::before,
  #toggle span::after {
    background-color: #ffffff !important;
  }

  /* Main links in the slide-out menu */
  #overlay .treemenu li a {
    font-family: 'Libre Franklin', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 1.2rem;
    font-weight: 400;
    color: #ffffff;
    line-height: 1.5;
  }

  #overlay .treemenu li a:hover,
  #overlay .treemenu li a:focus,
  #overlay .treemenu li a.active {
    color: #ffffff;
    text-decoration: underline;
  }

  /* “+ / –” togglers for submenus */
  #overlay .treemenu li .toggler {
    font-family: 'Libre Franklin', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 1.2rem;
    color: #ffffff;
    margin-right: 0.6rem;
    position: relative;
    top: 0.28rem;
  }

  /* Spacing and alignment within the overlay menu */
  #overlay .treemenu li {
    padding: 0.6rem 0;
    align-items: center;
  }

  #overlay .treemenu li ul li {
    padding: 0.45rem 0;
    padding-left: 1.5rem;
    align-items: center;
  }

  /* Bullets alignment */
  #overlay .treemenu li::before {
    margin-right: 0.75rem;
    position: relative;
    top: 0.28rem;
  }

  /* Snail image behavior on mobile */
  .desktop-snail {
    display: none;
    float: none;
    max-width: none;
    margin: 0;
  }

  .mobile-snail {
    display: block;
  }
}


/* =====================================================================
   COLUMN GRID LAYOUT HELPERS
   ===================================================================== */
.twocolumn-container,
.threecolumn-container {
    display: grid;
    gap: var(--space-lg);
}

.twocolumn-container {
    grid-template-columns: repeat(2, 1fr);
}

.threecolumn-container {
    grid-template-columns: repeat(3, 1fr);
}

/* --- Asymmetric two-column layout for course pages --- */
.asym-two-column {
    display: grid;
    grid-template-columns: 2fr 1fr;   /* Left wider than right */
    gap: 2rem;
    align-items: flex-start;
}

/* Ensure grid columns can shrink to available width (important for embeds) */
.asym-two-column > div {
  min-width: 0;
}

@media (max-width: 768px) {
    .asym-two-column {
        grid-template-columns: 1fr;   /* Stack on mobile */
        gap: 1rem;
    }

    .twocolumn-container,
    .threecolumn-container {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .twocolumn-container h3,
    .threecolumn-container h3 {
        margin-top: var(--space-sm);
    }

    /* Increase vertical breathing room above H3s in three-column on mobile */
    .threecolumn-container h3 {
        margin-top: 2rem !important;
    }
}


/* =====================================================================
   IMAGE FLOAT / RESPONSIVE HELPERS
   ===================================================================== */
.mobile-snail {
    display: none;
}

.desktop-snail {
    float: right;
    max-width: var(--snail-maxwidth);
    margin: 0 0 var(--space-md) var(--space-lg);
}

.desktop-snail img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.pdf-mobile-link {
  display: none !important;
}

/* On small screens, show the link instead of the embed */
@media (max-width: 768px) {
  .responsive-pdf {
    display: none;
  }

  .pdf-mobile-link {
    display: block !important;
    margin-top: 0.5rem;
  }

  .pdf-mobile-link a {
    text-decoration: underline;
  }
}


/* =====================================================================
   PINNED TO JAPAN LAYOUT
   ===================================================================== */
.p2j-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2rem;
}

.p2j-map-column {
  flex: 3 1 64%;
  min-width: 0;
}

.p2j-list-column {
  flex: 1 1 28%;
  min-width: 260px;
  max-height: min(600px, 60vh);
  overflow-y: auto;
  padding: 0 !important;
  margin-top: -0.35rem !important;
}

/* Entry list items */
.p2j-entry-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.p2j-entry {
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}

.p2j-entry:last-child {
  border-bottom: none;
}

.p2j-entry:hover {
  background: #f7f7f7;
}

.p2j-entry.active {
  background: #e6eef7;
  border-radius: 6px;
}

.p2j-entry-title {
  font-family: "Newsreader", serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.p2j-entry-date,
.p2j-entry-location {
  font-family: "Libre Franklin", sans-serif;
  font-size: 0.7rem;
  font-weight: 300;
  line-height: 1.3;
  color: #555555;
}

.p2j-entry-location {
  margin-bottom: 0.2rem;
}

/* Permalink icon for pin entries */
.p2j-entry-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.p2j-permalink {
  opacity: 0;
  transition: opacity 0.2s;
  text-decoration: none;
  font-size: 0.75rem;
  color: #666;
  flex-shrink: 0;
}

.p2j-entry:hover .p2j-permalink {
  opacity: 1;
}

.p2j-permalink:hover {
  color: #9E1B34;
}


/* =====================================================================
   PINNED TO JAPAN MAP BOX
   ===================================================================== */
#p2j-map {
  width: 100%;
  height: min(600px, 60vh);
  min-height: 450px;
  border: 1px solid #cccccc;
}

/* Show All Pins button */
.show-all-pins-btn {
  background: white;
  border: 2px solid rgba(0,0,0,0.2);
  border-radius: 4px;
  padding: 0;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0,0,0,0.15);
  margin-top: 10px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 34px;
  -webkit-appearance: none;
  appearance: none;
}

.show-all-pins-btn:hover {
  background: #f4f4f4;
}

/* =====================================================================
   PINNED TO JAPAN POPUPS
   ===================================================================== */

/* Remove Leaflet's default inner margin/padding so we control everything */
.leaflet-popup-content {
  margin: 0;
}

.leaflet-popup-content-wrapper {
  padding: 0;
}

/* Override Leaflet's default paragraph margins in popups */
.leaflet-popup-content p {
  margin: 0.45rem 0 !important;
}

/* Overall popup container – no padding so image can go edge-to-edge */
.p2j-popup {
  font-family: "Libre Franklin", sans-serif;
  max-width: 280px;
  padding: 0;
}

/* Basic text sizing */
.p2j-popup h3 {
  margin: 0;
  font-size: 1rem;
}

.p2j-popup p {
  margin: 0;
  font-size: 0.8rem;
}

/* Hero image full width */
.p2j-popup-image {
  margin: 0;
}

.p2j-popup-image img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

/* Text content padding */
.p2j-popup-title,
.p2j-popup-location,
.p2j-popup-text {
  padding: 0 0.75rem;
}

/* Title / headline */
.p2j-popup-title {
  font-family: "Newsreader", serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.6rem 0 0.1rem;
}

/* Location line / subtitle */
.p2j-popup-location {
  font-size: 0.65rem;
  font-weight: 400;
  color: #444;
  margin: 0 0 0.25rem;
}

/* Descriptive text (scrollable) */
.p2j-popup-text {
  font-family: "Newsreader", serif;
  font-size: 0.7rem;
  line-height: 1.2;
  color: #333;
  margin: 0 0 0.75rem;
  max-height: 125px;
  overflow-y: auto;
  padding-right: 1rem;  /* room for scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.25) transparent;
}

/* Handle markdown-generated paragraphs inside popup text */
.p2j-popup-text p {
  font-family: "Newsreader", serif;
  font-size: 0.7rem;
  line-height: 1.2;
  color: #333;
  margin: 0;
}

/* Style links in popup text */
.p2j-popup-text a {
  color: #9E1B34;
  text-decoration: underline;
}

.p2j-popup-text a:hover {
  color: #7a1528;
}

/* Scrollbar styling */
.p2j-popup-text::-webkit-scrollbar {
  width: 6px;
}

.p2j-popup-text::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.25);
  border-radius: 3px;
}

.p2j-popup-link {
  padding: 0 0.75rem;
  margin: 0.15rem 0 0.75rem !important;
  font-size: 0.7rem !important;
}

.p2j-popup-link a {
  color: #9E1B34;
  text-decoration: none;
  font-weight: 500;
}

.p2j-popup-link a:hover {
  text-decoration: underline;
}

/* =====================================================================
   PINNED TO JAPAN MOBILE DEGRADATION
   ===================================================================== */
@media (max-width: 800px) {
  .p2j-layout {
    flex-direction: column;
  }

  .p2j-list-column {
    max-height: none;
    border-left: none;
    border-top: 1px solid #dddddd;
    padding-left: 0;
    padding-top: 1.25rem;
  }

  #p2j-map {
    height: 50vh;
    min-height: 320px;
  }
}

/* =====================================================================
   SIMPLELIGHTBOX FIXES
   ===================================================================== */

/* Lightbox overlay above header but below image */
.sl-overlay {
  z-index: 3000 !important;
}

/* Wrapper, image, and controls above overlay */
.sl-wrapper {
  z-index: 3001 !important;
}

.sl-image {
  z-index: 3002 !important;
}

/* Make close button visible and properly positioned */
.sl-close {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  color: #ffffff !important;
  font-size: 3rem !important;
  line-height: 1 !important;
  font-weight: 200 !important;
  position: fixed !important;
  top: 30px !important;
  right: 30px !important;
  z-index: 3003 !important;
  cursor: pointer !important;
}

.sl-close:hover {
  color: #cccccc !important;
}


/* =====================================================================
   CONTACT PAGE LAYOUT
   ===================================================================== */

.contact-two-column {
    display: grid;
    grid-template-columns: 1.1fr 1.5fr;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 1.5rem;
}

.contact-text {
    max-width: 36rem;
}

.contact-form {
    max-width: 32rem;
}

@media (max-width: 768px) {
    .contact-two-column {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .contact-form {
        max-width: 100%;
    }
}


/* =====================================================================
   FOOTER
   ===================================================================== */
#footer {
    font-family: 'Libre Franklin', sans-serif;
    font-size: 0.6rem;
}
