/* ============================================================
   CUSTOM ALBUM TEMPLATE STYLES
   v5.7 - More subtle heart/X icon opacity
   ============================================================ */

/* Apply theme to page */
[data-theme="dark"] body {
  background-color: var(--tt-bg);
  color: var(--tt-text);
}

[data-theme="dark"] #container {
  background-color: var(--tt-bg);
}

[data-theme="dark"] main.template-set {
  background-color: var(--tt-bg);
}

[data-theme="dark"] header,
[data-theme="dark"] footer {
  background-color: var(--tt-bg);
}

/* ============================================================
   Main Site Header - Sticky on all devices
   ============================================================ */

header.js-nav {
  position: sticky !important;
  top: 0 !important;
  z-index: 200;
  background-color: var(--tt-bg, #fff);
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }
  
  /* Ensure header doesn't break hamburger menu from custom.css */
  header.js-nav {
    min-height: var(--header-height);
  }
}

/* Header logo invert in dark mode */
[data-theme="dark"] header .website-title a img,
[data-theme="dark"] header .title-container img {
  filter: invert(1);
}

/* Nav links in dark mode */
[data-theme="dark"] header nav a {
  color: var(--tt-text);
}

/* ============================================================
   Nav Theme Toggle (Desktop)
   ============================================================ */

.tt-nav-theme-item {
  display: flex;
  align-items: center;
}

.tt-nav-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 150ms ease;
}

.tt-nav-theme-toggle:hover {
  opacity: 1;
}

.tt-nav-theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Show moon in light mode, sun in dark mode */
.tt-nav-theme-toggle .tt-icon-sun { display: none; }
.tt-nav-theme-toggle .tt-icon-moon { display: block; }

[data-theme="dark"] .tt-nav-theme-toggle .tt-icon-sun { display: block; }
[data-theme="dark"] .tt-nav-theme-toggle .tt-icon-moon { display: none; }

/* Hide nav toggle on mobile (album header has its own toggle) */
@media (max-width: 768px) {
  .tt-nav-theme-item {
    display: none;
  }
}

/* ============================================================
   Container - match gallery padding
   ============================================================ */

.tt-album {
  position: relative;
  z-index: 1;
  max-width: var(--website-maxwidth, 1800px);
  margin: 0 auto;
  padding: 24px 0 0 0;
  box-sizing: border-box;
}

/* Ensure main content area has consistent padding */
main.template-set {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* ============================================================
   Album Header - sticky on all devices
   Desktop: single row (meta left, title right)
   Mobile/Tablet: stacked, centered title
   Now a direct child of main for better sticky behavior
   ============================================================ */

.tt-album__header {
  position: sticky;
  top: var(--header-height, 60px);
  z-index: 100;
  background-color: var(--tt-bg, #fff);
  margin-bottom: 0;
  padding: 16px 24px;
}

/* Desktop: single row layout */
@media (min-width: 769px) {
  .tt-album__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }
  
  .tt-album__topbar {
    margin-bottom: 0;
  }
  
  .tt-album__title {
    text-align: right;
    flex-shrink: 0;
  }
}

/* Mobile/Tablet: stacked layout */
@media (max-width: 768px) {
  .tt-album__header {
    top: var(--header-height, 56px);
    padding: 12px 16px 16px;
    text-align: center;
  }
  
  .tt-album__topbar {
    justify-content: center;
  }
  
  .tt-album__title {
    text-align: center;
  }
}


.tt-album__topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--tt-text-muted);
}

.tt-album__back {
  font-weight: 400;
  color: var(--tt-text-faint);
  text-decoration: none !important;
  transition: color 150ms ease;
}

.tt-album__back:hover,
.tt-album__back:focus,
.tt-album__back:active {
  color: var(--tt-text-muted);
  text-decoration: none !important;
}

.tt-album__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--tt-text-muted);
}

.tt-album__separator {
  opacity: 0.5;
}

.tt-album__title {
  font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--tt-text);
}

.tt-album__architect {
  font-weight: 500;
}

/* Admin year link - subtle, opens admin panel */
.tt-album__year--admin {
  text-decoration: none !important;
  color: inherit;
  transition: opacity 140ms ease;
}

.tt-album__year--admin:hover,
.tt-album__year--admin:focus,
.tt-album__year--admin:active {
  color: #dc2626 !important;
  opacity: 1;
  text-decoration: none !important;
  text-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

/* ============================================================
   Gallery Grid - targets IO200's AlbumGallery output
   Disable Masonry.js, use pure CSS columns
   ============================================================ */

/* Override IO200's default gallery with CSS columns masonry */
.tt-album ul.gallery.gallery-album {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  column-count: 1 !important;
  column-gap: 0 !important;
  columns: 1 !important;
  /* Disable Masonry.js layout */
  height: auto !important;
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.tt-album ul.gallery.gallery-album li {
  break-inside: avoid;
  margin: 0 0 16px 0 !important;
  padding: 0 !important;
  /* Override Masonry.js inline styles */
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  position: relative !important;
  transform: none !important;
  box-sizing: border-box !important;
}

.tt-album ul.gallery.gallery-album li a {
  display: block;
  line-height: 0;
}

.tt-album ul.gallery.gallery-album li img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  transition: opacity 150ms ease;
}

.tt-album ul.gallery.gallery-album li:hover img {
  opacity: 0.92;
}

/* Heart/favorite button - IO200 injects .action-basket after <a> */
/* SVG heart for unselected, SVG X for selected */

/* Base button styling */
.gallery-album li .action-basket,
.gallery-album li button.action,
ul.gallery.gallery-album li .action-basket,
ul.gallery.gallery-album li button.action {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  z-index: 5 !important;
  width: 20px !important;
  height: 20px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  opacity: 0.45 !important;
  cursor: pointer !important;
  transition: opacity 150ms ease, transform 150ms ease !important;
  overflow: hidden !important;
}

/* Hide ALL IO200's default button content (svg, spans, icons) */
.gallery-album li .action-basket > *,
.gallery-album li button.action > *,
ul.gallery.gallery-album li .action-basket > *,
ul.gallery.gallery-album li button.action > * {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Unselected: SVG heart outline via ::after */
.gallery-album li .action-basket::after,
.gallery-album li button.action::after,
ul.gallery.gallery-album li .action-basket::after,
ul.gallery.gallery-album li button.action::after {
  content: "" !important;
  display: block !important;
  width: 16px !important;
  height: 16px !important;
  margin: 2px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z'/%3E%3C/svg%3E") !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)) !important;
}

/* Hover: show more clearly */
.gallery-album li:hover .action-basket,
.gallery-album li:hover button.action,
ul.gallery.gallery-album li:hover .action-basket,
ul.gallery.gallery-album li:hover button.action {
  opacity: 0.7 !important;
}

/* Hover scale */
.gallery-album li .action-basket:hover,
.gallery-album li button.action:hover,
ul.gallery.gallery-album li .action-basket:hover,
ul.gallery.gallery-album li button.action:hover {
  transform: scale(1.1) !important;
}

/* Selected/Active: SVG X to remove */
.gallery-album li .action-basket.active::after,
.gallery-album li .action-basket.is-active::after,
.gallery-album li .action-basket.selected::after,
.gallery-album li button.action.active::after,
.gallery-album li button.action.is-active::after,
ul.gallery.gallery-album li .action-basket.active::after,
ul.gallery.gallery-album li .action-basket.is-active::after,
ul.gallery.gallery-album li .action-basket.selected::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E") !important;
}

/* Selected buttons always visible */
.gallery-album li .action-basket.active,
.gallery-album li .action-basket.is-active,
.gallery-album li .action-basket.selected,
.gallery-album li button.action.active,
.gallery-album li button.action.is-active,
ul.gallery.gallery-album li .action-basket.active,
ul.gallery.gallery-album li .action-basket.is-active,
ul.gallery.gallery-album li .action-basket.selected {
  opacity: 0.7 !important;
}

/* Mobile: always show buttons */
@media (max-width: 600px) {
  .gallery-album li .action-basket,
  .gallery-album li button.action,
  ul.gallery.gallery-album li .action-basket,
  ul.gallery.gallery-album li button.action {
    opacity: 0.5 !important;
  }
}

/* Responsive columns - 3 columns on desktop */
@media (min-width: 1024px) {
  .tt-album ul.gallery.gallery-album {
    column-count: 3 !important;
    columns: 3 !important;
    column-gap: 20px !important;
  }

  .tt-album ul.gallery.gallery-album li {
    margin-bottom: 20px;
  }
}

/* Cap at 3 columns — container max-width is 1800px */

/* Tablet: 2 columns */
@media (min-width: 768px) and (max-width: 1023px) {
  .tt-album ul.gallery.gallery-album {
    column-count: 2 !important;
    columns: 2 !important;
    column-gap: 16px !important;
  }

  .tt-album ul.gallery.gallery-album li {
    margin-bottom: 16px;
  }
}

/* Mobile: single column */
@media (max-width: 767px) {
  .tt-album ul.gallery.gallery-album {
    column-count: 1 !important;
    columns: 1 !important;
  }
}

@media (max-width: 600px) {
  .tt-album ul.gallery.gallery-album li > button {
    opacity: 1 !important;
  }
}

/* GLightbox - see src/css/components/lightbox.css for full styles */

/* ============================================================
   Description
   ============================================================ */

.tt-album__description {
  max-width: 720px;
  margin-bottom: 32px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--tt-text-muted);
}

.tt-album__description p {
  margin: 0 0 1em 0;
}

.tt-album__description p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Empty state
   ============================================================ */

.tt-album__empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--tt-text-faint);
  font-size: 15px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (min-width: 600px) {
  .tt-album {
    padding: 24px 24px 80px;
  }
}

@media (min-width: 1000px) {
  .tt-album {
    padding: 32px 40px 100px;
  }
}

@media (min-width: 2000px) {
  .tt-album {
    padding: 40px 48px 100px;
  }
}

@media (max-width: 768px) {
  .tt-theme-toggle {
    right: 12px;
    width: 36px;
    height: 36px;
  }
  
  .tt-theme-toggle svg {
    width: 16px;
    height: 16px;
  }
}

/* Lightbox styles moved to src/css/components/lightbox.css */

/* ============================================================
   Layout fixes
   ============================================================ */

main.template-set {
  /* Use clip instead of hidden to not break sticky positioning */
  overflow-x: clip;
}

/* Hide default title since we have custom header */
main.template-set > h1:first-of-type,
main.template-set > .title:first-of-type {
  display: none;
}

/* ============================================================
   Dark mode adjustments for IO200 elements
   ============================================================ */

[data-theme="dark"] .gallery-album li a {
  color: var(--tt-text);
}

[data-theme="dark"] nav a,
[data-theme="dark"] header a,
[data-theme="dark"] footer a {
  color: var(--tt-text-muted);
}

[data-theme="dark"] nav a:hover,
[data-theme="dark"] header a:hover,
[data-theme="dark"] footer a:hover {
  color: var(--tt-text);
}

/* Header logo invert in dark mode */
[data-theme="dark"] header .website-title a img,
[data-theme="dark"] header span.website-title {
  filter: invert(1);
}

/* Social media icons invert */
[data-theme="dark"] footer .socialmedia img {
  filter: invert(1);
}

/* Basket icon */
[data-theme="dark"] .linktemplate-basket svg path {
  fill: var(--tt-text);
}

/* ============================================================
   Toast Notification
   ============================================================ */

.tt-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1000;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 100ms ease, transform 100ms ease;
  pointer-events: none;
}

.tt-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

[data-theme="dark"] .tt-toast {
  background: rgba(255, 255, 255, 0.9);
  color: #111;
}

/* ============================================================
   Scroll to Top Button
   ============================================================ */

.tt-scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 100ms ease, transform 100ms ease, visibility 100ms ease, background 100ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tt-scroll-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tt-scroll-top:hover {
  background: rgba(0, 0, 0, 0.85);
}

.tt-scroll-top svg {
  width: 20px;
  height: 20px;
}

[data-theme="dark"] .tt-scroll-top {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

[data-theme="dark"] .tt-scroll-top:hover {
  background: rgba(255, 255, 255, 0.3);
}


/* ============================================================
   Image loading - breathing placeholder effect
   ============================================================ */

.tt-album ul.gallery.gallery-album li {
  background: #e5e5e5;
  animation: breathe 2s ease-in-out infinite;
}

[data-theme="dark"] .tt-album ul.gallery.gallery-album li {
  background: #3a3a3a;
}

.tt-album ul.gallery.gallery-album li.is-loaded {
  animation: none;
  background: transparent;
}

/* Hide broken image icon while loading */
.tt-album ul.gallery.gallery-album li:not(.is-loaded) img {
  opacity: 0;
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
