:root {
  --primary-green: #4CAF50;
  --secondary-green: #388E3C;
  --light-gray: #f9f9f9;
  --dark-gray: #333;
  --footer-h: 60px; /* fixed footer height */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; overflow-x: hidden; }
body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Arial, sans-serif;
  line-height: 1.6;
  background-color: var(--light-gray);
  text-align: center;
}

/* Header (scrolls away naturally) */
header {
  background-color: var(--primary-green);
  color: white;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: left;
  position: relative; /* not fixed/sticky */
  z-index: 2;
}
.logo { height: 90px; width: auto; padding: 0 40px; }
.site-title { font-size: 50px; }

/* Fixed footer */
footer {
  position: fixed;
  bottom: 0; left: 0; width: 100%;
  background-color: #222; color: white;
  display: flex; justify-content: space-between; padding: 1rem;
  z-index: 3;
  transition: opacity 0.3s ease;
  opacity: 1;
}
footer.hidden-footer { opacity: 0; pointer-events: none; }
.footer-space { height: var(--footer-h); }
footer .socials a { color: white; margin-left: 1rem; text-decoration: none; }

/* Shell: two-column layout under header */
.shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: start;
}

/* Sidebar column controls height/overflow (NOT sticky itself) */
.sidebar {
  background-color: var(--secondary-green);
  color: #fff;
  display: none;                                /* shown on >= 768px */
  overflow: auto;                               /* column scrolls if long */
  min-height: 100%;  
  align-self: start;                            /* required so sticky works in grid */
}

/* Sticky inner wrapper (no height/overflow here) */
.sidebar-inner {
  position: sticky;
  top: 0;       /* sticks to top when it reaches it */
  padding: 1rem;
}

/* Sidebar links */
.sidebar a {
  display: block;
  background-color: var(--dark-gray);
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 0.5rem;
  transition: background-color 0.3s;
}
.sidebar a:hover { background-color: black; }

/* Main content */
main {
  padding: 1rem;
  padding-bottom: var(--footer-h); /* room for fixed footer */
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

h2 { margin: 1rem 0 0.5rem; justify-self: center; }

.job-container {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 1rem; padding: 1rem; width: 100%; box-sizing: border-box;
}
.job-card {
  background-color: white;
  padding: 1rem;
  border: 2px solid var(--primary-green);
  border-radius: 8px;
  width: 280px; box-sizing: border-box;
}
.job-card img { width: 100%; height: auto; border-radius: 4px; }

.button {
  display: inline-block;
  background-color: var(--primary-green);
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  margin-top: 0.5rem;
  border-radius: 5px;
}

/* Top nav (mobile only) */
.top-nav { display: none; gap: 0.5rem; }

/* Desktop layout */
@media (min-width: 768px) {
  .top-nav { display: none; }
  .sidebar { display: block; }  /* show sidebar column */
  main { width: 100%; }         /* grid handles sizing */
}

/* Mobile layout */
@media (max-width: 767px) {
  .shell { grid-template-columns: 1fr; }

  header { flex-direction: column; align-items: center; }
  .top-nav {
    display: flex; flex-direction: column; width: 100%;
    align-items: center; margin-top: 0.5rem;
  }
  .top-nav a {
    background-color: var(--dark-gray); color: white; text-decoration: none;
    padding: 0.5rem 1rem; border-radius: 5px; text-align: center;
    width: 90%; max-width: 300px; font-size: fit-content;
  }

  .site-title { font-size: 25px; margin-bottom: 0.5rem; }

  /* Hide sidebar on mobile (as before) */
  .sidebar { display: none; }
}

/* Ultra-small */
@media (max-width: 300px) {
  .top-nav a { font-size: x-small; }
  .site-title { font-size: 20px; margin-bottom: 0.5rem; }
}

/* Finished Products Section (home) */
#finished-products {
  margin: 2rem auto;
  padding: 1rem;
  background-color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-radius: 8px;
  max-width: 700px;
  border: 2px solid var(--primary-green);
}
#finished-products h2 { margin-bottom: 1rem; }

.finished-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}
.finished-grid img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  border-radius: 4px;
}

.see-finished-btn {
  margin-top: 1rem;
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  color: white;
  background-color: var(--primary-green);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.see-finished-btn:hover { background-color: var(--secondary-green); }

/* Portfolio-specific styles (job cards with gallery) */
.job-card.full-width {
  margin: 2rem auto;
  padding: 1rem;
  box-sizing: border-box;
  border: 2px solid var(--primary-green);
  border-radius: 8px;
  background-color: white;
  width: 100%;
  max-width: 800px;
  min-width: 300px;
}
.gallery-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem 0;
}
.image-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 4 / 3;
  margin: auto;
}
.gallery-image { width: 100%; height: 100%; object-fit: contain; border-radius: 4px; }
.gallery-nav {
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  font-size: 1.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  z-index: 2;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: background-color 0.3s;
}
.gallery-nav.left { left: 0; }
.gallery-nav.right { right: 0; }
.gallery-nav:hover { background-color: rgba(0, 0, 0, 0.8); }

/* Favorite Works (portfolio top card) */
.card-green-outline {
  border: 3px solid var(--primary-green);
  border-radius: 10px;
  background: #fff;
  padding: 1rem;
  margin: 1.5rem auto;
  max-width: 800px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.card-green-outline h2 { margin: 0 0 0.75rem 0; text-align: left; }

/* Center-focused gallery (portfolio) */
.key-gallery {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
}
.key-gallery .nav {
  border: none; background: var(--primary-green); color: #fff;
  font-size: 1.6rem; line-height: 1; padding: 0.5rem 0.8rem; border-radius: 8px; cursor: pointer;
}
.key-gallery .nav:disabled { opacity: 0.5; cursor: default; }
.key-gallery .nav:focus { outline: 2px solid #00000033; outline-offset: 2px; }

.key-stage {
  position: relative;
  height: clamp(260px, 55vh, 620px);
  overflow: hidden;   /* important */
  display: grid;
  place-items: center;
}

.key-frame {
  position: absolute; display: grid; place-items: center;
  transition: transform 350ms ease, opacity 350ms ease; will-change: transform, opacity;
}
.key-frame img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
:root { --hero-w: min(70%, 950px); --hero-h: 100%; --side-scale: 0.7; --side-offset: 52%; }
.key-frame.hero { width: var(--hero-w); height: var(--hero-h); max-height: 100%; transform: translateX(0) scale(1); z-index: 3; }
.key-frame.prev, .key-frame.next {
  width: var(--hero-w); height: var(--hero-h); max-height: 100%;
  transform: translateX(0) scale(var(--side-scale)); opacity: 0.85; z-index: 2;
}
.key-frame.prev { transform: translateX(calc(-1 * var(--side-offset))) scale(var(--side-scale)); }
.key-frame.next { transform: translateX(var(--side-offset)) scale(var(--side-scale)); }
.key-frame.prev::after, .key-frame.next::after {
  content: ""; position: absolute; inset: 0; border-radius: 10px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.12), rgba(0,0,0,0.25)); pointer-events: none;
}
.key-frame.prev, .key-frame.next { cursor: pointer; }
.key-dots { display: flex; gap: 0.4rem; justify-content: center; margin-top: 0.75rem; flex-wrap: wrap; }
.key-dot { width: 8px; height: 8px; border-radius: 999px; background: #cfd8dc; border: 1px solid #90a4ae; cursor: pointer; }
.key-dot.active { background: var(--secondary-green); border-color: var(--secondary-green); }


/* keep arrows left/right on small screens, but hide side images */
@media (max-width: 780px) {
  /* don't collapse to 1 column and don't reorder navs */
  .key-gallery {
    grid-template-columns: auto 1fr auto; /* keep 3 columns */
    align-items: center;
  }

  /* hide the side preview frames only */
  .key-frame.prev,
  .key-frame.next {
    display: none;
  }

  /* keep the nav buttons in their left/right columns */
  .key-gallery .nav {
    order: 0;           /* reset any previous 'order: 3' */
    margin-top: 0;      /* no extra spacing */
    align-self: center; /* vertically center in the column */
  }
  /* make the hero image bigger */
  .key-frame.hero {
    width: 95% !important;  /* increase from your current % */
    height: auto !important; /* let height adjust to width */
  }
  /* Vertically center the hero frame on small screens */
  .key-frame.hero {
    top: 50% !important;
    left: 50% !important;                 /* keep horizontal center */
    transform: translate(-50%, -50%) scale(1) !important;
    height: auto !important;
    max-height: 100%;
  }

  /* make sure the image itself sizes nicely */
  .key-frame.hero img {
    width: 100%;
    height: auto;
    object-fit: contain;
  }

}

/* Lightox section */
/* -------- Lightbox (site-wide) -------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.86);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 9999; /* above fixed footer & everything */
}
.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-img {
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border-radius: 12px;
  background: #111; /* nice on transparent PNGs */
}

/* Close button */
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.lightbox-close:hover { background: rgba(255,255,255,0.24); }
