@import url('https://fonts.googleapis.com/css2?family=Alegreya:ital,wght@0,400..900;1,400..900&display=swap');

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

*, html, body, form, ul, ol, li {
  margin: 0;
  padding: 0;
}

html, body {
  font-family: "Alegreya", serif;
  display: block;
}

	:root {
		--bg-color: #13110B;
		--primary-color: #F7E573;
		--secondary-color: #AC6F50;
		--tertiary-color: #65252D;
		--text-secondary: #C79B9B;
		--highlight-bg: #65252D;
	}

	body {
		background-color: #fffffb;
	}

	/* Общие стили */
.gorky-letters-page {
  position: relative;
  min-height: 100vh;
  background-color: var(--bg-color);
  padding: 0;
  margin: 0;
  overflow: hidden;
}

/* Фоновое изображение Горького */
.gorky-letters-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('/wp-content/uploads/gorkiy-letters.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 0.3;
  filter: grayscale(40%) blur(1px);
  z-index: 1;
}

/* Градиентный оверлей для улучшения читаемости */
.gorky-letters-page::after {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at center, transparent 20%, var(--bg-color) 70%),
    linear-gradient(to bottom, rgba(19, 17, 11, 0.4), rgba(19, 17, 11, 0.8));
  z-index: 2;
}

.search-section {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: clamp(1rem, 5vw, 2.5rem);
}

.search-container {
  width: 100%;
  max-width: min(800px, 90vw);
  text-align: center;
}

.page-title {
  color: var(--primary-color);
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 300;
  margin-bottom: clamp(2rem, 5vh, 2.5rem);
  letter-spacing: 0.5px;
  line-height: 1.3;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

/* Поисковая строка */
.search-wrapper {
  position: relative;
  max-width: 100%;
  margin: 0 auto clamp(1rem, 3vh, 1.25rem);
}

#gorky-search {
  font-family: "PT Serif", serif;
  width: 100%;
  padding: clamp(1rem, 3vw, 1.125rem) clamp(3.5rem, 10vw, 3.75rem) clamp(1rem, 3vw, 1.125rem) clamp(1.25rem, 4vw, 1.5rem);
  font-size: clamp(1rem, 3vw, 1.125rem);
  border: 2px solid var(--secondary-color);
  border-radius: 12px;
  background-color: rgba(247, 229, 115, 0.05);
  color: var(--primary-color);
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#gorky-search::placeholder {
  color: var(--secondary-color);
  text-align: center;
  font-family: "PT Serif", serif;
}

#gorky-search:focus::placeholder {
  color: var(--primary-color);
  opacity: 0.7;
}

#gorky-search:focus {
  border-color: var(--primary-color);
  background-color: rgba(247, 229, 115, 0.1);
  box-shadow: 
    0 0 0 3px rgba(247, 229, 115, 0.15),
    0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Иконка поиска */
.search-icon {
  position: absolute;
  right: clamp(0.75rem, 2vw, 1rem);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-icon svg {
  width: clamp(32px, 5vw, 40px);
  height: clamp(40px, 6vw, 50px);
}

.search-icon path {
  fill: var(--secondary-color);
  transition: fill 0.3s ease;
}

#gorky-search:focus + .search-icon path {
  fill: var(--primary-color);
}

/* Результаты поиска */
#search-results {
  position: relative;
  z-index: 4;
  max-width: 100%;
  margin-top: clamp(1rem, 2vh, 1.5rem);
  background: rgba(19, 17, 11, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(172, 111, 80, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

	.search-loading {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 30px;
		gap: 15px;
	}

	.loading-spinner {
		width: 20px;
		height: 20px;
		border: 2px solid rgba(247, 229, 115, 0.3);
		border-top: 2px solid var(--primary-color);
		border-radius: 50%;
		animation: spin 1s linear infinite;
	}

	.loading-text {
		color: var(--primary-color);
		font-size: 16px;
	}

	@keyframes spin {
		0% { transform: rotate(0deg); }
		100% { transform: rotate(360deg); }
	}

	/* Заголовки и разделы */
	.results-title {
		background-color: var(--secondary-color);
		color: var(--primary-color);
		font-size: 20px;
		font-weight: 500;
		padding: 1rem;
	}

	.stat-item {
		display: inline-block;
		margin-left: 20px;
		font-size: 16px;
		font-weight: normal;
	}

	.stat-item a {
		color: var(--primary-color);
		text-decoration: none;
		border-bottom: 1px dotted rgba(247, 229, 115, 0.5);
		transition: border-color 0.2s;
	}

	.stat-item a:hover {
		border-bottom-color: var(--primary-color);
	}

	/* Блоки адресатов */
	.recipient-block {
		border-bottom: 1px solid rgba(172, 111, 80, 0.2);
	}

	.recipient-block:last-child {
		border-bottom: none;
	}

	.recipient-header {
		display: flex;
		align-items: center;
		padding: 1rem;
		background-color: rgba(172, 111, 80, 0.1);
		gap: 1rem;
		margin-bottom: 1rem;
	}

	.recipient-avatar {
		width: 110px;
		height: 110px;
		border-radius: 50%;
		object-fit: cover;
		border: 2px solid var(--secondary-color);
		flex-shrink: 0;
	}

	.recipient-info {
		flex: 1;
		text-align: left;
	}

	.recipient-name {
		color: var(--primary-color);
		font-size: 24px;
		font-weight: 600;
		margin: 0 0 8px;
	}

	mark {
		background-color: var(--highlight-bg);
		color: var(--primary-color);
		padding: 0;
		border-radius: 3px;
	}

	.recipient-stats {
		display: flex;
		gap: 20px;
		font-size: 14px;
		color: var(--text-secondary);
	}

	.recipient-stats strong {
		color: var(--primary-color);
	}

.column-title .letters-list, .column-title .mentions-list {
padding: 0;
}

.search-results-section > .letters-list {
padding: 1rem 2rem 0.75rem 1rem;
}

	.letter-item {
		display: block;
		padding: 10px 0;
		border-bottom: 1px solid rgba(172, 111, 80, 0.1);
		transition: background-color 0.2s;
		text-decoration: none;
		color: inherit;
	}

	.letter-title {
		text-decoration: none;
		color: var(--text-secondary);
		font-size: 20px;
		font-weight: 600;
		line-height: 1;
		text-align: left;
	}

	.letter-title:hover {
		color: var(--primary-color);
	}

	.letter-header {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		margin-bottom: 8px;
		gap: 1rem;
	}

	.letter-header h3 {
		font-size: 20px;
		font-weight: 600;
		margin: 0;
		flex: 1;
		line-height: 1.3;
	}

	.letter-date {
		color: inherit;
		font-size: 1rem;
		line-height: 1.3;
		font-weight: normal;
		flex-shrink: 0;
	}

	.letter-excerpt {
		color: inherit;
		font-size: 1rem;
		line-height: 1.3;
		margin-top: 8px;
		text-align: left;
		font-weight: 400;
	}

	/* Упоминания */
	.mentions-block, .mentions-summary {
		padding: 20px 24px;
		background-color: rgba(101, 37, 45, 0.1);
		border-top: 1px solid rgba(101, 37, 45, 0.3);
	}

	.mentions-block p, .mentions-summary p {
		color: var(--text-secondary);
		margin: 0 0 10px;
		font-size: 16px;
	}

	.mentions-block strong, .mentions-summary strong {
		color: var(--primary-color);
	}

	.show-mentions, .show-all-letters, .show-more-mentions {
		color: var(--primary-color);
		text-decoration: none;
		font-size: 16px;
		border-bottom: 1px dotted rgba(247, 229, 115, 0.5);
		transition: border-color 0.2s;
	}

	.show-mentions:hover, 
	.show-all-letters:hover,
	.show-more-mentions:hover {
		border-bottom-color: var(--primary-color);
	}

	.show-more-mentions {
		color: var(--tertiary-color);
	}

	/* Кнопки */
	.show-more {
		padding: 16px 24px;
		text-align: center;
		border-bottom: 1px solid rgba(172, 111, 80, 0.1);
	}

	.show-more a {
		color: var(--secondary-color);
		text-decoration: none;
		font-size: 16px;
		font-weight: 500;
		padding: 8px 16px;
		border: 1px solid var(--secondary-color);
		border-radius: 4px;
		display: inline-block;
		transition: all 0.2s;
	}

	.show-more a:hover {
		background-color: var(--secondary-color);
		color: var(--primary-color);
	}

	/* Сообщения */
	.search-no-results, 
	.search-error,
	.no-mentions {
		padding: 40px 24px;
		text-align: center;
		color: var(--text-secondary);
		font-size: 16px;
		font-style: italic;
	}

	.search-error {
		color: var(--tertiary-color);
	}

	/* Колонки */
	.recipient-content-columns {
		display: flex;
		gap: 2px;
		background-color: rgba(19, 17, 11, 0.5);
	}

	.letters-column,
	.mentions-column {
		flex: 1;
		text-align: left;
		margin: 0 1rem;
	}

	.column-title {
		color: var(--primary-color);
		font-size: 1rem;
		border-bottom: 1px solid rgba(172, 111, 80, 0.3);
		text-align: left;
		font-weight: 400;
		padding: 0 0 0.55rem;
		margin: 0;
	}

	/* Особые элементы */
	.letter-recipient {
		color: var(--text-secondary);
		font-size: 14px;
		margin: 4px 0 8px;
		font-style: italic;
	}

	.letter-recipient::before {
		content: "→ ";
		color: var(--secondary-color);
	}

	.keyboard-focus {
		background-color: rgba(247, 229, 115, 0.1) !important;
		outline: 2px solid var(--primary-color);
		outline-offset: -2px;
	}

	/* Адаптивность */
	@media (max-width: 768px) {
		
		  .gorky-letters-page::before {
    background-attachment: scroll;
    background-position: center top;
  }
  
  .page-title {
    letter-spacing: 0;
  }
		
  #gorky-search {
    border-radius: 10px;
  }
  
		.recipient-header {
			flex-direction: column;
			text-align: center;
			gap: 15px;
			padding: 16px;
		}
		
		.recipient-avatar {
			width: 50px;
			height: 50px;
		}
		
		.recipient-name {
			font-size: 20px;
		}
		
		.recipient-stats {
			justify-content: center;
			flex-wrap: wrap;
			gap: 15px;
		}
		
		.letter-header {
			flex-direction: column;
			align-items: flex-start;
			gap: 8px;
		}
		
		.letter-header h3 {
			font-size: 16px;
		}
		
		.results-title {
			font-size: 18px;
			padding: 16px 20px;
		}
		
		.stat-item {
			display: block;
			margin: 8px 0 0;
			font-size: 15px;
		}
		
		.recipient-content-columns {
			flex-direction: column;
		}
		
		.letters-column {
			border: none;
		}
		
		.column-title {
			padding: 10px 16px;
			font-size: 15px;
		}
		
		.mentions-summary {
			padding: 16px;
		}
	}

	@media (max-width: 480px) {
  .search-section {
    padding: 1rem;
  }
  
    .gorky-letters-page::before {
    filter: grayscale(50%) blur(2px);
    opacity: 0.25;
  }
		
		.letter-item, 
		.mentions-block, 
		.show-more,
		.mentions-summary {
			padding-left: 16px;
			padding-right: 16px;
		}
		
		.results-title {
			padding: 14px 16px;
			font-size: 16px;
		}
	}
	
/* Высокие экраны */
@media (min-height: 900px) {
  .search-section {
    min-height: 100vh;
  }
}
	
	/* Улучшенная доступность */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  
  .gorky-letters-page::before {
    background-attachment: scroll;
  }
}

/* Landscape на мобильных */
@media (max-height: 600px) and (orientation: landscape) {
  .search-section {
    min-height: auto;
    padding: 2rem 1rem;
  }
  
  .page-title {
    margin-bottom: 1.5rem;
  }
}



/* Основные стили для страниц с письмами */
.text-page-container {
	min-height: 100vh;
	background: #fffffb;
	padding: 2rem 0;
}

.text-content-wrapper {
	max-width: 1180px;
	margin: 0 auto;
	padding: 0 1rem;
}

.text-title {
	font-size: 5.6rem;
	color: var(--highlight-bg);
	line-height: 1.1;
	font-weight: bold;
	margin-bottom: 6px;
	word-wrap: break-word;
	hyphens: auto;
}

.text-meta {
	font-size: 2.5rem;
	line-height: 1.2;
	color: var(--highlight-bg);
	font-style: normal;
}

.text-body {
	padding: 0;
	margin: 2rem 0;
}

/* Типографика для текста письма */
.text-body h1,
.text-body h2,
.text-body h3,
.text-body h4,
.text-body h5,
.text-body h6 {
	color: var(--highlight-bg);
	font-weight: normal;
	word-wrap: break-word;
}

.text-body h1 { font-size: 1.5rem; }
.text-body h2 {  }
.text-body h3 {  }

.text-body p {
	font-size: 1.6rem;
	line-height: 1.45;
	color: var(--bg-color);
	margin-bottom: 0.75rem;
	text-align: left;
	hyphens: auto;
	word-wrap: break-word;
}

.text-body p:first-child {
	margin-top: 0;
}

.text-body p:last-child {
	margin-bottom: 0;
}

/* Кавычки и цитаты */
.text-body blockquote {
  border-left: 4px solid var(--secondary-color);
  padding-left: 2rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--tertiary-color);
  position: relative;
  word-wrap: break-word;
}

.text-body blockquote::before {
  content: '"';
  font-size: 4rem;
  color: var(--secondary-color);
  position: absolute;
  left: -1rem;
  top: -1rem;
  opacity: 0.3;
}

/* Списки */
.text-body ul,
.text-body ol {
	margin: 1.5rem 0;
	padding-left: 2rem;
}

.text-body li {
	margin-bottom: 0.5rem;
	line-height: 1.6;
	word-wrap: break-word;
}

/* Навигация между письмами */
.nav-links {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	gap: 55px;
	flex-wrap: wrap;
}

.nav-item {
	margin-left: -1rem;
	flex: 1;
	min-width: 250px;
}

.nav-item:hover {
	background: rgba(247, 229, 115, 0.2);
}

.nav-link, .nav-link:visited {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem;
	color: var(--text-secondary);
	text-decoration: none;
	width: 100%;
	transition: color 0.3s ease;
}

.nav-link-content {
	display: flex;
	flex-direction: column;
	gap: 0;
	flex-grow: 1;
}

.nav-label {
	font-size: 2.5rem;
	font-weight: 600;
	color: var(--secondary-color);
}

.nav-label {
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--tertiary-color);
  word-wrap: break-word;
  hyphens: auto;
}

.nav-title, .nav-year {
	font-size: 20px;
}

/* Планшеты и небольшие десктопы */
@media screen and (max-width: 1200px) {
  .text-content-wrapper {
	max-width: 95%;
	padding: 0 2rem;
  }
  
  .nav-links {
	gap: 2rem;
  }
}

/* Планшеты */
@media screen and (max-width: 768px) {
  .text-page-container {
	padding: 0.5rem 0;
  }
  
  .text-content-wrapper {
	padding: 0 0.5rem;
  }
  
  .text-title {
	font-size: 3.8rem;
	margin-bottom: 8px;
  }
  
  .text-meta {
	font-size: 1.8rem;
  }
  
  .text-body {
	margin: 1.5rem 0;
  }
  
  .text-body p {
	font-size: 1.4rem;
	line-height: 1.5;
  }
  
  .text-body h1 { 
	font-size: 1.3rem; 
  }
  
  .text-body blockquote {
	padding-left: 1.5rem;
	margin: 1.5rem 0;
  }
  
  .text-body blockquote::before {
	font-size: 3rem;
	left: -0.8rem;
	top: -0.8rem;
  }
  
  .nav-links {
	flex-direction: column;
	gap: 1rem;
  }
  
  .nav-item {
	margin-left: 0;
	min-width: auto;
	width: 100%;
  }
  
  .nav-label {
	font-size: 1.8rem;
  }
  
  .nav-title, .nav-year {
	font-size: 1.1rem;
  }
}

/* Мобильные устройства */
@media screen and (max-width: 480px) {
  .text-page-container {
	padding: 0.5rem 0;
  }
  
  .text-content-wrapper {
	padding: 0 0.5rem;
  }
  
  .text-title {
	font-size: 2.8rem;
	line-height: 1.2;
  }
  
  .text-meta {
	font-size: 1.4rem;
	line-height: 1.3;
  }
  
  .text-body p {
	font-size: 1.2rem;
	line-height: 1.6;
  }
  
  .text-body h1 { 
	font-size: 1.2rem; 
  }
  
  .text-body blockquote {
	padding-left: 1rem;
	margin: 1rem 0;
  }
  
  .text-body blockquote::before {
	font-size: 2.5rem;
	left: -0.5rem;
	top: -0.5rem;
  }
  
  .text-body ul,
  .text-body ol {
	padding-left: 1.5rem;
	margin: 1rem 0;
  }
  
  .nav-label {
	font-size: 1.4rem;
	line-height: 1.3;
  }
  
  .nav-title, .nav-year {
	font-size: 1rem;
  }
  
  .nav-link {
	padding: 0.8rem;
  }
}

/* Очень маленькие экраны */
@media screen and (max-width: 320px) {
  .text-title {
	font-size: 2.2rem;
  }
  
  .text-meta {
	font-size: 1.2rem;
  }
  
  .text-body p {
	font-size: 1.1rem;
  }
  
  .nav-label {
	font-size: 1.2rem;
  }
}

/* Печать */
@media print {
	.text-page-container {
		background: white;
		padding: 0;
	}
	
	.text-header {
		background: none;
		border: 1px solid #ccc;
		page-break-inside: avoid;
	}
	
	.text-body {
		box-shadow: none;
		border: 1px solid #ccc;
	}
	
	.text-navigation {
		display: none;
	}
}