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

:root {
  --bg: #FAF7F2;
  --bg-cosmic: #0F1729;
  --text: #0F1729;
  --text-muted: #5A5A52;
  --text-on-cosmic: #E8E6E1;
  --accent: #2D8659;
  --accent-hover: #236B47;
  --star: #E4B24A;
  --border: #E2DED6;
  --error: #9b2c2c;
  --success: #1a5a3e;
  --measure: 760px;
}

* { 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;
  letter-spacing: -0.015em;
  color: var(--text);
  margin-top: 0;
}
h1 { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 600; line-height: 1.1; margin-bottom: 1rem; }
h2 { font-size: 1.75rem; font-weight: 600; line-height: 1.2; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; margin: 2rem 0 .75rem; }
@media (min-width: 720px) { 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; }
ul li::marker { color: var(--star); }
li { margin-bottom: .4em; }

/* Nawigacja */
.site-nav {
  background: var(--bg-cosmic) url('/stars.svg') center / 400px 200px repeat;
  border-bottom: 1px solid rgba(232, 230, 225, 0.08);
  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-on-cosmic); text-decoration: none; letter-spacing: -0.01em;
}
.site-nav__logo:hover { color: var(--star); }
.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-on-cosmic); text-decoration: none; font-size: 0.95rem;
  transition: color 0.15s ease;
}
.site-nav__menu a:hover { color: var(--star); }
.site-nav__menu .nav-home { display: inline-flex; align-items: center; padding: 2px 0; }
.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, #F0ECE3 0%, var(--bg) 100%);
}
@media (min-width: 720px) {
  .section { padding: 4rem 1.5rem; }
  .section--hero { padding: 5rem 1.5rem 3rem; }
}

/* Info-box (zasady) */
.info-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.info-box[hidden] { display: none; }
.info-box h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600; font-size: 1.15rem;
  margin: 0 0 0.75rem; line-height: 1.3;
}
.info-box ul {
  list-style: disc; padding-left: 1.4em; margin: 0 0 1rem;
  font-size: 0.95rem; line-height: 1.55;
}
.info-box ul li::marker { color: var(--star); }
.info-box ul li { margin-bottom: 0.4em; }
.info-box strong { font-weight: 600; }
.info-box__footer {
  margin: 0; padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem; color: var(--text-muted); line-height: 1.5;
}
.info-box__footer a { color: var(--accent); text-underline-offset: 2px; }
.info-box__footer a:hover { color: var(--star); text-decoration-color: var(--star); }

/* Formularz */
form { margin: 1rem 0 0; }
.form-field { margin-bottom: 1.5rem; }
.form-field label {
  display: block;
  font-size: 0.95rem; font-weight: 500;
  margin-bottom: 0.4rem;
}
.form-field__required { color: var(--error); margin-left: 0.15rem; }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit; font-size: 1rem; line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-field textarea { resize: vertical; min-height: 100px; }
.form-field input[type="text"]:focus,
.form-field input[type="email"]:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.15);
}
.form-field--invalid input,
.form-field--invalid textarea {
  border-color: var(--error);
}
.form-field--warning input,
.form-field--warning textarea {
  border-color: var(--star);
}
.form-field__meta {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.75rem; flex-wrap: wrap;
  margin-top: 0.35rem;
}
.form-field__hint { flex: 1 1 auto; }
.form-field__count { flex-shrink: 0; font-variant-numeric: tabular-nums; }

.form-field--collapsible { margin-bottom: 1.5rem; }
.form-field--collapsible summary {
  cursor: pointer;
  font-size: 0.9rem; font-weight: 500;
  color: var(--accent);
  padding: 0.5rem 0;
  list-style: none;
}
.form-field--collapsible summary::-webkit-details-marker { display: none; }
.form-field--collapsible summary:hover { color: var(--accent-hover); }
.form-field--collapsible[open] summary { margin-bottom: 0.5rem; }

/* Mode toggle */
.mode-toggle {
  display: flex;
  gap: 0.5rem;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}
.mode-toggle__btn {
  flex: 1 1 50%;
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  padding: 0.85rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
  min-height: 64px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.mode-toggle__btn:hover:not(.is-active) {
  background: rgba(45, 134, 89, 0.05);
  color: var(--text);
}
.mode-toggle__btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.mode-toggle__btn.is-active .mode-toggle__sub { color: rgba(255, 255, 255, 0.85); }
.mode-toggle__title {
  font-family: 'Fraunces', serif;
  font-weight: 600; font-size: 1rem;
  letter-spacing: 0.04em;
}
.mode-toggle__sub { font-size: 0.8rem; color: var(--text-muted); }
.mode-toggle__desc {
  margin: 0 0.2rem 1.5rem;
  font-size: 0.85rem;
}

/* Form actions */
.form-actions {
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
button[type="submit"]#generate-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.95rem 1.75rem;
  border-radius: 6px;
  font: inherit; font-weight: 600; font-size: 1rem;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.15s ease;
}
button[type="submit"]#generate-btn:hover:not(:disabled) { background: var(--accent-hover); }
button[type="submit"]#generate-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.chat__error,
#form-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: 0.9rem;
}
.chat__error[hidden],
#form-error[hidden] { display: none; }

.chat__hint { margin: 2rem 0 0; font-size: 0.85rem; }
.chat__hint strong { font-weight: 600; }

/* Result section */
.result-section { margin-top: 2.5rem; }
.result-section[hidden] { display: none; }

.result-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.result-actions[hidden] { display: none; }
.result-action {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font: inherit; font-weight: 500; font-size: 0.9rem;
  cursor: pointer;
  min-height: 38px;
  transition: background 0.15s ease;
}
.result-action:hover:not(:disabled) { background: var(--accent-hover); }
.result-action:disabled { opacity: 0.5; cursor: not-allowed; }
.result-action--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.result-action--ghost:hover { background: rgba(45, 134, 89, 0.08); }

/* Wynik (markdown) */
.result {
  padding: 1.75rem 1.5rem;
  border-radius: 8px;
  background: #F4EFE5;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.result--error { border-left-color: var(--error); background: #fdf2f2; }
.result--loading { border-left-color: var(--text-muted); }

.result-md h1 {
  font-family: 'Fraunces', serif;
  font-weight: 600; font-size: 1.6rem;
  margin: 0 0 1rem; line-height: 1.25;
  color: var(--text);
}
.result-md h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600; font-size: 1.35rem;
  margin: 1.6rem 0 0.6rem; line-height: 1.25;
  letter-spacing: -0.005em;
}
.result-md h3 {
  font-family: 'Fraunces', serif;
  font-weight: 500; font-size: 1.1rem;
  margin: 1.2rem 0 0.5rem;
}
.result-md p { margin: 0 0 0.9em; }
.result-md ul, .result-md ol { margin: 0.2em 0 1em; padding-left: 1.3em; }
.result-md li { margin-bottom: 0.35em; }
.result-md li > p { margin-bottom: 0.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: 0.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;
}

/* Email opt-in box */
.email-box {
  margin-top: 2rem;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--star);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}
.email-box[hidden] { display: none; }
.email-box__title {
  font-family: 'Fraunces', serif;
  font-weight: 600; font-size: 1.15rem;
  margin: 0 0 0.5rem;
}
.email-box__label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0.75rem 0 0.4rem;
  display: block;
}
.email-box input[type="email"] {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit; font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.email-box input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.15);
}
.email-box__consent {
  display: flex; gap: 0.6rem;
  align-items: flex-start;
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  cursor: pointer;
}
.email-box__consent input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.email-box__consent a { color: var(--accent); }
.email-box__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}
.email-box__error {
  color: var(--error);
  font-size: 0.85rem;
}
.email-box__error[hidden] { display: none; }
.email-box button[type="submit"]#email-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.7rem 1.3rem;
  border-radius: 6px;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  cursor: pointer;
  min-height: 42px;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.email-box button[type="submit"]#email-submit:hover:not(:disabled) { background: var(--accent-hover); }
.email-box button[type="submit"]#email-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.email-thanks {
  margin: 1rem 0 0;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--success);
}
.email-thanks[hidden] { display: none; }

/* Stopka */
.site-footer {
  background: var(--bg-cosmic) url('/stars.svg') center / 400px 200px repeat;
  padding: 2.5rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-on-cosmic);
}
.site-footer__inner {
  max-width: var(--measure);
  margin: 0 auto;
  text-align: center;
}
.site-footer a {
  color: var(--text-on-cosmic);
  text-decoration-color: rgba(232, 230, 225, 0.4);
}
.site-footer a:hover {
  color: var(--star);
  text-decoration-color: var(--star);
}

/* Loader animation podczas streamingu */
.dots { display: inline-flex; gap: 4px; vertical-align: middle; margin-right: 6px; }
.dots > span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: dot 1s infinite ease-in-out;
  opacity: 0.6;
}
.dots > span:nth-child(2) { animation-delay: 0.15s; }
.dots > span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
