/* CSS Variables for easy customization */
:root {
  /* Colors */
  --accent: #ff1461; /* Bright pink accent color */
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-light: #999;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-accent: #fff5f8;
  --border-light: #e0e0e0;
  --shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 30px rgba(0, 0, 0, 0.15);

  /* Layout widths - easy to change */
  --container-max-width: 1600px; /* Main container max width */
  --case-max-width: 800px; /* Case study page max width */

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-xxl: 4rem;

  /* Typography */
  --font-family: "Raleway", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-size-body: clamp(16px, 2.5vw, 16px);
  --font-size-h1: clamp(32px, 5vw, 56px);
  --font-size-h2: clamp(24px, 4vw, 40px);
  --font-size-h3: clamp(24px, 3vw, 32px);

  /* Border radius */
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;

  /* Breakpoints */
  --breakpoint-tablet: 640px;
  --breakpoint-desktop: 1024px;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  font-variant-numeric: tabular-nums;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Адаптивная загрузка изображений */
img[data-src] {
  opacity: 0;
  transition: opacity 0.6s ease-in-out, filter 0.6s ease-in-out;
  filter: blur(10px);
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

img[data-src].loaded {
  opacity: 1;
  filter: blur(0);
}

img[data-src].load-error {
  opacity: 0.5;
  filter: blur(0);
  background: var(--bg-secondary);
}

/* Анимация скелетона для загружающихся изображений */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Оптимизация для изображений с aspect-ratio */
.hero-image img,
.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Placeholder для изображений */
.image-wrapper {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-secondary);
}

.image-wrapper::before {
  content: '';
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: loading 1.5s infinite;
}

.image-wrapper.loaded::before {
  display: none;
}

@keyframes loading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

a:hover, a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Container system */
.container {
  max-width: var(--container-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

.case-container {
  max-width: var(--case-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

@media (min-width: 640px) {
  .container,
  .case-container {
    padding: 0 var(--spacing-lg);
  }
}

/* Header and Navigation */
.header {
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  left: 0;
  right: 0;
}

.nav {
  padding: var(--spacing-sm) 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

@media (min-width: 1101px) {
  .nav-container {
    gap: 240px;
  }
}

.logo {
  display: inline-block;
}

.logo a {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: var(--spacing-xs) var(--spacing-sm);
  font-weight: 600;
  font-size: 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.logo span::after {
  content: "антон костылев";
  color: white;
}

/* Адаптивные изменения в порядке приоритета */

/* 1. Сначала убираем "скачать" (остаётся "↓ резюме") при ≤1000px */
@media (max-width: 1000px) {
  .btn-text-short {
    display: inline;
  }

  .btn-text-full {
    display: none;
  }
}

/* 2. Потом логотип меняется на "ak" при ≤1100px */
@media (max-width: 1100px) {
  .logo span::after {
    content: "ak";
  }
}

/* 3. Потом убираем "канал в" (остаётся "tg") при ≤700px */
/* Стили уже применены в пункте 1 */

.logo a:hover, .logo a:focus {
  outline: none;
  opacity: 0.9;
}

.burger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 32px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
}

.burger-menu span {
  display: block;
  width: 100%;
  height: 4px;
  background: var(--accent);
  transition: all 0.3s ease;
}

.burger-menu.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.burger-menu.active span:nth-child(2) {
  opacity: 0;
}

.burger-menu.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

.nav-buttons-wrapper {
  display: flex;
  flex-shrink: 0;
  min-width: 0;
}

.nav-buttons {
  display: flex;
  gap: var(--spacing-xs);
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.nav-buttons > * {
  flex-shrink: 0;
}

.logo {
  flex-shrink: 0;
}


@media (min-width: 640px) {
  .nav {
    padding: var(--spacing-md) 0;
  }

  .nav-buttons {
    gap: var(--spacing-sm);
  }
}

@media (max-width: 1100px) {
  .burger-menu {
    display: flex;
  }

  .nav-buttons-wrapper {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .nav-buttons-wrapper.active {
    right: 0;
  }

  .nav-buttons {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 100px 24px 40px;
    flex-wrap: nowrap;
    min-height: 100%;
    width: 100%;
    max-width: 320px;
    gap: var(--spacing-sm);
  }

  .nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    align-self: stretch;
  }

  .nav-buttons .btn-secondary {
    align-self: stretch;
  }
}

@media (min-width: 1101px) {
  .burger-menu {
    display: none !important;
  }

  .nav-buttons-wrapper {
    position: static !important;
    width: auto !important;
    height: auto !important;
    box-shadow: none !important;
    overflow: hidden !important;
  }

  .nav-buttons {
    position: static !important;
    width: auto !important;
    height: auto !important;
    flex-direction: row !important;
    padding: 0 !important;
    box-shadow: none !important;
  }
}

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 16px;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn:hover, .btn:focus {
  box-shadow: var(--shadow-hover);
  outline: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #e60050;
}

.btn-secondary {
  background: white;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-secondary:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.nav-buttons .btn-secondary {
  flex-shrink: 0;
  order: 2;
}

.nav-buttons .nav-links {
  order: 1;
}

.btn-text {
  background: transparent;
  color: var(--accent);
  border: none;
  padding: var(--spacing-xs) var(--spacing-sm);
  font-weight: 500;
}

.btn-text:hover {
  opacity: 0.8;
  transform: none;
  box-shadow: none;
}

.btn-icon {
  padding: var(--spacing-xs) var(--spacing-sm);
  min-width: 40px;
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  border: none;
  font-weight: 500;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}

.btn-icon:hover {
  opacity: 0.7;
  transform: none;
  box-shadow: none;
}

.btn-large {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 16px;
}

.btn-text-short {
  display: none;
}

.btn-text-full {
  display: inline;
}


@media (max-width: 800px) {
  .btn {
    padding: var(--spacing-xs);
    font-size: 14px;
    white-space: nowrap;
  }

  .btn:not(.btn-icon) {
    padding: var(--spacing-xs) 8px;
  }

  .btn-text {
    font-size: 14px;
    padding: var(--spacing-xs) 4px;
  }

  .btn-secondary {
    padding: var(--spacing-xs) 8px;
    font-size: 14px;
  }

  .nav-buttons {
    gap: 4px;
  }

  .social-buttons {
    gap: 4px;
  }
}

/* Main content */
.main {
  min-height: calc(100vh - 80px);
}

/* Hero section */
.hero {
  padding: var(--spacing-xxl) 0;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.hero-content {
  display: flex;
  flex-direction: row;
  gap: 40px;
  align-items: flex-start;
  text-align: left;
}

.hero-image {
  order: 0;
  flex-shrink: 0;
}

.hero-image img {
  width: 200px;
  height: 100%;
  min-height: 200px;
  border-radius: 0;
  object-fit: cover;
  border: 4px solid var(--accent);
}

@media (max-width: 639px) {
  .hero-content {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .hero-image {
    order: -1;
  }
}

.hero-greeting {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
  letter-spacing: 0;
}

.hero-text h1 {
  font-size: var(--font-size-h1);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-md);
  line-height: 1.2;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-lg);
  justify-content: flex-start;
}

@media (max-width: 640px) {
  .hero-tags {
    justify-content: center;
  }
}

.hero-tag {
  display: inline-block;
  background: var(--bg-accent);
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  line-height: 1.5;
}

.hero-tag-break {
  flex-basis: 100%;
  height: 0;
  width: 0;
}

.hero-text p {
  font-size: clamp(16px, 2.5vw, 24px);
  color: var(--text-secondary);
  max-width: 600px;
}

@media (min-width: 1024px) {
  .hero-image img {
    width: 280px;
  }
}

/* Projects section */
.projects {
  padding: var(--spacing-xxl) 0;
  background: var(--bg-secondary);
}

.projects h2 {
  font-size: var(--font-size-h2);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-lg);
  text-align: center;
  text-transform: lowercase;
  color: var(--accent);
}

.projects h2::before {
  content: "[ ";
}

.projects h2::after {
  content: " ]";
}

.projects-grid {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1024px) {
  .projects-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
}

@media (min-width: 1600px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
  }
}

/* Project cards with hover animation */
.project-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.project-card:hover {
  box-shadow: var(--shadow-hover);
}

.project-card:hover .project-title {
  color: var(--accent);
}

.project-card:hover, .project-card:focus {
  outline: none;
}

@media (min-width: 800px) {
  .project-card {
    flex-direction: row;
    align-items: stretch;
  }
}

.project-image {
  flex-shrink: 0;
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.3s ease;
}

.project-card:hover .project-image img {
  transform: scale(1.05);
}

@media (min-width: 800px) {
  .project-image {
    width: 50%;
    height: 100%;
    min-height: auto;
  }

  .project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.project-content {
  padding: var(--spacing-md);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-sm);
}

.project-tag {
  display: inline-block;
  background: var(--bg-accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  line-height: 1.5;
}

.project-title {
  font-size: var(--font-size-h3);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-xs);
  line-height: 1.3;
}

.project-description {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
  font-size: 16px;
}

.project-link {
  color: var(--accent);
  font-weight: 500;
  font-size: 16px;
  margin-top: auto;
}

.project-link:hover {
  text-decoration: underline;
}

/* Contact section */
.contact {
  padding: var(--spacing-xxl) 0;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  text-align: center;
}

.contact-content h2 {
  font-size: var(--font-size-h2);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-md);
  text-align: center;
  text-transform: lowercase;
  color: var(--accent);
}

.contact-content h2::before {
  content: "[ ";
}

.contact-content h2::after {
  content: " ]";
}

.contact-content p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xl);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Footer */
.footer {
  background: var(--text-primary);
  color: white;
  padding: var(--spacing-xl) 0;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  text-align: center;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
}

.footer-links a:hover, .footer-links a:focus {
  color: var(--accent);
  outline: none;
}

@media (min-width: 640px) {
  .footer-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .footer-links {
    flex-direction: row;
    gap: var(--spacing-lg);
  }
}

/* Case study specific styles */
.breadcrumbs {
  padding: var(--spacing-lg) 0 var(--spacing-md);
  background: var(--bg-secondary);
}

.breadcrumb-link {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.breadcrumb-link:hover {
  color: var(--accent);
}

.case-hero {
  padding: var(--spacing-xl) 0 var(--spacing-xxl);
  background: var(--bg-secondary);
}

.case-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.case-tag {
  display: inline-block;
  background: var(--bg-accent);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-md);
}

.case-title {
  font-size: var(--font-size-h1);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-md);
  line-height: 1.2;
}

.case-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.case-content {
  padding: var(--spacing-xxl) 0;
}

.case-section {
  margin-bottom: var(--spacing-xxl);
}

.case-section h2 {
  font-size: var(--font-size-h2);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-lg);
  color: var(--text-primary);
}

.case-section h3 {
  font-size: var(--font-size-h3);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: var(--spacing-xl) 0 var(--spacing-md);
  color: var(--text-primary);
}

.case-section p {
  margin-bottom: var(--spacing-md);
  line-height: 1.7;
}

.case-section ul {
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-lg);
}

.case-section li {
  margin-bottom: var(--spacing-xs);
  line-height: 1.7;
}

/* Case gallery */
.case-gallery {
  margin-bottom: var(--spacing-xxl);
}

.case-gallery h2 {
  font-size: var(--font-size-h2);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-xl);
  text-align: center;
}

.gallery-row {
  display: grid;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .gallery-row {
    grid-template-columns: 1fr 1fr;
  }
}

.gallery-item img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.gallery-caption {
  text-align: center;
  margin-top: var(--spacing-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.gallery-banner {
  margin-bottom: var(--spacing-xl);
}

.gallery-banner img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

/* Case metrics */
.case-metrics {
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: 1fr;
  background: var(--bg-secondary);
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
}

@media (min-width: 640px) {
  .case-metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

.metric {
  text-align: center;
}

.metric-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--spacing-xs);
}

.metric-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Case CTA */
.case-cta {
  background: var(--bg-accent);
  padding: var(--spacing-xxl);
  border-radius: var(--radius-lg);
  text-align: center;
}

.cta-content h2 {
  font-size: var(--font-size-h2);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-md);
}

.cta-content p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xl);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Focus styles for accessibility */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Experience section */
.experience {
  padding: var(--spacing-xxl) 0;
  background: var(--bg-primary);
}

.experience h2 {
  font-size: var(--font-size-h2);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-lg);
  text-align: center;
  text-transform: lowercase;
  color: var(--accent);
}

.experience h2::before {
  content: "[ ";
}

.experience h2::after {
  content: " ]";
}

.experience-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
  max-width: 680px;
  margin: 0 auto;
}

.experience-item {
  border-bottom: 1px solid var(--border-light);
  padding-bottom: var(--spacing-lg);
}

.experience-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.experience-period {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: var(--spacing-xs);
  font-variant-numeric: tabular-nums;
}

.experience-title {
  font-size: var(--font-size-h3);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-xs);
  color: var(--text-primary);
}

.experience-company {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.experience-company-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
  line-height: 1.5;
}

.experience-subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
  text-transform: lowercase;
}

.experience-description {
  color: var(--text-secondary);
  line-height: 1.8;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.experience-description li {
  position: relative;
  padding-left: 1.5em;
  margin-bottom: 0.5em;
}

.experience-description li:before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--text-secondary);
}

/* Case tags */
.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--spacing-xxl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-light);
}

.case-tags .tag {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.2s ease;
}

.case-tags .tag:hover {
  background: var(--bg-accent);
  color: var(--accent);
}

/* Print styles */
@media print {
  .header,
  .footer,
  .case-cta {
    display: none;
  }

  .main {
    margin: 0;
  }

  * {
    background: white !important;
    color: black !important;
  }
}