/* ==========================================================================
   JB Soluções — Construções e Remodelações — "Rigor de Estaleiro"
   ========================================================================== */

:root {
  --bg: #f5f5f3;
  --bg-raised: #ffffff;
  --bg-panel: #ececea;
  --ink: #23262b;
  --ink-dim: #5b6067;
  --ink-faint: #8b9096;
  --navy: #1c4e80;
  --navy-deep: #143a61;
  --navy-pale: #dce8f2;
  --border: #dcdad4;
  --border-strong: #c7c4bc;

  --font-display: "Archivo", -apple-system, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --max-width: 1200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
  color: var(--ink);
}
h1 { font-size: clamp(2.4rem, 5.4vw, 4.2rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h3 { font-size: 1.1rem; font-weight: 700; }

p { margin: 0 0 1em; color: var(--ink-dim); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 1em;
}
.eyebrow::before { content: "//"; color: var(--border-strong); }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--navy); color: #fff; padding: 0.75em 1.2em; z-index: 1000;
}
.skip-link:focus { left: 1em; top: 1em; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Corner-mark motif (borrowed from architectural drawings) ---------- */

.corner-marks { position: relative; }
.corner-marks::before, .corner-marks::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border-color: var(--navy);
  border-style: solid;
  border-width: 0;
  opacity: 0.6;
}
.corner-marks::before { top: -8px; left: -8px; border-top-width: 2px; border-left-width: 2px; }
.corner-marks::after { bottom: -8px; right: -8px; border-bottom-width: 2px; border-right-width: 2px; }

/* ---------- Reveal ---------- */

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

.reveal-stagger > * {
  --reveal-y: 20px;
  opacity: 0;
  transform: translateY(var(--reveal-y));
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal-stagger.is-visible > * { --reveal-y: 0px; opacity: 1; }
.reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0.04s; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 0.1s; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 0.16s; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 0.22s; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 0.28s; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 0.34s; }
.reveal-stagger.is-visible > *:nth-child(7) { transition-delay: 0.4s; }

/* ---------- Layout ---------- */

.section { padding: clamp(4rem, 9vw, 7.5rem) 1.5rem; }
.section-inner { max-width: var(--max-width); margin: 0 auto; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.85em 1.9em;
  font-size: 0.92rem; font-weight: 600;
  border-radius: 2px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-deep); }
.btn-ghost { border-color: rgba(255, 255, 255, 0.6); color: #fff; }
.btn-ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.12); }
.btn-ghost-dark { border-color: var(--border-strong); color: var(--ink); }
.btn-ghost-dark:hover { border-color: var(--navy); color: var(--navy); }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245, 245, 243, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); background: rgba(245, 245, 243, 0.97); }

.header-inner {
  max-width: var(--max-width); margin: 0 auto; padding: 0.9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}

.brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border: 2px solid var(--navy); display: flex; align-items: center; justify-content: center; color: var(--navy); font-weight: 800; font-size: 0.95rem; }

.main-nav ul { list-style: none; display: flex; gap: 2rem; margin: 0; padding: 0; }
.main-nav a { font-size: 0.92rem; font-weight: 600; color: var(--ink-dim); transition: color 0.2s ease; }
.main-nav a:hover { color: var(--navy); }

.nav-cta { margin-left: auto; }

.menu-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.menu-toggle span { width: 22px; height: 2px; background: var(--ink); transition: transform 0.25s ease, opacity 0.25s ease; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  position: fixed; inset: 0; top: 0; background: var(--bg); z-index: 99;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.mobile-nav.open { opacity: 1; visibility: visible; transition: opacity 0.3s ease, visibility 0s linear 0s; }
.mobile-nav ul { list-style: none; padding: 0; margin: 0; text-align: center; display: flex; flex-direction: column; gap: 1.8rem; }
.mobile-nav a { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.mobile-nav .btn { margin-top: 0.5rem; }

/* ---------- Hero (video) ---------- */

.hero {
  position: relative;
  min-height: min(88vh, 760px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  color: #fff;
}
.hero-media { position: absolute; inset: 0; overflow: hidden; }
.hero-media video, .hero-media img {
  position: absolute; top: 50%; left: 50%; width: 100%; height: 100%;
  object-fit: cover; transform: translate(-50%, -50%);
}
.hero-media::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(15, 22, 30, 0.5) 0%, rgba(15, 22, 30, 0.35) 40%, rgba(15, 22, 30, 0.88) 100%),
    linear-gradient(90deg, rgba(15, 22, 30, 0.55) 0%, rgba(15, 22, 30, 0.05) 55%);
}

.hero-inner { position: relative; z-index: 1; max-width: var(--max-width); width: 100%; margin: 0 auto; padding: 2.5rem 1.5rem clamp(3rem, 8vw, 5rem); }
.hero-content { max-width: 660px; }
.hero .eyebrow { color: var(--navy-pale); }
.hero h1 { color: #fff; margin-bottom: 0.5em; }
.hero h1 span { color: var(--navy-pale); }
.hero-lede { font-size: 1.12rem; max-width: 48ch; margin-bottom: 2.1em; color: rgba(255, 255, 255, 0.86); }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.5rem; }

.hero-strip { display: flex; flex-wrap: wrap; border-top: 1px solid rgba(255, 255, 255, 0.25); padding-top: 1.5rem; gap: 2rem; }
.hero-strip-item strong { display: block; font-family: var(--font-display); font-size: 1.5rem; color: #fff; }
.hero-strip-item span { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.65); }

/* ---------- Info strip ---------- */

.strip { border-bottom: 1px solid var(--border); background: var(--bg-raised); }
.strip-inner {
  max-width: var(--max-width); margin: 0 auto; padding: 0.9rem 1.5rem;
  display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center;
  font-size: 0.85rem; color: var(--ink-dim); letter-spacing: 0.01em;
}
.strip-sep { color: var(--navy); }

/* ---------- Sobre ---------- */

.sobre-visual { position: relative; }
.sobre-frame { position: relative; overflow: hidden; }
.sobre-frame img { width: 100%; aspect-ratio: 4/3; object-fit: cover; transition: transform 0.7s var(--ease); }
.sobre-frame:hover img { transform: scale(1.04); }

.sobre-stats { display: flex; gap: 2.5rem; margin-top: 2rem; flex-wrap: wrap; }
.sobre-stat strong { display: block; font-family: var(--font-display); font-size: 2rem; color: var(--navy); }
.sobre-stat span { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); }

/* ---------- Serviços ---------- */

.servicos-grid { display: flex; flex-wrap: wrap; gap: 1px; background: var(--border); border: 1px solid var(--border); margin-top: 2.5rem; }
.servico-card { flex: 1 1 240px; background: var(--bg-raised); padding: 2.1rem 1.7rem; transition: background-color 0.3s ease; position: relative; }
.servico-card:hover { background: var(--navy-pale); }
.servico-num { font-family: var(--font-display); color: var(--navy); font-size: 1.5rem; margin-bottom: 0.5em; font-weight: 800; }
.servicos-note { margin-top: 2rem; font-size: 0.85rem; color: var(--ink-faint); font-style: italic; }

/* ---------- Trabalhos — pranchas técnicas (filmstrip horizontal) ---------- */

.trabalhos { background: var(--bg-panel); }

.gallery-viewport {
  position: relative;
  margin-top: 2.5rem;
}

.gallery-track {
  display: flex;
  gap: 1.4rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0.5rem 0 1.5rem;
  scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }

.gallery-item {
  display: block;
  position: relative;
  flex: 0 0 auto;
  width: min(360px, 78vw);
  scroll-snap-align: start;
  cursor: zoom-in;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  padding: 0.9rem 0.9rem 1.1rem;
  text-align: left;
  font: inherit;
}

.gallery-item-photo { position: relative; overflow: hidden; aspect-ratio: 4/3; background: var(--border); }
.gallery-item-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.gallery-item:hover .gallery-item-photo img { transform: scale(1.06); }

.gallery-item-plate {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-strong);
  font-family: var(--font-display);
}
.gallery-item-plate .plate-num { font-size: 0.78rem; font-weight: 800; color: var(--navy); letter-spacing: 0.04em; }
.gallery-item-plate .plate-total { font-size: 0.7rem; color: var(--ink-faint); font-weight: 500; }
.gallery-item-caption { margin-top: 0.35rem; font-size: 0.92rem; font-weight: 600; color: var(--ink); }

.gallery-nav {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.gallery-nav button {
  width: 40px; height: 40px;
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.gallery-nav button:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.gallery-nav button:disabled { opacity: 0.35; cursor: default; }
.gallery-nav button:disabled:hover { background: var(--bg-raised); border-color: var(--border-strong); color: var(--ink); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; background: rgba(10, 14, 18, 0.94); padding: 2rem; }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(90vw, 1100px); max-height: 85vh; width: auto; object-fit: contain; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.3); color: #fff;
  width: 44px; height: 44px; cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background-color 0.2s ease;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: var(--navy); }
.lightbox-close { top: 1.5rem; right: 1.5rem; }
.lightbox-prev { left: 1.5rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1.5rem; top: 50%; transform: translateY(-50%); }

/* ---------- Processo ---------- */

.processo-steps { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; gap: 0; }
.processo-steps li { display: grid; grid-template-columns: 70px 1fr; gap: 1.5rem; padding: 1.8rem 0; border-top: 1px solid var(--border); align-items: start; }
.processo-steps li:last-child { border-bottom: 1px solid var(--border); }
.step-marker { font-family: var(--font-display); color: var(--navy); font-size: 1.3rem; font-weight: 800; }
.processo-steps h3 { margin-bottom: 0.35em; }
.processo-steps p { margin: 0; }

/* ---------- Contacto ---------- */

.contacto { background: var(--navy); color: #fff; }
.contacto .eyebrow { color: var(--navy-pale); }
.contacto h2 { color: #fff; }
.contacto p { color: rgba(255, 255, 255, 0.78); }

.contact-list { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 1.1rem; }
.contact-list li { display: flex; flex-direction: column; gap: 0.2rem; padding-bottom: 1.1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.18); font-size: 1.05rem; }
.contact-list a { transition: color 0.2s ease; }
.contact-list a:hover { color: var(--navy-pale); }
.contact-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--navy-pale); }

.contact-form { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.2); padding: 2.2rem; }
.form-row { margin-bottom: 1.3rem; }
.form-row label { display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.65); margin-bottom: 0.5em; }
.form-row input, .form-row textarea {
  width: 100%; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff;
  padding: 0.75em 0.9em; font-family: var(--font-body); font-size: 0.95rem;
}
.form-row input::placeholder, .form-row textarea::placeholder { color: rgba(255, 255, 255, 0.4); }
.form-row input:focus, .form-row textarea:focus { outline: none; border-color: #fff; }
.form-row textarea { resize: vertical; }
.form-submit { width: 100%; }
.form-note { margin: 1rem 0 0; font-size: 0.88rem; color: var(--navy-pale); min-height: 1.2em; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--border); padding: 3rem 1.5rem 2rem; background: var(--bg-raised); }
.footer-inner { max-width: var(--max-width); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 2rem; }
.footer-info p { margin: 0 0 0.3em; font-size: 0.88rem; color: var(--ink-dim); }
.footer-info a:hover { color: var(--navy); }
.footer-copy { margin: 0 0 0 auto; font-size: 0.8rem; color: var(--ink-faint); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .main-nav, .nav-cta { display: none; }
  .menu-toggle { display: flex; }
  .two-col { grid-template-columns: 1fr; }
  .sobre-visual { order: -1; }
  .footer-copy { margin-left: 0; }
  .gallery-item { width: min(300px, 82vw); }
}

@media (max-width: 520px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .strip-inner { flex-direction: column; gap: 0.3rem; }
  .strip-sep { display: none; }
  .processo-steps li { grid-template-columns: 46px 1fr; gap: 1rem; }
  .hero-strip { gap: 1.2rem; }
}
