
:root{
  --history-burgundy:#3e002f;
  --history-burgundy-2:#5d123f;
  --history-gold:#b4874b;
  --history-ink:#272329;
  --history-muted:#655f65;
  --history-paper:#f7f2ed;
  --history-line:#ded4d9;
  --history-white:#fff;
  --history-shadow:0 18px 48px rgba(62,0,47,.10);
}
*{box-sizing:border-box}
body.history-services-page{overflow-x:hidden;color:var(--history-ink);background:#fff}
.history-services-page img{max-width:100%}

.history-hero{
  position:relative;
  isolation:isolate;
  overflow:hidden;
  min-height:560px;
  background:
    linear-gradient(90deg,rgba(31,7,22,.94) 0%,rgba(62,0,47,.84) 46%,rgba(62,0,47,.47) 70%,rgba(20,5,15,.52) 100%),
    url("img/genealogia-hero.webp") center 45%/cover no-repeat;
}
.history-hero::after{
  content:"";position:absolute;inset:0;z-index:-1;
  background:linear-gradient(180deg,rgba(0,0,0,.05),rgba(0,0,0,.22));
}
.history-hero-inner{
  display:grid;grid-template-columns:minmax(0,1.38fr) minmax(290px,.62fr);
  align-items:center;gap:56px;min-height:560px;padding-top:62px;padding-bottom:62px;
}
.history-hero-copy{max-width:760px;color:#fff}
.history-hero .eyebrow{color:#e8caa4}
.history-hero h1{max-width:760px;margin:8px 0 20px;font-size:clamp(43px,6vw,72px);line-height:1.02;color:#fff}
.history-hero .lead{max-width:720px;margin:0;color:rgba(255,255,255,.9);font-size:19px;line-height:1.7}
.hero-actions{display:flex;flex-wrap:wrap;gap:13px;margin-top:30px}
.history-hero-card{
  display:flex;flex-direction:column;gap:13px;padding:30px;
  border:1px solid rgba(255,255,255,.30);border-radius:22px;
  color:#fff;background:rgba(62,0,47,.78);backdrop-filter:blur(8px);
  box-shadow:0 24px 60px rgba(0,0,0,.25)
}
.hero-card-label{font-size:12px;font-weight:900;text-transform:uppercase;letter-spacing:.1em;color:#e8caa4}
.history-hero-card strong{font-size:25px;line-height:1.2}
.history-hero-card p{margin:0;color:rgba(255,255,255,.83);line-height:1.65}
.history-hero-card a{color:#fff;font-weight:800;text-decoration:none}

.history-intro{padding-top:54px;padding-bottom:48px}
.history-intro .section-head{max-width:810px}
.history-jumps{display:flex;flex-wrap:wrap;gap:11px;margin-top:26px}
.history-jumps a{
  display:inline-flex;align-items:center;justify-content:center;min-height:46px;padding:11px 18px;
  border:1px solid #d6c4ce;border-radius:999px;color:var(--history-burgundy);
  background:#f8f2f5;font-weight:800;text-decoration:none;transition:.2s ease
}
.history-jumps a:hover,.history-jumps a:focus-visible{color:#fff;background:var(--history-burgundy);border-color:var(--history-burgundy);transform:translateY(-1px)}

.history-details{padding:10px 0 72px;background:linear-gradient(180deg,#faf7f8,#fff 42%,#f8f4f1)}
.history-service{
  display:grid;grid-template-columns:minmax(300px,.78fr) minmax(0,1.22fr);
  gap:46px;align-items:center;margin-top:28px;padding:42px;
  border:1px solid var(--history-line);border-radius:26px;background:#fff;
  box-shadow:var(--history-shadow);scroll-margin-top:120px
}
.history-service-reverse .history-service-photo{order:2}
.history-service-reverse .history-service-content{order:1}
.history-service-photo{
  margin:0;overflow:hidden;min-height:420px;border-radius:20px;background:#e9e1e4
}
.history-service-photo img{display:block;width:100%;height:100%;min-height:420px;object-fit:cover;transition:transform .45s ease}
.history-service:hover .history-service-photo img{transform:scale(1.025)}
.history-service-content{min-width:0}
.service-kicker{margin:0 0 8px;color:var(--history-gold);font-size:12px;font-weight:900;letter-spacing:.1em;text-transform:uppercase}
.history-service h2{margin:0 0 20px;color:var(--history-burgundy);font-size:clamp(31px,4vw,48px);line-height:1.08}
.history-service-content>p:not(.service-kicker){margin:0 0 15px;color:var(--history-muted);font-size:16.5px;line-height:1.78}
.service-points{display:flex;flex-wrap:wrap;gap:8px;margin-top:22px}
.service-points span{padding:8px 12px;border-radius:999px;color:var(--history-burgundy);background:#f3eaef;font-size:13px;font-weight:800}
.service-note,.individual-price{
  margin-top:23px;padding:17px 19px;border-left:4px solid var(--history-gold);
  border-radius:0 14px 14px 0;color:var(--history-muted);background:#faf5ef;line-height:1.65
}
.individual-price{display:flex;flex-direction:column;gap:5px}
.individual-price strong{color:var(--history-burgundy);font-size:21px}

.pricing-card{
  margin-top:22px;padding:34px;border:1px solid var(--history-line);border-radius:22px;
  background:#fff;box-shadow:0 12px 34px rgba(62,0,47,.07)
}
.pricing-heading{display:flex;align-items:end;justify-content:space-between;gap:24px;margin-bottom:20px}
.pricing-heading h3{margin:0;color:var(--history-burgundy);font-size:clamp(25px,3vw,36px)}
.table-wrap{overflow-x:auto;border:1px solid var(--history-line);border-radius:15px}
.pricing-card table{width:100%;border-collapse:collapse;min-width:620px}
.pricing-card th,.pricing-card td{padding:15px 17px;border-bottom:1px solid #e7dfe3;text-align:left;vertical-align:top}
.pricing-card th{color:#fff;background:var(--history-burgundy);font-size:13px;text-transform:uppercase;letter-spacing:.04em}
.pricing-card tbody tr:last-child td{border-bottom:0}
.pricing-card tbody tr:nth-child(even){background:#fbf8f9}
.pricing-card td:last-child{white-space:nowrap;color:var(--history-burgundy)}
.pricing-footnote{margin:15px 0 0;color:var(--history-muted);font-size:13.5px;line-height:1.6}
.translation-prices{display:flex;flex-wrap:wrap;gap:9px;margin-top:20px;padding-top:20px;border-top:1px solid var(--history-line)}
.translation-prices strong{width:100%;color:var(--history-burgundy)}
.translation-prices span{padding:7px 10px;border-radius:9px;background:#f4edef;color:var(--history-muted);font-size:13px}
.double-pricing{display:grid;grid-template-columns:1fr 1fr;gap:22px}
.double-pricing .pricing-card{min-width:0}
.double-pricing .pricing-card table{min-width:500px}

.history-banner{
  padding:60px 0;
  background:
    linear-gradient(90deg,rgba(62,0,47,.96),rgba(62,0,47,.80)),
    url("img/genealogia-polska.webp") center/cover no-repeat;
  color:#fff
}
.history-banner-inner{display:flex;align-items:center;justify-content:space-between;gap:50px}
.history-banner-inner>div{max-width:780px}
.history-banner .eyebrow{color:#e8caa4}
.history-banner h2{margin:7px 0 14px;color:#fff;font-size:clamp(30px,4vw,46px);line-height:1.1}
.history-banner p{margin:0;color:rgba(255,255,255,.84);font-size:17px;line-height:1.7}
.history-banner .btn{flex:0 0 auto;white-space:nowrap}

.cooperation{padding-top:70px;padding-bottom:72px}
.section-head.centered{text-align:center;margin-left:auto;margin-right:auto}
.cooperation-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:18px;margin-top:32px}
.cooperation-grid article{position:relative;padding:26px 22px;border:1px solid var(--history-line);border-radius:18px;background:#fff;box-shadow:0 9px 26px rgba(62,0,47,.055)}
.cooperation-grid span{display:grid;place-items:center;width:42px;height:42px;margin-bottom:17px;border-radius:50%;color:#fff;background:var(--history-burgundy);font-weight:900}
.cooperation-grid h3{margin:0 0 9px;color:var(--history-burgundy);font-size:19px}
.cooperation-grid p{margin:0;color:var(--history-muted);font-size:14.5px;line-height:1.65}

.history-cta{padding:58px 0;color:#fff;background:linear-gradient(135deg,#28001e,#5b0f3e)}
.history-cta-inner{display:flex;align-items:center;justify-content:space-between;gap:50px}
.history-cta-inner>div:first-child{max-width:720px}
.history-cta .eyebrow{color:#e8caa4}
.history-cta h2{margin:6px 0 12px;color:#fff;font-size:clamp(32px,4vw,48px)}
.history-cta p{margin:0;color:rgba(255,255,255,.82);line-height:1.7}
.cta-contact{display:flex;flex-direction:column;align-items:flex-start;gap:9px}
.cta-contact>a:not(.btn){color:#fff;font-size:17px;font-weight:800;text-decoration:none}
.cta-contact .btn{margin-top:7px;white-space:nowrap}

@media(max-width:1050px){
  .history-hero-inner{grid-template-columns:1fr}
  .history-hero-card{max-width:620px}
  .history-service{grid-template-columns:minmax(270px,.8fr) minmax(0,1.2fr);gap:34px;padding:34px}
  .double-pricing{grid-template-columns:1fr}
  .cooperation-grid{grid-template-columns:1fr 1fr}
}
@media(max-width:820px){
  .history-hero{background-position:58% center}
  .history-service,.history-service-reverse{grid-template-columns:1fr;padding:26px}
  .history-service-reverse .history-service-photo,.history-service-reverse .history-service-content{order:initial}
  .history-service-photo,.history-service-photo img{min-height:300px}
  .history-banner-inner,.history-cta-inner{align-items:flex-start;flex-direction:column}
}
@media(max-width:560px){
  .history-hero h1{font-size:42px}
  .history-jumps{display:grid;grid-template-columns:1fr}
  .history-jumps a{border-radius:13px}
  .history-service{padding:20px;border-radius:19px}
  .history-service-photo,.history-service-photo img{min-height:240px}
  .pricing-card{padding:23px 18px}
  .cooperation-grid{grid-template-columns:1fr}
}


/* =========================================================
   POPRAWKA KOŃCOWA: zdjęcia u góry sekcji i cenniki bez scrolla
   ========================================================= */

/* Wszystkie elementy sekcji zaczynają się od tej samej górnej krawędzi. */
.history-service{
  align-items:start;
  gap:34px;
}
.history-service-photo,
.history-service-content{
  align-self:start;
}

/* Zdjęcia historii nieruchomości i kwerend są mniejsze,
   ale pozostają przy górnej krawędzi sekcji. */
#historia-nieruchomosci .history-service-photo,
#kwerendy-archiwalne .history-service-photo{
  display:flex;
  align-items:flex-start;
  justify-content:center;
  min-height:0;
  margin:0;
  padding:16px;
  overflow:hidden;
  border:1px solid #e3d9de;
  border-radius:18px;
  background:#fff;
  box-shadow:0 10px 24px rgba(62,0,47,.08);
}

#historia-nieruchomosci .history-service-photo img{
  display:block;
  width:85%;
  height:auto;
  min-height:0;
  max-height:320px;
  object-fit:contain;
  object-position:center top;
}

#kwerendy-archiwalne .history-service-photo img{
  display:block;
  width:75%;
  height:auto;
  min-height:0;
  max-height:285px;
  object-fit:contain;
  object-position:center top;
}

/* Tabele zawsze mieszczą się w szerokości kontenera. */
.table-wrap{
  width:100%;
  max-width:100%;
  overflow-x:visible;
}

.pricing-card{
  min-width:0;
}

.pricing-card table,
.double-pricing .pricing-card table{
  width:100%;
  min-width:0;
  max-width:100%;
  table-layout:fixed;
}

.pricing-card th,
.pricing-card td{
  padding:12px 13px;
  font-size:14px;
  line-height:1.45;
  overflow-wrap:anywhere;
  word-break:normal;
}

.pricing-card th:first-child,
.pricing-card td:first-child{
  width:68%;
}

.pricing-card th:last-child,
.pricing-card td:last-child{
  width:32%;
  white-space:normal;
  text-align:right;
}

.double-pricing{
  align-items:start;
}

.double-pricing .pricing-card{
  padding:26px 20px;
}

.double-pricing .pricing-card th:first-child,
.double-pricing .pricing-card td:first-child{
  width:62%;
}

.double-pricing .pricing-card th:last-child,
.double-pricing .pricing-card td:last-child{
  width:38%;
}

/* Na tabletach obrazy nadal zaczynają się u góry i zachowują rozsądny rozmiar. */
@media(max-width:820px){
  .history-service{
    gap:24px;
  }

  #historia-nieruchomosci .history-service-photo,
  #kwerendy-archiwalne .history-service-photo{
    width:100%;
    padding:14px;
  }

  #historia-nieruchomosci .history-service-photo img{
    width:min(78%,560px);
    max-height:300px;
  }

  #kwerendy-archiwalne .history-service-photo img{
    width:min(72%,500px);
    max-height:270px;
  }
}

/* Na telefonach cenniki pozostają czytelne bez poziomego przesuwania. */
@media(max-width:560px){
  .pricing-card{
    padding:20px 12px;
  }

  .pricing-card th,
  .pricing-card td{
    padding:9px 7px;
    font-size:12px;
    line-height:1.35;
  }

  .pricing-card th:first-child,
  .pricing-card td:first-child,
  .double-pricing .pricing-card th:first-child,
  .double-pricing .pricing-card td:first-child{
    width:58%;
  }

  .pricing-card th:last-child,
  .pricing-card td:last-child,
  .double-pricing .pricing-card th:last-child,
  .double-pricing .pricing-card td:last-child{
    width:42%;
  }

  #historia-nieruchomosci .history-service-photo img,
  #kwerendy-archiwalne .history-service-photo img{
    width:100%;
    max-height:none;
  }
}
