@import url(../vendor/normalize.css);
@import url(../vendor/fonts/fonts.css);

:root {
  --color-bg: #f5f5f5;
  --color-text: #1a1a1a;
  --color-accent: #ee2e31;
  --font-main: 'Inter', sans-serif;
  --spacing-unit: 20px;
}

[data-theme="dark"] {
  --color-bg: #1a1a1a;
  --color-text: #f5f5f5;
  --color-accent: #ff4d4f;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-main);
  margin: 0;
  height: 100vh;
  width: 100vw;
}

::selection {
  background-color: var(--color-accent);
  color: var(--color-bg);
}

.page {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Common Links */
a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
}

a:hover {
  color: var(--color-accent);
}

/* 1. Year: Top Left */
.lead {
  position: fixed;
  top: 0;
  left: 0;
  padding: var(--spacing-unit);
  z-index: 100;
  pointer-events: none;
}

.lead__title {
  font-size: 2.5rem;
  font-weight: 900;
  margin: 0;
  pointer-events: auto;
}

.lead__subtitle {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-top: -5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: auto;
}

/* 2. Months: Top Center */
.month-nav {
  position: fixed;
  top: var(--spacing-unit);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 100;
  padding: 0;
}

.month-nav__link {
  font-size: 1.5rem; /* Larger font to see image */
  font-weight: 900;
  text-transform: uppercase;
  
  /* Image fill magic */
  background-color: #555; /* Fallback */
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent; /* Make text transparent to see background */
  -webkit-text-fill-color: transparent;
  
  opacity: 0.5;
  filter: grayscale(100%);
  transition: opacity 0.3s, transform 0.3s, filter 0.3s;
}

.month-nav__link.active {
  opacity: 1;
  filter: grayscale(0%);
  transform: scale(1.2);
  /* color remains transparent to show the image */
  color: transparent;
  -webkit-text-fill-color: transparent;
}

@media (hover: hover) {
  .month-nav__link:hover {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.2);
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

/* 3. Links to other years: Top Right */
.header {
  position: fixed;
  top: 0;
  right: 0;
  padding: var(--spacing-unit);
  z-index: 100;
}

.header__year {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.header__year-link {
  font-weight: 700;
  font-size: 1rem;
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s;
}

.header__year-link:hover {
  color: var(--color-text);
  opacity: 1;
}

.header__year-link_active {
  opacity: 1;
  color: var(--color-accent);
}

.header__year-link_past {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

/* 4. Description: Bottom Left */
.intro {
  position: fixed;
  bottom: 0;
  left: 0;
  padding: var(--spacing-unit);
  max-width: 400px;
  z-index: 100;
  pointer-events: auto;
}



.intro__text {
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0 0 10px 0;
}

.intro__text:last-of-type {
  margin: 0;
}

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

.intro .link:hover {
  color: var(--color-text);
}

/* 5. Footer Links: Bottom Right */
.footer {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: var(--spacing-unit);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.footer__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 15px;
}

.footer__link {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.footer__copyright {
  display: block;
  position: fixed;
  bottom: var(--spacing-unit);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  opacity: 0.5;
  margin: 0;
  z-index: 100;
  pointer-events: none;
}

/* 6. Photos: Vertical Scroll */
.photo-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  overflow-x: hidden;
  overflow-y: auto;
  /* scroll-behavior: smooth; */ /* Removed for manual wheel scroll */
  scroll-snap-type: y mandatory;
  display: flex;
  justify-content: center;
  /* Hide scrollbar */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE 10+ */
}

.photo-grid::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.photo-grid__list {
  list-style: none;
  margin: 0;
  padding: 50vh 0; /* Padding to center first/last item */
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 60vw; /* Control width of the strip */
  align-items: center;
}

.photo-grid__list::after {
  content: "";
  display: block;
  /* Высота нижнего отступа, чтобы центрировать последнее фото */
  height: 50vh; 
  width: 100%;
  flex-shrink: 0; /* Запрещаем блоку сжиматься */
}

.photo-grid__item {
  position: relative;
  height: 70vh; /* Height of each photo card */
  width: 100%;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transform: scale(0.8);
}

.photo-grid__item.active {
  opacity: 1;
  transform: scale(1);
}

.photo-grid__image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.photo-grid__list-pic {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background-color: transparent;
}

.photo-grid__overlay {
  position: absolute;
  bottom: -70px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: 100%;
  opacity: 0;
  transition: opacity 0.3s;
}

.photo-grid__item.active .photo-grid__overlay {
  opacity: 1;
}

.photo-grid__caption {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.photo-grid__tech {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text);
  margin-bottom: 8px;
  /* opacity: 0.7; */
}

.photo-grid__film {
  color: var(--color-accent);
  font-weight: 600;
}

.photo-grid__month {
  display: none;
}

/* 7. Year Stats: Right Center Vertical */
.year-stats {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  padding: var(--spacing-unit);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  display: flex;
  align-items: center;
}

.year-stats__grid {
  display: flex;
  gap: 40px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.year-stats__card {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.year-stats__number {
  font-weight: 900;
  font-size: 1.2rem;
  color: var(--color-accent);
  line-height: 1;
}

.year-stats__label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.5;
  line-height: 1.5;
}

.year-stats__title, 
.year-stats__subtitle {
  display: none;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 50%;
  left: var(--spacing-unit);
  transform: translateY(-50%);
  z-index: 101;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px;
  color: var(--color-text);
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  opacity: 1;
  color: var(--color-accent);
}

.theme-toggle__icon {
  font-size: 1.5rem;
  position: absolute;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Light Mode: Show Moon */
.theme-toggle__icon_light {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.theme-toggle__icon_dark {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Dark Mode: Show Sun */
[data-theme="dark"] .theme-toggle__icon_light {
  opacity: 1;
  transform: rotate(0) scale(1);
}

[data-theme="dark"] .theme-toggle__icon_dark {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--color-bg);
  border-top: 1px solid var(--color-text);
  padding: var(--spacing-unit);
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
  box-sizing: border-box;
}

.cookie-banner.show {
  transform: translateY(0);
}

.cookie-banner__text {
  font-size: 0.9rem;
  margin: 0;
  padding-right: 20px;
}

.cookie-banner__button {
  background-color: var(--color-accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.cookie-banner__button:hover {
  opacity: 0.8;
}

/* MOBILE STYLES */
@media (max-width: 768px) {
  /* Reset Global Scrolling */
  body {
    overflow: auto;
    height: auto;
  }
  .page {
    overflow: visible;
    height: auto;
    display: flex;
    flex-direction: column;
  }
  
  /* Make main flex to reorder children */
  main {
    display: flex;
    flex-direction: column;
  }

  /* 1. Header & Lead */
  /* Year Title (Top Left -> Static/Relative) */
  .lead {
    position: static;
    width: auto;
    margin: 0;
    pointer-events: auto;
    /* Adjust padding to fit with header above */
    padding-top: 10px;
    order: 0;
  }
  .lead__title {
    font-size: 4rem;
  }

  /* Year Nav (Top Right -> Fixed) - Inherits correct styles already, but maybe adjust padding */
  .header {
    position: static;
    width: auto;
    padding: var(--spacing-unit) var(--spacing-unit) 0;
    order: -1; /* Header first */
  }

  .header__year {
    flex-direction: row;
    align-items: center;
    gap: 20px;
  }

  /* Months (Under Title) */
  .month-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--color-bg);
    transform: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 10px var(--spacing-unit);
    margin-bottom: 20px;
    width: auto;
    gap: 10px;
    pointer-events: auto;
    order: 1;
  }
  
  /* ... (month-nav__link styles preserved) ... */
  .month-nav__link {
    font-size: 1.5rem;
    opacity: 0.5;
    background-color: #555; /* Fallback */
    background-image: var(--bg-image); 
    background-size: cover;
    background-position: center;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent; 
    -webkit-text-fill-color: transparent;
    transition: opacity 0.3s, transform 0.3s;
  }
  .month-nav__link.active {
    opacity: 1;
    transform: scale(1);
    background-image: var(--bg-image); 
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }

  /* Photo Grid - Vertical Stack */
  .photo-grid {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    display: block;
    padding: 0;
    order: 3; /* Photos */
  }
  
  .photo-grid__list {
    flex-direction: column;
    padding: 0 var(--spacing-unit);
    height: auto;
    gap: 40px;
    margin-bottom: 40px;
    width: auto;
  }

  .photo-grid__list::after {
    height: 0; 
  }

  /* ... (photo grid item styles preserved) ... */
  .photo-grid__item {
    flex: none;
    width: 100%;
    height: auto;
    margin: 0;
    opacity: 1;
    transform: none;
  }
  
  .photo-grid__image-wrapper {
    height: auto;
    margin-bottom: 20px;
  }
  
  .photo-grid__list-pic {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    box-shadow: none;
  }
  
  .photo-grid__overlay {
    position: static;
    transform: none;
    opacity: 1;
    margin-top: 10px;
    bottom: auto; /* Reset absolute pos props just in case */
    left: auto;
  }

  /* Footer & Intro */
  .intro {
    position: static;
    max-width: 100%;
    margin-bottom: 40px;
    order: 2; /* Intro after nav */
  }

  /* Year Stats (Mobile) */
  .year-stats {
    position: static;
    width: auto;
    transform: none;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    padding: var(--spacing-unit);
    display: flex;
    justify-content: center;
    pointer-events: auto;
    margin-bottom: 40px;
    order: 4; /* Stats AFTER photos */
  }

  .year-stats__grid {
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
  }

  .year-stats__card {
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
  }

  .year-stats__number {
    font-size: 1.5rem;
    text-combine-upright: none;
    -webkit-text-combine: none;
  }

  .year-stats__label {
    writing-mode: horizontal-tb;
  }

  .footer {
    position: static;
    width: auto;
    padding: var(--spacing-unit);
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    order: 5; /* Footer comes last */
  }
  
  .footer__links {
    justify-content: center;
    gap: 20px;
  }
  
  .footer__copyright {
    position: static;
    transform: none;
    margin-top: 10px;
  }

  .theme-toggle {
    position: static;
    transform: none;
    order: 10; /* Place at the end of main content */
    margin: 20px auto; /* Center it */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(128, 128, 128, 0.1); /* Subtle background */
    box-shadow: none;
    opacity: 1;
  }

  .cookie-banner {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .cookie-banner__text {
    padding-right: 0;
  }
}
