/* ---------------------------------------------------------------
   Zakladateľ s.r.o. — generátor dokumentov
   Vizuálny jazyk: papier registrového súdu + úradná pečiatka.
   --------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --paper: #f6f4ee;
  --paper-raised: #fffdf8;
  --ink: #1c2430;
  --ink-soft: #4b5563;
  --rule: #d8d2c2;
  --seal: #7a2e2e;
  --seal-soft: #a24b3f;
  --brass: #a9862d;
  --ok: #2f6d4f;
  --danger: #b3372c;
  --radius: 3px;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'IBM Plex Sans', -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  background: var(--paper);
  background-image:
    linear-gradient(var(--paper) 0%, var(--paper) 100%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: 6rem;
}

/* subtle laid-paper texture via repeating lines */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(28, 36, 48, 0.015),
    rgba(28, 36, 48, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}

.masthead h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.9rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

.masthead p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  max-width: 46ch;
}

.seal {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid var(--seal);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-8deg);
  opacity: 0.9;
}

.seal::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--seal-soft);
  border-radius: 50%;
}

.seal span {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--seal);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-align: center;
  line-height: 1.25;
  text-transform: uppercase;
}

/* ---------- Article sections (mirrors the contract's own numbering) ---------- */

.article {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.article-head {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(to bottom, #fbfaf5, var(--paper-raised));
}

.article-num {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--seal);
  min-width: 2.2rem;
}

.article-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0;
}

.article-head .hint {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-style: italic;
  white-space: nowrap;
}

.article-body {
  padding: 1.5rem;
}

/* ---------- Form primitives ---------- */

.field-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.field-row.thirds { grid-template-columns: repeat(3, 1fr); }
.field-row.single { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; gap: 0.35rem; }

.field label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field .opt {
  text-transform: none;
  font-weight: 400;
  font-style: italic;
  letter-spacing: normal;
  opacity: 0.75;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  font-family: var(--sans);
  font-size: 0.92rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  width: 100%;
}

input.mono, .mono input { font-family: var(--mono); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--seal-soft);
  box-shadow: 0 0 0 3px rgba(122, 46, 46, 0.1);
}

input.rc-invalid {
  border-color: var(--danger);
  background: #fdf4f3;
}
input.rc-invalid:focus {
  box-shadow: 0 0 0 3px rgba(179, 55, 44, 0.12);
}

textarea { resize: vertical; min-height: 3rem; }

/* ---------- Repeating person cards (spoločníci / konatelia) ---------- */

.person-list { display: flex; flex-direction: column; gap: 1rem; }

.person-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.25rem;
  background: #fdfcf8;
  position: relative;
}

.person-card .person-tag {
  position: absolute;
  top: -0.65rem;
  left: 1rem;
  background: var(--seal);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
}

.person-card .remove-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
}

.list-add {
  align-self: flex-start;
}

/* Odrazky (predmet podnikania) */

.bullet-list { display: flex; flex-direction: column; gap: 0.5rem; }
.bullet-row { display: flex; gap: 0.5rem; align-items: center; }
.bullet-row input { flex: 1; }

/* ---------- Buttons ---------- */

button, .btn {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

button:hover, .btn:hover { border-color: var(--ink-soft); }

button.ghost-danger {
  color: var(--danger);
  border-color: transparent;
  background: transparent;
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
}
button.ghost-danger:hover { background: rgba(179, 55, 44, 0.08); }

.btn-add {
  border-style: dashed;
  color: var(--ink-soft);
}
.btn-add:hover { color: var(--ink); border-color: var(--ink-soft); }

button.primary {
  background: var(--seal);
  border-color: var(--seal);
  color: #fff;
  font-size: 0.95rem;
  padding: 0.85rem 1.6rem;
}
button.primary:hover { background: #632423; border-color: #632423; }
button.primary:disabled { opacity: 0.6; cursor: progress; }

/* toggle-style checkbox row */
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fdfcf8;
  margin-bottom: 1rem;
}
.toggle-row input { margin-top: 0.2rem; }
.toggle-row .toggle-text { font-size: 0.88rem; }
.toggle-row .toggle-text small { display: block; color: var(--ink-soft); margin-top: 0.1rem; }

/* ---------- Submit bar ---------- */

.submit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.5rem;
}

.submit-bar .note {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* ---------- Result / status states ---------- */

.status-box {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  background: var(--paper-raised);
  margin-bottom: 1.75rem;
}

.status-box.ok { border-color: var(--ok); }
.status-box.error { border-color: var(--danger); }

.status-box h3 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.05rem;
}

.status-box.ok h3 { color: var(--ok); }
.status-box.error h3 { color: var(--danger); }

.status-box pre {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 0.78rem;
  background: #f3f1ea;
  padding: 0.75rem;
  border-radius: var(--radius);
  overflow-x: auto;
}

.file-links { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.75rem; }
.file-links a {
  color: var(--seal);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}
.file-links a:hover { text-decoration: underline; }

footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.78rem;
  margin-top: 3rem;
}

@media (max-width: 640px) {
  .field-row, .field-row.thirds { grid-template-columns: 1fr; }
  .masthead { flex-direction: column; align-items: flex-start; }
}

/* focus-visible accessibility */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
