/* ==========================================================================
   projects.css — Projects page: layout cleanup + PPE carousels (light)
   Loaded ONLY on the Projects page, so everything here is scoped to it.
   Depends on theme.css + blog.css. Works with Bootstrap 3 carousel markup.
   ========================================================================== */

/* Bootstrap (loaded only on this page, for the grid + carousels) sets a
   base `a:hover, a:focus { text-decoration: underline; }` with no scoping,
   so it leaks onto the nav, sidebar and every other link. Our own hover
   rules only ever touch `color`, never `text-decoration`, so nothing else
   cancels it out. Same specificity as Bootstrap's rule (0,1,1); this file
   loads after bootstrap.min.css so it wins the tie. */
a:hover,
a:focus {
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Project rhythm — turn the flat list into clearly separated blocks.
   Each <h2> becomes a project header with a divider above it; the two
   <h4>s right after it collapse into one "Organisation · Date" meta line.
   -------------------------------------------------------------------------- */
.blog-body hr.section-rule {
  display: none;
}

.blog-body h2 {
  margin-top: 52px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
  font-size: clamp(1.5rem, 3vw, 1.85rem);
}

/* First project header sits right under the intro — a little less gap */
.blog-body > p:first-child + hr.section-rule + h2,
.blog-body > p:first-child + h2 {
  margin-top: 34px;
}

.blog-body h2 + h4 {
  display: inline-block;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.blog-body h2 + h4 + h4 {
  display: inline-block;
  margin: 0 0 0 0.55em;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-subtle);
}

.blog-body h2 + h4 + h4::before {
  content: "·";
  margin-right: 0.55em;
  color: var(--text-subtle);
}

/* Gap between the meta line and the description that follows */
.blog-body h4 + p {
  margin-top: 12px;
}

/* Media rows: consistent framing */
.blog-body .row {
  margin-top: 6px;
  margin-bottom: 8px;
}

/* Compact table text (Smart Mailbox feature overview) */
.blog-body table {
  font-size: 0.8rem;
}

.blog-body table th,
.blog-body table td {
  padding: 7px 10px;
}

/* Word-wrap table cells instead of horizontal scrolling */
@media (max-width: 768px) {
  .blog-body table {
    overflow-x: visible;
    white-space: normal;
  }
}

/* Tableau embed: contain within column, reduce height */
.tableauPlaceholder {
  max-width: 100%;
  overflow: hidden;
}

.blog-body .row img,
.blog-body .row video {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.blog-body .video-container iframe {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* --------------------------------------------------------------------------
   Carousels
   -------------------------------------------------------------------------- */
[class*="carousel1-img"],
[class*="carousel2-img"] {
  height: clamp(300px, 44vh, 480px);
  background-position: center;
  background-size: cover;
  border-radius: var(--radius-lg);
}

.carousel {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  margin-bottom: 18px;
}

.carousel-inner,
.carousel-inner .item {
  border-radius: var(--radius-lg);
}

/* Controls ----------------------------------------------------------------- */
.carousel-control {
  width: 12%;
  background-image: none !important;
  opacity: 1;
  color: var(--text);
  text-shadow: none;
}

.carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-top: -21px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: rgba(255, 253, 248, 0.86);
  color: var(--text);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 16px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.carousel-control:hover .glyphicon-chevron-left,
.carousel-control:hover .glyphicon-chevron-right {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Indicators --------------------------------------------------------------- */
.carousel-indicators li {
  width: 8px;
  height: 8px;
  margin: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.28);
}

.carousel-indicators .active {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-color: var(--accent);
}

/* Caption ------------------------------------------------------------------ */
.carousel-caption {
  right: 15%;
  left: 15%;
  bottom: 16px;
  padding: 8px 0;
  text-shadow: none;
}

.carousel-caption h3 {
  display: inline-block;
  margin: 0;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background: rgba(31, 28, 24, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
}

/* Responsive --------------------------------------------------------------- */
@media (max-width: 768px) {
  [class*="carousel1-img"],
  [class*="carousel2-img"] {
    height: clamp(240px, 36vh, 380px);
  }
}

/* --------------------------------------------------------------------------
   Background images (one rule per slide)
   -------------------------------------------------------------------------- */
.carousel1-img1  { background-image: url(../../projects/img-volunteer/Mask1a.webp); }
.carousel1-img2  { background-image: url(../../projects/img-volunteer/Mask2a.webp); }
.carousel1-img3  { background-image: url(../../projects/img-volunteer/Mask3a.webp); }
.carousel1-img4  { background-image: url(../../projects/img-volunteer/Mask4a.webp); }
.carousel1-img5  { background-image: url(../../projects/img-volunteer/Mask5a.webp); }
.carousel1-img6  { background-image: url(../../projects/img-volunteer/Mask6a.webp); }
.carousel1-img7  { background-image: url(../../projects/img-volunteer/Mask7a.webp); }
.carousel1-img8  { background-image: url(../../projects/img-volunteer/Mask8a.webp); }
.carousel1-img9  { background-image: url(../../projects/img-volunteer/Mask9a.webp); }
.carousel1-img10 { background-image: url(../../projects/img-volunteer/Mask10a.webp); }

.carousel2-img1  { background-image: url(../../projects/img-volunteer/Mask1b.webp); }
.carousel2-img2  { background-image: url(../../projects/img-volunteer/Mask2b.webp); }
.carousel2-img3  { background-image: url(../../projects/img-volunteer/Mask3b.webp); }
.carousel2-img4  { background-image: url(../../projects/img-volunteer/Mask4b.webp); }
.carousel2-img5  { background-image: url(../../projects/img-volunteer/Mask5b.webp); }
.carousel2-img6  { background-image: url(../../projects/img-volunteer/Mask6b.webp); }
.carousel2-img7  { background-image: url(../../projects/img-volunteer/Mask7b.webp); }
.carousel2-img8  { background-image: url(../../projects/img-volunteer/Mask8b.webp); }
.carousel2-img9  { background-image: url(../../projects/img-volunteer/Mask9b.webp); }
.carousel2-img10 { background-image: url(../../projects/img-volunteer/Mask10b.webp); }

/* ==========================================================================
   Projects page — sidebar nav layout
   ========================================================================== */
.proj-layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 32px;
  align-items: start;
  margin-top: 0;
}

.proj-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
}

.proj-nav {
  list-style: none;
  padding: 6px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.proj-nav li { margin: 0; }

.proj-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: none !important;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.proj-nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: rgba(38, 34, 28, 0.08);
  color: var(--text-subtle);
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}

.proj-nav-link.is-active .proj-nav-count {
  background: var(--accent-ring);
  color: var(--accent);
}

.proj-nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.proj-nav-link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Clip Bootstrap row negative-margin overflow so it can't widen the page */
.proj-layout > .blog-body {
  overflow-x: clip;
  min-width: 0;
}

/* Scroll targets */
h2.proj-section,
section.proj-section {
  scroll-margin-top: calc(var(--nav-h) - 21px);
}

/* Category section headings — matches h3.cert-section-heading exactly.
   Needs the `p` type qualifier so its specificity (0,1,1) beats the generic
   `.blog-body p` rule (also 0,1,1 but earlier in the cascade) — otherwise
   that rule's margin-bottom: 18px silently wins over this one. */
p.proj-section-heading {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-top: 52px;
  margin-bottom: 8px;
}

.proj-section-heading:first-of-type {
  margin-top: 0;
}

/* First h2 after a category heading — suppress duplicate top border */
.proj-section-heading + h2.proj-section {
  border-top: none;
  margin-top: 8px;
  padding-top: 0;
}

/* First h2 inside a section immediately after a category heading (e.g. Volunteer → PPE) */
.proj-section-heading + section.proj-section > h2 {
  border-top: none;
  margin-top: 8px;
  padding-top: 0;
}

@media (max-width: 760px) {
  .proj-layout {
    grid-template-columns: 1fr;
    gap: 0;
    overflow-x: clip;
    overflow-y: visible;
  }

  .proj-sidebar {
    position: sticky;
    top: calc(var(--nav-h) + 4px);
    z-index: 90;
    background: var(--bg);
    padding-bottom: 14px;
    margin-bottom: 0;
  }

  .proj-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .proj-nav li { flex: 0 0 auto; }

  .proj-nav-link {
    justify-content: center;
    padding: 7px 5px;
    font-size: 0.78rem;
    white-space: nowrap;
    border: 1px solid var(--border);
  }

  .proj-nav-link.is-active { border-color: var(--accent-ring); }

  /* Free up horizontal space for the label text — the count is
     redundant here and was pushing longer labels off the right edge. */
  .proj-nav-count {
    display: none;
  }

  /* The desktop offset above is tuned for the vertical sidebar layout and
     throws off scroll position once the nav becomes a horizontal strip —
     fall back to the site's normal scroll-padding-top baseline on mobile. */
  h2.proj-section,
  section.proj-section {
    scroll-margin-top: 0;
  }
}
