/* ANCHOR: markdown_content_styles */
/* FSD: styles → markdown content styling */
/* REUSED: Design system colors and typography */
/* SCALED FOR: Rich content with Notion-like blocks */

/* ============================================
   MARKDOWN CONTENT BASE
   ============================================ */

.markdown-content {
  /* UPDATED COMMENTS: Base styles for all markdown content */
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 18px;
  line-height: 140%;
  letter-spacing: 0.01em;
  color: #FFFFFF;
  /* CRITICAL: Prevent content overflow */
  max-width: 100%;
  overflow: visible;
  overflow-x: visible;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
  
  /* CRITICAL: Prevent widows and orphans for better typography */
  orphans: 3;
  widows: 3;
}


/* CRITICAL: Ensure all child elements respect container width */
.markdown-content > * {
  max-width: 100%;
  box-sizing: border-box;
}

.project-page .markdown-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.project-page .markdown-content > * {
  margin: 0;
}

.project-content {
  overflow: visible;
}

/* ============================================
   PROJECT HEADER ELEMENTS
   ============================================ */

.project-header {
  /* UPDATED COMMENTS: Project hero section with new layout */
  margin-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 24px; /* Balanced spacing between title, meta row, description, team, hero */
}

.project-title {
  /* CRITICAL: Large prominent title - SF Pro Medium 86px */
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 86px;
  font-weight: 500; /* Medium */
  line-height: 100%;
  letter-spacing: -0.04em;
  margin: 0;
  color: #FFFFFF; /* Pure white */
}

.project-meta-row {
  /* CRITICAL: Horizontal row with tags, year, and read time */
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.project-tags {
  /* REUSED: Chips container for tags (fill available width) */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0; /* Allow shrinking */
}

.project-meta-item {
  /* UPDATED COMMENTS: Year and read time with icons - SF Pro 16px Regular */
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  font-weight: 400; /* Regular */
  color: #FFFFFF; /* Pure white */
  white-space: nowrap;
  flex-shrink: 0;
}

.project-meta-icon {
  /* CRITICAL: Icon styling */
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.project-meta-icon--light {
  /* UPDATED COMMENTS: Light icons (already white) - just add opacity */
  opacity: 0.6;
}

.project-meta-icon--dark {
  /* UPDATED COMMENTS: Dark icons - convert to white (SVG already has opacity in group) */
  filter: brightness(0) invert(1);
}

.project-summary {
  /* UPDATED COMMENTS: Short project description under meta row */
  margin: 0;
  font-size: 18px;
  line-height: 170%;
  color: rgba(255, 255, 255, 0.85);
  max-width: 820px;
}

.project-team-table {
  /* UPDATED COMMENTS: Reuse markdown table styling for team */
  margin: 0;
}

.project-team-table td:last-child {
  text-align: right;
  min-width: 28px;
  font-variant-numeric: tabular-nums;
}

.project-team-table td {
  padding: 14px 18px;
}

.project-hero {
  /* UPDATED COMMENTS: Full-bleed hero with side gutters */
  width: calc(100vw - 120px);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  margin-left: calc(50% - ((100vw - 120px) / 2));
  margin-right: 0;
}

.project-hero img {
  /* CRITICAL: Full width image */
  width: 100%;
  height: auto;
  display: block;
}

/* DEPRECATED: Old styles - keeping for backwards compatibility */
.project-meta {
  display: none;
}

.project-category,
.project-year {
  display: none;
}

.project-description {
  display: none;
}

.project-info {
  display: none;
}

.project-info-item {
  display: none;
}

.project-info-label {
  display: none;
}

.project-info-value {
  display: none;
}

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

.markdown-content h1 {
  font-size: 48px;
  font-weight: 700;
  line-height: 120%;
  letter-spacing: -0.03em;
  margin: 48px 0 24px 0; /* Уменьшено на 40%: было 80px/40px */
  color: #FFFFFF;
}

/* CRITICAL: First heading has less top margin */
.markdown-content h1:first-child {
  margin-top: 0;
}

.markdown-content h2 {
  font-size: 32px;
  font-weight: 600;
  line-height: 130%;
  letter-spacing: -0.02em;
  margin: 43px 0 19px 0; /* Уменьшено на 40%: было 72px/32px */
  color: #FFFFFF;
}

.markdown-content h3 {
  font-size: 24px;
  font-weight: 600;
  line-height: 140%;
  letter-spacing: -0.01em;
  margin: 34px 0 14px 0; /* Уменьшено на 40%: было 56px/24px */
  color: #FFFFFF;
}

.markdown-content h4 {
  font-size: 20px;
  font-weight: 600;
  line-height: 140%;
  margin: 29px 0 12px 0; /* Уменьшено на 40%: было 48px/20px */
  color: #FFFFFF;
}

.markdown-content h5,
.markdown-content h6 {
  font-size: 18px;
  font-weight: 600;
  line-height: 150%;
  margin: 24px 0 10px 0; /* Уменьшено на 40%: было 40px/16px */
  color: rgba(255, 255, 255, 0.9);
}

.markdown-content p {
  margin: 0 0 12px 0; /* Уменьшено на 40%: было 20px */
  color: rgba(255, 255, 255, 0.9);
  line-height: 140%;
  letter-spacing: 0.01em;
}

/* ============================================
   INLINE FORMATTING
   ============================================ */

.markdown-content strong {
  font-weight: 700;
  font-style: italic;
  color: #8C8C8C;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content code {
  /* CRITICAL: Inline code styling */
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #C248A3;
}

.markdown-content a {
  color: #C248A3;
  text-decoration: none;
  border-bottom: 1px solid rgba(194, 72, 163, 0.3);
  transition: border-color 0.2s ease;
}

.markdown-content a:hover {
  border-bottom-color: #C248A3;
}

/* ============================================
   LISTS
   ============================================ */

.markdown-content ul,
.markdown-content ol {
  margin: 0 0 12px 0; /* Уменьшено на 40%: было 20px */
  padding-left: 32px;
}

.markdown-content li {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.9);
  line-height: 140%;
  letter-spacing: 0.01em;
  padding-left: 8px;
}

.markdown-content li + li {
  margin-top: 12px;
}

/* CRITICAL: Custom bullet markers - minimalist gray */
.markdown-content ul li::marker {
  color: rgba(255, 255, 255, 0.4);
  font-size: 1.2em;
}

.markdown-content ol li::marker {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

/* UPDATED COMMENTS: Nested lists with different markers */
.markdown-content ul ul li::marker {
  content: '◦ ';
  color: rgba(255, 255, 255, 0.3);
}

.markdown-content ul ul ul li::marker {
  content: '▪ ';
  color: rgba(255, 255, 255, 0.2);
}

/* ============================================
   BLOCKQUOTES
   ============================================ */

.markdown-content blockquote {
  margin: 32px 0;
  padding-left: 24px;
  border: none;
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  padding: 20px 24px;
  border-radius: 12px;
}

/* CRITICAL: Hanging quotes for better visual alignment */
.markdown-content blockquote::before {
  content: '"';
  position: absolute;
  left: 12px;
  top: 4px;
  font-size: 40px;
  color: rgba(194, 72, 163, 0.3);
  font-family: Georgia, serif;
  line-height: 1;
}

/* ============================================
   CODE BLOCKS
   ============================================ */

.markdown-content pre {
  background: rgba(255, 255, 255, 0.05);
  padding: 24px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 32px 0;
}

.markdown-content pre code {
  /* UPDATED COMMENTS: Override inline code styles */
  background: none;
  padding: 0;
  border-radius: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  line-height: 160%;
}

/* ============================================
   IMAGES
   ============================================ */

.project-page .markdown-content > .image-gallery {
  width: calc(100vw - 120px);
  max-width: calc(100vw - 120px);
  margin-left: calc(50% - ((100vw - 120px) / 2));
  margin-right: 0;
}

.markdown-content img:not(.quote-icon) {
  /* CRITICAL: Standalone content images should center within their block */
  max-width: 100%;
  width: auto;
  height: auto;
  display: block;
  border-radius: 12px;
  margin: 0 auto;
  box-shadow: none;
  object-fit: contain;
}

.project-page .markdown-content > .markdown-image-block {
  width: calc(100vw - 120px);
  max-width: none;
  height: auto;
  display: flex;
  justify-content: center;
  border-radius: 12px;
  margin: 32px 0;
  margin-left: calc(50% - 50vw + 60px);
  margin-right: 0;
  box-shadow: none;
  box-sizing: border-box;
  padding: 0;
}

.markdown-image-block img {
  width: auto;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: inherit;
  margin: 0 auto;
  box-shadow: none;
  object-fit: contain;
}

.markdown-image {
  display: block;
  margin: 0 auto;
}

/* ============================================
   HORIZONTAL RULES
   ============================================ */

.chapter-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0;
}

.chapter-divider img {
  width: 24px;
  height: 24px;
  opacity: 0.4;
}

/* ============================================
   PROBLEM / SOLUTION BLOCK
   ============================================ */

.problem-solution {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 24px;
  align-items: start;
}

.problem-solution-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.15);
  align-self: stretch;
}

.problem-solution-col p {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 140%;
}

.problem-solution-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'SF Pro Display', 'SF Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 130%;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.problem-solution-title--problem {
  color: rgba(255, 255, 255, 0.5);
}

.problem-solution-title--solution {
  color: #23E63A;
}

.problem-solution-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.problem-solution-icon--problem {
  -webkit-mask-image: url('/assets/icons/material-symbols_block-outline.svg');
  mask-image: url('/assets/icons/material-symbols_block-outline.svg');
}

.problem-solution-icon--solution {
  -webkit-mask-image: url('/assets/icons/material-symbols_check.svg');
  mask-image: url('/assets/icons/material-symbols_check.svg');
}

/* ============================================
   TABLES
   ============================================ */

.markdown-table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  overflow: hidden;
}

.markdown-table thead {
  background: rgba(255, 255, 255, 0.05);
}

.markdown-table th {
  padding: 16px;
  text-align: left;
  font-weight: 400;
  font-size: 16px;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-table td {
  padding: 16px;
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.markdown-table tbody tr:last-child td {
  border-bottom: none;
}

.markdown-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.2s ease;
}

/* SCALED FOR: Sticky table headers on scroll */
.markdown-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

/* ============================================
   CALLOUT BLOCKS
   ============================================ */

.callout {
  /* CRITICAL: Notion-style callout component */
  display: flex;
  gap: 16px;
  padding: 20px;
  border-radius: 12px;
  margin: 32px 0;
  background: rgba(255, 255, 255, 0.05);
  border: none;
}

.callout-icon {
  /* CRITICAL: Monochrome SVG mask keeps the info icon color exact (#579DFF) */
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: block;
  margin-top: 0;
  background-color: #579DFF;
  -webkit-mask-image: url('/assets/icons/entypo_info-with-circle.svg');
  mask-image: url('/assets/icons/entypo_info-with-circle.svg');
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.callout-content {
  flex: 1;
  color: rgba(255, 255, 255, 0.9);
}

/* UPDATED COMMENTS: Callout variants */
.callout--info {
  background: rgba(255, 255, 255, 0.05);
}

.callout--warning {
  background: rgba(255, 255, 255, 0.05);
}

.callout--success {
  background: rgba(255, 255, 255, 0.05);
}

.callout--error {
  background: rgba(255, 255, 255, 0.05);
}

.callout--tip {
  background: rgba(255, 255, 255, 0.05);
}

.callout--note {
  background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   STATS BLOCKS
   ============================================ */

.stats-block {
  /* SCALED FOR: Key metrics display */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; /* Уменьшено в 2 раза: было 24px */
  margin: 48px 0;
}

.stat-item {
  padding: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  text-align: center;
  font-size: 16px;
  line-height: 150%;
  color: rgba(255, 255, 255, 0.9);
  transition: all 0.2s ease;
}

.stat-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

/* UPDATED COMMENTS: Regular weight numbers in stats - white for minimalism */
.stat-item strong {
  display: block;
  font-size: 32px;
  font-weight: 500;
  color: #FFFFFF;
  font-style: normal;
  opacity: 0.5;
  margin-bottom: 8px;
}

/* ============================================
   IMAGE GALLERY
   ============================================ */

.image-gallery {
  /* UPDATED COMMENTS: Full-bleed gallery matching standalone image width */
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 24px 0;
  width: calc(100vw - 120px);
  max-width: calc(100vw - 120px);
  margin-left: calc(50% - ((100vw - 120px) / 2));
  margin-right: 0;
  box-shadow: none;
}

.image-gallery-row {
  display: grid;
  gap: 8px;
  width: 100%;
}

.image-gallery-row--1 {
  grid-template-columns: minmax(0, 1fr);
}

.image-gallery-row--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-gallery-row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.image-gallery-row--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.markdown-gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: none;
}

.image-gallery-row .markdown-gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  width: 100%;
  max-width: none;
  align-self: stretch;
  box-shadow: none;
}

.markdown-gallery-item img {
  /* CRITICAL: Fit within gallery item while preserving aspect ratio */
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  margin: 0;
  box-shadow: none;
  transition: none;
  /* UPDATED COMMENTS: Prevent overflow in gallery */
  object-fit: cover;
}

.image-gallery-row .markdown-gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
  box-shadow: none;
  object-fit: cover;
}

/* REMOVED: .gallery-item:hover img scale animation - conflicts with universal gallery-shared.css */

/* ============================================
   VIDEO EMBEDS
   ============================================ */

.video-embed {
  /* CRITICAL: Responsive video container */
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  margin: 48px 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-error {
  padding: 24px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
}

/* ============================================
   QUOTE BLOCKS
   ============================================ */

.quote-block {
  /* REUSED: Note-like quote block styled from Figma */
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  margin: 32px 0;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  border: none;
  box-sizing: border-box;
}

.quote-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  opacity: 0.3;
  margin-top: 0;
  display: block;
  max-width: 24px;
  max-height: 24px;
  object-fit: contain;
}

.quote-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.quote-text {
  font-size: 20px;
  font-weight: 400;
  line-height: 130%;
  color: rgba(255, 255, 255, 0.95);
}

.quote-author {
  font-size: 16px;
  font-style: italic;
  font-weight: 400;
  line-height: 130%;
  text-align: right;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.7);
}

/* ============================================
   METRICS BLOCKS
   ============================================ */

.metrics-block {
  /* SCALED FOR: Before/After comparisons */
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 48px 0;
  padding: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-row--single {
  justify-content: flex-start;
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-label {
  font-weight: 600;
  color: #FFFFFF;
  flex: 0 0 200px;
}

.metric-row--single .metric-label {
  flex: 1;
  min-width: 0;
}

.metric-value {
  flex: 0 0 auto;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  text-align: right;
  white-space: nowrap;
}

.metric-values {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: flex-end;
}

.metric-before {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: line-through;
}

.metric-arrow {
  color: rgba(255, 255, 255, 0.3);
}

.metric-after {
  color: #22C55E;
  font-weight: 600;
}

.metric-impact {
  padding: 4px 12px;
  background: rgba(194, 72, 163, 0.2);
  border-radius: 6px;
  font-size: 14px;
  color: #C248A3;
  font-weight: 600;
}

/* ============================================
   PIE CHART BLOCKS
   ============================================ */

.piechart-block {
  /* CRITICAL: Minimalist pie chart with legend */
  display: flex;
  align-items: center;
  gap: 48px;
  margin: 48px 0;
  padding: 32px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
}

.piechart-svg-container {
  /* UPDATED COMMENTS: SVG container with fixed size */
  flex-shrink: 0;
  width: 280px;
  height: 280px;
}

.piechart-svg {
  /* CRITICAL: SVG viewBox for responsive scaling */
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* Start from top */
}

.piechart-segment {
  /* REUSED: Smooth transitions for hover effects */
  transition: opacity 0.2s ease, filter 0.2s ease;
  cursor: pointer;
}

/* CRITICAL: Hover state - brighten segment */
.piechart-segment:hover {
  filter: brightness(1.2);
}

/* UPDATED COMMENTS: Dim non-hovered segments when segment is hovered */
.piechart-block:has(.piechart-segment:hover) .piechart-segment:not(:hover) {
  opacity: 0.3;
}

/* CRITICAL: Dim all segments except hovered when legend item is hovered */
.piechart-block:has(.piechart-legend-item:hover) .piechart-segment {
  opacity: 0.3;
}

/* UPDATED COMMENTS: Highlight specific segment when its legend item is hovered */
.piechart-block:has(.piechart-legend-item[data-segment-index="0"]:hover) .piechart-segment[data-segment-index="0"],
.piechart-block:has(.piechart-legend-item[data-segment-index="1"]:hover) .piechart-segment[data-segment-index="1"],
.piechart-block:has(.piechart-legend-item[data-segment-index="2"]:hover) .piechart-segment[data-segment-index="2"],
.piechart-block:has(.piechart-legend-item[data-segment-index="3"]:hover) .piechart-segment[data-segment-index="3"],
.piechart-block:has(.piechart-legend-item[data-segment-index="4"]:hover) .piechart-segment[data-segment-index="4"],
.piechart-block:has(.piechart-legend-item[data-segment-index="5"]:hover) .piechart-segment[data-segment-index="5"] {
  filter: brightness(1.2);
  opacity: 1;
}

.piechart-legend {
  /* SCALED FOR: Legend items list */
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.piechart-legend-item {
  /* UPDATED COMMENTS: Legend item with color indicator + hover interaction */
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

/* CRITICAL: Hover state for legend items */
.piechart-legend-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* UPDATED COMMENTS: Dim non-hovered legend items when one is active */
.piechart-block:has(.piechart-legend-item:hover) .piechart-legend-item:not(:hover) {
  opacity: 0.4;
}

/* CRITICAL: Highlight legend when segment is hovered */
.piechart-block:has(.piechart-segment[data-segment-index="0"]:hover) .piechart-legend-item[data-segment-index="0"],
.piechart-block:has(.piechart-segment[data-segment-index="1"]:hover) .piechart-legend-item[data-segment-index="1"],
.piechart-block:has(.piechart-segment[data-segment-index="2"]:hover) .piechart-legend-item[data-segment-index="2"],
.piechart-block:has(.piechart-segment[data-segment-index="3"]:hover) .piechart-legend-item[data-segment-index="3"],
.piechart-block:has(.piechart-segment[data-segment-index="4"]:hover) .piechart-legend-item[data-segment-index="4"],
.piechart-block:has(.piechart-segment[data-segment-index="5"]:hover) .piechart-legend-item[data-segment-index="5"] {
  background-color: rgba(255, 255, 255, 0.05);
  opacity: 1;
}

.piechart-legend-color {
  /* CRITICAL: Color indicator circle */
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
}

.piechart-legend-text {
  /* REUSED: Text content container */
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.piechart-legend-label {
  /* UPDATED COMMENTS: Label text - white regular */
  font-size: 16px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  line-height: 140%;
}

.piechart-legend-value {
  /* CRITICAL: Percentage and time - dimmed */
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  line-height: 140%;
}

.piechart-error {
  /* REUSED: Error state styling */
  padding: 24px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
}

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

@media (max-width: 768px) {
  .markdown-content {
    font-size: 16px;
  }
  
  .markdown-content h1 {
    font-size: 32px;
    margin: 38px 0 19px 0; /* Уменьшено на 40%: было 64px/32px */
  }
  
  .markdown-content h1:first-child {
    margin-top: 0;
  }
  
  .markdown-content h2 {
    font-size: 24px;
    margin: 34px 0 14px 0; /* Уменьшено на 40%: было 56px/24px */
  }
  
  .markdown-content h3 {
    font-size: 20px;
    margin: 29px 0 12px 0; /* Уменьшено на 40%: было 48px/20px */
  }
  
  .markdown-content h4 {
    font-size: 18px;
    margin: 24px 0 10px 0; /* Уменьшено на 40%: было 40px/16px */
  }
  
  .markdown-content p {
    margin-bottom: 10px; /* Уменьшено на ~40%: было 16px */
    line-height: 140%;
    letter-spacing: 0.01em;
  }
  
  /* UPDATED COMMENTS: Disable drop cap on mobile */
  
  /* UPDATED COMMENTS: Smaller hanging quotes on mobile */
  .markdown-content blockquote::before {
    font-size: 36px;
    left: -8px;
    top: -4px;
  }
  
  .quote-block {
    gap: 12px;
    padding: 20px;
    border-radius: 20px;
  }

  .quote-text {
    font-size: 18px;
    line-height: 140%;
  }

  .quote-author {
    font-size: 14px;
  }
  
  /* UPDATED COMMENTS: Project header responsive */
  .project-title {
    font-size: 40px;
  }
  
  .project-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .project-tags {
    width: 100%;
  }
  
  .project-meta-item {
    font-size: 14px;
  }
  
  .project-meta-icon {
    width: 14px;
    height: 14px;
  }

  .project-summary {
    font-size: 16px;
    line-height: 160%;
  }

  .project-team-table td {
    padding: 12px 14px;
    font-size: 14px;
  }

  .project-hero {
    width: calc(100vw - 32px);
    margin-left: calc(50% - ((100vw - 32px) / 2));
    margin-right: 0;
  }

  .project-page .markdown-content > .markdown-image-block {
    width: calc(100vw - 32px);
    max-width: none;
    margin-left: calc(50% - 50vw + 16px);
    margin-right: 0;
  }

  .project-page .markdown-content > .image-gallery {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    margin-left: calc(50% - ((100vw - 32px) / 2));
    margin-right: 0;
  }
  
  .stats-block {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .image-gallery {
    gap: 8px;
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    margin-left: calc(50% - ((100vw - 32px) / 2));
    margin-right: 0;
  }

  .image-gallery-row {
    gap: 8px;
  }

  .image-gallery-row--2,
  .image-gallery-row--3,
  .image-gallery-row--4 {
    grid-template-columns: 1fr;
  }
  
  .metric-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .metric-label {
    flex: none;
  }
  
  .metric-values {
    justify-content: flex-start;
  }

  .metric-value {
    text-align: left;
    white-space: normal;
  }
  
  /* CRITICAL: Disable sticky headers on mobile for better performance */
  .markdown-table thead {
    position: relative;
  }
  
  /* UPDATED COMMENTS: Pie chart responsive - stack vertically on mobile */
  .piechart-block {
    flex-direction: column;
    gap: 32px;
    padding: 24px;
  }
  
  .piechart-svg-container {
    width: 220px;
    height: 220px;
  }
  
  .piechart-legend {
    width: 100%;
  }

  .problem-solution {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .problem-solution-divider {
    width: 100%;
    height: 1px;
  }
}
