/* ============================================================
   Kalkulator O-ringów — system stylów
   Jasny = kalka techniczna (papier, tusz grafitowy)
   Ciemny = światłodruk / cyanotype (białe linie na pruskim błękicie)
   ============================================================ */

:root {
  /* domyślnie jasny — bezpieczny fallback dla no-JS/print */
  --bg: #E9E6DB;
  --panel: #F3F1E8;
  --panel-border: #CFC8B0;
  --line: #46403A;
  --pen: #2E5C74;
  --pen-accent: #B5622A;
  --centerline: #8C8570;
  --accent2: #B8791E;
  --danger: #B23B30;
  --ok: #3F7D52;
  --dim: #746C5C;
  --text: #211E18;
  --text-dim: #5B5548;
  --frame: #9C927A;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0F3057;
  --panel: #16406F;
  --panel-border: #2C5A87;
  --line: #DCE8EF;
  --pen: #7EC8E3;
  --pen-accent: #E8935A;
  --centerline: #7C9BB5;
  --accent2: #E0A94A;
  --danger: #E8786C;
  --ok: #7FCB93;
  --dim: #8CA9C0;
  --text: #EEF3F5;
  --text-dim: #A9C0D2;
  --frame: #4573A0;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  transition: background 0.15s ease, color 0.15s ease;
}

/* ---- Ramka arkusza rysunkowego (format ISO 5457, uproszczony) ---- */
.sheet-frame {
  position: fixed;
  inset: 10px;
  border: 1px solid var(--frame);
  pointer-events: none;
  z-index: 2;
}
.sheet-frame::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--frame);
  opacity: 0.5;
}
.zone-marks-x, .zone-marks-y {
  position: fixed;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--frame);
  pointer-events: none;
  z-index: 2;
}
.zone-marks-x { top: 13px; left: 24px; right: 24px; display: flex; justify-content: space-between; }
.zone-marks-y { top: 30px; bottom: 24px; left: 13px; display: flex; flex-direction: column; justify-content: space-between; }

@media (max-width: 760px) {
  .sheet-frame, .zone-marks-x, .zone-marks-y { display: none; }
}

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, currentColor 1px, transparent 1px),
    linear-gradient(to bottom, currentColor 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--panel-border);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.site-header { position: relative; z-index: 1; border-bottom: 1px solid var(--panel-border); }
.site-header-inner {
  max-width: 900px; margin: 0 auto; padding: 22px 32px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { font-size: 22px; color: var(--pen-accent); }
.brand-name { font-family: var(--mono); font-weight: 600; font-size: 15px; letter-spacing: 0.01em; }
.site-nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.site-nav a { color: var(--text-dim); text-decoration: none; }
.site-nav a:hover, .site-nav a.active { color: var(--pen); }

.theme-toggle-btn {
  font-family: var(--mono); font-size: 12px; background: transparent;
  color: var(--text-dim); border: 1px solid var(--panel-border); border-radius: 3px;
  padding: 6px 12px; cursor: pointer; letter-spacing: 0.02em;
}
.theme-toggle-btn:hover { border-color: var(--pen); color: var(--pen); }
.theme-toggle-btn:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }

.site-main { position: relative; z-index: 1; max-width: 900px; margin: 0 auto; padding: 44px 32px 70px; }

.site-main h1 {
  font-family: var(--mono); font-size: 28px; line-height: 1.3; font-weight: 600;
  margin: 0 0 22px; letter-spacing: -0.01em;
}
.site-main h2 { font-size: 21px; font-weight: 600; margin: 38px 0 14px; }
.site-main h3 { font-size: 16px; font-weight: 600; margin: 24px 0 10px; color: var(--pen); }
.site-main p { margin: 0 0 16px; max-width: 68ch; }
.site-main a { color: var(--pen-accent); }
.site-main ul, .site-main ol { margin: 0 0 16px; padding-left: 22px; max-width: 68ch; }
.site-main li { margin-bottom: 6px; }
.site-main code {
  font-family: var(--mono); background: var(--panel); border: 1px solid var(--panel-border);
  padding: 2px 6px; border-radius: 3px; font-size: 0.9em;
}
.site-main pre {
  font-family: var(--mono); background: var(--panel); border: 1px solid var(--panel-border);
  padding: 14px; border-radius: 4px; overflow-x: auto; font-size: 14px;
}

.article-meta {
  font-family: var(--mono); font-size: 12px; color: var(--dim);
  margin-bottom: 28px; padding-bottom: 16px; border-bottom: 1px solid var(--panel-border);
}

table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14px; overflow-x: auto; display: block; }
table thead, table tbody { display: table; width: 100%; table-layout: fixed; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--panel-border); }
th { font-family: var(--mono); font-size: 11px; color: var(--dim); font-weight: 500; }

.faq-item { margin-bottom: 18px; }
.faq-q { font-weight: 600; margin-bottom: 4px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 24px 0; }
.post-card {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 3px;
  padding: 18px; text-decoration: none; color: var(--text); display: block;
  border-left: 2px solid var(--panel-border);
}
.post-card:hover { border-left-color: var(--pen); }
.post-card-title { font-family: var(--mono); font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.post-card-desc { font-size: 13px; color: var(--text-dim); }

.cta-box {
  background: var(--panel); border: 1px solid var(--panel-border); border-left: 3px solid var(--pen);
  border-radius: 3px; padding: 20px 24px; margin: 28px 0; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 14px;
}
.cta-box p { margin: 0; max-width: none; }
.cta-button {
  font-family: var(--mono); font-size: 13px; background: var(--pen);
  padding: 10px 18px; border-radius: 3px; text-decoration: none; font-weight: 600; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.cta-box .cta-button { color: var(--bg); }
.cta-box .cta-button:hover { background: var(--pen-accent); color: var(--bg); }

.contact-form { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.contact-form label { font-size: 13px; color: var(--text-dim); }
.contact-form input, .contact-form textarea {
  background: var(--panel); border: 1px solid var(--panel-border); color: var(--text);
  padding: 10px 12px; border-radius: 3px; font-family: var(--sans); font-size: 14px; width: 100%;
}
.contact-form button {
  background: var(--pen); color: var(--bg); border: none; padding: 12px 20px;
  border-radius: 3px; font-weight: 600; cursor: pointer; font-family: var(--sans); width: fit-content;
}

.site-footer {
  position: relative; z-index: 1; border-top: 1px solid var(--panel-border);
  padding: 24px; text-align: center; color: var(--dim); font-size: 12px;
}
.site-footer a { color: var(--dim); }
.footer-links { display: flex; gap: 16px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .site-main h1 { font-size: 22px; }
  table { font-size: 13px; }
}
