/* Color variables */
:root {
  --color-primary: #000000;
  --color-secondary: #ababab;
  --color-background: #ffffff;
  --color-toggle-border: #ababab;
  --color-toggle-slider: #ababab;
}

/* Dark mode color variables */
[data-theme="dark"] {
  --color-primary: #ffffff;
  --color-secondary: #555555;
  --color-background: #000000;
  --color-toggle-border: #555555;
  --color-toggle-slider: #555555;
}

/* Color utility classes */
.text-primary {
  color: var(--color-primary);
}

.text-secondary {
  color: var(--color-secondary);
}

/* Font declarations */
@font-face {
  font-family: 'Oswald';
  src: url('../fonts/Oswald/static/Oswald-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Young Serif';
  src: url('../fonts/Young_Serif/YoungSerif-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Inconsolata';
  src: url('../fonts/Inconsolata/static/Inconsolata-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'News Cycle';
  src: url('../fonts/News_Cycle/NewsCycle-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'News Cycle';
  src: url('../fonts/News_Cycle/NewsCycle-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

/* General styles */
html, body {
  height: 100%;
  margin: 0;
  padding-left: 10px;
  padding-right: 10px;
  background-color: var(--color-background);
  color: var(--color-primary);
  font-family: 'News Cycle', sans-serif;
  font-size: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
  /* Allow scrolling */
}

.container-fluid {
  min-height: 100%;
  padding: 0;
}

/* Navigation */
.navbar {
  background-color: var(--color-background);
  border: none;
  margin-bottom: 20px;
  transition: background-color 0.3s ease;
}

.navbar .container-fluid {
  padding: 20px;
}

.navbar-brand {
  font-family: 'Oswald', sans-serif;
  font-size: 24px;
  color: var(--color-primary);
  text-transform: uppercase;
}

.navbar-nav li {
  display: inline-flex;
  align-items: center;
  height: 40px;
}

.navbar-nav li a {
  font-family: 'News Cycle', sans-serif;
  font-size: 20px;
  color: var(--color-secondary);
  transition: color 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  line-height: 1;
  padding: 0 15px;
  position: relative;
  top: -4px;
}

.navbar-nav li a:hover,
.navbar-nav li a:focus,
.navbar-nav li a:active {
  color: var(--color-primary);
  background-color: transparent !important;
  outline: none;
}

.navbar-nav li a.active {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: bold;
  background-color: transparent !important;
}

/* Responsive navigation */
@media (max-width: 767px) {
  .navbar .container-fluid {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px;
  }
  
  .navbar-header {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
  }
  
  .navbar-brand {
    font-size: 24px;
    display: inline-block;
    text-align: center;
    float: none;
    margin: 0 auto;
  }
  
  .navbar-nav {
    text-align: center;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
  }
  
  .navbar-nav li {
    display: inline-flex;
    margin: 0 5px;
  }
  
  .navbar-nav li a {
    padding: 0 10px;
  }
}

/* Typography */
h1, h2, h3 {
  font-family: 'Young Serif', serif;
  font-size: 24px;
  font-weight: normal;
  color: var(--color-primary);
}

/* Homepage - Masonry grid with 3 explicit columns */
.masonry-grid {
  display: flex;
  gap: 8px;
  margin: 0 auto;
  padding: 10px 0;
}

.grid-sizer {
  display: none;
}

.masonry-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grid-item {
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.grid-item:hover {
  opacity: 0.85;
}

.grid-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* Responsive masonry grid */
@media (max-width: 991px) {
  .masonry-grid {
    flex-wrap: wrap;
  }
  
  .masonry-column {
    flex: 0 0 calc(50% - 4px);
  }
  
  .masonry-column:nth-child(3) {
    display: none;
  }
}

@media (max-width: 576px) {
  .masonry-column {
    flex: 0 0 100%;
  }
  
  .masonry-column:nth-child(2),
  .masonry-column:nth-child(3) {
    display: none;
  }
}

/* Series grid */
.series-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: auto;
  gap: 8px;
  padding: 10px 0;
  margin: 0 auto;
}

/* Responsive series grid */
@media (max-width: 767px) {
  .series-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .series-grid {
    grid-template-columns: 1fr;
  }
}

.series-item {
  position: relative;
  overflow: hidden;
  height: 200px; /* Fixed height for all items */
  width: 100%; /* Take full width of grid cell */
}

.series-item img {
  width: 100%;
  height: 100%; /* Fill the container */
  object-fit: cover; /* Cover instead of contain to fill the space */
  object-position: center; /* Center the image within the container */
  background-color: #f9f9f9;
}

.series-title {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.7);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.series-item:hover .series-title {
  opacity: 1;
}

.series-title h2 {
  color: var(--color-primary);
  text-align: center;
}

/* Serie page */
.serie-container {
  min-height: calc(100vh - 120px);
  padding-bottom: 20px;
}

/* Serie content */
.content-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 70vh;
  padding-left: 40px;
    padding-right: 40px;
}

.serie-description {
  font-family: 'News Cycle', sans-serif;
  text-align: justify;
  max-width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  margin: 0 auto;
  padding-right: 10px;
  /* Hide scrollbar by default, show on hover */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.serie-description::-webkit-scrollbar {
  width: 6px;
  background: transparent;
}

.serie-description::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 3px;
}

.serie-description:hover {
  scrollbar-width: thin; /* Firefox - show on hover */
}

.serie-description:hover::-webkit-scrollbar-thumb {
  background-color: var(--color-secondary);
}

.slide-indicator {
  display: none;
  margin-top: 10px;
  font-family: 'News Cycle', sans-serif;
  font-size: 14px;
  color: var(--color-secondary);
}

.photo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  height: 70vh;
}

.photo-container img, .photo-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  transition: transform 0.3s ease;
}

/* Side columns */
.side-column {
  position: relative;
  height: 70vh;
}

/* Remove padding between columns in serie page */
.serie-container .row .col-xs-2:first-child {
  padding-right: 0;
}

.serie-container .row .col-xs-8 {
  padding-left: 0;
  padding-right: 0;
}

.serie-container .row .col-xs-2:last-child {
  padding-left: 0;
}

.photo-metadata {
  position: absolute;
  bottom: 0px;
  right: 0px;
  color: var(--color-secondary);
  font-size: 16px;
  text-align: right;
  z-index: 1;
  width: 50%;
  font-family: 'Inconsolata', monospace;
}

#photo-metadata {
  margin-bottom: 0 !important;
}

/* Arrow containers */
.arrow-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.arrow-container a {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-secondary);
  text-decoration: none;
  transition: opacity 0.3s ease;
  padding: 0;
  z-index: 2;
}

.left-arrow-container a {
  right: 0;
}

.right-arrow-container a {
  left: 0;
}

.arrow-container a:hover {
  opacity: 0.7;
}

.arrow-container img {
  display: block;
}

.serie-title {
  font-family: 'Young Serif', serif;
  font-size: 24px;
  text-align: center;
  margin: 20px 0;
}

.prev-serie, .next-serie {
  font-family: 'Young Serif', serif;
  font-size: 20px;
  color: var(--color-secondary);
  text-decoration: none;
  display: block;
  margin: 20px 0;
  cursor: pointer;
}

.prev-serie:hover, .next-serie:hover {
  color: var(--color-secondary);
  text-decoration: none;
}

/* Responsive serie page */
@media (max-width: 767px) {
  .content-container {
    height: 60vh;
    padding-left: 10px;
    padding-right: 10px;
  }
  
  .photo-container {
    height: 60vh;
  }
  
  .photo-container img {
    max-height: 60vh;
  }
  
  /* Keep side columns with height matching photo container for arrow centering */
  .side-column {
    height: 60vh;
    position: relative;
    margin: 0;
  }
  
  /* Hide metadata on small screens to prevent layout disruption */
  .photo-metadata {
    display: none;
  }
  
  /* Keep arrow container absolute for proper vertical centering */
  .arrow-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
  
  .arrow-container a {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .left-arrow-container a {
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .right-arrow-container a {
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .serie-navigation {
    flex-direction: column;
    align-items: center;
  }
  
  /* Smaller font size for series navigation on small screens */
  .prev-serie, .next-serie {
    font-size: 14px;
    margin: 10px 0;
  }
  
  /* Keep text alignment for series navigation */
  .prev-serie {
    text-align: right;
  }
  
  .next-serie {
    text-align: left;
  }
  
  /* Add lateral padding to serie title and remove top margin */
  .serie-title {
    padding-left: 50px;
    padding-right: 50px;
    margin-top: 5px;
  }
  
  /* Limit serie description height for mobile and enable scroll */
  .serie-description {
    max-height: 60vh;
  }
}

/* About page */
.about-container {
  display: flex;
  min-height: calc(100vh - 120px);
  padding-bottom: 20px;
}

.about-image {
  flex: 1;
  padding-right: 20px;
}

.about-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.about-content {
  flex: 1;
  padding-left: 20px;
}

.about-content p {
  text-align: justify;
}

/* Responsive about page */
@media (max-width: 767px) {
  .about-container {
    flex-direction: column;
  }
  
  .about-image {
    padding-right: 0;
    padding-bottom: 20px;
  }
  
  .about-content {
    padding-left: 0;
  }
  
  .about-image img {
    max-height: 50vh;
  }
}

.about-links {
  margin-top: 20px;
}

.about-links a {
  display: block;
  margin-bottom: 10px;
  color: var(--color-secondary);
}

.about-links a.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: color 0.3s ease;
}

.about-links a.contact-link:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.about-links a.contact-link i {
  font-size: 16px;
  line-height: 1;
  position: relative;
  top: 1px;
}

/* Photo metadata */
.metadata {
  color: var(--color-secondary);
  font-family: 'Inconsolata', monospace;
}

/* Fade transitions */
.fade-transition {
  transition: opacity 300ms ease;
}

.fade-out {
  opacity: 0;
}

.fade-in {
  opacity: 1;
}

/* Page transition container */
.page-content {
  opacity: 1;
  transition: opacity 300ms ease;
}

.page-content.fade-out {
  opacity: 0;
}

/* ===== Image Modal (Homepage Masonry) ===== */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.image-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.modal-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 90vh;
  padding: 30px;
  box-shadow: none;
  background: var(--color-background);
  border: none;
  border-radius: 0;
  outline: none;
  transition: background-color 0.3s ease;
}

.modal-close {
  position: fixed;
  top: 20px;
  right: 30px;
  background: none;
  border: none;
  font-size: 40px;
  font-weight: 300;
  color: white;
  cursor: pointer;
  transition: opacity 0.3s ease;
  padding: 0;
  line-height: 1;
  z-index: 10000;
}

.modal-close:hover {
  color: var(--color-primary);
}

.modal-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 65vh;
  border: none;
  outline: none;
}

.modal-image-container img {
  max-width: 100%;
  max-height: 65vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border: none;
  outline: none;
  box-shadow: none;
}

.modal-info {
  text-align: center;
  margin-top: 25px;
}

.modal-series-text {
  font-family: 'News Cycle', sans-serif;
  font-size: 16px;
  color: var(--color-secondary);
  margin: 0 0 5px 0;
  font-style: italic;
}

.modal-series-title {
  font-family: 'Young Serif', serif;
  font-size: 28px;
  color: var(--color-primary);
  margin: 0 0 15px 0;
  font-weight: normal;
}

.modal-series-link {
  font-family: 'News Cycle', sans-serif;
  font-size: 18px;
  text-decoration: none;
  display: inline-block;
  padding: 10px 25px;
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: 0;
  transition: opacity 0.3s ease;
}

.modal-series-link:hover {
  opacity: 0.8;
  color: white;
  text-decoration: none;
}

/* Make grid items clickable */
.grid-item {
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.grid-item:hover {
  opacity: 0.85;
}

/* Responsive modal styles */
@media (max-width: 767px) {
  .modal-content {
    max-width: 95vw;
    padding: 15px;
  }
  
  .modal-close {
    top: 15px;
    right: 20px;
    font-size: 32px;
  }
  
  .modal-image-container {
    max-height: 50vh;
  }
  
  .modal-image-container img {
    max-height: 50vh;
  }
  
  .modal-series-title {
    font-size: 22px;
  }
  
  .modal-series-link {
    font-size: 16px;
    padding: 8px 20px;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 10px;
  }
  
  .modal-close {
    top: 10px;
    right: 15px;
    font-size: 28px;
  }
  
  .modal-image-container {
    max-height: 45vh;
  }
  
  .modal-image-container img {
    max-height: 45vh;
  }
  
  .modal-series-text {
    font-size: 14px;
  }
  
  .modal-series-title {
    font-size: 20px;
  }
  
  .modal-series-link {
    font-size: 14px;
    padding: 8px 15px;
  }
}

/* ===== Theme Toggle Button ===== */
.theme-toggle-container {
  display: inline-flex;
  align-items: center;
  height: 40px;
  margin-left: 15px;
  padding: 0 15px;
}

.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 34px;
  height: 17px;
  padding: 2px;
  background-color: transparent;
  border: 1.5px solid var(--color-toggle-border);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

@media (hover: hover) {
  .theme-toggle:hover {
    border-color: var(--color-primary);
  }
}

.theme-toggle:focus {
  outline: none;
}

.theme-icon {
  width: 11px;
  height: 11px;
  color: var(--color-secondary);
  z-index: 1;
  transition: color 0.3s ease, opacity 0.3s ease;
  display: block;
  flex-shrink: 0;
}

.sun-icon {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
}

.moon-icon {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
}

.toggle-slider {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 2px;
  width: 11px;
  height: 11px;
  background-color: var(--color-toggle-slider);
  border-radius: 50%;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

/* Dark mode toggle state */
[data-theme="dark"] .toggle-slider {
  transform: translateY(-50%) translateX(16px);
}

/* Hide active icon behind slider */
.theme-toggle .sun-icon {
  opacity: 0;
}

.theme-toggle .moon-icon {
  opacity: 1;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  opacity: 1;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  opacity: 0;
}

/* Dark mode specific styles for series overlay */
[data-theme="dark"] .series-title {
  background-color: rgba(0, 0, 0, 0.7);
}

/* Dark mode specific styles for modal link text */
[data-theme="dark"] .modal-series-link {
  color: black;
}

/* Responsive theme toggle */
@media (max-width: 767px) {
  .theme-toggle-container {
    margin-left: 10px;
    margin-top: 5px;
  }
}
