/* ==========================================================================
   SOFTWARE PAGE – GLOBAL LAYOUT ADJUSTMENTS
   ========================================================================== */

/* Full-bleed container on the Softwares page */
body.page-software .container,
body.page-software .section-timeline .container,
body.page-software .section-timeline-heading .container {
  max-width: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* ------------------------------------------------------------------
   Prevent inversion of Astrolore screenshots on the Softwares page.
   This file is loaded after the site-wide theme CSS, so a page-scoped,
   high-specificity selector here will override broader inversion rules.
 ------------------------------------------------------------------ */
body.page-software:not(.light-mode) .image-pair img,
body.page-software:not(.light-mode) .project-card img,
body.page-software:not(.light-mode) img{
  filter: none !important;
  -webkit-filter: none !important;
}

/* Explicit 'no-invert' helper class for specific images that must
   retain original colors regardless of theme filters. Applied to the
   image-wrapper in software.html for Astrolore screenshots. */
.page-software .image-wrapper.no-invert,
.page-software .image-wrapper.no-invert img{
  filter: none !important;
  -webkit-filter: none !important;
  mix-blend-mode: normal !important;
  isolation: isolate !important;
}

/* Projects grid full width with internal padding */
body.page-software .projects-grid {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  grid-gap: 28px;
  padding-left: 5vw;
  padding-right: 5vw;
  box-sizing: border-box;
}

/* Filter bar above the projects grid */
.project-filters {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center; /* center the bar */
  padding: 20px 5vw; /* larger vertical padding */
  box-sizing: border-box;
  margin-bottom: 22px; /* add more space between filters and cards */
  flex-wrap: wrap; /* allow wrap on small screens */
}
.project-filters .filter-btn {
  background: rgba(255,255,255,0.04);
  color: #fff;
  border: 0;
  padding: 10px 16px; /* larger touch target */
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px; /* larger label */
  min-width: 88px; /* consistent button width */
  text-align: center;
  transition: background 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}
.project-filters .filter-btn[aria-pressed="true"], .project-filters .filter-btn.active{
  background: linear-gradient(90deg, rgba(254,218,74,0.14), rgba(160,138,65,0.12));
  box-shadow: 0 8px 26px rgba(0,0,0,0.12);
}

/* Light-mode: make the filter buttons visible on white backgrounds while
   keeping the dark-mode visual style (rounded pills + gold accent). */
body.light-mode .project-filters .filter-btn{
  background: rgba(0, 0, 0, 0.02) !important;
  color: #111 !important;
  box-shadow: none !important;
}
body.light-mode .project-filters .filter-btn:hover{
  background: rgba(0,0,0,0.08) !important;
}
body.light-mode .project-filters .filter-btn[aria-pressed="true"],
body.light-mode .project-filters .filter-btn.active{
  background: linear-gradient(90deg, rgba(250,228,150,0.22), rgba(200,170,80,0.14)) !important;
  color: #111 !important;
  box-shadow: 0 8px 22px rgba(140,102,12,0.09) !important;
}

/* Light-mode: ensure tag chips remain readable on white backgrounds */
body.light-mode .tag-chip{
  background: rgba(170,126,0,0.08) !important; /* subtle warm tint */
  color: #111 !important;
  box-shadow: none !important;
}

@media (max-width: 520px) {
  .project-filters { gap: 10px; padding-left: 4vw; padding-right: 4vw; }
  .project-filters .filter-btn { min-width: 72px; padding: 8px 12px; font-size: 14px; }
}

/* Tag chips shown on each project card */
.project-tags { margin-top: 8px; }
.tag-chip {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(255,255,255,0.04);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

/* Layout for tag chips inside the compact/closed card view */
.project-meta .project-tags {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.project-meta .tag-chip { margin: 0; }

/* Keep a consistent 1px border space on project cards to avoid layout
  shifts when light-mode applies a visible border. Using a transparent
  border in the default state ensures inner content stays aligned. */
body.page-software .project-card{ border: 1px solid transparent; box-sizing: border-box; }

/* Project icons (GitHub / Sphinx / PyPI) shown under tags in condensed view */
.project-icons{ display: flex; gap: 18px; align-items: center; margin-top: 18px; margin-bottom: 12px; }
.project-icon-link{ display: inline-block; border-radius: 8px; overflow: hidden; padding: 2px; }
.project-icons .project-icon{ width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: inline-block; transition: opacity 300ms cubic-bezier(.2,.9,.2,1), transform 260ms cubic-bezier(.2,.9,.2,1), box-shadow 260ms cubic-bezier(.2,.9,.2,1); opacity: 0.7; }

/* Explicitly prevent theme-based inversion on these small icons */
body.light-mode .project-icons .project-icon,
body:not(.light-mode) .project-icons .project-icon,
.project-icons .project-icon{
  filter: none !important;
  -webkit-filter: none !important;
}

.project-icon-link:hover .project-icon,
.project-icon-link:focus .project-icon{
  transform: scale(1.06);
  opacity: 1 !important;
}

/* Remove any visible border/outline on hover while keeping an accessible
   focus indicator for keyboard users via box-shadow (no browser outline). */
.project-icon-link:focus{ outline: none; }

@media (max-width: 520px){
  .project-icons .project-icon{ width: 36px; height: 36px; }
}

/* Badges (CI / PyPI / License / DOI) shown inline next to tag chips */
.project-badges{ display: inline-flex; gap: 8px; align-items: center; margin-left: 10px; }
.project-badges img{ height: 44px; width: auto; display: block; filter: none !important; -webkit-filter: none !important; object-fit: contain; }

/* Ensure badges are never color-inverted by site theme rules in either
   light or dark mode. This explicit override prevents unexpected
   `filter: invert()` from affecting badges. */
body.page-software .project-badges img,
body.page-software body.light-mode .project-badges img,
body.page-software body:not(.light-mode) .project-badges img{
  filter: none !important;
  -webkit-filter: none !important;
}

@media (max-width: 520px){
  .project-badges img{ height: 32px; }
}


/* Invert badge colours in light mode so SVG badges designed for dark backgrounds
   render properly on white backgrounds. This targets badges only; project
   icons kept un-inverted elsewhere. */

/* Hide project icons when a card is expanded.
   - The clone/expanded view uses `.project-clone` so hide icons there.
   - Use `:has()` to hide icons when the containing card has an expanded `.project-full`.
   This keeps icons visible on condensed cards but removes them in the expanded view. */
.project-clone .project-icons{ display: none !important; }
.project-card:has(.project-full[aria-expanded="true"]) .project-icons{ display: none !important; }

/* Hidden cards when filtered out */
.project-card.card-hidden { display: none !important; opacity: 0; transform: translateY(6px); }

/* Match Research page gutter on ultra-wide screens */
@media (min-width: 1360px) {
  body.page-software .projects-grid {
    padding-left: calc((100vw - 1360px)/2 + 24px);
    padding-right: calc((100vw - 1360px)/2 + 24px);
  }
}

/* Force 2-column layout on desktop only */
@media (min-width: 769px) {
  body.page-software .projects-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Nav-hint alignment fix (dark mode only) */
@media (min-width: 769px) {
  body:not(.light-mode) header nav .nav-hint-wrapper {
    right: -48vw;
  }
}

/* ==========================================================================
   SOFTWARE PAGE – INTRO + MEME SECTION (Research-page parity)
   ========================================================================== */

/* Layout of heading row */
body.page-software .research-heading-row {
  display: flex;
  gap: 1.6rem;
  align-items: stretch;
  justify-content: center;
}

/* Intro text column */
body.page-software .research-intro-text {
  flex: 1 1 70%;
}

/* Intro paragraph styling */
body.page-software .research-intro-text .research-intro {
  color: #ffffff;
  font-size: 2.1vh;
  line-height: 1.45;
}

/* Meme column */
@media (min-width: 769px) {

body.page-software .research-meme {
  flex: 0 0 550px;
  display: flex;
  align-items: center;
}
}

/* Meme wrapper */
body.page-software .research-meme .meme-wrapper {
  width: 100%;
  height: auto;
  max-width: 1000px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
}

/* Meme image */
body.page-software .research-meme .timeline-hero-image {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  transform: none;
}

/* Overlay */
body.page-software #meme-wrapper .meme-overlay,
body.page-software .meme-wrapper .meme-overlay {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 101%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile: smaller overlay */
@media (max-width: 768px) {
  body.page-software #meme-wrapper .meme-overlay,
  body.page-software .meme-wrapper .meme-overlay {
    height: 101%;
  }
}

/* Reveal button (dark mode parity) */
body.page-software body:not(.light-mode) #meme-wrapper .reveal-btn,
body.page-software body:not(.light-mode) .research-meme #meme-wrapper .reveal-btn {
  background: rgba(255,255,255,0.06) !important;
  color: #ffffff !important;
  border: 2px solid transparent !important;
  padding: 0.6rem 1rem !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
}

body.page-software body:not(.light-mode) #meme-wrapper .reveal-btn:hover,
body.page-software body:not(.light-mode) #meme-wrapper .reveal-btn:focus {
  box-shadow: 0 0 0.2rem rgba(254, 218, 74, 0.8) !important;
  background: rgba(160, 138, 65, 0.179) !important;
  transition: transform 0.15s ease,
              background 0.3s ease,
              box-shadow 0.3s ease,
              border 0.15s ease !important;
}

/* Mobile layout: meme on top, then intro text */
@media (max-width: 768px) {
  body.page-software .research-heading-row {
    flex-direction: column;
    align-items: center;
    gap: 1.9rem;
  }

  body.page-software .research-meme {
    order: -1;
    width: 100%;
    max-width: none;
  }

  body.page-software .meme-wrapper {
    width: 100%;
    padding: 0 5vw;
    margin-bottom: 1.25rem;
    box-sizing: border-box;
  }

  body.page-software .timeline-hero-image {
    max-height: 220px;
    margin: 0 auto;
  }

  body.page-software .research-intro-text {
    width: 100%;
  }

  body.page-software .research-intro-text .research-intro {
    text-align: center;
    font-size: 1.6vh !important;
  }
}

/* Mobile spacing adjustments */
@media (max-width: 768px) {
  body.page-software .padding-vertical-xlarge {
    padding-top: 60px !important;
    padding-bottom: 40px !important;
  }
}

/* ==========================================================================
   PROJECT CARD TYPOGRAPHY (Softwares page only)
   ========================================================================== */

body.page-software .project-title {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 700;
}

body.page-software .project-subtitle {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 400;
}

/* ==========================================================================
   IMAGE PAIR (Two images side-by-side on desktop, stacked on mobile)
   ========================================================================== */

.page-software .image-pair {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: stretch;
  margin: 1.25rem 0;
  padding-left: 5vw;
  padding-right: 5vw;
  box-sizing: border-box;
}

.page-software .image-pair .image-wrapper {
  flex: 1 1 0;
  border-radius: 8px;
  padding: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.page-software .image-pair img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  max-height: 480px;
}

/* Snitch launcher button positioned at the bottom-right of the image wrapper */
.image-wrapper { position: relative; display: block; }
.image-wrapper .snitch-launch {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10002;
  padding: 0;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  transition: background 160ms ease, transform 120ms ease, box-shadow 160ms ease;
  filter: invert(1) brightness(1.2) saturate(1); /* dark icon */

}

/* Icon inside the button */
.snitch-launch-icon{
  width: 60%;
  height: 60%;
  display: block;
  object-fit: contain;
  transition: filter 160ms ease, transform 160ms ease;
  /* default (dark theme): make the PNG pop (brighter) */
}

.image-wrapper .snitch-launch:hover{
  background: rgba(255, 255, 255, 0.268);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.337);
}



/* ==========================================================================
   SNITCH GAME – LIGHT MODE BUTTON FIX
   ========================================================================== */

/* Light-mode: snitch-launch button appearance */
body.light-mode .image-wrapper .snitch-launch {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.52);       /* darker overlay */
  border: 2px solid rgba(0, 0, 0, 0.6); /* slightly darker border */
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

/* Light-mode: hover state for snitch-launch button */
body.light-mode .image-wrapper .snitch-launch:hover {
  background: rgba(0, 0, 0, 0.772);       /* darker overlay on hover */
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
  transition: background 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

/* Light-mode: icon inside snitch-launch button */
body.light-mode .snitch-launch-icon {
  filter: invert(1) brightness(0.6) saturate(1); /* dark icon */
  width: 60%;
  height: 60%;
  display: block;
  object-fit: contain;
  transition: filter 160ms ease, transform 160ms ease;
}





/* --- MOBILE FIX: STACKED IMAGES WITHOUT THIN STRIPS --- */
@media (max-width: 768px) {
  .page-software .image-pair {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
    height: auto !important;
    max-height: none !important;
  }

  .page-software .image-pair .image-wrapper {
    flex: 0 0 auto !important;   /* <-- CRITICAL FIX */
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .page-software .image-pair img {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    border-radius: 6px;
    display: block;
  }
}



/* --- SNITCH REQUIRED STYLES (copied locally so software page does not depend on css/style.css) --- */
/* Slot that the snitch script mounts into. Mirrors the inline rules used on index.html. */
#snitch-slot {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  pointer-events: none;
  z-index: 99999;
  display: block;
  opacity: 0;
  transition: opacity 220ms ease;
}

#snitch-runner {
  position: absolute;
  width: 96px;
  height: auto;
  max-height: 80px;
  user-select: none;
  transition: transform 0.08s linear;
  transform-origin: center center;
  animation: snitch-twitch 50ms linear infinite;
  pointer-events: none;
  will-change: left, top, transform;
}

@keyframes snitch-twitch{
  0% { transform: rotate(-10deg); }
  50% { transform: rotate(10deg); }
  100% { transform: rotate(-10deg); }
}

.snitch-progress {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}
.snitch-progress.show { opacity: 1; }
.snitch-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, gold, #fc5b5b);
  transition: width 120ms linear;
  opacity: 0.6;
}

.snitch-win {
  position: absolute;
  pointer-events: auto;
  z-index: 1000000;
  transform: translateY(6px) scale(0.96);
  opacity: 0;
  transition: transform 220ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease;
}
.snitch-win.show { transform: translateY(0) scale(1); opacity: 1; }

@keyframes snitch-appear {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); filter: blur(6px); }
  60% { opacity: 0.92; transform: translateY(-6px) scale(1.02); filter: blur(2px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

#snitch-slot.snitch-appear { animation: snitch-appear 520ms cubic-bezier(.2,.9,.2,1) both; pointer-events: none; }

@keyframes snitch-image-settle { 0% { transform: scale(1.06); } 60% { transform: scale(0.98); } 100% { transform: scale(1); } }
#snitch-slot.snitch-appear img#snitch-runner { animation: snitch-image-settle 120ms ease 160ms both, snitch-twitch 5ms linear infinite; }

/* Play again button visuals matching the style in the main stylesheet */
.snitch-play-again {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  border: 0;
  background: rgba(0,0,0,0.5);
  color: #fff;
  cursor: pointer;
}
.snitch-play-again:hover{ box-shadow: 0 0 0.18rem rgba(254, 218, 74, 0.9); filter: brightness(.98); }

body.light-mode .snitch-win { background: rgba(255,255,255,0.92); color: #111; border-color: rgba(140,102,12,0.95); box-shadow: 0 6px 18px rgba(0,0,0,0.08); }
body.light-mode .snitch-play-again { background: rgba(255,255,255,0.92); color: #111; border-color: rgba(140,102,12,0.95); box-shadow: 0 6px 18px rgba(0,0,0,0.06); filter: none; }

/* --- end snitch styles --- */

/* Modal/overlay used when launching snitch from Softwares page */
.snitch-modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 68px; /* leave room for header */
  z-index: 100500;
  background: rgba(0, 0, 0, 0.602); /* stronger dim */
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 260ms cubic-bezier(.2,.9,.2,1);
}
.snitch-modal .snitch-modal-close{
  position: fixed;
  right: 12px;
  top: 12px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 0;
  background: rgba(255,255,255,0.06);
  color: #fff;
  z-index: 100510;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.snitch-modal .snitch-modal-close:hover{ background: rgba(255,255,255,0.12); }
body.light-mode .snitch-modal{ background: rgba(255, 255, 255, 0.584); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.light-mode .snitch-modal .snitch-modal-close{ color: #111; background: rgba(0,0,0,0.06); }

/* When modal is open, lock page scroll */
.snitch-modal-open{ overflow: hidden !important; height: 100% !important; }

/* Make the snitch slot fill the modal viewport for gameplay */
.snitch-modal #snitch-slot{ position: relative !important; top: 0 !important; left: 0 !important; height: calc(100vh - 88px) !important; width: 100% !important; }

/* Smooth close animation for the snitch slot: shrink + fade before moving back */
.snitch-closing{
  transition: transform 220ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease;
  transform: scale(0.96) translateY(8px) !important;
  opacity: 0 !important;
}

/* show state for modal */
.snitch-modal.show{ opacity: 1; }

/* Victory/win box: copy exact styles from main stylesheet so it's identical */
.snitch-win {
  position: absolute;
  z-index: 1000000;
  pointer-events: auto;
  padding: 14px 16px;
  background: rgba(52, 49, 40, 0.45);
  color: white;
  border: 0.05rem solid gold;
  border-radius: 6px;
  box-shadow: 0 0 0.08rem rgba(254, 218, 74, 0.5);
  font-family: "Poppins", "Montserrat", sans-serif;
  font-weight: 200;
  font-size: 15px;
  line-height: 1.25;
  max-width: calc(100% - 32px);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 200ms ease, box-shadow 180ms ease;
}
.snitch-win.show { opacity: 1; transform: translateY(0); box-shadow: 0 0 0.18rem rgba(254,218,74,0.9); }
.snitch-win .hint-line { margin-bottom: 8px; text-align: center; }
.snitch-win .hint-line .snitch-points { font-weight: 700; color: gold; display: inline-block; }

.snitch-play-again {
  display: inline-block;
  margin: 12px auto 0;
  padding: 8px 12px;
  background: rgba(52, 49, 40, 0.6);
  border: 0.05rem solid gold;
  border-radius: 6px;
  cursor: pointer;
  color: white;
  font-weight: 700;
  text-align: center;
  display: block;
  max-width: 160px;
}
.snitch-play-again:hover { box-shadow: 0 0 0.18rem rgba(254, 218, 74, 0.9); filter: brightness(.98); }

body.light-mode .snitch-win {
  background: rgba(255,255,255,0.92);
  color: #111;
  border-color: rgba(140,102,12,0.95);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
body.light-mode .snitch-win .hint-line { color: #111; }
body.light-mode .snitch-win .hint-line .snitch-points { color: rgba(140,102,12,0.95); }
body.light-mode .snitch-play-again {
  background: rgba(255,255,255,0.92);
  color: #111;
  border-color: rgba(140,102,12,0.95);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  filter: none;
}



