/**
 * ==========================================================================
 * MIPPAN - Main Stylesheet
 * 
 * Table of Contents:
 * 1. Variables & Custom Properties
 * 2. Reset & Base Styles
 * 3. Typography
 * 4. Layout & Grid
 * 5. Global Components (Header, Footer, Buttons, CTA)
 * 6. Page Sections (Hero, Problems, Method, Cases, Process, Formats, Trust, FAQ, Articles)
 * 7. Animations & Utilities
 * 8. UI Widgets (Sitemap)
 * 9. Inner Pages (Symptoms, 404, Quiz, Forms)
 * 10. Media Queries (Responsive)
 * ==========================================================================
 */

/* 1. Variables & Custom Properties */
:root {
  --bg-color: #f4f4f2;
  --text-color: #0f0f0f;
  --gray-color: #c2c2c2;
  --accent-color: #ff3300;
  --coral-color: #ff997f;
  --border-color: rgba(15, 15, 15, 0.12);

  --font-heading: "Clash Display", sans-serif;
  --font-body: "Satoshi", sans-serif;

  --grid-gap: 24px;
}

/* 2. Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

/* 4. Layout & Grid */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 2rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--grid-gap);
}

/* 3. Typography */
h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  text-transform: uppercase;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.title-huge {
  font-size: clamp(4rem, 11vw, 7rem);
  font-weight: 600;
}
.title-large {
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 500;
}
.title-medium {
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 500;
}

/* Typewriter Cursor */
.typewriter-cursor {
  display: inline-block;
  width: clamp(4px, 0.8vw, 10px);
  height: 0.9em;
  background-color: var(--accent-color);
  margin-left: 0.1em;
  vertical-align: baseline;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* 5. Global Components */
/* Header */
.site-header {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-color);
  z-index: 100;
}

.nav-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.04em;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  position: relative;
  letter-spacing: 0.05em;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--text-color);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--text-color);
  color: var(--bg-color);
  padding: 1rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 14px;
  line-height: 1;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  transition:
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.4s;
  border-radius: 2px;
}

.btn:hover {
  background: var(--accent-color);
  transform: translateY(-2px);
}

.btn-large {
  padding: 1.75rem 5rem;
  font-size: 1.5rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
}
.btn-outline:hover {
  transform: translateY(-3px);

  border-color: var(--text-color);
  background: var(--text-color);
  color: var(--bg-color);
}

.btn-accent {
  background: var(--accent-color);
  color: var(--bg-color);
}

.btn-accent:hover {
  background: var(--bg-color);
  color: var(--text-color);
}

/* 7. Animations & Utilities */
.reveal {
  opacity: 0;
  transform: translateY(60px);
  transition:
    opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger Delays */
.stagger-1 {
  transition-delay: 0.15s;
}
.stagger-2 {
  transition-delay: 0.3s;
}
.stagger-3 {
  transition-delay: 0.45s;
}
.stagger-4 {
  transition-delay: 0.6s;
}

/* Remove delays if active happens on scroll to avoid feeling stuck, but CSS handles it gracefully if needed */

/* 6. Page Sections */
/* Base Sections */
section {
  padding: 10rem 0;
  border-bottom: 1px solid var(--border-color);
}

section:last-of-type {
  border-bottom: none;
}

.section-label {
  grid-column: 1 / 5;
  position: sticky;
  top: 8rem;
  align-self: start;
}

.section-label h2 {
  font-size: clamp(2.5rem, 4vw, 4.5rem);
}

/* Hero */
.hero {
  padding: 8rem 0;
}

.hero .title-huge {
  grid-column: 1 / 13;
  margin-bottom: 5rem;
}

.hero-subtitle {
  grid-column: 1 / 6;
  font-size: 1.5rem;
  opacity: 0.75;
  line-height: 1.4;
}

.hero-list {
  grid-column: 8 / 13;
  list-style: none;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}

.hero-list li {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-heading);
  font-size: 1.5rem;
  text-transform: uppercase;
  transition:
    padding-left 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    color 0.4s ease;
  cursor: pointer;
}

.hero-list li:first-child {
  border-top: 1px solid var(--border-color);
}

.hero-list li:hover {
  padding-left: 3rem;
  color: var(--accent-color);
}

/* Problems Grid */
.problems-grid {
  grid-column: 6 / 13;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--grid-gap);
}

.problem-card {
  border: 1px solid var(--border-color);
  padding: 3.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 380px;
  background-color: var(--bg-color);
  transition: all 0.4s ease;
}

.problem-card h3 {
  font-size: 2.25rem;
  margin-bottom: 1.5rem;
  line-height: 1.1;
}

.problem-card p {
  opacity: 0.7;
  margin-bottom: 2rem;
}

.card-icon {
  align-self: flex-end;
  width: 56px;
  height: 56px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s ease;
  font-size: 1.25rem;
}

.problem-card:hover {
  background-color: var(--text-color);
  color: var(--bg-color);
  transform: translateY(-10px);
  border-color: var(--text-color);
}

.problem-card:hover .card-icon {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--bg-color);
  transform: rotate(45deg);
}

/* Method Section */
.method-content {
  grid-column: 6 / 12;
  font-family: var(--font-heading);
  font-size: clamp(2rem, 3.5vw, 3.5rem);
  line-height: 1.15;
}

.method-content span {
  color: var(--accent-color);
}

/* Cases Section */
.cases-list {
  grid-column: 6 / 13;
  display: flex;
  flex-direction: column;
  gap: 5rem;
}

.case-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-color);
}

.case-img-wrap {
  overflow: hidden;
}

.case-card img {
  width: 100%;
  height: 480px;
  object-fit: cover;
  filter: grayscale(100%);
  transition:
    transform 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.8s ease;
}

.case-card:hover img {
  filter: grayscale(0%);
  transform: scale(1.04);
}

.case-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.case-tag {
  font-family: var(--font-heading);
  color: var(--accent-color);
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

.case-info h3 {
  font-size: 2.5rem;
  margin-bottom: 2.5rem;
  line-height: 1.1;
}

.case-stats p {
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
}

/* Process Section */
.process-wrapper {
  grid-column: 6 / 13;
}

.process-step {
  padding: 4rem 0;
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 2rem;
  transition: color 0.4s ease;
}

.process-step:hover {
  color: var(--accent-color);
}

.step-number {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 500;
}

.step-info h3 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

.step-info p {
  opacity: 0.75;
  font-size: 1.25rem;
}

/* Formats */
.formats-wrapper {
  grid-column: 6 / 13;
  position: relative;
}

.formats-grid {
  display: flex;
  gap: var(--grid-gap);
  overflow-x: auto;
  margin-right: -50vw; /* Хак, чтобы скроллинг уходил за правый край экрана */
  padding-right: 50vw; /* Компенсируем margin, чтобы можно было доскроллить до конца контента */
  scroll-snap-type: x mandatory;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.formats-grid::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

.format-card {
  border: 1px solid var(--border-color);
  padding: 4rem 3rem;
  background-color: var(--bg-color);
  width: 500px;
  flex-shrink: 0;
  scroll-snap-align: start;
  transition:
    background-color 0.4s ease,
    color 0.4s ease,
    border-color 0.4s ease,
    transform 0.4s ease;
}

.format-card h3,
.format-card p,
.format-card .price {
  transition: color 0.4s ease;
}

.format-card:hover {
  background-color: var(--text-color);
  color: var(--bg-color);
  transform: translateY(-8px);
}

.format-card h3 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.1;
}

.format-card p {
  opacity: 0.8;
}

.format-card .price {
  margin-top: 3rem;
  font-family: var(--font-heading);
  font-size: 1.75rem;
  color: var(--accent-color);
}

/* Trust Section */
.trust-grid {
  grid-column: 6 / 13;
  display: flex;
  gap: 1rem;
}

.trust-item h4 {
  font-size: clamp(3rem, 5vw, 5rem);
  color: var(--accent-color);
  margin-bottom: 1rem;
  letter-spacing: -0.04em;
}

.trust-item p {
  font-size: 1.125rem;
  opacity: 0.75;
}

/* FAQ */
.faq-list {
  grid-column: 6 / 13;
  border-top: 1px solid var(--border-color);
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
}

.faq-question {
  padding: 3rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: color 0.4s ease;
}

.faq-question h3 {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.75rem;
  text-transform: none;
  letter-spacing: normal;
}

.faq-icon {
  font-size: 2.5rem;
  font-weight: 300;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.6s ease;
  opacity: 0.8;
}

.faq-item.open .faq-answer {
  max-height: 300px;
  padding-bottom: 3rem;
}

.faq-item.open .faq-icon {
  transform: rotate(45deg);
  color: var(--accent-color);
}

/* Articles */
.articles-grid {
  grid-column: 6 / 13;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem var(--grid-gap);
}

.article-card {
  display: flex;
  flex-direction: column;
}

.article-img {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  margin-bottom: 2rem;
}

.article-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.article-card:hover .article-img img {
  transform: scale(1.05);
}

.article-meta {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  opacity: 0.6;
  font-weight: 500;
}

.article-card h3 {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.75rem;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.3;
}

/* CTA */
.cta {
  background: var(--text-color);
  color: var(--bg-color);
  text-align: center;
  border-bottom: none;
  padding: 12rem 0;
}

.cta h2 {
  grid-column: 1 / -1;
  margin-bottom: 5rem;
  /* color: var(--text-color); */
}

.cta .btn-wrapper {
  grid-column: 1 / -1;
}

/* Footer */
footer {
  padding: 4rem 0;
  border-top: 1px solid var(--border-color);
  background: var(--bg-color);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  text-transform: uppercase;
  font-weight: 500;
  opacity: 0.6;
  letter-spacing: 0.05em;
}

/* 10. Media Queries (Responsive) */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .section-label,
  .hero .title-huge,
  .hero-subtitle,
  .hero-list,
  .problems-grid,
  .method-content,
  .cases-list,
  .process-wrapper,
  .trust-grid,
  .formats-wrapper,
  .faq-list,
  .articles-grid {
    grid-column: 1 / -1;
  }

  .section-label {
    position: static;
    margin-bottom: 4rem;
  }

  .hero {
    padding: 8rem 0;
  }

  .problems-grid,
  .case-card,
  .articles-grid {
    grid-template-columns: 1fr;
  }

  .format-card {
    width: 85vw; /* На мобилках карточка занимает почти всю ширину экрана */
  }

  .nav-links {
    display: none;
  }

  .stagger-1,
  .stagger-2,
  .stagger-3,
  .stagger-4 {
    transition-delay: 0s;
  }
}

/* 8. UI Widgets */
/* Sitemap Widget */
.sitemap-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
}

.sitemap-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--text-color);
  color: var(--bg-color);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.4s;
}

.sitemap-toggle:hover {
  transform: scale(1.1);
  background: var(--accent-color);
}

.sitemap-toggle svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.sitemap-modal {
  position: absolute;
  bottom: calc(100% + 1rem);
  right: 0;
  width: 350px;
  max-height: 70vh;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.sitemap-modal.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sitemap-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-color);
}

.sitemap-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sitemap-header h3 {
  font-size: 1.25rem;
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
}

.sitemap-workflow-btn {
  display: block;
  text-align: center;
  padding: 0.7rem 1rem;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-color);
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 500;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.sitemap-workflow-btn:hover {
  background: var(--text-color);
  color: var(--bg-color);
}

.sitemap-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-color);
}

.sitemap-close {
  background: none;
  border: none;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-color);
  transition: color 0.3s;
  padding: 0;
  margin-top: -5px;
}

.sitemap-close:hover {
  color: var(--accent-color);
}

.sitemap-content {
  padding: 1.5rem;
  overflow-y: auto;
  font-family: var(--font-body);
}

.sitemap-content ul {
  list-style: none;
  padding-left: 0;
}

.sitemap-content > ul > li {
  margin-bottom: 1rem;
}

.sitemap-content a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 600;
  transition: color 0.3s;
  font-size: 1rem;
}

.sitemap-content a:hover {
  color: var(--accent-color);
}

.sitemap-content ul ul {
  padding-left: 1.5rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  border-left: 1px solid var(--border-color);
}

.sitemap-content ul ul li {
  margin-bottom: 0.5rem;
}

.sitemap-content ul ul a {
  font-weight: 400;
  opacity: 0.8;
  font-size: 0.95rem;
}

/* Sitemap Sections */
.sitemap-section {
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
  border: 1px dashed var(--border-color);
}

.sitemap-section:last-child {
  margin-bottom: 0;
}

.sitemap-section-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.sitemap-primary {
  background: rgba(255, 51, 0, 0.02); /* Very light tint of accent-color */
  border-color: rgba(255, 51, 0, 0.2);
}

.sitemap-primary .sitemap-section-title {
  color: var(--accent-color);
}

.sitemap-secondary {
  background: rgba(0, 0, 0, 0.02);
}

.sitemap-secondary .sitemap-section-title {
  color: var(--text-color);
  opacity: 0.7;
}

/* ==========================================================================
   9. Inner Pages Specific Styles (Symptoms, 404, Diagnostics, Cases, etc.)
   ========================================================================== */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main {
  flex: 1;
}

/* 404 Page */
.hero-404 {
  width: 100%;
  padding: 8rem 0;
}

/* Symptoms Grid (Problems Pages) */
.symptoms-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}
.symptom-card {
  grid-column: span 4;
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  transition: border-color 0.3s;
}
.symptom-card:hover {
  border-color: var(--accent-color);
}
.symptom-card .icon {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}
.symptom-card h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}
.symptom-card p {
  opacity: 0.8;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Quiz Page Styles */
.quiz-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--card-bg);
  padding: 3rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}
.quiz-step {
  display: none;
}
.quiz-step.active {
  display: block;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}
.quiz-option {
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}
.quiz-option:hover {
  border-color: var(--accent-color);
  background: rgba(255, 51, 0, 0.05);
}
.quiz-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.quiz-step-text {
  color: var(--accent-color);
  font-weight: 600;
}
.quiz-progress {
  flex-grow: 1;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}
.quiz-progress-bar {
  height: 100%;
  background: var(--accent-color);
  width: 0%;
  transition: width 0.3s ease;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}
.form-control {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-body);
  font-size: 1rem;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.3s;
}
.form-control:focus {
  border-color: var(--accent-color);
}

@media (max-width: 1024px) {
  .symptom-card {
    grid-column: span 6;
  }
}
@media (max-width: 768px) {
  .symptom-card {
    grid-column: span 12;
  }
  .quiz-container {
    padding: 1.5rem;
  }
}

/* Highlighted Sitemap Items */
.sitemap-content li.highlight > a {
  color: var(--text-color);
  /* font-weight: 500; */
  position: relative;
  display: inline-block;
}
.sitemap-content li.highlight > a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--accent-color);
  opacity: 0.5;
  transition: opacity 0.3s;
}
.sitemap-content li.highlight > a:hover {
  color: var(--accent-color);
}
.sitemap-content li.highlight > a:hover::after {
  opacity: 1;
}
