/* ApiVista — strona jako papierowa karta pasieki (formularz KP-1).
   Papier na zielonej desce ulowej; Archivo (formularz) + Caveat (długopis)
   + Plex Mono (adnotacje); pieczątki: czerwień urzędowa. */

:root {
  --deska: #46523f;
  --papier: #f7f5ef;
  --tusz: #21201b;
  --tusz-slaby: #6d675a;
  --linia: #c9c2ae;
  --dlugopis: #274690;
  --pieczatka: #b5311e;
  --miod: #b77816;
  --op-bialy: #f2f0eb;
  --op-zolty: #eec01c;
  --op-czerwony: #d8442f;
  --op-zielony: #3e8f4a;
  --op-niebieski: #3a6fc4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--deska);
  background-image: repeating-linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.06) 0 2px,
    transparent 2px 140px
  );
  color: var(--tusz);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  padding: clamp(12px, 4vw, 56px) 12px;
}

.mono { font-family: 'IBM Plex Mono', monospace; }

a { color: var(--miod); }
:focus-visible { outline: 3px solid var(--dlugopis); outline-offset: 2px; }

::selection { background: rgba(39, 70, 144, 0.18); }

/* ---------- stos kartek ---------- */

.stos {
  max-width: 880px;
  margin: 0 auto;
}

.kartka {
  position: relative;
  margin-bottom: clamp(30px, 5vw, 56px);
  /* cień liczony z sylwetki (podąża za poszarpanym clip-path papieru) */
  filter:
    drop-shadow(0 2px 2px rgba(0, 0, 0, 0.28))
    drop-shadow(0 16px 24px rgba(0, 0, 0, 0.3));
  scroll-margin-top: 24px;
}
.kartka:nth-child(odd) { transform: rotate(0.45deg); }
.kartka:nth-child(even) { transform: rotate(-0.4deg); }

/* papier właściwy — poszarpane brzegi */
.papier {
  background-color: var(--papier);
  /* ziarno papieru */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 90px rgba(122, 101, 62, 0.1);
  padding: clamp(26px, 4.5vw, 54px) clamp(20px, 5vw, 64px) clamp(30px, 4.5vw, 58px);
  clip-path: polygon(
    0.5% 0.4%, 6% 1%, 13% 0.2%, 21% 1.2%, 29% 0.4%, 37% 1.3%, 46% 0.3%,
    54% 1.1%, 62% 0.4%, 70% 1.3%, 78% 0.3%, 86% 1%, 93% 0.3%, 99.5% 0.9%,
    99.7% 7%, 99.2% 15%, 99.8% 24%, 99.3% 33%, 99.8% 43%, 99.2% 52%,
    99.9% 61%, 99.3% 70%, 99.8% 79%, 99.2% 88%, 99.7% 95%,
    99.3% 99.5%, 93% 99%, 85% 99.8%, 77% 99.1%, 68% 99.8%, 60% 99.2%,
    52% 99.9%, 43% 99.2%, 35% 99.8%, 27% 99.1%, 19% 99.8%, 11% 99.2%, 4% 99.7%, 0.4% 99.3%,
    0.2% 93%, 0.8% 85%, 0.1% 76%, 0.7% 67%, 0.2% 58%, 0.8% 49%,
    0.1% 40%, 0.7% 31%, 0.2% 22%, 0.8% 13%, 0.3% 6%
  );
}
/* drugi wzór rozdarcia, żeby kartki się nie powtarzały */
.kartka:nth-child(even) .papier {
  clip-path: polygon(
    0.3% 0.9%, 7% 0.2%, 15% 1.2%, 23% 0.3%, 31% 1.1%, 40% 0.3%, 48% 1.3%,
    56% 0.2%, 65% 1.1%, 73% 0.3%, 81% 1.2%, 89% 0.4%, 96% 1%, 99.6% 0.4%,
    99.2% 6%, 99.8% 14%, 99.3% 23%, 99.9% 32%, 99.3% 42%, 99.8% 51%,
    99.2% 60%, 99.8% 69%, 99.3% 78%, 99.9% 87%, 99.3% 94%,
    99.7% 99.2%, 92% 99.8%, 84% 99.1%, 76% 99.9%, 67% 99.2%, 59% 99.8%,
    51% 99.1%, 42% 99.9%, 34% 99.2%, 26% 99.8%, 18% 99.1%, 10% 99.9%, 3% 99.3%, 0.5% 99.8%,
    0.7% 92%, 0.1% 84%, 0.8% 75%, 0.2% 66%, 0.7% 57%, 0.1% 48%,
    0.8% 39%, 0.2% 30%, 0.8% 21%, 0.1% 12%, 0.7% 5%
  );
}

/* taśma klejąca u góry kartki (nad papierem, poza obcięciem) */
.kartka::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: -13px;
  left: 50%;
  width: 132px;
  height: 30px;
  background: rgba(226, 207, 158, 0.75);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 0 6px rgba(255, 255, 255, 0.35);
  transform: translateX(-50%) rotate(-2deg);
}
.kartka:nth-child(even)::before { transform: translateX(-50%) rotate(1.6deg); }

/* pierwsza kartka: dwie taśmy w narożnikach */
.kartka-head::before {
  left: 30px;
  width: 110px;
  transform: rotate(-38deg);
}
.kartka-head::after {
  content: '';
  position: absolute;
  z-index: 1;
  top: -8px;
  right: -22px;
  width: 110px;
  height: 30px;
  background: rgba(226, 207, 158, 0.75);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 0 6px rgba(255, 255, 255, 0.35);
  transform: rotate(37deg);
}

/* pismo odręczne (długopis) */
.hand {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.45em;
  line-height: 1.1;
  color: var(--dlugopis);
  white-space: nowrap;
}

/* etykiety formularza */
.flabel {
  font-stretch: 62%;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tusz-slaby);
}

/* wiersz z kropkowaną linią do wypełnienia */
.frow {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0 3px;
}
.frow .dots {
  flex: 1;
  min-width: 24px;
  border-bottom: 2px dotted var(--linia);
  transform: translateY(-4px);
}
.frow-lg { padding: 12px 0 4px; }
.frow-lg .flabel { font-size: 15px; }

.frow-pair { display: flex; gap: 28px; }
.frow-pair .frow { flex: 1; }

/* pieczątka */
.stamp {
  display: inline-block;
  font-stretch: 62%;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pieczatka);
  border: 3px double var(--pieczatka);
  border-radius: 3px;
  padding: 5px 14px 4px;
  transform: rotate(-3.5deg);
  opacity: 0.88;
  mix-blend-mode: multiply;
}
.stamp-big { font-size: 18px; padding: 8px 18px 7px; }

/* ---------- nagłówek formularza ---------- */

.form-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--tusz-slaby);
  border-bottom: 2px solid var(--tusz);
  padding-bottom: 10px;
}
.form-meta s { text-decoration-color: var(--pieczatka); text-decoration-thickness: 2px; }

.form-title {
  font-weight: 900;
  font-stretch: 100%;
  font-size: clamp(44px, 9vw, 84px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 26px 0 0;
}

.hand-note {
  font-size: 26px;
  margin: 4px 0 18px;
  transform: rotate(-2deg);
  transform-origin: left;
}

.form-head .lead {
  margin: 30px 0 26px;
  font-size: 18.5px;
  max-width: 38em;
}

.head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 26px;
  margin-bottom: 8px;
}
.cta-soon {
  font-size: 13px;
  color: var(--tusz);
  border-bottom: 2px solid var(--tusz);
  padding-bottom: 2px;
}
.cta-demo {
  font-weight: 600;
  color: var(--dlugopis);
  text-decoration-style: wavy;
  text-decoration-color: rgba(39, 70, 144, 0.5);
}

/* ---------- rubryki ---------- */

.rubryka .rub-head { margin-top: 4px; }

.rub-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-weight: 900;
  font-size: clamp(21px, 3vw, 27px);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  border-top: 3px solid var(--tusz);
  padding-top: 12px;
  margin-bottom: 18px;
}
.rub-no {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--papier);
  background: var(--tusz);
  padding: 3px 8px;
  white-space: nowrap;
  transform: translateY(-3px);
}

.rub-lead { max-width: 40em; margin-bottom: 22px; }
.rub-note { font-size: 14px; color: var(--tusz-slaby); margin-top: 14px; }

.rub-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}
.rub-copy p + p { margin-top: 14px; }

.rub-form-stamp { text-align: right; margin-top: 18px; }

/* ---------- demo ---------- */

.demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.demo-chips { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 20px; }

.chip {
  font-family: 'Archivo', sans-serif;
  font-stretch: 62%;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tusz);
  background: none;
  border: 2px solid var(--tusz);
  padding: 7px 13px 6px;
  cursor: pointer;
}
.chip:hover { background: var(--tusz); color: var(--papier); }
.chip.active { background: var(--tusz); color: var(--papier); }

.demo-label { display: block; margin-bottom: 8px; }

.demo-input {
  width: 100%;
  font-family: 'Caveat', cursive;
  font-weight: 500;
  font-size: 24px;
  line-height: 36px;
  color: var(--dlugopis);
  background: transparent;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 34px,
    var(--linia) 34px 36px
  );
  border: none;
  border-bottom: 2px solid var(--linia);
  padding: 0 2px;
  resize: vertical;
}
.demo-input::placeholder { color: #9d97a8; }
.demo-input:focus { outline: none; border-bottom-color: var(--dlugopis); }

.demo-fields { list-style: none; }
.demo-fields li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0 3px;
  animation: wpis 0.3s ease both;
}
.demo-fields li .dots {
  flex: 1;
  min-width: 24px;
  border-bottom: 2px dotted var(--linia);
  transform: translateY(-4px);
}
.demo-fields li .flabel { text-transform: uppercase; }
.demo-fields li.field-task .hand { color: var(--pieczatka); }

@keyframes wpis {
  from { opacity: 0; transform: translateY(5px) rotate(-0.5deg); }
  to { opacity: 1; transform: none; }
}

.demo-empty { color: #9d97a8; font-weight: 500; }
.demo-footnote { font-size: 12px; color: var(--tusz-slaby); margin-top: 14px; }

/* ---------- checklisty i etykieta QR ---------- */

.checklist { list-style: none; }
.checklist li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px 0;
}
.checklist li + li { border-top: 1px dotted var(--linia); }

.checkbox {
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--tusz);
  position: relative;
  top: 3px;
}
.checkbox.checked::after {
  content: '✓';
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 26px;
  color: var(--dlugopis);
  position: absolute;
  left: 1px;
  top: -12px;
}

.task-done { text-decoration: line-through; text-decoration-color: var(--dlugopis); }

.rub-label-demo { justify-self: center; text-align: center; }

.qr-label {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 2px solid var(--tusz);
  padding: 16px 20px;
  box-shadow: 4px 4px 0 rgba(33, 32, 27, 0.2);
  transform: rotate(1.5deg);
}
.qr { width: 92px; height: 92px; color: var(--tusz); }
.qr-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.qr-num {
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 0.02em;
}
.qr-meta .mono { font-size: 11px; color: var(--tusz-slaby); }
.rub-label-demo .hand-note { margin-top: 14px; font-size: 22px; transform: rotate(-1.5deg); }

/* ---------- opalitki ---------- */

.opal {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 1.5px solid rgba(33, 32, 27, 0.4);
  vertical-align: baseline;
}

.opal-bialy { background: var(--op-bialy); }
.opal-zolty { background: var(--op-zolty); }
.opal-czerwony { background: var(--op-czerwony); }
.opal-zielony { background: var(--op-zielony); }
.opal-niebieski { background: var(--op-niebieski); }

.opal-legend {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border: 2px solid var(--tusz);
}
.opal-item {
  text-align: center;
  padding: 18px 10px 14px;
}
.opal-item + .opal-item { border-left: 2px solid var(--tusz); }
.opal-item .opal { width: 30px; height: 30px; }
.opal-item .opal-name {
  display: block;
  font-stretch: 62%;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 10px;
}
.opal-item .opal-years {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--tusz-slaby);
  margin-top: 2px;
}
.opal-item.current { background: rgba(183, 120, 22, 0.12); }
.opal-item .opal-now {
  display: block;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 19px;
  color: var(--pieczatka);
  margin-top: 4px;
  transform: rotate(-2deg);
}

/* ---------- ewidencja ---------- */

.ledger-title {
  border-bottom: 2px solid var(--tusz);
  padding-bottom: 6px;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--tusz);
}
.ledger-in { color: var(--op-zielony); }
.ledger-out { color: var(--pieczatka); }
.ledger-sum { border-top: 2px solid var(--tusz); margin-top: 8px; padding-top: 10px; }

/* ---------- rubryka 6 / stopka ---------- */

.privacy-stamp {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}
.privacy-stamp .stamp { transform: rotate(-6deg); }

.kartka-foot {
  font-size: 12px;
  color: var(--tusz-slaby);
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}
.kartka-foot .papier {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 20px 30px;
}
/* skrawek jest niski — rozdarcie musi być grubsze w pionie */
.kartka-foot .papier,
.kartka:nth-child(even).kartka-foot .papier {
  clip-path: polygon(
    0.6% 6%, 9% 13%, 18% 3%, 28% 14%, 38% 4%, 49% 15%, 59% 3%,
    69% 13%, 79% 4%, 89% 14%, 96% 5%, 99.5% 10%,
    99.2% 90%, 91% 96%, 81% 86%, 71% 97%, 61% 87%, 51% 96%,
    41% 85%, 31% 96%, 21% 86%, 11% 97%, 4% 88%, 0.4% 94%
  );
}
.kartka-foot.kartka:nth-child(odd),
.kartka-foot.kartka:nth-child(even) { transform: rotate(-1.1deg); }

/* ---------- responsywność ---------- */

@media (max-width: 760px) {
  body { padding: 20px 8px; }
  .kartka:nth-child(odd) { transform: rotate(0.25deg); }
  .kartka:nth-child(even) { transform: rotate(-0.25deg); }
  .kartka-head::after { right: -14px; }
  .frow-pair { flex-direction: column; gap: 0; }
  .rub-cols, .demo { grid-template-columns: 1fr; gap: 24px; }
  .opal-legend { grid-template-columns: 1fr; border-width: 2px; }
  .opal-item + .opal-item { border-left: none; border-top: 2px solid var(--tusz); }
  .opal-item {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    text-align: left;
    gap: 2px 12px;
    padding: 12px 14px;
  }
  .opal-item .opal { grid-row: 1 / 3; }
  .opal-item .opal-name { margin-top: 0; }
  .opal-item .opal-years { grid-column: 2; }
  .opal-item .opal-now { grid-column: 3; grid-row: 1 / 3; }
  .rub-label-demo { justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .demo-fields li { animation: none; }
}
