/* mirekcad.com — arkusz rysunkowy jako strona.
   Motyw: kartka kreślarska (chłodny papier), geometria w kolorze aplikacji,
   opisy wymiarowe na czerwono jak korekta na wydruku. Jedno pasmo ciemne
   (linia poleceń) niesie cały kontrast. */

:root {
  --sheet: #edeff3;
  --mylar: #ffffff;
  --graphite: #171b22;
  --ink: #1a1e25;
  --ink-dim: #626b78;
  --blue: #1553b7;
  --blue-soft: #dce7f8;
  --hair: #c6cdd8;
  --hair-soft: #dfe3ea;
  --redline: #c8402a;

  --display: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  --body: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Martian Mono', ui-monospace, 'SFMono-Regular', monospace;

  --pad: clamp(20px, 5vw, 76px);
  --rule: 1px solid var(--hair);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); }

h1, h2, h3 {
  font-family: var(--display);
  font-stretch: 116%;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.02;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(2.5rem, 5.6vw, 4.3rem); }
h2 { font-size: clamp(1.9rem, 3.8vw, 2.9rem); }
h3 { font-size: 1.28rem; font-stretch: 108%; letter-spacing: -0.012em; }

p { margin: 0; }

/* ── rama arkusza + znaczniki pasowania ──────────────────────────────── */
.sheet-frame {
  position: fixed;
  inset: 9px;
  border: 1px solid var(--hair);
  pointer-events: none;
  z-index: 5;
  background:
    linear-gradient(var(--hair), var(--hair)) top center / 1px 13px no-repeat,
    linear-gradient(var(--hair), var(--hair)) bottom center / 1px 13px no-repeat,
    linear-gradient(var(--hair), var(--hair)) left center / 13px 1px no-repeat,
    linear-gradient(var(--hair), var(--hair)) right center / 13px 1px no-repeat;
}

/* ── litery stref (jak na ramce rysunku technicznego) ────────────────── */
.zone {
  position: absolute;
  left: 26px;
  top: clamp(28px, 5vw, 60px);
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
}

.zone::after {
  content: '';
  display: block;
  width: 1px;
  height: 26px;
  margin: 8px auto 0;
  background: var(--hair);
}

.zone-dark { color: #6d7684; }
.zone-dark::after { background: #333c48; }

/* ── pasek górny ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px var(--pad);
  background: color-mix(in srgb, var(--sheet) 88%, transparent);
  backdrop-filter: blur(9px);
  border-bottom: var(--rule);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--blue);
  border-radius: 50%;
  background:
    linear-gradient(var(--blue), var(--blue)) center / 1px 21px no-repeat,
    linear-gradient(var(--blue), var(--blue)) center / 21px 1px no-repeat;
}

.brand-name {
  font-family: var(--display);
  font-stretch: 118%;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

.topnav {
  display: flex;
  gap: 22px;
  margin-right: auto;
  font-family: var(--mono);
  font-size: 0.63rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.topnav a {
  color: var(--ink-dim);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.topnav a:hover { color: var(--ink); border-bottom-color: var(--blue); }

.topbar-right { display: flex; align-items: center; gap: 18px; }

.lang {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--hair);
}

.lang button {
  border: 0;
  background: none;
  padding: 2px 1px;
  font: inherit;
  color: var(--ink-dim);
  cursor: pointer;
}

.lang button[aria-pressed='true'] { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

/* ── przyciski ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 17px;
  border: 1px solid var(--blue);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 0.63rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, color .15s, transform .15s;
}

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #0f3f8e; }
.btn-ghost { background: transparent; color: var(--blue); }
.btn-ghost:hover { background: var(--blue-soft); }
.btn-lg { padding: 14px 26px; font-size: 0.7rem; }
.btn:active { transform: translateY(1px); }

/* ── sekcje ──────────────────────────────────────────────────────────── */
main > section {
  position: relative;
  padding: clamp(56px, 8vw, 104px) var(--pad);
  border-bottom: var(--rule);
  scroll-margin-top: 58px; /* sticky topbar nie zasłania nagłówka sekcji */
}

.sec-head { max-width: 44rem; }
.sec-head h2 { margin-top: 6px; }
.sec-lead { margin-top: 16px; color: var(--ink-dim); max-width: 40rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
}

/* ── hero ────────────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding-top: clamp(48px, 7vw, 88px);
}

.hero h1 { margin: 14px 0 0; }
.hero .lead { margin-top: 22px; font-size: 1.09rem; color: #3b434f; max-width: 33rem; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
  margin: 34px 0 0;
  padding: 14px 0 0;
  border-top: var(--rule);
  list-style: none;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.01em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.facts li { position: relative; padding-left: 14px; }
.facts li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 6px;
  height: 6px;
  border: 1px solid var(--blue);
  transform: rotate(45deg);
}

/* ── rysunek w hero ──────────────────────────────────────────────────── */
.hero-art { margin: 0; }

.art-paper {
  padding: clamp(14px, 2.4vw, 30px);
  background-color: var(--mylar);
  background-image:
    repeating-linear-gradient(0deg, #edf1f7 0 1px, transparent 1px 14px),
    repeating-linear-gradient(90deg, #edf1f7 0 1px, transparent 1px 14px);
  border: var(--rule);
}

.dwg { display: block; width: 100%; height: auto; }

.dwg-center line { stroke: #93a8c9; stroke-width: 1; stroke-dasharray: 14 3 3 3; }
.dwg-outline rect { fill: none; stroke: var(--blue); stroke-width: 2.2; }
.dwg-circles circle,
.dwg-holes circle { fill: none; stroke: var(--blue); stroke-width: 1.8; }

.dwg-dims { stroke: var(--redline); fill: var(--redline); }
.dwg-dims line { stroke-width: 1; }
.dwg-dims text {
  stroke: none;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

/* rysunek kreśli się sam: linie osiowe → obrys → okręgi → otwory → wymiary */
.dwg-center { animation: fade .5s ease .1s backwards; }
.dwg-outline rect { animation: draw .95s ease-out .3s backwards; }
.dwg-circles circle { animation: draw .5s ease-out 1.05s backwards; }
.dwg-circles circle:nth-child(2) { animation-delay: 1.2s; }
.dwg-holes circle { animation: draw .45s ease-out 1.35s backwards; }
.dwg-holes circle:nth-child(2) { animation-delay: 1.45s; }
.dwg-holes circle:nth-child(3) { animation-delay: 1.55s; }
.dwg-holes circle:nth-child(4) { animation-delay: 1.65s; }
.dwg-dims .dim { animation: rise .45s ease-out calc(1.95s + var(--i) * .13s) backwards; }

@keyframes draw {
  from { stroke-dasharray: 1; stroke-dashoffset: 1; }
  to { stroke-dasharray: 1; stroke-dashoffset: 0; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }

/* obroty co pewien czas: przez większość cyklu nic się nie dzieje, ruch to
   ostatnie ~15% czasu. Kąty dobrane tak, żeby figura wracała na siebie
   (krzyżyk co 90°, para osi co 180°) — pętla nie ma szwu. */
.cl-main,
.cl-hole {
  transform-box: fill-box;
  transform-origin: center;
}

.cl-main { animation: turn-half 17s ease-in-out 3.4s infinite; }
.cl-hole { animation: turn-quarter 11s ease-in-out calc(2.6s + var(--i) * 0.14s) infinite; }

@keyframes turn-quarter {
  0%, 84% { transform: rotate(0deg); }
  100% { transform: rotate(90deg); }
}
@keyframes turn-half {
  0%, 82% { transform: rotate(0deg); }
  100% { transform: rotate(180deg); }
}

.titleblock {
  display: flex;
  flex-wrap: wrap;
  border: var(--rule);
  border-top: 0;
  background: var(--mylar);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.01em;
  color: var(--ink-dim);
}

.titleblock span {
  flex: 1 1 auto;
  padding: 9px 12px;
  border-right: var(--rule);
  white-space: nowrap;
}

.titleblock span:last-child { border-right: 0; }
.titleblock b { color: var(--ink); font-weight: 500; margin-right: 7px; }

/* ── moduły ──────────────────────────────────────────────────────────── */
.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: clamp(20px, 2.6vw, 32px);
  margin-top: clamp(32px, 5vw, 56px);
}

.panel {
  padding: clamp(22px, 3vw, 34px);
  background: var(--mylar);
  border: var(--rule);
}

.panel-kicker {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--blue);
  text-transform: uppercase;
}

.panel h3 { margin: 12px 0 10px; }
.panel > p { color: var(--ink-dim); font-size: 1rem; }

.mock {
  margin-top: 22px;
  border: var(--rule);
  background: #f8f9fb;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: -0.01em;
}

.mock-bar {
  padding: 6px 10px;
  border-bottom: var(--rule);
  background: #eef1f6;
  color: var(--ink-dim);
  letter-spacing: 0.05em;
}

.mock-snap ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 9px 10px;
  list-style: none;
  color: var(--ink-dim);
}

.mock-snap li::before { content: '⊹ '; color: var(--blue); }

.mock-layers table { width: 100%; border-collapse: collapse; }
.mock-layers td { padding: 5px 10px; border-bottom: 1px solid var(--hair-soft); color: var(--ink-dim); }
.mock-layers tr:last-child td { border-bottom: 0; }
.mock-layers td:first-child { color: var(--ink); }
.mock-layers td:last-child { text-align: right; }

.sw {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: var(--c);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 4px 8px;
  border: 1px solid var(--hair-soft);
  background: #f4f6fa;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.01em;
  color: var(--ink-dim);
}

.iso-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(150px, 1fr);
  gap: 16px;
  align-items: center;
  margin-top: 18px;
}

.iso { display: block; width: 100%; height: auto; }
.iso polygon, .iso polyline { stroke: #2f3844; stroke-width: 1; stroke-linejoin: round; }
.f-top { fill: #c5ccd7; }
.f-side { fill: #aab2be; }
.f-left { fill: #99a2af; }
.f-right { fill: #838c99; }
.f-hole { fill: #6d7683; }
.f-bore { fill: #5a626e; }
.f-bore-in { fill: none; stroke: #838c99; }

.mock-tree ul { margin: 0; padding: 8px 10px; list-style: none; color: var(--ink-dim); }
.mock-tree li { padding: 2px 0; }
.t-root { color: var(--ink); }
.t-1 { padding-left: 12px; }
.t-2 { padding-left: 24px; }
.t-2::before { content: '▸ '; color: var(--blue); }

/* ── pasmo linii poleceń ─────────────────────────────────────────────── */
.cmd { background: var(--graphite); color: #e6e9f0; border-bottom-color: #2b3340; }
.cmd .eyebrow { color: #7ea9f0; }
.cmd h2 { margin-top: 6px; }
.cmd p { color: #a2acbb; }

.cmd-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(28px, 4vw, 60px);
  align-items: center;
}

.cmd-text > p { margin-top: 16px; max-width: 32rem; }

.cmd-notes {
  margin: 26px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid #2b3340;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.01em;
  color: #8a94a4;
}

.cmd-notes li { padding: 3px 0; }

.transcript {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  background: #0f1319;
  border: 1px solid #29313d;
  font-family: var(--mono);
  font-size: 0.63rem;
  line-height: 2;
  letter-spacing: -0.02em;
  white-space: pre;
}

.transcript .p { color: #79839a; }
.transcript .c { color: #8fb8ff; }
.transcript .v { color: #ffffff; }

.caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  vertical-align: -0.15em;
  background: #8fb8ff;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ── pliki ───────────────────────────────────────────────────────────── */
.fmt {
  width: 100%;
  margin-top: clamp(28px, 4vw, 44px);
  border-collapse: collapse;
  background: var(--mylar);
  border: var(--rule);
}

.fmt th, .fmt td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--hair-soft);
  text-align: left;
  vertical-align: baseline;
}

.fmt tbody tr:last-child th, .fmt tbody tr:last-child td { border-bottom: 0; }

.fmt thead th {
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border-bottom: var(--rule);
}

.fmt tbody th {
  width: 8.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--blue);
}

.fmt td { font-size: 0.95rem; color: var(--ink-dim); }
.fmt td:first-of-type { width: 11rem; color: var(--ink); }

/* ── offline ─────────────────────────────────────────────────────────── */
.offline-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 60px);
  align-items: start;
}

.spec { margin: 0; padding: 0; list-style: none; border-top: var(--rule); }

.spec li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0;
  border-bottom: var(--rule);
}

.spec b {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
  padding-top: 3px;
}

.spec span { color: var(--ink-dim); font-size: 0.98rem; }

/* ── zamknięcie ──────────────────────────────────────────────────────── */
.closing { text-align: center; }
.closing h2 { margin-bottom: 28px; }
.closing-note {
  margin-top: 22px;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.01em;
  color: var(--ink-dim);
}

/* ── stopka: tabelka rysunkowa ───────────────────────────────────────── */
.footer { padding: 0 var(--pad) 40px; }

.footer-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  border: var(--rule);
  border-top: 0;
  background: var(--mylar);
}

.footer-block > div {
  padding: 13px 16px;
  border-right: var(--rule);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.01em;
}

.footer-block > div:last-child { border-right: 0; }
.footer-block b { display: block; color: var(--ink-dim); font-weight: 400; margin-bottom: 5px; }
.footer-block span { color: var(--ink); }

.footer-note {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 0.55rem;
  color: var(--ink-dim);
}

/* ── dostępność ──────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.cmd :focus-visible { outline-color: #8fb8ff; }

/* ── węższe ekrany ───────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .zone { display: none; }
}

@media (max-width: 980px) {
  .hero, .cmd-inner, .offline-inner { grid-template-columns: minmax(0, 1fr); }
  .hero-art { margin-top: 8px; }
  .topnav { display: none; }
  .sheet-frame { display: none; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .iso-wrap { grid-template-columns: minmax(0, 1fr); }
  .spec li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .fmt th, .fmt td { padding: 11px 12px; }
  .fmt tbody th { width: auto; }
  .fmt td:first-of-type { width: auto; }
  .transcript { font-size: 0.52rem; padding: 14px; }
  /* rysunek jest wąski — opis wymiarowy musi zostać czytelny */
  .dwg-dims text { font-size: 16px; }
  .dwg-dims line { stroke-width: 1.4; }
  .dwg-outline rect { stroke-width: 3; }
  .dwg-circles circle, .dwg-holes circle { stroke-width: 2.4; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dwg-center, .dwg-outline rect, .dwg-circles circle, .dwg-holes circle,
  .dwg-dims .dim, .cl-main, .cl-hole, .caret { animation: none; }
}
