/* =========================================================
   Projects Gallery Styles (GitHub Pages – Modernist theme)
   ========================================================= */

/* Palette */
:root {
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --card-bg: #F8FAFC;
  --card-border: #E5E7EB;
  --text: #1E293B;
  --muted: #64748B;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 10px rgba(0,0,0,0.12);

  /* Knobs */
  --thumb-gap: 14px;       /* space between the two thumbs */
  --thumb-aspect: 16 / 10; /* set 16/9 to make thumbs shorter */
}

/* Remove any theme line above the Projects heading */
h2#projects,
#projects {
  border: 0 !important;
  box-shadow: none !important;
  background-image: none !important;
  margin-top: 0.6rem;
  padding-top: 0;
}
/* Hide an <hr> if it sits right before the Projects heading (modern browsers) */
hr:has(+ h2#projects) { display: none; }

/* ========= STACK PROJECTS (one per row) ========= */
.projects-grid {
  display: flex;
  flex-direction: column;       /* stack cards in a single column */
  gap: 32px;                    /* spacing between stacked cards */
  margin-top: 12px;
  width: 100%;
}

/* Card */
.project-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
  overflow: hidden; /* stop micro-overflow */
}
/* Include borders in width calculations to avoid creep */
.project-card, .project-card * { box-sizing: border-box; }

.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.project-title {
  margin: 0 0 12px 0;
  font-size: 1.15rem;
  line-height: 1.25;
  color: var(--accent);
}

/* ==== Thumbnails row (left-justified, two-up) ==== */
.project-thumbs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* always two columns */
  gap: var(--thumb-gap);
  width: 100%;
  max-width: 860px;                                   /* safe, slightly larger */
  margin: 0 0 12px 0 !important;                      /* align to card's left edge */
  padding: 0;                                         /* line up with text */
  justify-content: start;                             /* tracks hug the left */
  align-items: start;
}
.project-thumbs a { display: block; width: 100%; }

/* Thumbnail box */
.thumb {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #f3f6fa;
  aspect-ratio: var(--thumb-aspect);
  width: 100%;
}
.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}
.thumb:hover img,
a:focus .thumb img { transform: scale(1.04); }

/* Hover/focus caption overlay */
.thumb-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 6px 10px;
  font-size: 0.86rem;
  line-height: 1.25;
  color: #fff;
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.thumb:hover .thumb-caption,
a:focus .thumb .thumb-caption { opacity: 1; }

/* Body / links */
.project-body { margin-top: 8px; }
.project-desc { color: var(--text); }
.project-desc p { margin: 0 0 10px 0; }

.project-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 2px 0;
}
.btn-sm {
  display: inline-block;
  padding: 6px 10px;
  background: var(--accent);
  color: #fff !important;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  text-decoration: none;
  font-size: 0.92rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: transform .15s ease, box-shadow .15s ease, background .2s ease;
}
.btn-sm:hover,
.btn-sm:focus { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 3px 6px rgba(0,0,0,0.15); }
.btn-sm:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-secondary {
  display: inline-block;
  padding: 6px 10px;
  background: #E2E8F0;
  color: #1E293B !important;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  text-decoration: none;
  font-size: 0.92rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: transform .15s ease, box-shadow .15s ease, background .2s ease;
}
.btn-secondary:hover,
.btn-secondary:focus { background: #CBD5E1; transform: translateY(-1px); box-shadow: 0 3px 6px rgba(0,0,0,0.15); }
.btn-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Responsiveness */
@media (max-width: 760px) {
  .project-thumbs { max-width: none; grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .projects-grid { gap: 24px; }
}

/* Reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .project-card, .thumb img, .thumb-caption, .btn-sm { transition: none !important; }
}

/* Gentle dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    /* Mirror light theme variables so card stays #F8FAFC */
    --card-bg: #F8FAFC;
    --card-border: #E5E7EB;
    --text: #1E293B;
    --muted: #64748B;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 10px rgba(0,0,0,0.12);
  }
  .thumb { background: #f3f6fa; }
}
