/* ==========================================================================
   InsiteMedia — "Jak budujemy prototyp strony" scroll-driven 3D story
   Light edition: white canvas + brand bordo accent (insitemedia.pl palette),
   same scroll-storytelling register as the dark version, but the 3D object
   is a literal browser-window prototype assembling itself, then a padlock
   locking onto it for the security chapter.
   ========================================================================== */
:root{
  --bg: #ffffff;
  --canvas: #f6f5f4;
  --panel: rgba(255,255,255,0.78);
  --border: #e6e3e2;
  --border-strong: #d7d3d1;

  --ink: #16130f0f; /* unused placeholder guard */
  --ink: #17140f;
  --ink-soft: #2a2523;
  --text: #17140f;
  --text-muted: #6f6a69;
  --text-dim: #a29d9b;

  --accent: #8f1d2c;
  --accent-hover: #741622;
  --accent-soft: rgba(143,29,44,0.08);
  --accent-line: rgba(143,29,44,0.28);

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

  --max: 1180px;
  --ease: cubic-bezier(.16,1,.3,1);
  --nav-h: 78px;
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
ul, ol{ margin:0; padding:0; list-style:none; }
button{ font: inherit; color: inherit; background:none; border:none; cursor:pointer; }
input, textarea{ font: inherit; color: inherit; }
h1,h2,h3,p{ margin:0; }

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

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
::selection{ background: var(--accent); color: #fff; }

/* ==========================================================================
   Preloader
   ========================================================================== */
.preloader{
  position: fixed; inset:0; z-index: 300;
  background: var(--bg);
  display:flex; flex-direction: column; align-items:center; justify-content:center;
  gap: 14px;
  transition: opacity .8s var(--ease), visibility .8s var(--ease);
}
.preloader__mark{
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .35em;
  color: var(--ink);
}
.preloader__sub{
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse{ 0%,100%{ opacity:.35 } 50%{ opacity:1 } }
.preloader.is-hidden{ opacity:0; visibility:hidden; pointer-events:none; }

/* ==========================================================================
   Fixed 3D canvas + atmosphere
   ========================================================================== */
#scene{
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  display:block;
  background:
    radial-gradient(var(--border-strong) 1px, transparent 1px);
  background-size: 26px 26px;
  background-color: var(--bg);
}
.scene-glow{
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 80% 12%, var(--accent-soft), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(255,255,255,.9), transparent 55%);
}

main, .footer, .chapters-nav{ position: relative; z-index: 3; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding: 15px 30px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  transition: transform .4s var(--ease), background .3s ease, border-color .3s ease, color .3s ease, box-shadow .4s ease;
  white-space: nowrap;
}
.btn--primary{
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(143,29,44,.15);
}
.btn--primary:hover{ transform: translateY(-2px); background: var(--accent-hover); }
.btn--outline{
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(8px);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn--outline:hover{ border-color: var(--accent); color: var(--accent); }
.btn--sm{ padding: 9px 18px; font-size: 13px; }
.btn--block{ width:100%; }

/* ==========================================================================
   Persistent chapter nav / breadcrumb
   ========================================================================== */
.chapters-nav{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display:flex; align-items:center; gap: 32px;
  padding: 20px 32px;
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background .4s ease, backdrop-filter .4s ease, border-color .4s ease, box-shadow .4s ease;
  border-bottom: 1px solid transparent;
}
.chapters-nav.is-scrolled{
  background: rgba(255,255,255,.9);
  border-color: var(--border);
  box-shadow: 0 8px 24px -18px rgba(23,20,15,0.35);
}
.chapters-nav__logo{
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.chapters-nav__logo span{ color: var(--accent); }
.chapters-nav__logo-img{
  display: block;
  height: 30px;
  width: auto;
}
.chapters-nav__list{
  display:flex;
  gap: 22px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}
.chapters-nav__list a{
  display:flex; align-items:center; gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color .35s ease;
}
.chapters-nav__list .dot{
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background .35s ease, box-shadow .35s ease, transform .35s ease;
}
.chapters-nav__list a:hover{ color: var(--ink); }
.chapters-nav__list a.is-active{ color: var(--accent); }
.chapters-nav__list a.is-active .dot{
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transform: scale(1.3);
}
.chapters-nav__actions{ display:flex; align-items:center; gap: 10px; flex-shrink: 0; }

@media (max-width: 900px){
  .chapters-nav__list{ display:none; }
}

/* ==========================================================================
   Reveal animation
   ========================================================================== */
.reveal{
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.reveal.is-visible{ opacity: 1; transform: translateY(0); }

/* ==========================================================================
   Story chapters
   ========================================================================== */
.story-chapter{
  min-height: 100vh;
  display:flex;
  align-items:center;
  padding: var(--nav-h) 32px 0;
}
.story-chapter__inner{
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 44px;
  box-shadow: 0 30px 60px -35px rgba(23,20,15,0.15);
}
.story-chapter--hero .story-chapter__inner{ text-align:center; max-width: 700px; }

.story-chapter:not(.story-chapter--hero) .story-chapter__inner{ text-align:center; }
.story-chapter:not(.story-chapter--hero) .story-body{ margin-left:auto; margin-right:auto; }
.story-chapter:not(.story-chapter--hero) .btn{ margin-left:auto; margin-right:auto; }

.chapter-label{
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 20px;
}

.story-title{
  font-weight: 800;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 22px;
  color: var(--ink);
}
.story-sub{
  max-width: 52ch;
  margin: 0 auto 36px;
  color: var(--text-muted);
  font-size: clamp(15px, 1.2vw, 16.5px);
}
.story-chapter--hero .story-sub{ margin-left:auto; margin-right:auto; }

.story-heading{
  font-weight: 800;
  font-size: clamp(26px, 3.6vw, 42px);
  line-height: 1.16;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  color: var(--ink);
}
.story-body{
  max-width: 46ch;
  color: var(--text-muted);
  font-size: clamp(15px, 1.1vw, 16px);
  margin-bottom: 8px;
}
.story-chapter .btn{ margin-top: 28px; }

.scroll-cue{
  display:flex; flex-direction: column; align-items:center; gap: 10px;
  margin-top: 6px;
}
.scroll-cue span:first-child{
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.scroll-cue__line{
  width: 1px; height: 42px;
  background: var(--border-strong);
  position: relative;
  overflow: hidden;
}
.scroll-cue__line::after{
  content:"";
  position:absolute; top:-100%; left:0; right:0; height:100%;
  background: var(--accent);
  animation: scrollDrip 1.8s ease-in-out infinite;
}
@keyframes scrollDrip{
  0%{ top: -100%; }
  60%{ top: 100%; }
  100%{ top: 100%; }
}

/* ==========================================================================
   Contact
   ========================================================================== */
.contact{
  padding: 140px 32px 120px;
  background: linear-gradient(180deg, transparent, var(--canvas) 18%);
}
.contact__panel{
  max-width: var(--max);
  margin: 0 auto;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: clamp(30px, 5vw, 60px);
  box-shadow: 0 30px 60px -35px rgba(23,20,15,0.12);
}
.contact__info h2{
  font-weight: 800;
  font-size: clamp(26px, 3.2vw, 38px);
  letter-spacing: -0.02em;
  margin: 18px 0 20px;
  color: var(--ink);
}
.contact__lead{ color: var(--text-muted); max-width: 46ch; margin-bottom: 30px; }
.contact__details{
  display:flex; flex-direction: column; gap: 16px;
  margin-bottom: 30px;
}
.contact__details div{ display:flex; flex-direction: column; gap: 4px; }
.contact__label{ font-size: 12px; color: var(--text-dim); }
.contact__details a{ font-size: 16px; transition: color .25s ease; }
.contact__details a:hover{ color: var(--accent); }
.contact__social{ display:flex; gap: 12px; flex-wrap: wrap; }
.contact__social a{
  display:flex; align-items:center; justify-content:center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  background: var(--canvas);
  transition: color .25s ease, border-color .25s ease, background .25s ease, transform .3s var(--ease);
}
.contact__social a svg{ width: 17px; height: 17px; fill: currentColor; }
.contact__social a:hover{
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
}

.contact__form{ display:flex; flex-direction: column; gap: 16px; }
.field, .field-row{ display:flex; flex-direction: column; gap: 8px; }
.field-row{ flex-direction: row; gap: 16px; }
.field-row .field{ flex:1; }
label{ font-size: 13px; color: var(--text-dim); font-weight: 500; }
input, textarea{
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 15px;
  color: var(--ink);
  transition: border-color .25s ease, background .25s ease;
  resize: vertical;
}
input:focus, textarea:focus{ border-color: var(--accent); outline: none; background: #fff; }
.contact__note{
  font-size: 13.5px;
  color: var(--accent);
  min-height: 18px;
  margin: 0;
  font-weight: 500;
}
.contact__note--overload{
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  padding: 16px 18px;
  opacity: 0;
  transform: translateY(8px);
  animation: noteIn .5s var(--ease) forwards;
}
.contact__note--overload .contact__note-icon{
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
  animation: mailboxShake 1.8s ease-in-out .4s infinite;
}
.contact__note--overload strong{ color: var(--ink); }
.contact__note--overload a{ color: var(--accent); font-weight: 700; border-bottom: 1px solid var(--accent-line); }
.contact__note--overload a:hover{ border-color: var(--accent); }
@keyframes noteIn{ to{ opacity: 1; transform: translateY(0); } }
@keyframes mailboxShake{
  0%, 100%{ transform: rotate(0deg); }
  10%{ transform: rotate(-8deg); }
  20%{ transform: rotate(7deg); }
  30%{ transform: rotate(-5deg); }
  40%{ transform: rotate(3deg); }
  50%{ transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce){
  .contact__note--overload, .contact__note--overload .contact__note-icon{ animation: none; opacity: 1; transform: none; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer{ border-top: 1px solid var(--border); padding: 30px 32px; background: var(--bg); }
.footer__inner{
  max-width: var(--max);
  margin: 0 auto;
  display:flex; justify-content:space-between; align-items:center; flex-wrap: wrap; gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
}
.footer__inner a:hover{ color: var(--accent); }
.footer__legal{ display:flex; gap: 18px; flex-wrap: wrap; }
.footer__legal a:hover{ color: var(--accent); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 720px){
  :root{ --nav-h: 62px; }
  .contact__panel{ grid-template-columns: 1fr; }
  .field-row{ flex-direction: column; }
  .story-chapter{ min-height: 92vh; padding-top: calc(var(--nav-h) + 14px); }
  .story-chapter__inner{ padding: 30px 26px; }
  .chapters-nav{ padding: 14px 20px; }
}

/* ==========================================================================
   WOW layer — custom cursor, kinetic text, floating stat badges,
   scroll progress bar, upgraded preloader exit.
   ========================================================================== */

/* Custom cursor ------------------------------------------------------ */
.cursor{
  position: fixed;
  top:0; left:0;
  z-index: 400;
  pointer-events: none;
  will-change: transform;
  opacity: 0;
  transition: opacity .3s ease;
}
.cursor.is-active{ opacity: 1; }
.cursor__dot{
  position:absolute;
  top:-3px; left:-3px;
  width:6px; height:6px;
  border-radius:50%;
  background: var(--accent);
  transition: transform .15s ease;
}
.cursor__ring{
  position:absolute;
  top:-18px; left:-18px;
  width:36px; height:36px;
  border-radius:50%;
  border: 1px solid var(--border-strong);
  transition: transform .35s cubic-bezier(.16,1,.3,1), border-color .35s ease, background .35s ease;
}
.cursor.is-hover .cursor__ring{
  transform: scale(1.7);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cursor.is-hover .cursor__dot{ transform: scale(0); }
body.has-custom-cursor, body.has-custom-cursor a, body.has-custom-cursor button{ cursor: none; }

/* Scroll progress bar -------------------------------------------------- */
.progress-bar{
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 401;
  transition: width .1s linear;
}

/* Kinetic hero title --------------------------------------------------- */
.story-chapter__inner--hero{ position: relative; }
.hero-actions{
  display:flex; flex-direction: column; align-items:center; gap: 34px;
}
.story-title{
  overflow: visible;
}
.kinetic-word{
  display: inline-block;
  opacity: 0;
  filter: blur(10px);
  transform: translateY(28px) scale(0.94);
  animation: kineticIn .9s cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: calc(var(--d) * 0.055s + 0.15s);
}
.kinetic-word--accent{ color: var(--accent); }
.kinetic-in{
  opacity: 0;
  transform: translateY(16px);
  animation: kineticInSimple .9s cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: calc(var(--d) * 0.055s + 0.15s);
}
@keyframes kineticIn{
  to{ opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
}
@keyframes kineticInSimple{
  to{ opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce){
  .kinetic-word, .kinetic-in{ animation: none; opacity: 1; filter:none; transform:none; }
}

/* Floating stat badges -------------------------------------------------- */
.hero-badge{
  position: absolute;
  z-index: 4;
  display:flex; align-items:center; gap: 10px;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: 0 20px 40px -24px rgba(23,20,15,0.25);
  opacity: 0;
  transform: translateY(18px) scale(.92);
  animation: badgeIn .8s cubic-bezier(.16,1,.3,1) forwards;
  will-change: transform;
}
.hero-badge--a{ top: 22%; left: 6%; animation-delay: 1.9s; }
.hero-badge--b{ bottom: 20%; left: 9%; animation-delay: 2.15s; }
.hero-badge--c{ top: 26%; right: 7%; animation-delay: 2.05s; flex-direction: column; align-items: flex-start; gap: 2px; }
@keyframes badgeIn{ to{ opacity: 1; transform: translateY(0) scale(1); } }

.hero-badge__num{ font-size: 22px; font-weight: 800; color: var(--ink); line-height:1; }
.hero-badge__plus{ font-size: 15px; font-weight: 700; color: var(--accent); }
.hero-badge__rating{ font-size: 18px; font-weight: 800; color: var(--ink); }
.hero-badge__label{
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-muted);
  font-weight: 500;
}

@media (max-width: 980px){
  .hero-badge{ display: none; }
}
@media (prefers-reduced-motion: reduce){
  .hero-badge{ animation: none; opacity: 1; transform: none; }
}

/* Upgraded preloader exit ------------------------------------------------ */
.preloader{
  transition: opacity .6s cubic-bezier(.7,0,.84,0), visibility .6s ease, transform .6s cubic-bezier(.7,0,.84,0);
}
.preloader.is-hidden{
  opacity: 0;
  transform: scale(1.06);
}
.preloader__mark{
  transition: transform .4s cubic-bezier(.34,1.56,.64,1);
}
.preloader.is-hidden .preloader__mark{ transform: scale(0.85); }
