/* ===== RESET & BASE ===== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: #1a1a1a;
  background-color: #fff;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* ===== CONTAINER ===== */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== TYPOGRAPHY ===== */

h1, h2, h3 {
  line-height: 1.25;
  color: #111;
}

h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

p:last-child {
  margin-bottom: 0;
}

/* ===== SECTIONS ===== */

.section {
  padding: 4rem 0;
}

.section--alt {
  background-color: #f7f8fa;
}

.section__lead {
  font-size: 1.125rem;
  color: #555;
  margin-bottom: 2rem;
}

/* ===== BUTTON ===== */

.btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background-color: #2563eb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s, transform 0.1s;
}

.btn:hover {
  background-color: #1d4ed8;
}

.btn:active {
  transform: scale(0.98);
}

.btn--large {
  padding: 1rem 2.5rem;
  font-size: 1.125rem;
}

.btn--copy {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  background-color: #111;
  margin-top: 1rem;
  width: 100%;
}

.btn--copy:hover {
  background-color: #333;
}

.btn--copy.copied {
  background-color: #16a34a;
}

.btn--copy .btn__done {
  display: none;
}

.btn--copy.copied .btn__text {
  display: none;
}

.btn--copy.copied .btn__done {
  display: inline;
}

/* ===== HERO ===== */

.hero {
  padding: 5rem 0 4rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
}

.hero h1 {
  margin-bottom: 1rem;
}

.hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: #555;
  margin-bottom: 2rem;
  max-width: 600px;
}

/* ===== PROBLEM ===== */

.problem-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 640px) {
  .problem-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* Check list */
.check-list {
  list-style: none;
  margin-bottom: 1.5rem;
}

.check-list li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: 0.75rem;
}

.check-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: #16a34a;
  font-weight: 700;
}

.check-list--cross li::before {
  content: "\2717";
  color: #dc2626;
}

/* ===== PHOTO GRID ===== */

.photo-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  color: #94a3b8;
  text-align: center;
  padding: 1rem;
}

.photo-placeholder span {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.photo-placeholder small {
  font-size: 0.8125rem;
}

.photo-placeholder--success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #4ade80;
}

/* ===== TIMELINE ===== */

.timeline {
  position: relative;
  padding-left: 2.5rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.timeline__item:last-child::after {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 1rem;
  bottom: 0;
  width: 2px;
  background: #f7f8fa;
}

.timeline__item {
  position: relative;
  padding-bottom: 2rem;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__marker {
  position: absolute;
  left: -2.5rem;
  width: 2rem;
  height: 2rem;
  background: #2563eb;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  z-index: 1;
}

.timeline__item:last-child .timeline__marker {
  background: #16a34a;
}

.timeline__content h3 {
  margin-bottom: 0.25rem;
}

.timeline__content p {
  color: #555;
  font-size: 0.9375rem;
}

/* ===== STEPS ===== */

.steps {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.step {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.5rem;
  background: #f7f8fa;
  border-radius: 12px;
  transition: box-shadow 0.2s;
}

.step:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.step__number {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  background: #2563eb;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
}

.step__body h3 {
  margin-bottom: 0.25rem;
}

.step__body p {
  color: #555;
  font-size: 0.9375rem;
}

/* ===== DETAILS (collapsible blocks) ===== */

.details-block {
  margin-top: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.details-block summary {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  color: #2563eb;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s;
}

.details-block summary:hover {
  background: #f8fafc;
}

.details-block summary::before {
  content: "\25B6";
  font-size: 0.625rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.details-block[open] summary::before {
  transform: rotate(90deg);
}

.details-block summary::-webkit-details-marker {
  display: none;
}

.details-block__content {
  padding: 0.25rem 1rem 1rem;
  font-size: 0.9375rem;
  color: #555;
  border-top: 1px solid #e2e8f0;
}

.details-block__content ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.details-block__content li {
  margin-bottom: 0.625rem;
  line-height: 1.5;
}

.details-block__content a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.details-block__content a:hover {
  border-bottom-color: #2563eb;
}

.details-block__content p:last-child {
  margin-bottom: 0;
  font-size: 0.8125rem;
  color: #94a3b8;
}

.template-formal {
  opacity: 0.9;
}

.template-text[data-mode="app"] .template-formal {
  display: none;
}

.template-text[data-mode="full"] .template-formal {
  display: inline;
  color: #64748b;
}


/* ===== TEMPLATES ===== */

.templates-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.template-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
}

.template-card h3 {
  margin-bottom: 1rem;
}

/* ===== CARD SECTIONS (fieldset) ===== */

.card-section {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0 0 1rem;
  min-width: 0;
}

.card-section legend {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #334155;
  padding: 0 0.375rem;
}

.card-section--details > legend {
  grid-column: 1 / -1;
}

.template-select {
  width: 100%;
  padding: 0 0.75rem;
  height: 2.25rem;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #111;
  cursor: pointer;
  appearance: auto;
}

.template-select:focus {
  outline: 2px solid #2563eb;
  outline-offset: -1px;
}

/* ===== TOPIC BUTTONS ===== */

.topic-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.topic-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.topic-btn:hover {
  border-color: #93c5fd;
  color: #2563eb;
}

.topic-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.topic-btn--full {
  display: none;
}

.topic-buttons.show-all .topic-btn--full {
  display: inline-flex;
}


/* ===== CARD HEADER + DETAILS SWITCH ===== */

.template-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.template-card__header h3 {
  margin-bottom: 0;
}

.details-control {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
  flex-shrink: 0;
}

.details-hint {
  font-size: 0.6875rem;
  color: #94a3b8;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.switch-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: #e2e8f0;
  border-radius: 12px;
  transition: background-color 0.2s;
  cursor: pointer;
}

.switch-track::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
}

.switch-input:checked + .switch-track {
  background: #2563eb;
}

.switch-input:checked + .switch-track::before {
  transform: translateX(20px);
}

.template-text {
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #334155;
  max-height: 300px;
  overflow-y: auto;
}

.template-text.has-variants::before {
  content: '';
  float: right;
  width: 11rem;
  height: 1.4em;
}

@media (max-width: 639px) {
  .template-text.has-variants::before {
    display: none;
  }

  .template-text.has-variants {
    padding-top: 2.25rem;
  }
}

.template-text-wrap {
  position: relative;
}

.btn-variant {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  color: #475569;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.4;
}

.btn-variant:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.97);
  border-color: #94a3b8;
}

.btn-variant::before {
  content: "\21BB";
  font-size: 0.875rem;
  display: inline-block;
  transition: transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .btn-variant:hover::before {
    transform: rotate(90deg);
  }
}

.btn-variant:active::before {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  .btn-variant::before {
    transition: none;
  }
  .btn-variant:hover::before,
  .btn-variant:active::before {
    transform: none;
  }
}

.btn-variant__counter {
  color: #94a3b8;
  font-size: 0.6875rem;
  margin-left: 0.25rem;
  padding-left: 0.375rem;
  border-left: 1px solid #e2e8f0;
}

.template-placeholder {
  color: #94a3b8;
  font-style: italic;
  font-family: system-ui, -apple-system, sans-serif;
}

/* ===== RIGHTS ===== */

.rights-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .rights-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.rights-card {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  text-align: center;
}

.rights-card__icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  color: #2563eb;
}

.rights-card p {
  font-size: 0.9375rem;
  color: #555;
}

.rights-card a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.rights-card a:hover {
  border-bottom-color: #2563eb;
}

.rights-card__links {
  margin-top: 0.5rem;
  font-size: 0.8125rem !important;
  color: #94a3b8 !important;
}

.rights-card__links a {
  color: #64748b;
}

.rights-card__links a:hover {
  color: #2563eb;
}

/* ===== CTA ===== */

.section--cta {
  padding: 5rem 0;
  text-align: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
}

.cta-quote {
  font-size: clamp(1.125rem, 3vw, 1.5rem);
  margin-bottom: 2rem;
  border: none;
  padding: 0;
}

.cta-quote p {
  margin-bottom: 0.5rem;
}

/* ===== FOOTER ===== */

.footer {
  padding: 2rem 0;
  text-align: center;
  font-size: 0.8125rem;
  color: #94a3b8;
  border-top: 1px solid #f1f5f9;
}

/* ===== TEMPLATE FIELDS ===== */

.template-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.template-field input,
.template-field select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #111;
  transition: border-color 0.2s;
}

.template-field input:focus,
.template-field select:focus {
  outline: none;
  border-color: #2563eb;
}

.template-field input::placeholder {
  color: #94a3b8;
}

.template-field input[readonly] {
  background: #f1f5f9;
  color: #64748b;
  cursor: default;
}

.template-field {
  position: relative;
}

.template-field__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.05rem;
  text-transform: uppercase;
}

.template-field--wide {
  grid-column: 1 / -1;
}

.template-field.is-hidden {
  display: none;
}

/* ===== REQUISITES SWITCH (small) ===== */

.requisites-field {
  grid-column: 1 / -1;
}

.requisites-field .switch-label {
  font-size: 0.75rem;
}

.requisites-field .switch {
  width: 36px;
  height: 20px;
}

.requisites-field .switch-track {
  border-radius: 10px;
}

.requisites-field .switch-track::before {
  width: 16px;
  height: 16px;
}

.requisites-field .switch-input:checked + .switch-track::before {
  transform: translateX(16px);
}

/* ===== SUGGEST DROPDOWN ===== */

.suggest-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 10;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  max-height: 200px;
  overflow-y: auto;
}

.suggest-dropdown.is-open {
  display: block;
}

.suggest-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: #334155;
  cursor: pointer;
  transition: background-color 0.1s;
}

.suggest-item:hover,
.suggest-item.active {
  background: #f1f5f9;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 639px) {
  .section {
    padding: 3rem 0;
  }

  .hero {
    padding: 3.5rem 0 3rem;
  }

  .step {
    padding: 1.25rem;
  }

  .rights-card {
    text-align: left;
  }

  .rights-card__icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
}
