/* ===== Base Styles ===== */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #fafafa;
}

main {
  padding: 2rem;
}

header {
  background: #222;
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  margin: 0;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

nav a {
  color: white;
  text-decoration: none;
}

nav a.active {
  font-weight: bold;
  color: #ffd700;
}

main h2 {
  margin-top: 2rem;
  font-size: 2rem;
  color: #222;
  border-bottom: 2px solid #ddd;
  padding-bottom: 0.3rem;
  text-align: center;
}

footer {
  text-align: center;
  padding: 1rem;
  background: #222;
  color: white;
  margin-top: 2rem;
}

/* ===== Photo Grid Styles ===== */
#photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  grid-auto-rows: 200px;          /* base row height */
  gap: 15px;
  grid-auto-flow: dense;          /* fill in gaps efficiently */
}

.photo-item {
  position: relative;
  overflow: hidden;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

/* Portrait images span more rows */
.photo-item.portrait {
  grid-row: span 2;               /*  if needed */
}

/* ===== Gallery Styles ===== */
.gallery-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
}

.gallery-item {
  text-align: center;
  max-width: 500px;
}

.gallery-item img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

.gallery-text {
  font-size: 1.5rem;
  font-weight: bold;
  margin-top: 0.5rem;
  color: #111;
  word-wrap: break-word;
}

.gallery-link {
  display: inline-block;
  text-decoration: none;
  color: inherit;
}

/* ===== Cart Button Styles ===== */
.cart-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(34, 34, 34, 0.8);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  z-index: 10; /* ensures button is above image */
}

.cart-btn:hover {
  background: #444;
}

.cart-btn.added {
  background: #28a745;   /* green */
  color: #fff;
  cursor: default;
}

.cart-btn.added::after {
  margin-left: 6px;
  font-weight: bold;
}

/* ===== Cart Counter ===== */
#cart-count {
  background: crimson;
  color: white;
  font-size: 0.8rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 50%;
  margin-left: 5px;
}

#cart-items {
  text-align: right;
}

#cart-items img {
  display: block;
  margin-left: auto;
  margin-right: 0;
  border-radius: 8px;
}

/* ===== Lightbox Styles ===== */
.lightbox {
  display: none; /* already handled in your JS */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.lightbox-content {
  position: relative;
  display: inline-block;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
}

#lightbox-cart-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(34, 34, 34, 0.8);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  z-index: 10;
}

#lightbox-cart-btn:hover {
  opacity: 1;
  background: #444;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 3rem;
  color: white;
  cursor: pointer;
}

#downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;               /* spacing between items */
  justify-content: center;
}

#downloads div {
  flex: 0 1 350px;         /* allow items to grow/shrink, max ~300px wide */
  text-align: center;
}
#downloads img {
  width: 100%;             /* fill the container width */
  height: auto;            /* keep aspect ratio */
  border-radius: 8px;
  display: block;
  margin: 0 auto 8px;
}
