/* Calculator, contact and blog-index pages (site/pages/calculator.mjs, contact.mjs, blog.mjs).
   Loaded only on those pages via page.styles. Uses the tokens from /styles.css. */

/* ============ Installment calculator ============ */
.calc { display: grid; gap: 24px; }
.calc__grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 24px; align-items: start; }
.calc__inputs {
  display: grid; gap: 22px; min-width: 0; margin: 0; padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--card-line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--card-shadow);
}
.calc__field { display: grid; gap: 8px; min-width: 0; align-content: start; }
.calc__field > label { font-size: .95rem; font-weight: 600; color: var(--ink); }
.calc__field .field-error { min-height: 0; padding-top: 0; }
.calc__field .field-error:empty { display: none; }
.calc__input {
  display: flex; align-items: center; min-width: 0; border: 1.5px solid #d3dfe6; border-radius: 14px; background: #f9fbfc;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.calc__input:focus-within { border-color: var(--teal-600); background: #fff; box-shadow: 0 0 0 4px rgba(31, 184, 188, .18); }
.calc__input:has(input[aria-invalid="true"]) { border-color: #d64545; box-shadow: 0 0 0 4px rgba(214, 69, 69, .12); }
.calc__input input {
  flex: 1; width: 100%; min-width: 0; min-height: 52px; padding: 0 14px; border: 0; background: transparent;
  font-size: 1.06rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink);
}
.calc__input input:focus, .calc__input input:focus-visible { outline: none; }
.calc__input input::placeholder { color: #9aabb8; font-weight: 500; }
.calc__input input[type="date"] { font-size: 1rem; }
.calc__input > span { flex: none; padding-right: 14px; font-size: .9rem; font-weight: 600; color: var(--fg-muted); }
.calc__input--short { width: 150px; }
.calc__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.calc__inline { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--teal-700); }
.calc__presets { margin-top: 2px; }
.calc__presets .seg { min-width: 52px; justify-content: center; }
.calc__hint { font-size: .85rem; line-height: 1.5; color: var(--fg-muted); }
.calc__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.calc__helper { padding: 14px 16px; border: 1px dashed #c4d5df; border-radius: 14px; background: #fbfdfe; }
.calc__helper summary { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; color: var(--teal-700); list-style: none; border-radius: 6px; }
.calc__helper summary::-webkit-details-marker { display: none; }
.calc__helper summary::after { content: '+'; margin-left: auto; font-size: 1.25rem; line-height: 1; transition: transform .2s var(--ease); }
.calc__helper[open] summary::after { transform: rotate(45deg); }
.calc__helper .calc__pair { margin-top: 14px; }
.calc__helper .calc__hint { margin-top: 10px; }

.calc__results {
  position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 18px; min-width: 0;
  padding: clamp(22px, 3vw, 32px); border-radius: var(--radius-lg); overflow: hidden;
  background: radial-gradient(90% 120% at 100% 0%, #1b5a73 0%, rgba(27, 90, 115, 0) 55%), linear-gradient(135deg, #0e2f46 0%, #061c2b 100%);
  box-shadow: 0 40px 80px -40px rgba(6, 28, 43, .7);
}
.calc__results:focus { outline: none; }
.calc__results:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.calc__results h3 { font-size: 1.15rem; font-weight: 700; }
.calc__stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.calc__stat { display: grid; gap: 6px; align-content: start; min-width: 0; padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(159, 182, 195, .16); }
.calc__stat dt { font-size: .8rem; color: var(--fg-muted); }
.calc__stat dd { margin: 0; font-family: var(--font-head); font-size: 1.08rem; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.calc__stat--main { grid-column: 1 / -1; padding: 20px; background: linear-gradient(135deg, rgba(45, 212, 216, .2), rgba(45, 212, 216, .06)); border-color: rgba(45, 212, 216, .35); }
.calc__stat--main dt { color: #bfeff0; font-weight: 600; }
.calc__stat--main dd { display: grid; gap: 4px; }
.calc__stat--main output { font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.35rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.calc__stat--main small { font-family: var(--font-body); font-size: .88rem; font-weight: 500; color: #bfeff0; }
.calc__last { font-size: .86rem; line-height: 1.5; color: var(--fg-muted); }
.calc__jump { font-size: .95rem; }

.calc__schedule { min-width: 0; padding: clamp(18px, 3vw, 28px); border: 1px solid var(--card-line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--card-shadow); }
.calc__schedule:focus { outline: none; }
.calc__schedule-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.calc__schedule-head h3 { font-size: 1.25rem; font-weight: 700; }
.calc__table-wrap { max-height: 600px; overflow: auto; }
.calc__table { font-variant-numeric: tabular-nums; }
.calc__table thead th { position: sticky; top: 0; z-index: 1; }
.calc__table td:nth-child(n+3), .calc__table thead th:nth-child(n+3) { text-align: right; }
.calc__table tbody tr:nth-child(even) > * { background: #fafcfd; }
.calc__table tbody tr:first-child th { color: var(--teal-700); }
.calc__table tfoot > * > * { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 700; background: #f7fafb; }
.calc .callout { margin: 0; }
.calc__results, .calc__schedule { transition: opacity .2s; }
.calc.is-stale .calc__results, .calc.is-stale .calc__schedule { opacity: .5; }
.calc__print { display: none; }

/* How it works, formula, comparison, developer block */
.calc-ask { margin-top: clamp(36px, 5vw, 56px); padding: clamp(22px, 3vw, 32px); border-radius: var(--radius-lg); background: var(--bg); border: 1px solid var(--line-soft); }
.calc-ask__title { font-size: 1.25rem; font-weight: 700; }
.calc-ask .checklist { margin-top: 20px; }
.calc-explain { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(28px, 5vw, 64px); align-items: center; }
.calc-explain__head { margin-bottom: 28px; }
.calc-formula { display: grid; gap: 12px; list-style: none; counter-reset: f; }
.calc-formula li {
  position: relative; padding: 16px 18px 16px 60px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--card-line);
  color: var(--fg-muted); line-height: 1.6; counter-increment: f;
}
.calc-formula li::before {
  content: counter(f); position: absolute; left: 16px; top: 15px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px;
  font-family: var(--font-head); font-weight: 800; font-size: .9rem; color: #fff; background: linear-gradient(135deg, var(--teal), var(--teal-700));
}
.calc-formula strong { color: var(--ink); }
.calc-explain .callout { margin: 0; padding: 24px; font-size: 1.02rem; line-height: 1.7; }
.calc-compare th, .calc-compare td { white-space: normal; min-width: 180px; vertical-align: top; line-height: 1.5; }
.calc-compare tbody th { min-width: 150px; }
.calc-phone { display: grid; place-items: center; padding-block: 12px; }

/* ============ Contact page ============ */
.page-contact .page-hero .contact-cards { grid-template-columns: minmax(0, 1fr); max-width: 460px; margin-left: auto; }
.page-contact .page-hero .contact-card { min-height: 92px; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: #fff; }
.page-contact .page-hero .contact-card:hover { background: rgba(255, 255, 255, .1); }
.page-contact .page-hero .contact-card small { color: var(--fg-muted); }
.page-contact .page-hero .contact-card__icon { background: linear-gradient(135deg, #29617c, #1b455e); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.page-contact .page-hero .contact-card--demo .contact-card__icon { background: linear-gradient(135deg, #7ff0ef, #1fb8bc); }
.page-contact .page-hero .contact-card strong { white-space: nowrap; }
.reach { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; list-style: none; }
.reach-card { display: flex; flex-direction: column; height: 100%; padding: 24px; }
.reach-card .card__icon { width: 46px; height: 46px; }
.reach-card .card__title { font-size: 1.08rem; overflow-wrap: anywhere; }
.reach-card .card__title button { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; }
.reach-card .card__text { flex: 1; font-size: .95rem; }
.reach-card__tag { position: absolute; top: 24px; right: 24px; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; color: #0b6b40; background: #e1f6ec; }
.reach-card--fast { border-color: rgba(31, 184, 188, .45); box-shadow: 0 1px 2px rgba(11, 44, 66, .04), 0 22px 40px -24px rgba(16, 156, 164, .45); }
.contact-duo { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(24px, 4vw, 48px); align-items: start; }
.contact-duo .section-head { margin-bottom: 0; }
.contact-duo .checklist { margin-top: 24px; }
.contact-note { margin-top: 20px; color: var(--fg-muted); font-size: .95rem; }
.client-card { display: grid; gap: 14px; padding: clamp(24px, 3vw, 32px); }
.client-card h2 { font-size: 1.35rem; font-weight: 800; }
.client-card p { color: var(--fg-muted); line-height: 1.6; }
.client-card__links { display: grid; gap: 10px; margin-top: 4px; list-style: none; }
.nap { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.nap .section-head { margin-bottom: 0; }
.nap address { font-style: normal; }
.nap dl { display: grid; margin: 0; border: 1px solid var(--card-line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.nap dl > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.nap dl > div:last-child { border-bottom: 0; }
.nap dt { font-size: .9rem; color: var(--fg-muted); }
.nap dd { margin: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.nap dd a { color: var(--teal-700); text-underline-offset: 3px; }

/* ============ Blog index ============ */
.posts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; list-style: none; }
.post-card { display: flex; flex-direction: column; height: 100%; padding: 0; overflow: hidden; }
.post-card__visual {
  position: relative; display: grid; align-items: end; height: 196px; padding: 54px 26px 22px; overflow: hidden;
  background: radial-gradient(120% 120% at 100% 0%, rgba(31, 184, 188, .16), transparent 60%), linear-gradient(160deg, #f3f9fb, #e9f2f6);
  border-bottom: 1px solid var(--line-soft);
}
.post-card__visual .bv-mini-grid, .post-card__visual .mini-bars, .post-card__visual .mini-pay { width: 100%; }
.post-card__visual .bv-mini-grid { max-width: 236px; }
.post-card__visual .mini-bars { max-width: 280px; height: 110px; }
.post-card__visual .mini-pay { max-width: 300px; gap: 7px; }
.post-card__visual .mini-pay span { background: #fff; }
.post-card__tag { position: absolute; top: 14px; left: 16px; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; color: var(--teal-700); background: #fff; border: 1px solid #c3e9ea; }
.post-card__body { display: flex; flex: 1; flex-direction: column; padding: 24px 26px 26px; }
.post-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 12px; font-size: .85rem; color: var(--fg-muted); }
.post-card__meta span { display: inline-flex; align-items: center; gap: 6px; }
.post-card__meta .icon { color: var(--teal-700); }
.post-card .card__title { font-size: 1.2rem; line-height: 1.3; }
.post-card .card__text { flex: 1; }
.post-tool {
  position: relative; display: flex; align-items: center; gap: 24px; margin-top: 20px; padding: clamp(22px, 3vw, 32px);
  border-radius: var(--radius-lg); border: 1px solid #c3e9ea; background: linear-gradient(120deg, #e9f8f8 0%, #f6fbfc 60%, #fff 100%);
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.post-tool:hover { transform: translateY(-3px); border-color: rgba(31, 184, 188, .6); box-shadow: 0 22px 40px -24px rgba(11, 44, 66, .35); }
.post-tool .card__icon { flex: none; width: 64px; height: 64px; margin: 0; border-radius: 18px; }
.post-tool .card__icon .icon { width: 30px; height: 30px; }
.post-tool__copy { flex: 1; min-width: 0; }
.post-tool .card__title { font-size: 1.3rem; }
.post-tool__go { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #29617c, #173146); }
.topic-grid .card__text a { color: var(--teal-700); font-weight: 600; text-underline-offset: 3px; }

/* ============ Responsive ============ */
@media (max-width: 1079px) {
  .reach { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .calc__grid, .calc-explain, .contact-duo, .nap { grid-template-columns: minmax(0, 1fr); }
  .page-contact .page-hero .contact-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; margin-left: 0; }
  .calc__results { position: static; }
  .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .posts > li:first-child { grid-column: 1 / -1; }
  .posts > li:first-child .post-card { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  .posts > li:first-child .post-card__visual { border-bottom: 0; border-right: 1px solid var(--line-soft); }
}
@media (max-width: 767px) {
  .calc__pair, .calc__stats { grid-template-columns: minmax(0, 1fr); }
  .calc__stat--main { grid-column: auto; }
  .calc__stats { gap: 10px; }
  .calc__stat { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
  .calc__stat--main { display: grid; }
  .calc__input--short { width: 132px; }
  .calc__schedule { padding: 18px 0 10px; overflow: hidden; }
  .calc__schedule-head { padding-inline: 16px; }
  .calc__table-wrap { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
  .calc__table tbody tr:first-child th { white-space: normal; }
  .calc__table { font-size: .78rem; }
  .calc__table th, .calc__table td { padding: 8px 7px; }
  .calc__table thead th { font-size: .66rem; letter-spacing: .03em; }
  .calc__table-wrap { max-height: 520px; }
  .reach, .posts { grid-template-columns: minmax(0, 1fr); }
  .posts > li:first-child .post-card { display: flex; }
  .posts > li:first-child .post-card__visual { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .page-contact .page-hero .contact-cards { grid-template-columns: minmax(0, 1fr); }
  .nap dl > div { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 12px 16px; }
  .post-tool { flex-direction: column; align-items: flex-start; gap: 16px; }
  .post-tool .card__icon { width: 52px; height: 52px; border-radius: 16px; }
  .post-tool__go { display: none; }
  .calc-compare-wrap { overflow: visible; border: 0; border-radius: 0; background: none; }
  .calc-compare, .calc-compare caption, .calc-compare tbody, .calc-compare tr, .calc-compare th, .calc-compare td { display: block; }
  .calc-compare thead { display: none; }
  .calc-compare caption { padding: 0 0 12px; }
  .calc-compare tbody { display: grid; gap: 12px; }
  .calc-compare tr { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
  .calc-compare tbody th, .calc-compare tbody tr:last-child th { min-width: 0; padding: 12px 16px; background: #f7fafb; border-bottom: 1px solid #e8eef2; }
  .calc-compare td { min-width: 0; padding: 10px 16px; }
  .calc-compare td, .calc-compare tbody tr:last-child td { border-bottom: 1px solid #e8eef2; }
  .calc-compare td:last-child, .calc-compare tbody tr:last-child td:last-child { border-bottom: 0; }
  .calc-compare td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #6a7f90; }
}

/* ============ Print: only the calculation ============ */
@media print {
  body { background: #fff; }
  .page-calculator main > :not(#kalkulyator) { display: none !important; }
  .page-calculator #kalkulyator { padding: 0; background: #fff; border: 0; }
  .page-calculator #kalkulyator .section-head .lead,
  .calc__inputs, .calc__jump, [data-calc-print], .calc .field-error { display: none !important; }
  .calc__print { display: block; margin-bottom: 8px; }
  .calc__print-title { font-weight: 700; margin-bottom: 8px; }
  .calc__print dl { display: grid; grid-template-columns: repeat(3, auto); gap: 6px 24px; margin: 0; }
  .calc__print dt { font-size: .8rem; color: #52677a; }
  .calc__print dd { margin: 0; font-weight: 600; }
  .calc__grid { display: block; }
  .calc__results { position: static; color: #173146; background: #fff; box-shadow: none; border: 1px solid #d9e4ea; padding: 12px 16px; }
  .calc__results h3, .calc__stat dd, .calc__stat--main dt, .calc__stat--main small { color: #173146 !important; }
  .calc__stat dt { color: #52677a !important; }
  .calc__stat { background: #fff; border-color: #d9e4ea; padding: 8px 10px; }
  .calc__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .calc__stat--main output { font-size: 1.4rem; }
  .calc__schedule { box-shadow: none; border: 0; padding: 0; margin-top: 16px; }
  .calc__table-wrap { max-height: none; overflow: visible; border: 0; }
  .calc__table th, .calc__table td { padding: 3px 8px; }
  .calc__table thead th { position: static; }
  .section-head { margin-bottom: 12px; }
}
