:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-text-light: #666;
  --color-border: #e0e0e0;
  --color-overlay: rgba(255, 255, 255, 0.97);
  --font-heading: 'Jost', sans-serif;
  --font-mono: 'Inconsolata', monospace;
  --grid-gap: 24px;
  --grid-columns: 3;
  --page-padding: 48px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-mono);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 32px var(--page-padding);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.site-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-text);
}

.site-nav {
  display: flex;
  gap: 32px;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--color-text-light);
  letter-spacing: 0.03em;
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link--active {
  color: var(--color-text);
}

/* --- Main Layout --- */

main {
  flex: 1;
}

.main-layout {
  display: flex;
  gap: 0;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--page-padding);
}

/* --- Sidebar --- */

.sidebar {
  width: 220px;
  flex-shrink: 0;
  padding-top: 8px;
  padding-right: 32px;
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  position: sticky;
  top: 32px;
}

.sidebar-brand {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: #555;
  font-weight: 500;
  padding: 6px 0;
  cursor: pointer;
  transition: color 0.2s;
  letter-spacing: 0.02em;
}

.sidebar-brand:hover {
  color: var(--color-text);
}

.sidebar-brand.active {
  color: var(--color-text);
  font-weight: 500;
}

.sidebar-sub {
  padding-left: 16px;
  padding-bottom: 4px;
}

.sidebar-type {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #666;
  padding: 4px 0;
  cursor: pointer;
  transition: color 0.2s;
}

.sidebar-type:hover {
  color: var(--color-text);
}

.sidebar-type.active {
  color: var(--color-text);
  font-weight: 500;
}

.sidebar-count {
  font-size: 0.7rem;
  color: #888;
  opacity: 0.8;
}

.sidebar-blocks {
  padding-left: 12px;
  padding-bottom: 2px;
}

.sidebar-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #666;
  padding: 3px 0;
  cursor: pointer;
  transition: color 0.2s;
}

.sidebar-block:hover {
  color: var(--color-text);
}

.sidebar-block.active {
  color: var(--color-text);
  font-weight: 500;
}

.sidebar-favorites {
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--color-border);
  width: 60%;
}

.sidebar-fav-btn svg {
  fill: var(--color-text-light);
}

.sidebar-fav-btn.active svg {
  fill: var(--color-text);
}

/* --- Main Content --- */

.main-content {
  flex: 1;
  min-width: 0;
}

/* --- Carousel --- */

.carousel {
  padding: 44px 0 20px;
}

.carousel-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 30vh;
  margin-left: 0;
  overflow: hidden;
}

.carousel-image-wrap {
  max-width: 900px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 24px;
}

.carousel-img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  cursor: pointer;
  position: relative;
  z-index: 3;
}

.carousel-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  z-index: 2;
}


.carousel-prev {
  left: 0;
  justify-content: flex-start;
  padding-left: 8px;
  cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><path d='M15 6L9 12l6 6' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") 12 12, w-resize;
}

.carousel-next {
  right: 0;
  justify-content: flex-end;
  padding-right: 8px;
  cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><path d='M9 6l6 6-6 6' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") 12 12, e-resize;
}

.carousel-nav:disabled {
  cursor: default;
}


.carousel-info {
  text-align: center;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-light);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.2s;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
}

.carousel-info:hover {
  color: var(--color-text);
  text-decoration-color: var(--color-text-light);
}

/* --- Painting Header (between carousel and grid) --- */

.painting-header {
  text-align: center;
  padding: 8px 0 16px;
  position: relative;
  z-index: 3;
}

.painting-header .carousel-info {
  display: inline;
  margin-top: 0;
}

.painting-header-choice {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 6px;
}

.painting-header-choice .fav-icon {
  fill: none;
  stroke: var(--color-text-light);
  stroke-width: 1.5;
  transition: all 0.2s;
}

.painting-header-choice:hover .fav-icon {
  stroke: var(--color-text);
}

.painting-header-choice.active .fav-icon {
  fill: var(--color-text);
  stroke: var(--color-text);
}

/* --- Browse Grid Section --- */

.browse-grid-section {
  display: none;
  padding: 0 0 64px;
}

/* --- Browse Grid (Ebene 3) --- */

.browse-grid {
  columns: var(--grid-columns);
  column-gap: var(--grid-gap);
}

.grid-item {
  break-inside: avoid;
  margin-bottom: var(--grid-gap);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s;
}

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

.grid-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.3s;
}

.grid-item:hover .grid-overlay {
  opacity: 1;
}

.grid-item:hover {
  transform: scale(1.02);
}

.grid-overlay-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #fff;
}

.grid-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 2;
  padding: 0;
}

.grid-item:hover .grid-fav-btn {
  opacity: 1;
}

.grid-fav-btn svg {
  fill: none;
  stroke: #666;
  stroke-width: 1.5;
}

.grid-fav-btn:hover svg {
  stroke: #333;
}

.grid-fav-btn.active svg {
  fill: #333;
  stroke: #333;
}

.grid-empty {
  column-span: all;
  text-align: center;
  padding: 80px 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.grid-clear {
  display: block;
  margin: 24px auto 0;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-text-light);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: all 0.2s;
}

.grid-clear:hover {
  color: var(--color-text);
  text-decoration-color: var(--color-text-light);
}

/* --- Lightbox --- */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--color-overlay);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  --cursor-prev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M15 4l-8 8 8 8' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 12 12, w-resize;
  --cursor-next: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M9 4l8 8-8 8' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 12 12, e-resize;
  cursor: default;
}

.lightbox.open {
  display: flex;
  padding: 64px 0 0;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  background: none;
  border: none;
  color: var(--color-text-light);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s;
  font-family: var(--font-mono);
  z-index: 10;
}

.lightbox-close:focus {
  outline: none;
}

.lightbox-close:hover {
  color: var(--color-text);
}

.lightbox-fav {
  position: absolute;
  top: 24px;
  right: 72px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  transition: all 0.2s;
  z-index: 10;
}

.lightbox-fav .fav-icon {
  fill: none;
  stroke: var(--color-text-light);
  stroke-width: 1.5;
  transition: all 0.2s;
}

.lightbox-fav:hover .fav-icon {
  stroke: var(--color-text);
}

.lightbox-fav.active .fav-icon {
  fill: var(--color-text);
  stroke: var(--color-text);
}

.lightbox-fav.active:hover .fav-icon {
  fill: var(--color-text);
  stroke: var(--color-text);
}

.lightbox-zoom-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  max-height: 70vh;
  max-width: 85vw;
  position: relative;
  z-index: 6;
}

.lightbox-img {
  max-height: 70vh;
  max-width: 85vw;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

.lightbox-img.zoomed {
  max-height: none;
  max-width: none;
  cursor: grab;
}

.lightbox-img.zoomed:active {
  cursor: grabbing;
}

.lightbox-nav-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 5;
  background: transparent;
}

.lightbox-nav-prev {
  left: 0;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M15 4l-8 8 8 8' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 12 12, w-resize;
}

.lightbox-nav-next {
  right: 0;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M9 4l8 8-8 8' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 12 12, e-resize;
}



.lightbox-meta {
  text-align: center;
  margin-top: 20px;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
}

.lightbox-counter {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-text-light);
  margin-top: 8px;
}

.lightbox-zoom-controls {
  position: absolute;
  bottom: 24px;
  right: 32px;
  display: flex;
  gap: 4px;
  z-index: 10;
}

.lightbox-zoom-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text-light);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
}

.lightbox-zoom-btn:hover:not(:disabled) {
  color: var(--color-text);
  border-color: var(--color-text-light);
}

.lightbox-zoom-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.lightbox-share {
  position: absolute;
  top: 24px;
  right: 112px;
  background: none;
  border: none;
  color: var(--color-text-light);
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s;
  z-index: 10;
}

.lightbox-share:hover {
  color: var(--color-text);
}

.lightbox-immersive svg {
  vertical-align: middle;
}

.lightbox-zoom-btn:focus {
  outline: none;
}

.lightbox-share:focus {
  outline: none;
}

.lightbox.immersive .lightbox-close,
.lightbox.immersive .lightbox-fav,
.lightbox.immersive .lightbox-share,
.lightbox.immersive .lightbox-meta,
.lightbox.immersive .lightbox-counter,
.lightbox.immersive .lightbox-nav-prev,
.lightbox.immersive .lightbox-nav-next,
.lightbox.immersive .lightbox-rotate,
.lightbox.immersive .lightbox-zoom-in,
.lightbox.immersive .lightbox-zoom-out {
  display: none;
}

.lightbox.immersive .lightbox-zoom-controls {
  position: fixed;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.lightbox.immersive .lightbox-immersive {
  opacity: 0.25;
  transition: opacity 0.3s;
}

.lightbox.immersive .lightbox-immersive:hover {
  opacity: 0.7;
}

.lightbox.immersive {
  padding: 24px 0 calc(56px + env(safe-area-inset-bottom, 0px));
}

.lightbox.immersive .lightbox-zoom-wrap {
  max-height: calc(100vh - 80px - env(safe-area-inset-bottom, 0px));
  max-width: 95vw;
}

.lightbox.immersive .lightbox-img {
  max-height: calc(100vh - 80px - env(safe-area-inset-bottom, 0px));
  max-width: 95vw;
}

/* --- Site Footer --- */

.site-footer {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 48px var(--page-padding);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--color-text-light);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.main-layout ~ .site-footer {
  padding-left: calc(220px + var(--page-padding));
}

.site-footer a {
  color: var(--color-text-light);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: var(--color-text);
}

/* --- About --- */

.about {
  padding: 48px;
  max-width: 700px;
  margin: 0 auto;
}

.about h1 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  margin-bottom: 32px;
}

.about p {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--color-text-light);
  margin-bottom: 16px;
}

/* --- Hamburger & Mobile Menu --- */

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--color-text);
  line-height: 0;
}

.menu-close {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 901;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--color-text-light);
  font-size: 1.5rem;
  font-family: var(--font-mono);
  line-height: 1;
}

.menu-close:hover {
  color: var(--color-text);
}

.mobile-breadcrumb {
  display: none;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
  :root {
    --grid-columns: 3;
    --grid-gap: 16px;
    --page-padding: 24px;
  }

  .about {
    padding: 32px 24px;
  }
}

@media (max-width: 600px) {
  :root {
    --grid-columns: 2;
    --page-padding: 16px;
  }

  /* --- Header --- */
  .site-header {
    padding: 16px var(--page-padding);
  }

  .hamburger {
    display: flex;
    align-items: center;
  }

  .site-name {
    font-size: 0.9rem;
  }

  .site-nav {
    gap: 16px;
  }

  .hamburger ~ .site-nav .nav-link--active {
    display: none;
  }

  .nav-link {
    font-size: 0.8rem;
  }

  /* --- Breadcrumb --- */
  .mobile-breadcrumb {
    display: block;
    padding: 0 var(--page-padding) 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-text-light);
    min-height: 18px;
    line-height: 18px;
  }

  .mobile-breadcrumb:not(:empty) {
    cursor: pointer;
  }

  .mobile-breadcrumb:not(:empty):hover {
    color: var(--color-text);
  }

  /* --- Sidebar as Fullscreen Overlay --- */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 900;
    background: var(--color-bg);
    padding: 56px var(--page-padding) 32px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-right: none;
    border-bottom: none;
    padding-right: var(--page-padding);
    margin-bottom: 0;
    display: none;
  }

  body.menu-open .sidebar {
    display: flex;
  }

  body.menu-open .menu-close {
    display: block;
  }

  body.menu-open {
    overflow: hidden;
  }

  .sidebar-nav {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .sidebar-favorites {
    width: 100%;
  }

  .sidebar-sub {
    width: 100%;
    padding-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .sidebar-brand {
    padding: 10px 0;
    font-size: 0.95rem;
  }

  .sidebar-type {
    padding: 8px 0;
    font-size: 0.85rem;
  }

  .sidebar-block {
    padding: 6px 0;
    font-size: 0.8rem;
  }

  /* --- Main Layout --- */
  .main-layout {
    flex-direction: column;
  }

  .main-content {
    padding-left: 0;
  }

  /* --- Carousel --- */
  .carousel {
    padding-top: 8px;
  }

  .carousel-wrap {
    margin-left: 0;
  }

  .carousel-image-wrap {
    padding: 0 16px;
    align-items: flex-end;
  }

  .carousel-nav {
    font-size: 1rem;
  }

  /* --- Lightbox --- */
  .lightbox-nav-zone {
    width: 50%;
  }

  .lightbox-close {
    top: 12px;
    right: 16px;
  }

  .lightbox-fav {
    top: 12px;
    right: 48px;
  }

  .lightbox-share {
    top: 12px;
    right: 84px;
  }

  .lightbox-zoom-controls {
    position: static;
    align-self: flex-end;
    margin-top: 8px;
    margin-right: 16px;
  }

  .lightbox.immersive .lightbox-zoom-controls {
    position: fixed;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    margin: 0;
  }

  .lightbox-zoom-wrap {
    max-width: 95vw;
    max-height: 65vh;
  }

  .lightbox-img {
    max-width: 95vw;
    max-height: 65vh;
  }

  /* --- Footer --- */
  .site-footer {
    gap: 12px;
    padding: 24px var(--page-padding);
    font-size: 0.6rem;
  }

  .main-layout ~ .site-footer {
    padding-left: var(--page-padding);
  }
}
