/* Public portfolio page. Ported from the static portfolios (portfolia/kaja). */

:root {
  --page-bg: #fafafa;
  --text: #222;
  --text-muted: #666;
  --price: #333;
  --card-bg: #fff;
  --placeholder: #f5f5f5;
  --rule: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
  --gap: 2.5rem;

  font-family: 'Segoe UI Light', 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  font-weight: 300;
  color: var(--text);
  background-color: var(--page-bg);

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-width: 320px;
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */

.header {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.header-title {
  font-weight: 300;
  font-size: 2.5rem;
  margin: 0 0 0.5rem 0;
  color: var(--text);
}

.header-subtitle {
  font-size: 1.25rem;
  margin: 0;
  color: var(--text-muted);
}

.header-intro {
  max-width: 44rem;
  margin: 1.5rem auto 0;
  color: var(--text-muted);
  white-space: pre-line;
}

/* Gallery */

.gallery {
  flex: 1;
  width: 100%;
  padding: 2rem 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.gallery-masonry {
  column-count: 3;
  column-gap: var(--gap);
}

.gallery-masonry .painting-card {
  break-inside: avoid;
  margin-bottom: var(--gap);
}

.gallery-columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(350px, 100%), 1fr));
  gap: var(--gap);
  align-items: start;
}

@media (max-width: 1024px) {
  .gallery-masonry {
    column-count: 2;
  }
}

@media (max-width: 768px) {
  .gallery {
    padding: 1.5rem 1rem;
  }

  .gallery-masonry {
    column-count: 1;
  }

  .header-title {
    font-size: 2rem;
  }
}

/* Painting card */

.painting-card {
  background: var(--card-bg);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s;
}

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

.painting-main-image-container {
  display: block;
  width: 100%;
  background: var(--placeholder);
  cursor: zoom-in;
}

.painting-main-image {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.3s;
}

.painting-main-image-container:hover .painting-main-image {
  opacity: 0.9;
}

.painting-info {
  padding: 1.5rem 1.5rem 1rem;
}

.painting-title {
  font-weight: 300;
  font-size: 1.5rem;
  margin: 0 0 0.5rem 0;
  color: var(--text);
}

.painting-details {
  font-size: 0.95rem;
  margin: 0;
  color: var(--text-muted);
}

.painting-price {
  font-weight: 400;
  font-size: 1.1rem;
  margin: 0.5rem 0 0;
  color: var(--price);
}

.painting-thumbnails {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  padding: 0 1.5rem 1.5rem;
}

.painting-thumbnails a {
  display: block;
  overflow: hidden;
  border-radius: 2px;
  background: var(--placeholder);
  cursor: zoom-in;
}

.painting-thumbnail {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s, transform 0.2s;
}

.painting-thumbnails a:hover .painting-thumbnail {
  opacity: 0.8;
  transform: scale(1.05);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Footer */

.footer {
  text-align: center;
  padding: 3rem 1rem;
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
}

.footer-text {
  font-size: 0.95rem;
  margin: 0;
  color: var(--text-muted);
}

.footer-link {
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s;
}

.footer-link:hover {
  opacity: 0.7;
}

/* Status pages and the draft banner on the admin preview */

.status-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
}

.status-page h1 {
  font-weight: 300;
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.status-page p {
  margin: 0;
  color: var(--text-muted);
}

.preview-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 400;
  color: #fff;
  background: #222;
}

/* Lightbox */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
  touch-action: none;
  overscroll-behavior: contain;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  cursor: default;
}

.lightbox-stage {
  overflow: hidden;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  transition: opacity 0.2s;
}

.lightbox-image.is-loading {
  opacity: 0.3;
}

.lightbox-image.is-zoomed {
  cursor: grab;
}

.lightbox-image.is-dragging {
  cursor: grabbing;
}

.lightbox-close,
.lightbox-nav {
  position: fixed;
  background: none;
  border: none;
  color: white;
  font-weight: 300;
  line-height: 1;
  z-index: 1001;
  transition: opacity 0.2s;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  opacity: 0.7;
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
  font-size: 3rem;
  padding: 0;
  width: 3rem;
  height: 3rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 4rem;
  padding: 1rem;
}

.lightbox-nav-prev {
  left: 1rem;
}

.lightbox-nav-next {
  right: 1rem;
}

.lightbox-counter {
  position: absolute;
  bottom: -2rem;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 0.9rem;
}

.lightbox-zoom-controls {
  position: fixed;
  top: 1rem;
  left: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  z-index: 1001;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.5rem;
  border-radius: 4px;
  cursor: default;
}

.lightbox-zoom-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
  font-size: 1.2rem;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  line-height: 1;
}

.lightbox-zoom-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
}

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

.lightbox-zoom-level {
  color: white;
  font-size: 0.9rem;
  min-width: 3rem;
  text-align: center;
}

.lightbox-overlay button:focus-visible {
  outline: 2px solid white;
}

@media (max-width: 768px) {
  .lightbox-nav {
    font-size: 3rem;
    padding: 0.5rem;
  }

  .lightbox-nav-prev {
    left: 0;
  }

  .lightbox-nav-next {
    right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
