/* =============================================================
   Puzzle-STAMPS  –  site-wide custom styles
   ============================================================= */

/* --- Navbar dropdown ---------------------------------------- */
@media (min-width: 992px) {
  .navbar .nav-item.dropdown:hover > .dropdown-menu {
    display: block;
    margin-top: 0;
  }
}

.navbar .dropdown-menu {
  border-radius: 0;
  border-top: 2px solid #343a40;
  border-left: 1px solid #dee2e6;
  border-right: 1px solid #dee2e6;
  border-bottom: 1px solid #dee2e6;
  min-width: 200px;
  padding: 0.25rem 0;
  box-shadow: 0 4px 8px rgba(0,0,0,.08);
}

.navbar .dropdown-item {
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  color: #495057;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
  background-color: #f8f9fa;
  color: #343a40;
}

.navbar .dropdown-item.active-page {
  background-color: #343a40;
  color: #fff;
}

/* Indent sub-items in mobile slideout menu */
.mobile-sub-item a {
  padding-left: 2rem !important;
  font-size: 0.92em;
  color: #555;
}

/* --- Download bar ------------------------------------------- */
.download-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.75rem 1.25rem;
  margin: 1rem 0 1.5rem;
  flex-wrap: wrap;
}

.download-btn {
  display: inline-block;
  background: #f8f9fa;
  color: #fff !important;
  padding: 0.45rem 1.1rem;
  border-radius: 0.25rem;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.download-btn:hover {
  background: #23272b;
  color: #fff !important;
}

.download-note {
  font-size: 0.85rem;
  color: #6c757d;
}

/* --- Sensor table ------------------------------------------- */
.sensor-table th { background-color: #f8f9fa; }

/* --- Dataset sub-pages -------------------------------------- */
.page-header-sub {
  color: #6c757d;
  text-align: center;
  margin-top: -0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.sub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.75rem;
}

/* When two sub-navs are stacked, remove the separator from the first */
.sub-nav:has(+ .sub-nav) {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0.3rem;
}

/* Secondary sub-nav (e.g. protocol phases) — muted grey scheme */
.sub-nav + .sub-nav a,
.sub-nav + .sub-nav a:link,
.sub-nav + .sub-nav a:visited {
  background: #fff;
  color: #6c757d !important;
  border-color: #adb5bd;
  font-size: 0.83rem;
}

.sub-nav + .sub-nav a:hover,
.sub-nav + .sub-nav a:focus {
  background: #f8f9fa;
  color: #495057 !important;
  border-color: #6c757d;
}

.sub-nav + .sub-nav a.active-page,
.sub-nav + .sub-nav a.active-page:link,
.sub-nav + .sub-nav a.active-page:visited {
  background: #6c757d;
  color: #fff !important;
  border-color: #6c757d;
}

.sub-nav + .sub-nav a.active-page:hover,
.sub-nav + .sub-nav a.active-page:focus {
  background: #5a6268;
  color: #fff !important;
  border-color: #5a6268;
}

.sub-nav a,
.sub-nav a:link,
.sub-nav a:visited {
  padding: 0.35rem 0.85rem;
  border-radius: 0.25rem;
  font-size: 0.88rem;
  color: #343a40 !important;
  text-decoration: none !important;
  background: #fff;
  border: 1px solid #343a40;
  transition: background 0.15s, color 0.15s;
}

.sub-nav a:hover,
.sub-nav a:focus {
  background: #f8f9fa;
  color: #343a40 !important;
  border-color: #343a40;
}

.sub-nav a.active-page,
.sub-nav a.active-page:link,
.sub-nav a.active-page:visited {
  background: #343a40;
  color: #fff !important;
  border-color: #343a40;
}

.sub-nav a.active-page:hover,
.sub-nav a.active-page:focus {
  background: #23272b;
  color: #fff !important;
  border-color: #23272b;
}

/* --- Issue tables ------------------------------------------- */
.issue-table th {
  background-color: #f8f9fa;
}

.badge-resolved {
  background-color: #28a745;
  color: #fff;
  padding: 0.25em 0.6em;
  border-radius: 0.25rem;
  font-size: 0.82em;
  white-space: nowrap;
}

.badge-unresolved {
  background-color: #dc3545;
  color: #fff;
  padding: 0.25em 0.6em;
  border-radius: 0.25rem;
  font-size: 0.82em;
  white-space: nowrap;
}

.badge-partial {
  background-color: #fd7e14;
  color: #fff;
  padding: 0.25em 0.6em;
  border-radius: 0.25rem;
  font-size: 0.82em;
  white-space: nowrap;
}

.badge-documented {
  background-color: #6c757d;
  color: #fff;
  padding: 0.25em 0.6em;
  border-radius: 0.25rem;
  font-size: 0.82em;
  white-space: nowrap;
}

/* --- Puzzle cards ------------------------------------------- */
.puzzle-card {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: #fff;
}

.puzzle-card .puzzle-title {
  font-weight: 600;
  font-size: 0.93rem;
  margin-bottom: 0.3rem;
}

.puzzle-card .hint-list {
  padding-left: 1.2rem;
  margin-top: 0.4rem;
  margin-bottom: 0;
  font-size: 0.92em;
}

.puzzle-card .segment-badge {
  font-size: 0.78em;
  background-color: #e9ecef;
  color: #495057;
  padding: 0.15em 0.55em;
  border-radius: 0.25rem;
  margin-right: 0.4rem;
}

/* --- Floor plan placeholder --------------------------------- */
.floor-plan-placeholder {
  border: 2px dashed #ced4da;
  border-radius: 0.375rem;
  padding: 3rem;
  text-align: center;
  color: #6c757d;
  background-color: #f8f9fa;
  margin: 1.5rem 0;
}

/* --- Consent table ----------------------------------------- */
.consent-table {
    border-collapse: collapse;
    width: 100%;
    border: 1px solid #dee2e6; /* Ensures the outer boundary is consistent */
}

/* Base styling for all cells */
.consent-table th, 
.consent-table td {
    padding: 0.3rem 0.5rem;
    font-size: 0.88rem;
    vertical-align: middle;
    text-align: center;
    border: 1px solid #dee2e6; /* Standardizes all grid lines */
}

/* Header Specifics */
.consent-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

/* Border for the start of a new recording group */
.consent-table tbody tr.rec-start {
    border-top: 2px solid #dee2e6;
}

/* HANDLING THE COLUMN SHIFT */
/* First row of a group: Participant is col 2, Role is col 3 */
.consent-table tr.rec-start td:nth-child(2),
.consent-table tr.rec-start td:nth-child(3) {
    text-align: center;
}

/* Subsequent rows: Participant is col 1, Role is col 2 */
.consent-table tr:not(.rec-start) td:nth-child(1),
.consent-table tr:not(.rec-start) td:nth-child(2) {
    text-align: center;
}

/* Status Colors (Yes/No) */
.consent-yes {
    background-color: #28a745;
    color: #fff;
    font-size: 0.82em;
    font-weight: bold;
}

.consent-no {
    background-color: #dc3545;
    color: #fff;
    font-size: 0.82em;
    font-weight: bold;
}

/* --- Recording Header (The Spanned Cell) ------------------- */
.consent-table td[rowspan] {
    background-color: #f8f9fa;
    font-weight: bold;
    /* Thick black border removed from here */
    border-left: 1px solid #dee2e6; 
}

/* --- Standalone Highlight Box (Keep this for external notes) - */
.consent-highlight {
    border-left: 4px solid #343a40;
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    margin: 1rem 0;
}

/* --- Mobile hamburger icon --------------------------------- */
.nav-hamburger-icon { font-size: 1.2rem; }

/* --- Page-level typography --------------------------------- */
.page-title { text-align: center; }
.page-nav-bottom { text-align: center; }
.abstract-text { text-align: justify; }

/* --- Table cell helpers ------------------------------------ */
.td-rowspan-header { vertical-align: middle; font-weight: 600; }
.td-label { font-weight: 600; }
.table-note { font-size: 0.85rem; color: #6c757d; margin-top: 1rem; }

/* --- Images & figures -------------------------------------- */
figcaption { font-size: 0.8em; color: #6c757d; margin-top: 0.25rem; }

.img-centered { display: block; margin-left: auto; margin-right: auto; max-width: 100%; height: auto; }

.gallery-img { max-width: 100%; border-radius: 0.25rem; border: 1px solid #dee2e6; }
.gallery-img--tall { max-height: 420px; width: auto; }
.gallery-img--artifact { max-width: 100%; border-radius: 0.25rem; border: 1px solid #ced4da; background: #fff; }
.trapdoor-code-img { height: 30px; width: auto; border-radius: 0.25rem; border: 1px solid #ced4da; background: #fff; }
.wand-img { height: 100px; width: auto; border-radius: 0.25rem; border: 1px solid #ced4da; background: #fff; }
.solution-img { height: 150px; max-width: 100%; border-radius: 0.25rem; border: 1px solid #ced4da; }

.gallery-figure { flex: 1; min-width: 180px; margin: 0; text-align: center; }
.gallery-figure--sm { flex: 1; min-width: 160px; margin: 0; text-align: center; }
.gallery-figure--wide { flex: 1; min-width: 0; max-width: 600px; margin: 0; text-align: center; }
.figure-inline { margin: 0; text-align: center; }
.figure-inline--spaced { margin: 0.6rem 0 0.4rem; text-align: center; }
.figure-standalone { margin: 0 0 1.5rem; text-align: center; max-width: 480px; }
.figure-standalone--centered { margin-left: auto; margin-right: auto; max-width: 100%; }

/* --- Flex layout containers -------------------------------- */
.img-gallery { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.img-gallery--centered { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; margin-bottom: 0.75rem; }
.img-gallery--puzzlebox { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.5rem; align-items: flex-end; justify-content: center; }
.img-gallery--puzzlebox .gallery-figure--sm { flex: 1 1 150px; min-width: 150px; }
.img-gallery--puzzlebox .gallery-figure--sm .gallery-img { width: 100%; height: auto; object-fit: contain; }
.img-gallery--puzzlebox .puzzlebox-side .gallery-img { aspect-ratio: 1488 / 1920; object-fit: cover; }
.trapdoor-code-strip { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; align-items: flex-end; }
.toolbox-items { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; margin-top: 0.6rem; }

/* --- Puzzle card sub-components ---------------------------- */
.puzzle-context-box {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #e9ecef;
  border-radius: 0.25rem;
  font-size: 0.92em;
  color: #495057;
}

.puzzle-sub-card {
  border: 1px solid #e9ecef;
  border-radius: 0.3rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: #fafafa;
}

.puzzle-sub-card--dark {
  border-color: #343a40;
  background: #f0f0f0;
}

.segment-badge--dark { background: #343a40; color: #fff; }
.segment-duration { font-weight: 400; margin-right: 0.4rem; }
.puzzle-desc-list { margin-bottom: 0.4rem; }
.puzzle-hint-list-sm { margin-bottom: 0.3rem; font-size: 0.92em; }

/* --- Responsive video embed -------------------------------- */
.video-embed-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
}

.video-embed-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* --- Floor plan placeholder text --------------------------- */
.floor-plan-placeholder p { font-size: 1.1rem; margin-bottom: 0.5rem; }
.floor-plan-placeholder p:last-child { margin-bottom: 0; }

/* --- Misc spacing helpers ---------------------------------- */
.section-h2--spaced { margin-top: 2rem; }
.p-contact-note { margin-top: 1.5rem; }
.p-intro-wide { text-align: center; margin-bottom: 2rem; }

/* --- Lightbox overlay -------------------------------------- */
.clickable-img {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.clickable-img:hover {
  opacity: 0.85;
}

.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  display: block;
  border-radius: 0.25rem;
}

.lightbox-close {
  position: absolute;
  top: -2rem;
  right: -1rem;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  z-index: 10000;
}

.lightbox-close:hover {
  color: #ccc;
}

/* --- Image credit badge ------------------------------------ */
.credit-badge {
  display: inline-block;
  font-size: 0.7em;
  color: #6c757d;
  background: #f0f0f0;
  border: 1px solid #dee2e6;
  border-radius: 0.2rem;
  padding: 0.1rem 0.35rem;
  margin-top: 0.15rem;
  vertical-align: middle;
}

.credit-badge a {
  color: #6c757d;
  text-decoration: none;
}

.credit-badge a:hover {
  color: #495057;
  text-decoration: underline;
}