/* ============================================================
   PROJECT TEMPLATE
   Overrides style.css project rules. Loaded after style.css.
   ============================================================ */

/* ── Page background ─────────────────────────────────────────────────────── */
/* Overrides any body background-color set by style.css so the image shows. */
body {
  background-color: transparent;
  background-image: url('../images/background.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* ── Column layout ───────────────────────────────────────────────────────── */
.project {
  max-width: 800px;
  margin: 60px auto 40px;
  padding: 40px 24px 24px;
  background: #EDE8DC;
  color: #000;
}

@media (max-width: 767px) {
  .project {
    margin-top: 0;
    margin-bottom: 80px;
    padding: 56px 16px 55px; /* bottom padding clears fixed nav bar */
  }

  /* background-attachment: fixed renders incorrectly on mobile browsers,
     causing a gap on the right edge. Switch to scroll on small screens. */
  body {
    background-attachment: scroll;
    overflow-x: hidden;
  }
}

/* ── Project title block (title + subheadings) ───────────────────────────── */
.project-title-block {
  flex: 1 1 auto;
  min-width: 0;
}

.project-title-block h1 {
  margin: 0 0 4px;
}

.project-sub1 {
  font-family: "RuneScape UF", Arial, Helvetica, sans-serif;
  font-size: clamp(14px, 2.5vw, 19px);
  font-weight: bold;
  color: #000;
  margin: 0 0 2px;
  line-height: 1.3;
}

.project-sub2 {
  font-family: "RuneScape UF", Arial, Helvetica, sans-serif;
  font-size: clamp(12px, 2vw, 15px);
  color: #555;
  margin: 0;
  line-height: 1.3;
}

/* ── External link button ────────────────────────────────────────────────── */
.project-link-btn {
  display: inline-block;
  font-family: "RuneScape UF", Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: #8B5CF6;
  border: 1px solid #8B5CF6;
  padding: 4px 12px;
  text-decoration: none;
  margin-bottom: 24px;
  transition: background 0.2s ease, color 0.2s ease;
}

.project-link-btn:hover {
  background: #8B5CF6;
  color: #EDE8DC;
}

/* ── Project header ──────────────────────────────────────────────────────── */
.project-header {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: -12px;
}

.project-header h1 {
  font-family: "RuneScape UF", Arial, Helvetica, sans-serif;
  font-size: clamp(20px, 4vw, 32px);
  font-weight: bold;
  color: #000;
  line-height: 1.3;
  margin: 0 0 4px;
}

/* ── Back link ───────────────────────────────────────────────────────────── */
.project-header .back {
  font-family: "RuneScape UF", Arial, Helvetica, sans-serif;
  font-size: clamp(20px, 4vw, 32px);
  font-weight: bold;
  color: #8B5CF6;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
  padding: 0.25em 0;
}

.project-header .back:hover {
  text-decoration: underline;
}

/* ── Project nav (replaces .back) ────────────────────────────────────────── */
.proj-nav {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex: 0 0 auto;
}

.proj-nav-btn {
  font-family: "RuneScape UF", Arial, Helvetica, sans-serif;
  font-size: clamp(20px, 4vw, 32px);
  font-weight: bold;
  color: #8B5CF6;
  text-decoration: none;
  line-height: 1;
  padding: 0.5em 0.75em;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.proj-nav-btn:hover {
  text-decoration: underline;
}

.proj-nav-home-img {
  display: inline-block;
  height: 75px !important;
  width: auto !important;
  vertical-align: top;
  transform: translateY(-18px);
}

/* ── Mobile: fixed bottom bar, title takes full header width ─────────────── */
@media (max-width: 600px) {
  .project-header h1 {
    width: 100%;
  }

  .proj-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    align-items: center;
    justify-content: center;
    gap: 32px;
    background: rgba(0, 0, 0, 0.78);
    padding: 0;
    height: 65px;
    overflow: visible;
    z-index: 999;
  }

  .proj-nav-btn {
    font-size: 24px;
    padding: 0.5em 0.75em;
  }

  .proj-nav-home-img {
    height: 57px !important;
    vertical-align: middle;
    transform: translateY(calc(10% + 12px));
  }
}

/* ── Blurb text ──────────────────────────────────────────────────────────── */
.project .blurb,
.project p {
  font-family: "RuneScape UF", Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 1.8;
  color: #000;
  margin-bottom: 24px;
}

/* ── Flanking chessmen (desktop only) ────────────────────────────────────── */
/* Fixed, centred vertically, positioned just outside the 800px content card.
   The content card is centred so its left edge = 50vw - 400px.
   We place chessmen just outside that with a small gap. */
.pt-flanker {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  height: 325px;
  width: auto;
  z-index: 9999;
  pointer-events: none;
}

/* Centred in the gap between the 800px content card and the viewport edge */
.pt-flanker-left {
  left: calc(39% - 570px);
}

.pt-flanker-right {
  left: calc(47% + 430px);
}

/* ── Carousel ────────────────────────────────────────────────────────────── */
/* 4:3 aspect ratio — 800px wide × 600px tall on desktop, scales on mobile */
.pt-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  margin-top: 40px;
  clear: both;
  overflow: hidden;
}

/* All images fill the fixed frame; opacity driven by JS */
.pt-carousel-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain !important;
  opacity: 0;
  transition: opacity 300ms ease;
}

.pt-carousel-img.active {
  opacity: 1;
}

/* Arrow buttons — bare < > characters overlaid on image */
.pt-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: none;
  border: none;
  font-family: "RuneScape UF", Arial, Helvetica, sans-serif;
  color: #ffffff;
  font-size: 48px;
  font-weight: bold;
  line-height: 1;
  padding: 8px 16px;
  cursor: url("../images/cursor/cursor-hover.png") 16 16, pointer;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.pt-carousel-prev { left: 0; }
.pt-carousel-next { right: 0; }

.pt-carousel-btn:hover {
  opacity: 0.7;
}

/* Image counter — bottom right of carousel */
.pt-carousel-counter {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-family: "RuneScape UF", Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: #fff;
  z-index: 10;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.05em;
}

@media (max-width: 767px) {
  .pt-flanker {
    display: none;
  }

  .pt-carousel-btn {
    font-size: 36px;
    padding: 8px;
  }
}
