:root {
  --bg-primary: #111111;
  --bg-secondary: #1a1a1a;
  --bg-accent: #1f1f1f;
  --text-primary: #eee;
  --text-secondary: #ccc;
  --border: #666;
  --hover-bg: #888;
  --hover-glow: rgba(184, 184, 184, 0.8);
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Typography scale */
  --font-size-base: 1rem;
  --font-size-sm: 0.875rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  
  /* Line heights */
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  
  /* Font weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;
}

* {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', 
                'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 
                'Droid Sans', 'Helvetica Neue', sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  text-align: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1;
  text-rendering: optimizeLegibility;
}
#books {
  text-align: center; /* Центрируем заголовок секции */
}

.book-table {
  width: auto;
  margin: 0 auto;
  border-collapse: separate;
  border-spacing: 0 12px; 
  margin-top: 30px;
}

.book-table td {
  padding: 12px 16px;
  transition: all var(--transition-fast);
}

.book-table .author {
  font-weight: 300;
  text-align: left;
  color: var(--text-secondary);
  font-style: italic;
}

.book-table .title {
  text-align: left;
  font-weight: 400;
}

.book-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

header {
  background-color: var(--bg-accent);
  color: var(--text-primary);
  padding: 20px 0;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  z-index: 1;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: opacity var(--transition-slow);
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, var(--bg-accent), var(--bg-accent)),
    url(https://grainy-gradients.vercel.app/noise.svg);
  background-blend-mode: overlay;
  filter: contrast(170%) brightness(100%);
  opacity: 0.2;
  pointer-events: none;
  z-index: -1;
}

header h1 {
  margin: 5px 0; /* Уменьшен отступ заголовка */
  font-size: 1.8em; /* Уменьшен размер шрифта заголовка */
}

header p {
  margin: 0; /* Убираем отступы параграфа */
  font-size: 0.85em; /* Немного уменьшен размер шрифта параграфа */
}

section {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  display: none;
  flex: 1;
  animation: fadeIn var(--transition-normal);
}

body > header,
body > .tabs,
body > section,
body > footer {
  opacity: 0;
  transition: opacity var(--transition-slow);
}

body.loaded > header,
body.loaded > .tabs,
body.loaded > section,
body.loaded > footer {
  opacity: 1;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1,
h2 {
  color: #fff;
  letter-spacing: -0.02em;
  font-weight: 700;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

h1 {
  font-size: 1.8em;
  line-height: 1.2;
}

h2 {
  font-size: 1.6em;
  line-height: 1.3;
}

h3,
h4 {
  color: var(--text-primary);
  letter-spacing: 0.01em;
  font-weight: 500;
  line-height: 1.4;
}

h3 {
  font-size: 1.3em;
}

h4 {
  font-size: 1.1em;
  margin-bottom: 0.5em;
}

p {
  line-height: var(--line-height-relaxed);
  color: var(--text-secondary);
  font-weight: var(--font-weight-light);
  font-size: var(--font-size-base);
  margin-bottom: 1em;
}

/* Улучшенная читаемость для длинных текстов */
section p {
  max-width: 65ch;
  margin-left: auto;
  margin-right: auto;
}

.project {
  margin-bottom: 30px;
}

/* Responsive design improvements */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .tabs {
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 0 10px;
    justify-content: center;
  }

  .tab {
    padding: 8px 12px;
    font-size: 0.85em;
    flex: 0 1 auto;
  }

  .tab:hover::after {
    width: 70%;
  }

  .tab.active::after {
    width: 90%;
  }

  .image {
    width: 100%;
    height: 350px;
    margin: 10px 0;
  }

  section {
    padding: 15px 10px;
  }

  header {
    padding: 15px 0;
  }

  header h1 {
    font-size: 1.4em;
  }

  header p {
    font-size: 0.8em;
  }

  h1, h2 {
    font-size: 1.3em;
  }

  h4 {
    font-size: 1em;
  }

  p {
    font-size: 0.9em;
    line-height: 1.6;
  }

  .book-table {
    font-size: 0.85em;
    margin-top: 20px;
  }

  .book-table td {
    padding: 8px 12px;
  }

  .hover-list {
    margin-left: 0;
  }

  .hover-list li {
    padding: 6px 0;
    font-size: 0.9em;
  }

  button {
    padding: 8px 16px;
    font-size: 0.85em;
    margin-top: 15px;
  }

  button:hover::after {
    width: 70%;
  }

  footer {
    padding: 8px 0;
    font-size: 0.8em;
  }
}

@media (max-width: 480px) {
  .tabs {
    gap: 2px;
    padding: 0 5px;
    margin-top: 12px;
    margin-bottom: 12px;
    justify-content: center;
  }

  .tab {
    padding: 8px 8px;
    font-size: 0.75em;
    flex: 0 0 auto;
    min-width: auto;
  }

  .tab:hover::after,
  .tab.active::after {
    height: 1.5px;
  }

  header {
    padding: 12px 0;
    margin-bottom: 8px;
  }

  header h1 {
    font-size: 1.1em;
    margin: 3px 0;
  }

  header p {
    font-size: 0.75em;
  }

  header h1 {
    font-size: 1.2em;
  }

  section {
    padding: 10px 5px;
  }

  .book-table {
    font-size: 0.75em;
  }

  .book-table td {
    padding: 6px 8px;
  }

  .hover-list li {
    font-size: 0.85em;
  }

  .image {
    height: 280px;
  }

  button {
    padding: 6px 12px;
    font-size: 0.8em;
    margin-top: 12px;
  }

  button:hover::after {
    width: 80%;
  }

  button:hover::after,
  .tab:hover::after,
  .tab.active::after {
    height: 1.5px;
  }
}

footer {
  background-color: var(--bg-accent);
  color: var(--text-primary);
  padding: 10px 0;
  font-size: 0.9em;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  transition: opacity var(--transition-slow);
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, var(--bg-accent), var(--bg-accent)),
    url(https://grainy-gradients.vercel.app/noise.svg);
  background-blend-mode: overlay;
  filter: contrast(170%) brightness(100%);
  opacity: 0.2;
  pointer-events: none;
  z-index: -1;
}

.tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 0 20px;
}

.tab {
  position: relative;
  cursor: pointer;
  padding: 12px 20px;
  background-color: transparent;
  color: var(--text-secondary);
  border: none;
  transition: all var(--transition-normal);
  font-weight: 400;
  letter-spacing: 0.03em;
  font-size: 0.9em;
  text-transform: lowercase;
  font-feature-settings: 'liga' 1;
}

.tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--transition-normal);
}

.tab:hover {
  color: var(--text-primary);
}

.tab:hover::after {
  width: 60%;
}

.tab.active {
  color: var(--text-primary);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.tab.active::after {
  width: 80%;
  background: var(--text-primary);
}
.gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
}

.image {
  width: calc(77.33% - 20px);
  height: 400px;
  margin: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-slow);
}

.image.active {
  display: block;
  animation: slideIn var(--transition-slow) ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.image img:hover {
  transform: scale(1.02);
}

.description {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  backdrop-filter: blur(8px);
  padding: 10px;
  color: var(--text-primary);
  font-size: 0.9em;
}

#projects {
  text-align: center; /* Центрирует содержимое внутри секции */
}
.hover-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  display: inline-block;
  margin-left: -29px; /* Сдвиг списка влево на 20px */
}

.hover-list li {
  padding: 8px 0;
  margin: 5px 0;
  transition: all var(--transition-normal);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.hover-list li[data-image] {
  cursor: pointer;
}

.hover-list li[data-image]:hover {
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.hover-list li:hover:not([data-image]) {
  color: var(--text-secondary);
  transform: translateX(4px);
}

.hover-list li span {
  margin-right: 12px;
  opacity: 0;
  transform: translateX(-10px) scale(0.8);
  transition: all var(--transition-normal);
}

.hover-list li:hover:not([data-image]) span {
  opacity: 1;
  transform: translateX(0) scale(1.1);
}

.hover-list li[data-image]:hover span {
  opacity: 1;
  transform: translateX(0) scale(1.1);
}

/* Movie background effect */
body.film-background::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--film-background-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: grayscale(100%) brightness(0.3);
  z-index: 0;
  transition: all var(--transition-slow);
}

body.film-background > header,
body.film-background > footer {
  position: relative;
  z-index: 2;
}

body.film-background > .tabs {
  position: relative;
  z-index: 1;
}

body.film-background > section {
  position: relative;
  z-index: 1;
}

/* Back button for film view */
.film-back-button {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  padding: 10px 20px;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9em;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  font-family: inherit;
}

.film-background .film-back-button {
  opacity: 1;
  visibility: visible;
}

.film-back-button:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}
button {
  position: relative;
  margin-top: 20px;
  padding: 10px 24px;
  font-family: inherit;
  background-color: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-weight: var(--font-weight-normal);
  letter-spacing: 0.02em;
  font-size: var(--font-size-base);
  text-transform: lowercase;
  font-feature-settings: 'liga' 1;
}

button::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--transition-normal);
}

button:hover {
  color: var(--text-primary);
  transform: translateY(-2px);
}

button:hover::after {
  width: 60%;
}

button:active {
  transform: translateY(0);
}

/* Loader styles */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid var(--text-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loader-text {
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 0.9em;
  letter-spacing: 0.1em;
  opacity: 0;
  animation: fadeInText 0.8s ease-out 0.3s forwards;
}

@keyframes fadeInText {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loader responsive */
@media (max-width: 768px) {
  .loader-spinner {
    width: 30px;
    height: 30px;
  }

  .loader-text {
    font-size: 0.8em;
  }
}

@media (max-width: 480px) {
  .loader-spinner {
    width: 25px;
    height: 25px;
  }

  .loader-text {
    font-size: 0.75em;
    margin-top: 15px;
  }

  .film-back-button {
    top: 10px;
    right: 10px;
    padding: 8px 16px;
    font-size: 0.85em;
  }
}

