/* =============================================
   BES Engineering – Main Stylesheet
   Font: Poppins (Google Fonts)
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  color: #111;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a  { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ---------- Variables ---------- */
:root {
  --color-text:   #111;
  --color-border: #e0e0e0;
  --nav-height:   68px;
  --max-w:        1280px;
  --px:           clamp(24px, 5vw, 100px);
}

/* ---------- Navigation ---------- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: #fff;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 4vw, 60px);
  border-bottom: 1px solid var(--color-border);
}

.nav-logo { display: flex; align-items: center; height: 29px; }
.nav-logo img { height: 27px; width: auto; }

.nav-links { display: flex; gap: 40px; }
.nav-links a {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #111;
  text-decoration: none;
  transition: color .2s;
}
.nav-links a:hover {
  color: #555;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: #111; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ---------- Hero Slideshow ---------- */
.hero-slideshow {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
}

.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  animation: heroSlide 20s infinite;
}

/* interval 5s — 4 slides × 5s = 20s cycle */
/* slide 1 delay -1s → already fully visible at page load  */
.hero-slide:nth-child(1) { animation-delay:  -1s; }
.hero-slide:nth-child(2) { animation-delay:   4s; }
.hero-slide:nth-child(3) { animation-delay:   9s; }
.hero-slide:nth-child(4) { animation-delay:  14s; }

@keyframes heroSlide {
  /* 0–1s   : fade in                          */
  0%   { opacity: 0;  transform: scale(1.00); }
  5%   { opacity: 1;  transform: scale(1.00); }
  /* 1–5s   : 4 seconds of very slow zoom      */
  25%  { opacity: 1;  transform: scale(1.07); }
  /* 5–6s   : crossfade out, no black gap      */
  30%  { opacity: 0;  transform: scale(1.09); }
  /* 6–20s  : hidden, scale resets             */
  100% { opacity: 0;  transform: scale(1.00); }
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.48);
  z-index: 1;
}

/* White logo on video — drifts down on scroll via JS */
.hero-logo {
  position: absolute;          /* sits inside hero, free to move */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
  pointer-events: none;
}

.hero-logo img {
  width: clamp(160px, 22vw, 320px);
  height: auto;
  display: block;
}

/* ---------- Intro (white section below hero) ---------- */
.intro {
  background: #fff;
  padding: 80px var(--px) 60px;
  max-width: 1320px;
  margin: 0 auto;
}

.intro p {
  font-size: clamp(16px, 1.4vw, 20px);
  font-weight: 300;
  line-height: 1.85;
  color: #111;
  margin-bottom: 18px;
}
.intro p:last-child { margin-bottom: 0; }

.intro-divider {
  width: clamp(60px, 8vw, 100px);
  border: none;
  border-top: 1px solid #555;
  margin: 0 auto;
  display: block;
}

/* ---------- Projects (full-width) ---------- */
#projects { padding: 64px 0 0; }

.section-title {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 300;
  text-align: center;
  letter-spacing: 0.01em;
  margin-bottom: 44px;
  color: #111;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  width: 100%;
}

.project-card {
  display: block;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.project-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  transition: transform .55s ease;
}
.project-card:hover .project-card-img { transform: scale(1.05); }

/* Dark overlay covering full card for centred label legibility */
.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.40);
  z-index: 1;
  pointer-events: none;
  transition: background .4s;
}
.project-card:hover::before { background: rgba(0,0,0,.50); }

/* Label centred over the image */
.project-card-label {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: #fff;
  font-size: clamp(16px, 1.6vw, 22px);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

/* ---------- About ---------- */
#about {
  padding: 100px var(--px);
  border-top: 1px solid var(--color-border);
}

.about-inner {
  max-width: 1100px;
  margin: 0 auto 90px;
  text-align: left;
}

.about-inner h2 {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 300;
  margin-bottom: 44px;
  letter-spacing: 0.01em;
  color: #111;
  text-align: center;
}

.about-inner p {
  font-size: clamp(16px, 1.4vw, 20px);
  font-weight: 300;
  line-height: 1.85;
  color: #111;
  margin-bottom: 22px;
}

.about-inner a {
  color: #111;
  text-decoration: none;
}

/* Our Customers */
.customers-title {
  font-size: clamp(22px, 2.5vw, 32px);
  font-weight: 300;
  letter-spacing: normal;
  text-transform: none;
  text-align: center;
  color: #555;
  margin-bottom: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  padding: 0 var(--px);
}
.customers-title::before,
.customers-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #ccc;
}

.logos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 60px 48px;
  max-width: var(--max-w);
  margin: 0 auto;
  align-items: center;
  padding: 0 var(--px);
}

.logos-grid img {
  width: 100%;
  max-height: 100px;
  object-fit: contain;
  opacity: .92;
  transition: opacity .25s;
}
.logos-grid img:hover { opacity: 1; }

/* ---------- Contact (parallax background + white card) ---------- */
#contact {
  position: relative;
  background-image: url('../assets/contact-bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;   /* CSS parallax */
  background-color: #666;
  padding: 120px clamp(20px, 5vw, 80px);   /* breathing room above & below */
}

.contact-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.97);
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 72px;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.5), 0 12px 48px rgba(0,0,0,0.22);
}

.contact-card h2 {
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 300;
  margin-bottom: 32px;
  letter-spacing: 0.02em;
  color: #111;
}

/* Contact meta – phone & email in one row */
.contact-meta {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 48px;
  margin-bottom: 44px;
  flex-wrap: nowrap;       /* always one row on desktop */
}

.contact-meta a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(15px, 1.4vw, 18px);
  font-weight: 500;
  color: #111;
  transition: opacity .2s;
  white-space: nowrap;
}
.contact-meta a:hover { opacity: .6; }

.contact-meta svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Form – underline style */
.contact-form {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  font-family: 'Poppins', sans-serif;
  font-size: clamp(14px, 1.2vw, 16px);
  font-weight: 400;
  color: #111;
  background: transparent;
  border: none;
  border-bottom: 1px solid #bbb;
  padding: 14px 4px;
  outline: none;
  transition: border-color .2s;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: #333;           /* dark placeholder */
  font-weight: 400;
}
.contact-form input:focus,
.contact-form textarea:focus { border-bottom-color: #111; }

.contact-form textarea {
  resize: none;
  min-height: 90px;
  margin-bottom: 32px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

.form-disclaimer {
  margin-top: 14px;
  font-size: 11px;
  font-weight: 300;
  color: #aaa;
  text-align: center;
  line-height: 1.5;
}

.btn-submit {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: #111;
  border: none;
  padding: 18px;
  cursor: pointer;
  transition: background .2s;
  width: 100%;
}
.btn-submit:hover { background: #444; }

/* ---------- Footer ---------- */
.site-footer {
  padding: 28px clamp(24px, 4vw, 60px);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer-text {
  font-size: 12px;
  font-weight: 400;
  color: #666;
  line-height: 1.8;
}
.footer-text a { color: #666; }
.footer-text a:hover { text-decoration: underline; }
.footer-legal { margin-top: 6px; }
.footer-legal a { text-decoration: underline; text-underline-offset: 2px; }

/* =============================================
   Scroll-reveal animations
   ============================================= */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Project cards — no scroll animation */

/* Respect user's reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* =============================================
   Project Detail Pages
   ============================================= */

.project-page {
  padding-top: var(--nav-height);
  min-height: 100vh;
}

/* ── Top bar: arrow | Projects | arrow ── */
.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 36px clamp(24px, 4vw, 60px) 0;
}

.project-nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  opacity: .75;
  transition: opacity .2s;
}
.project-nav-arrow:hover { opacity: 1; }
.project-nav-arrow.hidden { visibility: hidden; pointer-events: none; }

.project-nav-arrow img,
.project-nav-arrow svg {
  width: 44px;
  height: 44px;
}

.project-header-title {
  font-size: clamp(22px, 2.8vw, 36px);
  font-weight: 200 !important;
  letter-spacing: 0.01em;
  text-align: center;
  color: #111;
  flex: 1;
}

/* Page fade-in on load */
.project-page {
  animation: pageFadeIn 0.4s ease both;
}
@keyframes pageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Full-width rule below header */
.project-divider {
  width: 100%;
  border: none;
  border-top: 1px solid #ccc;
  margin: 28px 0 0;
}

/* ── Text content ── */
.project-description {
  padding: 48px 0 0;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - clamp(48px, 8vw, 180px) * 2);
}

.project-description h2 {
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 600;               /* bold title as in screenshot */
  margin-bottom: 16px;
  color: #111;
}

.project-description p {
  font-size: clamp(15px, 1.3vw, 18px);
  font-weight: 300;
  line-height: 1.85;
  color: #111;
}

/* ── Gallery — centred with side margins matching screenshot ── */
.project-gallery {
  margin-top: 48px;
  margin-bottom: 80px;
  margin-left: auto;
  margin-right: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 980px;
  width: calc(100% - clamp(48px, 8vw, 180px) * 2);
}

/* Image protection wrapper */
.project-gallery .img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
}

.project-gallery .img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

/* Transparent overlay blocks right-click save */
.project-gallery .img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* =============================================
   Responsive
   ============================================= */

@media (max-width: 1024px) {
  .contact-card { margin: 70px 32px; padding: 52px 44px; }
}

@media (max-width: 768px) {
  .hero {
    height: auto;
    aspect-ratio: 3 / 4;
    min-height: unset;
  }

  .hero-slide:nth-child(1) { background-position: 75% 100%; }   /* בין מרכז לימין + למטה — מבנה + צנרת */
  .hero-slide:nth-child(2) { background-position: 20% 100%; }   /* שמאלה + למטה — עיקול הצנרת       */
  .hero-slide:nth-child(3) { background-position: 0%  0%;   }   /* שמאל + למעלה — ארונות חשמל        */
  .hero-slide:nth-child(4) { background-position: 60% 100%; }   /* מעט ימינה + למטה                  */

  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .project-gallery { grid-template-columns: repeat(2, 1fr); gap: 4px; }
  .form-row { grid-template-columns: 1fr; }
  .contact-card { margin: 50px 20px; padding: 40px 28px; }
  .logos-grid { grid-template-columns: repeat(2, 1fr); gap: 36px 24px; }
}

@media (max-width: 480px) {
  .project-gallery { grid-template-columns: 1fr; gap: 4px; }
  .project-header-title { font-size: clamp(18px, 6vw, 24px); }
}

@media (max-width: 540px) {
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height); left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 28px 24px;
    gap: 24px;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }

  .projects-grid { grid-template-columns: 1fr; }
  .project-gallery { grid-template-columns: 1fr; }

  .intro { padding: 52px 24px 40px; }
  #about { padding: 70px 24px; }

  .contact-card { margin: 28px 10px; padding: 36px 20px; }
  .contact-meta { flex-direction: column; align-items: center; gap: 16px; }
}
