/* CSS Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Font Face - HelveticaNeueCyr (Local) */
@font-face {
  font-family: 'HelveticaNeueCyr';
  src: url('fonts/helveticaneuecyr-roman.woff2') format('woff2'),
    url('fonts/helveticaneuecyr-roman.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'HelveticaNeueCyr';
  src: url('fonts/helveticaneuecyr-medium.woff2') format('woff2'),
    url('fonts/helveticaneuecyr-medium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'HelveticaNeueCyr';
  src: url('fonts/helveticaneuecyr-bold.woff2') format('woff2'),
    url('fonts/helveticaneuecyr-bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Base Styles */
html {
  background-color: #FAFAFA;
  color: #333333;
}

body {
  font-family: "HelveticaNeueCyr", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
  background-color: #FAFAFA;
  color: #333333;
}

/* Desktop Grid Layout */
.container {
  display: grid;
  grid-template-columns: 1fr 3fr 1fr;
  grid-template-rows: auto;
  align-items: start;
  align-content: stretch;
  justify-items: start;
  column-gap: 60px;
  padding: 20px;
}

/* Navigation (Left Column) */
nav {
  display: flex;
  flex-direction: column;
  gap: 100px;
}

nav a {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  color: #333333;
  text-decoration: none;
}

/* Content Area (Middle Column) */
main {
  display: flex;
  flex-direction: column;
}

/* Right Sidebar */
aside {
  display: flex;
  flex-direction: column;
  gap: 100px;
}

aside a {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  color: #333333;
  text-decoration: none;
}

/* Marquee Effect for Current Page (except About) */
@keyframes marquee {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-33.333%);
  }
}

nav a.current-page {
  display: block;
  overflow: hidden;
  position: relative;
  width: auto;
  min-height: 48px;
  font-size: 0;
}

nav a.current-page::before {
  content: attr(data-text) "        " attr(data-text) "        " attr(data-text);
  display: inline-block;
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  animation: marquee var(--marquee-speed, 12s) linear infinite;
  will-change: transform;
}

nav a.current-page:hover::before,
nav a.current-page:focus::before {
  animation-play-state: paused;
}

/* Respect user motion preferences (WCAG 2.1) */
@media (prefers-reduced-motion: reduce) {
  nav a.current-page::before {
    animation: none;
  }
}

/* Typography */
h2 {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 40px;
}

h3 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 20px;
}

p {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 24px;
  text-align: justify;
}


/* Sections */
section {
  margin-bottom: 60px;
}

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

/* Links */
a {
  color: #333333;
}

/* External links */
main a[href^="http"] {
  text-decoration: underline;
  font-weight: 400;
}

/* Internal links (bold + underline) */
main a.internal-link {
  text-decoration: underline;
  font-weight: 500;
}

/* Lists */
ol,
ul {
  margin-left: 0;
  padding-left: 20px;
  margin-bottom: 24px;
}

li {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
}

/* Profile Image */
.profile-image {
  width: 90px;
  height: 90px;
  margin-top: 60px;
}

/* Content Images (full width) */
main img:not(.profile-image) {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 24px;
}

/* Spoiler Block */
details {
  margin-bottom: 24px;
}

details summary {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::before {
  content: ">";
  display: inline-block;
  transition: transform 0.2s ease;
}

details[open] summary::before {
  transform: rotate(90deg);
}

details[open] {
  margin-bottom: 24px;
}

details img {
  margin-top: 16px;
}

/* Mobile Layout */
@media (max-width: 768px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    column-gap: 0;
    padding: 20px;
  }

  /* Reorder: nav -> main -> aside */
  nav {
    order: 1;
    margin-bottom: 80px;
    /* Increased from 40px for clear visual separation */
    gap: 25px;
    /* Reverted from 60px to tighter mobile spacing */
  }

  main {
    order: 2;
    margin-bottom: 80px;
    /* Increased from 40px for symmetry */
  }

  aside {
    order: 3;
    gap: 25px;
    /* Reverted from 60px to tighter mobile spacing */
  }

  /* Scaled typography for mobile */
  nav a {
    font-size: 32px;
  }

  aside a {
    font-size: 32px;
  }

  h2 {
    font-size: 32px;
  }

  h3 {
    font-size: 20px;
  }

  p,
  li {
    font-size: 16px;
  }

  /* Marquee mobile scaling */
  nav a.current-page {
    min-height: 38px;
  }

  nav a.current-page::before {
    font-size: 32px;
  }
}