/* ==========================================================================
   Carpintaria Santos — Oficina Editorial (tema claro)
   ========================================================================== */

:root {
  --bg: #f7f3ea;
  --bg-raised: #ffffff;
  --bg-warm: #f0e9db;
  --ink: #241f16;
  --ink-dim: #6e6656;
  --ink-faint: #a39c8a;
  --gold: #b8862e;
  --gold-deep: #8f6a24;
  --gold-pale: #eddcb3;
  --line: #32414d;
  --border: #e2d9c6;
  --border-strong: #d2c6ac;
  --border-radius: 2px;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --max-width: 1180px;
  --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.6;
  -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: 500;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--ink);
}

h1 { font-size: clamp(2.4rem, 5.5vw, 4.4rem); font-weight: 400; }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
h3 { font-size: 1.2rem; font-weight: 500; }

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

.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--gold);
  margin: 0 0 1em;
  font-weight: 600;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--gold);
  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; }
}

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.reveal-stagger > * {
  --reveal-y: 24px;
  opacity: 0;
  transform: rotate(var(--rot, 0deg)) translateY(var(--reveal-y));
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal-stagger.is-visible > * { --reveal-y: 0px; opacity: 1; }
.reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 0.14s; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 0.23s; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 0.32s; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 0.41s; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 0.5s; }
.reveal-stagger.is-visible > *:nth-child(7) { transition-delay: 0.59s; }
.reveal-stagger.is-visible > *:nth-child(8) { transition-delay: 0.68s; }
.reveal-stagger.is-visible > *:nth-child(9) { transition-delay: 0.77s; }
.reveal-stagger.is-visible > *:nth-child(10) { transition-delay: 0.86s; }

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

.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: 1.05fr 0.95fr;
  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: 500;
  letter-spacing: 0.02em;
  border-radius: var(--border-radius);
  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:active { transform: translateY(0); }

.btn-primary { background: var(--gold); color: #fff; }
.btn-primary:hover { background: var(--gold-deep); }

.btn-ghost { border-color: rgba(255, 255, 255, 0.55); 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(--gold); color: var(--gold); }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 243, 234, 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(247, 243, 234, 0.97);
}

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

.logo-link { flex-shrink: 0; }
.logo-img { height: 52px; width: auto; }

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

.nav-cta { margin-left: auto; }
.btn.nav-cta { background: var(--gold); color: #fff; }
.btn.nav-cta:hover { background: var(--gold-deep); }

.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.7rem; color: var(--ink); }
.mobile-nav .btn { margin-top: 0.5rem; }

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

.hero {
  position: relative;
  min-height: min(92vh, 820px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  color: #fff;
}

.hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.hero-media video,
.hero-media .hero-poster {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate(-50%, -50%) scale(1.02);
}
.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 16, 8, 0.55) 0%, rgba(20, 16, 8, 0.35) 40%, rgba(20, 16, 8, 0.82) 100%),
    linear-gradient(90deg, rgba(20, 16, 8, 0.55) 0%, rgba(20, 16, 8, 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: 640px; }

.hero .eyebrow { color: var(--gold-pale); }

.hero h1 { color: #fff; margin-bottom: 0.55em; text-wrap: balance; }
.hero h1 span { color: var(--gold-pale); font-style: italic; }

.hero-lede {
  font-size: 1.15rem;
  max-width: 46ch;
  margin-bottom: 2.1em;
  color: rgba(255, 255, 255, 0.86);
}

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.scroll-cue {
  position: absolute;
  right: clamp(1.5rem, 4vw, 3rem);
  bottom: clamp(1.5rem, 4vw, 2.5rem);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.scroll-cue-line {
  width: 1px;
  height: 40px;
  background: rgba(255, 255, 255, 0.4);
  position: relative;
  overflow: hidden;
}
.scroll-cue-line::after {
  content: "";
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gold-pale);
  animation: scrollcue 2.2s ease-in-out infinite;
}
@keyframes scrollcue {
  0% { top: -100%; }
  60% { top: 100%; }
  100% { top: 100%; }
}

/* ---------- 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.02em;
}
.strip-sep { color: var(--gold); }

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

.sobre { background: var(--bg); }

.col-visual { position: relative; }

.sobre-photo-frame {
  position: relative;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 30px 60px -25px rgba(36, 31, 22, 0.35);
}
.sobre-photo-frame img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.sobre-photo-frame:hover img { transform: scale(1.04); }

.sobre-photo-motif {
  position: absolute;
  bottom: -22px;
  right: -22px;
  width: 46%;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  z-index: -1;
}
.sobre-photo-motif::before {
  content: "";
  position: absolute;
  inset: 14%;
  border: 1px solid var(--border-strong);
}

/* ---------- Trabalhos (galeria em colagem) ---------- */

.trabalhos { background: var(--bg-warm); position: relative; overflow: hidden; }

.gallery-board {
  position: relative;
  margin-top: 3rem;
}

.gallery-dot {
  position: absolute;
  border-radius: 50%;
  background: var(--gold);
  z-index: 1;
  animation: dotfloat 7s ease-in-out infinite;
}
.gallery-dot.dot-2 { background: var(--line); animation-delay: -2.3s; animation-duration: 8.5s; }
.gallery-dot.dot-3 { background: var(--gold-pale); border: 1px solid var(--gold); animation-delay: -4.6s; animation-duration: 6.2s; }
@keyframes dotfloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.gallery-grid {
  column-count: 4;
  column-gap: 1.4rem;
}

.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: 3px;
  cursor: zoom-in;
  background: var(--border);
  break-inside: avoid;
  margin: 0 0 1.4rem;
  padding: 0;
  border: none;
  box-shadow: 0 14px 30px -16px rgba(36, 31, 22, 0.28);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease), z-index 0s;
}
/* Composes with --rot (set per item below) and --reveal-y (set by the
   .reveal-stagger scroll-in animation); hover/focus swap to an explicit
   transform since that's a distinct final state, not part of the reveal. */
.gallery-item { transform: rotate(var(--rot, 0deg)) translateY(var(--reveal-y, 0px)); }
.gallery-item:hover,
.gallery-item:focus-visible {
  transform: rotate(0deg) scale(1.035) translateY(-4px);
  box-shadow: 0 26px 46px -18px rgba(36, 31, 22, 0.4);
  z-index: 2;
}

.gallery-item:nth-child(6n+1) { --rot: -2.4deg; }
.gallery-item:nth-child(6n+2) { --rot: 1.6deg; margin-top: 2.2rem; }
.gallery-item:nth-child(6n+3) { --rot: -1.2deg; }
.gallery-item:nth-child(6n+4) { --rot: 2.2deg; }
.gallery-item:nth-child(6n+5) { --rot: -1.8deg; margin-top: 1.4rem; }
.gallery-item:nth-child(6n+6) { --rot: 1.1deg; }

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.6s var(--ease);
}

.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(20, 16, 8, 0.6) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gallery-item:hover::after { opacity: 1; }

.gallery-item span {
  position: absolute;
  left: 0.9rem;
  bottom: 0.7rem;
  right: 0.9rem;
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.gallery-item:hover span { opacity: 1; transform: translateY(0); }

.gallery-note {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
  font-style: italic;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 12, 7, 0.92);
  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;
  border-radius: 50%;
  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: rgba(255, 255, 255, 0.25); }
.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%); }

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

.servicos-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 2.5rem;
}

.servico-card {
  background: var(--bg-raised);
  padding: 2.2rem 1.8rem;
  transition: background-color 0.3s ease;
}
.servico-card:hover { background: var(--bg-warm); }

.servico-num {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1.6rem;
  margin-bottom: 0.6em;
}

.servicos-note {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
  font-style: italic;
}

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

.processo { background: var(--bg-warm); }

.processo-steps {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0;
}
.processo-steps li {
  display: grid;
  grid-template-columns: 72px 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(--gold);
  font-size: 1.4rem;
}

.processo-steps h3 { margin-bottom: 0.35em; }
.processo-steps p { margin: 0; }

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

.contacto { position: relative; background: var(--line); color: #fff; overflow: hidden; }
.contacto .eyebrow { color: var(--gold-pale); }
.contacto h2 { color: #fff; }
.contacto p { color: rgba(255, 255, 255, 0.72); }

.contacto-grain {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(100deg, rgba(184, 134, 46, 0.08) 0, rgba(184, 134, 46, 0.08) 2px, transparent 2px, transparent 28px);
  pointer-events: none;
}

.contacto .section-inner { position: relative; }

.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.15);
  font-size: 1.05rem;
  color: #fff;
}
.contact-list a { transition: color 0.2s ease; }
.contact-list a:hover { color: var(--gold-pale); }

.contact-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-pale);
}

.contact-form {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 2.2rem;
  border-radius: var(--border-radius);
}

.form-row { margin-bottom: 1.3rem; }
.form-row label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  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.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.75em 0.9em;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border-radius: var(--border-radius);
}
.form-row input::placeholder,
.form-row textarea::placeholder { color: rgba(255, 255, 255, 0.35); }
.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--gold-pale);
}
.form-row textarea { resize: vertical; }

.form-submit { width: 100%; }

.form-note {
  margin: 1rem 0 0;
  font-size: 0.88rem;
  color: var(--gold-pale);
  min-height: 1.2em;
}

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

.site-footer {
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem 2rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem;
}
.footer-logo { height: 44px; width: auto; }
.footer-info p { margin: 0 0 0.3em; font-size: 0.88rem; }
.footer-info a:hover { color: var(--gold); }
.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; }
  .col-visual { order: -1; max-width: 340px; margin: 0 auto; }
  .footer-copy { margin-left: 0; }
  .gallery-grid { column-count: 3; }
}

@media (max-width: 640px) {
  .gallery-grid { column-count: 2; column-gap: 0.9rem; }
  .gallery-item { margin-bottom: 0.9rem; }
  .gallery-item:nth-child(6n+2) { margin-top: 1.2rem; }
  .gallery-item:nth-child(6n+5) { margin-top: 0.7rem; }
  .lightbox-prev, .lightbox-next { width: 38px; height: 38px; }
}

@media (max-width: 400px) {
  .gallery-grid { column-count: 1; }
  .gallery-item { transform: none !important; margin-top: 0 !important; }
}

@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: 48px 1fr; gap: 1rem; }
  .scroll-cue { display: none; }
}
