/* Общие переменные и сброс стилей */
:root {
  --dark-bg: #000;
  --light-bg: #ddd;
  --dark-text: #ddd;
  --light-text: #222;
  --header-bg: linear-gradient(to right, #266fb6, #122394);
  --link-color: #1AE0FF;
  --link-hover: #3ff;
  --about-color: #8dd;
  --gold-accent: #FFD700;
  --section-bg: #1A1A1A;
  --work-list-bg: #333;
  --work-list-link-bg: #006;
}

.green { color: #1e1;}
.blue { color: #11e;}
.gold { color: #ec0;}
.white { color: #ddd;}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  min-height: 100vh;
}

body {
  font-family: Verdana, sans-serif;
  display: flex;
  flex-direction: column;
  background: var(--dark-bg);
  color: var(--dark-text);
  line-height: 1.5;
  transition: background 0.3s ease, color 0.3s ease;
}

body.light {
  background: var(--light-bg);
  color: var(--light-text);
}

/* Общие стили ссылок */
a {
  color: var(--link-color);
  text-decoration: none;
  font-size: 1.4rem;
  text-shadow: 0 0 2px rgba(20, 200, 220, 0.7);
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

body.light a {
  color: var(--light-text);
  text-shadow: none;
}

/* Шапка */
header {
  display: flex;
  align-items: center;
  max-height: 4rem;
  background: var(--header-bg);
  box-shadow: inset 0 0 0 1px rgb(32 188 188);
  padding: 0 1rem;
}

header h1 {
  flex: 1;
  text-align: center;
  color: #fc0;
  font-size: 1.8rem;
  padding: 1rem 0;
}

/* Темная/светлая тема */
.toggle-dark-light {
  text-align: center;
  flex: 0.15;
  margin: 1.25rem auto;
  font-size: 1.25rem;
  color: var(--dark-text);
}

body.light .toggle-dark-light {
  color: var(--light-text);
}

/* О сайте */
.about {
  position: relative;
  top: 1.5rem;
  display: flex;
  flex: 0.2;
  overflow: hidden;
  flex-direction: column;
  align-items: center;
  height: 400px
}

.about > a {
  display: block;
  margin: 160px 0;
}

.another {
  margin: -145px auto;
  opacity: 0;
  text-align: center;
  transition: opacity 0.3s ease;
}

.about:hover .another {
  opacity: 1;
  color: var(--about-color);
  border-radius: 0 0 8px 8px;
  background: #128;
}

.another a {
  display: block;
  padding: 1rem 10px;
  line-height: 1rem;
}

body.light a {
  color: #00f;
}

body.light .about a {
  color: #4dd;
}

/* Основной контент */
.main-page {
  margin: 0 0 0 2rem;
  font-size: 1.25rem;
  color: #ebebff;
}

body.light .main-page {
  color: #eea;
}

.main-content {
  flex: 1;
  padding: 1.5rem;
}

.authors-works {
  display: flex;
  gap: 5rem;
  max-width: 1400px;
  margin-left: 4rem;
}

.authors-works > a {
  display: block;
  font-size: 1.6rem;
  max-height: 3rem;
}

.author-section {
  max-width: 30rem;
}

.author-section li {
  padding: 5px 0;
  list-style: none;
}

.author-name {
  border-bottom: 2px solid #aaa;
  padding: 0 5px;
}

body.light .author-name {
  color: var(--light-text);
  border-bottom-color: var(--light-text);
}

ul.works-list {
  margin-top: 10px;
}

/* Страница статьи */
.three-divs {
  display: flex;
  width: 100%;
  min-height: 100vh;
  gap: 0.5rem;
}

details {
  width: 20%;
}

/* Убираем стандартный маркер */
summary {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 900;
  list-style-type: none;
  position: relative;
  padding-top: 0.5rem;
  cursor: pointer;
}

/* Для WebKit-браузеров (Safari, Chrome) */
summary::-webkit-details-marker {
  display: none;
}

/* Кастомный маркер */
summary::after {
  content: "▶";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  transition: transform 0.2s ease;
}

/* Анимация поворота при раскрытии */
details[open] summary::after {
  transform: translateY(-50%) rotate(90deg);
}

/* ---------------- */
.works, .right {
  background: var(--work-list-bg);
  padding: 10px;
  overflow-y: auto;
  max-height: 100vh;
  position: sticky;
  top: 0;
  scrollbar-width: thin;
  scrollbar-color: #444 #222;
}

.works a {
  font-size: 1.25rem;
  font-family: Roboto;
  font-weight: 100;
  display: block;
  background: var(--work-list-link-bg);
  color: #4dd;
  padding: 0.2rem 1rem;
  margin-bottom: 2px;
  line-height: 1.2;
}

.works a:hover {
  color: #c9e;
}

body.light .works a {
  color: #00f;
  background: #dd7;
}

.works a.selected {
  color: #ff0;
}

/* Центр страницы */
.work-content {
  width: 60%;
  font-size: 1.25rem;
  padding: 1rem;
}

.work-content a {
  font-size: 1.25rem;
  color: #4dd;
}

.work-content h1 {
  text-align: center;
  font-size: 1.6rem;
  margin: 1.5rem;
}

.work-content h2 {
  text-align: center;
  font-size: 1.4rem;
  margin-top: 1.3rem;
}

.work-content h3 {
  font-size: 1.25rem;
  text-align: left;
  margin-top: 1.1rem;
}

.work-content p {
  text-indent: 2rem;
  margin-bottom: 1rem;
}

.work-content li {
  list-style-position: inside;
  padding-left: 0.5rem;
  padding-bottom: 0.5rem;
}

.right {
  width: 20%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.right p, .right a, .right div {
  padding: 10px;
}

/* Поиск */
.search-form {
  margin: 1rem 0;
}

.search-form form {
  margin: 0 1rem;
  max-width: 400px;
  display: flex;
}

.search-form input {
  padding: 8px 12px;
  border: 1px solid #000;
  border-radius: 4px 0 0 4px;
  background: #eee;
  font-size: 1rem;
  width: 100%;
}

.search-form button {
  padding: 8px 16px;
  background: #000;
  font-size: 1rem;
  color: #fff;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: background-color 0.3s;
}

.search-form button:hover {
  background-color: #2a2;
}

/* Результаты поиска */
.search-words {
  margin-top: 1rem;
  text-indent: 2rem;
}

.search-results > li {
  margin: 0;
  padding: 20px 0;
  line-height: 1.5;
  border-bottom: 1px solid #eee;
}

body.light .search-results > li {
  border-bottom: 1px solid #111;
}

/* О сайте (страница) */
.about-content {
  width: 40%;
  font-size: 1.25rem;
  line-height: 1.6;
  text-indent: 2rem;
  margin: 2.5rem auto;
}

/* Изображения */
img {
  height: 250px;
  width: auto;
  object-fit: cover; /* при необходимости обрезает изображение, чтобы заполнить область */
  display: block;
  margin: 8px auto;
}

.image-container {
  position: absolute;
  display: inline-block;
}

.image-container .tooltip {
  visibility: hidden;
  width: 300px;
  background-color: #222;
  color: #fff;
  text-align: left;
  border-radius: 8px;
  padding: 8px;
  position: absolute;
  top: 8px;
  left: 240px;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 10;
}

.author-name:hover {
  color: #a6f;
}

.author-name:hover + .image-container .tooltip {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* Фильтр статей */
.filter-works {
  display: flex;
  padding: 10px;
}

#filter-input {
  color: #000;
  background: #eee;
  font-size: 1rem;
  width: 250px;
  height: 25px;
  margin: 0 0 0 10px;
}

#filter-year {
  color: #000;
  background: #eee;
  font-size: 1rem;
  width: 80px;
  height: 25px;
  margin: 0 0 0 10px;
}

/* Кнопка "Очистить поле поиска" */
.clear-btn {
  width: 25px;
  height: 25px;
  border: none;
  background-color: #faa;
  border-radius: 50%;
  position: relative;
  left: 15px;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: background-color 0.3s;
}

.clear-btn:hover {
  background-color: #999;
}

/* Крестик из двух линий */
.clear-btn::before,
.clear-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 2px;
  background-color: #333;
  border-radius: 1px;
  transform-origin: center;
}

.clear-btn::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.clear-btn::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
