/* =========================================================
   SKELETON SITE STYLESHEET
   Edit the variables below to change colors/fonts sitewide.
   ========================================================= */

:root {
  --color-primary: #7a100d;   /* dark red, sampled from company logo */
  --color-primary-dark: #560b09; /* darker red for hover states */
  --color-accent: #d98936;    /* buttons, links, highlights */
  --color-text: #2b2b2b;
  --color-bg: #ffffff;
  --color-bg-alt: #f4f5f7;
  /* Matched to the "Young Construction, Inc." logo wordmark: an elegant,
     moderate-contrast serif. Baskerville/Big Caslon (Mac) are the closest
     system matches; falls back to Georgia elsewhere. */
  --font-heading: Baskerville, 'Big Caslon', 'Book Antiqua', Georgia, 'Times New Roman', serif;
  --font-body: Arial, Helvetica, sans-serif;
  --max-width: 1100px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

/* ---------- Home page full-page background photo (index.html only) ---------- */
body.home {
  position: relative;
}

body.home::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("../images/home-background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.2;
  z-index: -1;
}

/* ---------- About page full-page background photo (about.html only) ---------- */
body.about {
  position: relative;
}

body.about::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("../images/about-background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.2;
  z-index: -1;
}

/* ---------- Contact page full-page background photo (contact.html only) ---------- */
body.contact-page {
  position: relative;
}

body.contact-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("../images/contact-background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.2;
  z-index: -1;
}

/* Contact page hero has no photo of its own, so drop the shared gray
   fill and let the background photo above show through instead. */
body.contact-page .hero {
  background: none;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  line-height: 1.2;
}

/* ---------- Intro heading (index.html) ----------
   max-width keeps this from stretching into one long line at desktop
   widths; text-wrap:balance lets the browser split it evenly across
   lines instead of leaving an awkward short/long pair. Falls back to
   normal wrapping in older browsers that don't support the property. */
.intro-heading {
  font-size: 2rem;
  max-width: 900px;
  text-wrap: balance;
}

/* ---------- Welcome call-to-action (index.html) ----------
   Right-aligned, set in the logo/heading font at the same size as the
   intro heading, no arrow. */
.welcome-cta {
  display: block;
  text-align: right;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: bold;
  color: var(--color-primary);
  text-decoration: underline;
  margin-top: 24px;
}

.welcome-cta:hover {
  color: var(--color-accent);
}

a { color: var(--color-accent); }

img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header / Nav ---------- */
header {
  background: var(--color-bg);
  color: var(--color-primary);
  border-bottom: 1px solid #e0e0e0;
  padding: 16px 0;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: bold;
  display: flex;
  align-items: center;
}

.logo img {
  height: 56px;      /* scales the logo to fit the header; adjust as needed */
  width: auto;
  display: block;
}

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

nav a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

nav a:hover, nav a.active {
  color: var(--color-accent);
}

/* ---------- Hero ---------- */
.hero {
  background: var(--color-bg-alt) center/cover no-repeat;
  padding: 80px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.hero p {
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto 24px;
}

/* ---------- Home banner: logo (left third) + transit photo (right) ----------
   The logo's horizontal crossbar and the transit's telescope tube are
   deliberately lined up: each image has a fixed width (so its height is
   predictable) and a margin-top calculated so that the two features land
   on the same horizontal line, "align-line" below.
   - Logo:    700x254 art, crossbar sits at 50.2% of its height
   - Transit: transit-transparent.png (background removed), 4984x3485
     cropped to content, telescope tube sits at 14.6% of its height
   If you change either image's width, these margins need to be recalculated
   proportionally or the alignment will drift. ---------- */
.home-banner {
  padding: 64px 0;
}

.home-banner-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between; /* pushes logo to the left margin, transit to the right margin */
  gap: 58px; /* ~20% more than the old 48px; acts as a minimum before wrapping */
}

.home-banner-logo {
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
}

.home-banner-logo img {
  width: 400px;
  max-width: 100%;
  height: auto;
  margin-top: 17px; /* aligns crossbar to the shared line */
}

.home-banner-photo {
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
}

.home-banner-photo img {
  width: 340px;
  max-width: 100%;
  height: auto;
  margin-top: 55px; /* aligns telescope tube to the shared line */
  /* drop-shadow follows the image's transparent silhouette instead of
     drawing a rectangle behind it, which box-shadow would do */
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.25));
}

@media (max-width: 640px) {
  .home-banner-grid {
    text-align: center;
  }
  .home-banner-logo img,
  .home-banner-photo img {
    margin-top: 0; /* stacked on mobile, alignment no longer applies */
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  padding: 12px 28px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
}

.btn:hover { opacity: 0.9; }

/* ---------- Sections ---------- */
section {
  padding: 60px 0;
}

section.alt {
  background: var(--color-bg-alt);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
  margin-top: 32px;
}

.card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 24px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.gallery-grid img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 4px;
}

/* ---------- Gallery jump nav ---------- */
.gallery-jump {
  background: var(--color-bg-alt);
  border-bottom: 1px solid #e0e0e0;
  padding: 14px 0;
  text-align: center;
}

.gallery-jump a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  margin: 0 4px;
}

.gallery-jump a:hover { color: var(--color-accent); }

.gallery-jump span { color: #bbb; }

/* ---------- Gallery sections ---------- */
#residential,
#commercial {
  scroll-margin-top: 20px;
}

.residential-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  margin-top: 32px;
}

.gallery-sub {
  scroll-margin-top: 20px;
}

.gallery-sub h3 {
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 8px;
  display: inline-block;
}

@media (max-width: 640px) {
  .residential-grid {
    grid-template-columns: 1fr;
  }
}

.gallery-empty {
  margin-top: 16px;
  padding: 32px;
  text-align: center;
  background: var(--color-bg-alt);
  border: 1px dashed #ccc;
  border-radius: 6px;
  color: #777;
  font-style: italic;
}

/* ---------- Lead thumbnail (gallery summary -> detail page link) ---------- */
.lead-thumb {
  display: block;
  margin-top: 16px;
  text-decoration: none;
  color: inherit;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  transition: box-shadow 0.15s ease;
}

.lead-thumb:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.lead-thumb img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.lead-thumb .lead-thumb-caption {
  padding: 12px 16px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: var(--color-primary);
}

.lead-thumb .lead-thumb-caption span.count {
  font-weight: 400;
  color: #777;
  font-size: 0.9rem;
}

/* ---------- Detail page header bar ---------- */
.gallery-detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.gallery-detail-bar a.back-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.gallery-detail-bar a.back-link:hover { color: var(--color-accent); }

/* ---------- Lightbox / Slideshow ---------- */
.lightbox {
  /* Hidden by default. IMPORTANT: this must stay display:none (not rely on
     the HTML "hidden" attribute) — an author stylesheet's display value
     always wins over the browser's built-in [hidden]{display:none} rule,
     which silently broke the close button before. Visibility is toggled
     by JS adding/removing the .is-open class below. */
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.lightbox.is-open {
  display: flex;
}

.lightbox-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 85vh;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.lightbox-counter {
  color: #fff;
  margin-top: 12px;
  font-size: 0.9rem;
  opacity: 0.85;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next,
.lightbox-play {
  position: absolute;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 4px;
}

.lightbox-close {
  top: 20px;
  right: 24px;
  font-size: 2rem;
  line-height: 1;
  width: 44px;
  height: 44px;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem;
  width: 56px;
  height: 56px;
}

.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

.lightbox-play {
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.95rem;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-play:hover {
  background: var(--color-accent);
}

@media (max-width: 640px) {
  .lightbox-prev, .lightbox-next { width: 44px; height: 44px; font-size: 2rem; }
}

/* ---------- Forms ---------- */
form {
  max-width: 500px;
  margin-top: 24px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input, textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 18px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: var(--font-body);
}

/* ---------- Footer ---------- */
footer {
  background: var(--color-primary);
  color: #fff;
  text-align: center;
  padding: 24px 0;
  margin-top: 40px;
  font-size: 0.9rem;
}

footer a { color: var(--color-accent); }

@media (max-width: 640px) {
  header .container { flex-direction: column; gap: 12px; }
  nav ul { flex-wrap: wrap; justify-content: center; gap: 12px; }
}
