/* =========================================================
   narzedziageodezyjne.pl — arkusz stylów
   ========================================================= */

:root {
  --ink: #1f2b2d;
  --ink-soft: #4a5759;
  --muted: #6f7b7c;
  --paper: #f7f5f0;
  --card: #ffffff;
  --line: #dcd8ce;
  --line-strong: #c4bfb2;
  --accent: #d9541e;
  --accent-dark: #b8441a;
  --accent-soft: #fbe9e1;
  --green: #2f6b4f;
  --green-soft: #e4efe8;
  --warn: #8a5a00;
  --warn-soft: #fdf2d8;
  --error: #a3271b;
  --error-soft: #fbe4e1;

  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;

  --radius: 6px;
  --container: 1120px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

img, svg { max-width: 100%; }

a { color: var(--accent-dark); text-underline-offset: 2px; }
a:hover { color: var(--ink); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); margin-top: 1.8em; }
h3 { font-size: 1.15rem; margin-top: 1.5em; }
p { margin: 0 0 1em; }

code, .mono { font-family: var(--mono); font-size: .92em; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus { left: 10px; top: 10px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

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

.site-header {
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 3px solid var(--accent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
  white-space: nowrap;
}
.logo:hover { color: #fff; }
.logo-mark { width: 30px; height: 30px; color: #fff; flex-shrink: 0; }
.logo-text strong { font-weight: 700; color: #f2a07c; }

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 2px;
}

.nav-list a {
  display: block;
  color: #e4e8e6;
  text-decoration: none;
  padding: 8px 11px;
  border-radius: var(--radius);
  font-size: .95rem;
}
.nav-list a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-list a[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  background: none;
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: var(--radius);
  padding: 8px 12px;
  font: inherit;
  font-size: .95rem;
  cursor: pointer;
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  position: relative;
  transition: transform .2s, background .2s;
}
.nav-toggle-bar::before,
.nav-toggle-bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1020px) {
  .nav-toggle { display: inline-flex; }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ink);
    border-bottom: 3px solid var(--accent);
    display: none;
  }
  .main-nav.is-open { display: block; }

  .nav-list {
    flex-direction: column;
    padding: 8px 20px 16px;
  }
  .nav-list a { padding: 12px 10px; font-size: 1rem; border-bottom: 1px solid rgba(255,255,255,.07); border-radius: 0; }
}

/* ---------- Breadcrumbs / intro ---------- */

.breadcrumbs {
  font-size: .88rem;
  color: var(--muted);
  padding: 16px 0 0;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs span[aria-hidden] { margin: 0 4px; }

.page-intro { padding: 18px 0 8px; max-width: 780px; }
.page-intro .lead { font-size: 1.15rem; color: var(--ink-soft); }

/* ---------- Home ---------- */

.hero {
  padding: 46px 0 34px;
  border-bottom: 1px solid var(--line);
  /* delikatna siatka kilometrowa */
  background:
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(31,43,45,.05) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(31,43,45,.05) 39px 40px),
    var(--paper);
}
.hero h1 { max-width: 760px; }
.hero .lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 680px; }

.hero-facts {
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  color: var(--ink-soft);
  font-size: .95rem;
}
.hero-facts li::before { content: "▲"; color: var(--accent); font-size: .7em; margin-right: 8px; vertical-align: 2px; }

.tool-grid {
  list-style: none;
  padding: 0;
  margin: 26px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.tool-grid-small { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.tool-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.tool-card a:hover { border-color: var(--line-strong); border-left-color: var(--ink); transform: translateY(-2px); }
.tool-card-title { font-weight: 700; font-size: 1.1rem; margin-bottom: 6px; }
.tool-card-lead { color: var(--ink-soft); font-size: .95rem; }
.tool-card-more { margin-top: auto; padding-top: 12px; color: var(--accent-dark); font-weight: 600; font-size: .92rem; }

/* ---------- Tool panel ---------- */

.tool-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin: 18px 0 30px;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

@media (max-width: 600px) {
  .tool-panel { padding: 16px; margin-left: -8px; margin-right: -8px; }
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: -4px 0 20px;
  overflow-x: auto;
}
.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 14px;
  font: inherit;
  font-size: .97rem;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.tab-panel[hidden] { display: none; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px 18px;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }

label, .label { font-weight: 600; font-size: .92rem; }
.hint { font-size: .85rem; color: var(--muted); font-weight: 400; }

input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 11px;
  min-height: 44px;
}
input.mono, textarea.mono { font-family: var(--mono); font-size: .95rem; }
textarea { min-height: 170px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: 2px solid rgba(217,84,30,.25); outline-offset: 0; }

.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: .98rem;
  font-weight: 600;
  padding: 10px 18px;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn-link { background: none; border: none; color: var(--accent-dark); padding: 10px 6px; text-decoration: underline; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.swap-btn { align-self: end; }

/* ---------- Results ---------- */

.result {
  margin-top: 22px;
  border-top: 1px dashed var(--line-strong);
  padding-top: 18px;
}
.result[hidden] { display: none; }
.result-title { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.result-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  position: relative;
}
.result-label { display: block; font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.result-value { display: block; font-family: var(--mono); font-size: 1.22rem; font-weight: 600; word-break: break-all; }
.result-sub { display: block; font-size: .85rem; color: var(--ink-soft); font-family: var(--mono); }
.result-main .result-value { font-size: 1.6rem; color: var(--accent-dark); }

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: .75rem;
  padding: 3px 7px;
  cursor: pointer;
  color: var(--ink-soft);
}
.copy-btn:hover { border-color: var(--ink); color: var(--ink); }
.copy-btn.is-done { background: var(--green-soft); border-color: var(--green); color: var(--green); }

.table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; background: #fff; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--paper); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
td.num { font-family: var(--mono); text-align: right; }
tr:last-child td { border-bottom: none; }
tr.row-error td { background: var(--error-soft); }

.notice {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 14px 0;
  font-size: .95rem;
  border: 1px solid;
}
.notice[hidden] { display: none; }
.notice p:last-child { margin: 0; }
.notice-info { background: var(--green-soft); border-color: #b9d4c3; }
.notice-warn { background: var(--warn-soft); border-color: #ecd193; color: #5c3d00; }
.notice-error { background: var(--error-soft); border-color: #ecb8b1; color: var(--error); }

.preview-svg {
  width: 100%;
  height: 300px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: block;
  margin-top: 12px;
}

.map {
  height: 480px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 16px;
  z-index: 1;
}
@media (max-width: 600px) { .map { height: 360px; } }

/* ---------- Content (opis pod narzędziem) ---------- */

.layout-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 40px;
  align-items: start;
  padding-bottom: 30px;
}
@media (max-width: 900px) { .layout-content { grid-template-columns: 1fr; gap: 10px; } }

.content { max-width: 760px; }
.content ul, .content ol { padding-left: 1.3em; margin: 0 0 1em; }
.content li { margin-bottom: .35em; }
.content table { margin: 0; }

.example-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 16px 0;
}
.example-box p:last-child { margin: 0; }

.formula {
  font-family: var(--mono);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  overflow-x: auto;
  margin: 12px 0 16px;
  white-space: pre;
  font-size: .95rem;
}

.sidebar { position: sticky; top: 90px; }
@media (max-width: 900px) { .sidebar { position: static; } }

.side-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  font-size: .95rem;
}
.side-box h2 { font-size: 1rem; margin: 0 0 10px; }
.side-box ul { list-style: none; padding: 0; margin: 0; }
.side-box li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.side-box li:last-child { border-bottom: none; }

/* ---------- FAQ ---------- */

.faq { margin-top: 10px; }
.faq-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.faq-item summary {
  cursor: pointer;
  padding: 13px 44px 13px 16px;
  font-weight: 600;
  list-style: none;
  position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--accent);
}
.faq-item[open] summary::after { content: "−"; }
.faq-answer { padding: 0 16px 6px; color: var(--ink-soft); }

/* ---------- Related ---------- */

.related { border-top: 1px solid var(--line); padding: 10px 0 46px; background: #f1eee7; }

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

.site-footer { background: var(--ink); color: #c9d0ce; font-size: .93rem; padding-top: 40px; }
.site-footer a { color: #e4e8e6; text-decoration: none; }
.site-footer a:hover { color: #f2a07c; text-decoration: underline; }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1.4fr 1fr;
  gap: 30px;
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

.footer-logo { color: #fff; font-size: 1.1rem; }
.footer-logo strong { color: #f2a07c; }
.footer-heading { color: #fff; font-weight: 600; margin-bottom: 8px; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 6px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 26px; padding: 16px 20px 24px; font-size: .85rem; color: #98a3a1; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer-bottom p { margin: 0; }
.footer-credit a { color: #f2a07c; }

/* ---------- Miejsce na reklamę (włącz, gdy będzie AdSense) ---------- */

.ad-slot { display: none; margin: 24px 0; min-height: 100px; }
.ad-slot.is-active { display: block; }

/* ---------- Utility ---------- */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media print {
  .site-header, .site-footer, .related, .actions, .tabs, .copy-btn, .sidebar { display: none !important; }
  body { background: #fff; }
  .tool-panel { border: none; padding: 0; }
}
