/* walidator.racicki.com - spójny ze stylem racicki.com (James Clear minimalizm) */

:root {
  --bg: #fafaf7;
  --text: #111;
  --text-muted: #4a4a4a;
  --accent: #1a2a4a;
  --accent-hover: #2a3f6b;
  --border: #e2e2de;
  --placeholder-bg: #eeeeea;
  --placeholder-border: #cfcfc9;
  --error: #9b2c2c;
  --success: #1a5a3e;
  --measure: 680px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-top: 0;
}
h1 { font-size: 2.25rem; line-height: 1.15; margin-bottom: 1rem; }
h2 { font-size: 1.75rem; line-height: 1.2; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.25rem; line-height: 1.3; margin: 2rem 0 .75rem; font-weight: 600; }
@media (min-width: 720px) {
  h1 { font-size: 3rem; }
  h2 { font-size: 2.25rem; }
}

p { margin: 0 0 1.1em; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
.muted { color: var(--text-muted); font-size: 0.9rem; }
.lede { font-size: 1.15rem; color: var(--text-muted); }

ul { padding-left: 1.2em; }
li { margin-bottom: .4em; }

/* Nawigacja */
.site-nav {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-nav__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.site-nav__logo {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-nav__menu {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  align-items: center;
}
.site-nav__menu a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-nav__menu a:hover { color: var(--accent); }
.site-nav__menu .nav-home {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  padding: 2px 0;
}
.site-nav__menu .nav-home:hover { color: var(--accent); }
.site-nav__menu .nav-home svg { display: block; }

/* Sekcje */
main { display: block; }
.section {
  padding: 3rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.section:last-of-type { border-bottom: none; }
.section__inner {
  max-width: var(--measure);
  margin: 0 auto;
}
.section--hero {
  padding: 4rem 1.25rem 2rem;
  background: linear-gradient(180deg, #f0efea 0%, var(--bg) 100%);
}
@media (min-width: 720px) {
  .section { padding: 4rem 1.5rem; }
  .section--hero { padding: 5rem 1.5rem 3rem; }
}

/* Formularz */
form { margin: 1rem 0 0; }
label {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}
textarea {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 140px;
  transition: border-color 0.15s ease;
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 42, 74, 0.12);
}
.form-meta {
  display: flex;
  justify-content: flex-end;
  margin: 0.4rem 0 1rem;
}
button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.85rem 1.5rem;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
button[type="submit"]:hover:not(:disabled) { background: var(--accent-hover); }
button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; }

/* Wynik */
.result {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: 6px;
  background: #f5f4ef;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
}
.result--error { border-left-color: var(--error); }
.result--success { border-left-color: var(--success); }
.result--loading { border-left-color: var(--text-muted); }
.result h3 {
  margin-top: 0;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.25rem;
}
.result p:last-child { margin-bottom: 0; }

/* Markdown wyrenderowany przez marked.js wewnątrz .result */
.result-md h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.35rem;
  margin: 1.6rem 0 .6rem;
  line-height: 1.25;
  letter-spacing: -0.005em;
}
.result-md h2:first-child { margin-top: 0; }
.result-md h3 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.1rem;
  margin: 1.2rem 0 .5rem;
}
.result-md p { margin: 0 0 .9em; }
.result-md ul, .result-md ol { margin: .2em 0 1em; padding-left: 1.3em; }
.result-md li { margin-bottom: .35em; }
.result-md li > p { margin-bottom: .3em; }
.result-md strong { font-weight: 600; }
.result-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: #eeeeea;
  padding: 1px 5px;
  border-radius: 3px;
}
.result-md blockquote {
  margin: 1em 0;
  padding: .2em 1em;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}
.result-md hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5em 0;
}
.result-meta {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

/* Chat (krok 7 - wieloetapowy) */
.section--chat { padding-top: 2rem; }
.chat { display: flex; flex-direction: column; gap: 1.25rem; }

.chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.chat__progress {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1 1 auto;
  min-width: 220px;
}
.chat__counter {
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 500;
}
.chat__bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.chat__bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}
.chat__reset {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.chat__reset:hover { border-color: var(--accent); color: var(--accent); }

.chat__messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 120px;
}

.msg {
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.msg__role {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.msg__body {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  line-height: 1.55;
  background: #fff;
  border: 1px solid var(--border);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg--user { align-items: flex-end; }
.msg--user .msg__body {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  max-width: 85%;
}
.msg--assistant .msg__body {
  background: #f5f4ef;
  max-width: 100%;
}
.msg--loading .msg__body { background: #f5f4ef; color: var(--text-muted); }
.msg--final .msg__body {
  border-left: 4px solid var(--success);
  background: #fff;
}

.dots { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 6px; }
.dots > span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
  animation: dot 1s infinite ease-in-out;
}
.dots > span:nth-child(2) { animation-delay: .15s; }
.dots > span:nth-child(3) { animation-delay: .3s; }
@keyframes dot {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* Markdown wyrenderowany w raporcie końcowym */
.msg--final .msg__body h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.3rem;
  margin: 1.4rem 0 .5rem;
  line-height: 1.25;
}
.msg--final .msg__body h2:first-child { margin-top: 0; }
.msg--final .msg__body h3 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.1rem;
  margin: 1.1rem 0 .4rem;
}
.msg--final .msg__body p { margin: 0 0 .85em; }
.msg--final .msg__body ul, .msg--final .msg__body ol { margin: .2em 0 .9em; padding-left: 1.3em; }
.msg--final .msg__body li { margin-bottom: .3em; }
.msg--final .msg__body strong { font-weight: 600; }
.msg--final .msg__body blockquote {
  margin: .8em 0;
  padding: .2em 1em;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}
.msg--final .msg__body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: #eeeeea;
  padding: 1px 5px;
  border-radius: 3px;
}

.chat__verdict {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.chat__verdict-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.chat__verdict-body {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.25rem;
}

.chat__form {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.chat__label {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
}
.chat__form textarea {
  width: 100%;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 84px;
  transition: border-color 0.15s ease;
}
.chat__form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 42, 74, 0.12);
}
.chat__form textarea:disabled {
  background: #f5f4ef;
  cursor: not-allowed;
}
.chat__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
#send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.65rem 1.3rem;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
#send-btn:hover:not(:disabled) { background: var(--accent-hover); }
#send-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.chat__error {
  margin: 0;
  padding: 0.75rem 1rem;
  background: #fdf2f2;
  border: 1px solid #f5c2c2;
  border-left: 4px solid var(--error);
  color: var(--error);
  border-radius: 6px;
  font-size: .9rem;
}

.chat__hint { margin: 0; font-size: 0.85rem; }

/* Stopka */
.site-footer {
  background: #f0efea;
  padding: 2rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.site-footer__inner {
  max-width: var(--measure);
  margin: 0 auto;
  text-align: center;
}
.site-footer a { color: var(--text); }
