/* Portfolio Theme - Minimal & Clean */
/* Typography optimized for Polish reading experience (migrated from Krzaki Polskie) */

/* Fauna One Font */
@font-face {
  font-family: 'Fauna One';
  src: url('/fonts/FaunaOne-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Color Palette */
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #555555;
  --color-accent: #2c3e50;
  --color-border: #e0e0e0;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Fauna One', 'Times New Roman', Times, serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.75;
  font-size: 1.125rem;
  overflow-x: hidden;
  text-align: left;
  font-variation-settings: "opsz" 18;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  orphans: 2;
  widows: 2;
}

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: text-decoration-thickness 0.15s ease;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Image links keep images untouched - only cursor changes */
a.lightbox-trigger,
a.lightbox-trigger:hover,
a.project-tile,
a.project-tile:hover {
  opacity: 1 !important;
  text-decoration: none !important;
  transition: none !important;
}

.gallery-item {
  cursor: pointer;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Fauna One', 'Times New Roman', Times, serif;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--color-accent);
}

p {
  margin-bottom: 1.5rem;
}

/* Container */
.container {
  max-width: calc(80ch + (1.5rem * 2));
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Homepage Layout */
.homepage {
  padding-top: 40px;
  padding-bottom: 60px;
}

/* Projects Page Layout */
.projects-page {
  padding-top: 40px;
  padding-bottom: 60px;
}

/* Single Project Page Layout */
.project-page {
  padding-top: 40px;
  padding-bottom: 60px;
}

/* Featured Photo */
.featured-photo {
  width: 100%;
  margin-bottom: 30px;
}

.featured-photo img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Thumbnail Row */
.thumbnail-row {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  padding-bottom: 20px;
  scroll-behavior: smooth;
}

.thumbnail-row::-webkit-scrollbar {
  height: 6px;
}

.thumbnail-row::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 3px;
}

.thumbnail {
  flex-shrink: 0;
  width: 200px;
  height: 150px;
  cursor: pointer;
}

.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Projects Grid */
.projects-section {
  margin-top: 60px;
}

.projects-section h2 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 1.5rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
}

.project-tile {
  cursor: pointer;
  color: inherit;
}

.project-tile:hover {
  opacity: 1;
}

.project-tile img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  margin-bottom: 10px;
}

.project-title {
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.project-date {
  font-size: 0.9rem;
  color: #666;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
  gap: 20px;
}

.top-bar-left {
  flex: 1;
}

.top-bar-right {
  flex-shrink: 0;
}

.email {
  font-size: 1rem;
  color: #666;
  display: inline-block;
}

.projects-link {
  font-size: 1.1rem;
  color: #333;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.projects-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.top-divider {
  border: none;
  border-top: 1px solid #eee;
  width: 100%;
  margin-bottom: 30px;
}

/* Projects Section (hidden on homepage, shown on dedicated page) */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 50px;
  margin-top: 20px;
}

.project-list-item {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.project-list-item:hover {
  opacity: 1;
  text-decoration: none;
}

.project-list-item img {
  width: 350px;
  height: 250px;
  object-fit: cover;
  flex-shrink: 0;
}

.project-info {
  flex: 1;
}

.project-info h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.project-meta-small {
  font-size: 0.9rem;
  color: #666;
}

/* Old Contact Email - Bottom (deprecated) */
.contact-email {
  display: none;
}

/* Interior Pages */
.interior-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  margin-bottom: 30px;
  font-size: 0.95rem;
}

.back-button::before {
  content: "← ";
  margin-right: 5px;
}

/* Project Page Content */
.project-content p {
  margin-bottom: 1.5rem;
}

.project-content img {
  margin: 2rem auto;
  max-width: 100%;
}

.project-meta {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  font-size: 0.9rem;
  color: #666;
}

.project-meta dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
}

.project-meta dt {
  font-weight: 600;
  color: #333;
}

.project-meta dd {
  margin: 0;
}

.project-gallery {
  margin-top: 40px;
}

.project-gallery h3 {
  margin-bottom: 20px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.gallery-item {
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 80vh;
}

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  margin-left: auto;
  margin-right: auto;
}

.lightbox-nav {
  position: absolute;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 20px;
  transition: opacity 0.2s ease;
}

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

.lightbox-nav[style*="opacity: 0.3"] {
  cursor: not-allowed;
}

/* Desktop: arrows outside image, close button above */
.lightbox-prev {
  top: 50%;
  left: -80px;
  transform: translateY(-50%);
  font-size: 3rem;
  color: #333;
}

.lightbox-next {
  top: 50%;
  right: -80px;
  transform: translateY(-50%);
  font-size: 3rem;
  color: #333;
}

.lightbox-close {
  top: -50px;
  right: 0;
  font-size: 2rem;
  padding: 10px;
  color: #333;
}

.lightbox-metadata {
  margin-top: 20px;
  text-align: left;
}

.lightbox-caption {
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.lightbox-details {
  font-size: 0.9rem;
  color: #666;
}

.lightbox-text {
  font-size: 0.95rem;
  margin-top: 15px;
  font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
  :root {
    --size-base: 1rem;
    --measure: 60ch;
  }

  .thumbnail {
    width: 150px;
    height: 100px;
  }
  
  .projects-grid {
    grid-template-columns: 1fr;
  }
  
  /* Stack project list items vertically on mobile */
  .project-list-item {
    flex-direction: column;
  }
  
  .project-list-item img {
    width: 100%;
    height: auto;
    max-height: 300px;
  }
  
  /* Mobile: close pinned to top of screen, arrows pinned to bottom */
  .lightbox-content {
    width: 96%;
    max-height: 78vh;
    max-height: 78dvh;
  }
  
  .lightbox-close {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    font-size: 2rem;
    padding: 15px 20px;
    z-index: 1010;
    color: #333;
  }
  
  .lightbox-prev,
  .lightbox-next {
    position: fixed;
    top: auto;
    bottom: 0;
    transform: none;
    font-size: 2.5rem;
    color: #333;
    padding: 15px 25px;
    z-index: 1010;
  }
  
  .lightbox-prev {
    left: 0;
  }
  
  .lightbox-next {
    right: 0;
  }
  
  .lightbox-img {
    max-height: 62vh;
    max-height: 62dvh;
  }
  
  .lightbox-metadata {
    padding: 0 4px;
    margin-top: 10px;
  }

  .blog-header h1 {
    font-size: 1.5rem;
  }
}

/* Accessibility: Focus Styles */
:focus-visible {
  outline: 2px solid #333;
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid #333;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid #333;
  outline-offset: 2px;
  border-radius: 2px;
}

.lightbox-trigger:focus-visible,
.gallery-item:focus-visible {
  outline: 3px solid #333;
  outline-offset: 2px;
}

/* Skip Link for Screen Readers */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #333;
  color: white;
  padding: 8px 16px;
  z-index: 1001;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

/* Blog Section */
.blog-section {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid #eee;
}

.blog-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 24px;
}

.blog-entry {
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: #333;
  text-decoration: none;
  cursor: pointer;
  padding: 8px 0;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

@media (max-width: 820px) {
  .blog-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .blog-list {
    grid-template-columns: 1fr;
  }
}

.blog-entry:hover,
.blog-entry:focus {
    background-color: #fafafa;
    border: none;
    outline: none;
}

.blog-entry-date {
  font-size: 0.9rem;
  color: #666;
  min-width: 90px;
  flex-shrink: 0;
}

.blog-entry-title {
  font-size: 1rem;
  font-weight: 500;
  color: #333;
}

/* Blog Post Page */
.blog-page {
  padding-top: 40px;
  padding-bottom: 60px;
}

.blog-header {
  margin-bottom: 40px;
  border-bottom: 1px solid #eee;
  padding-bottom: 20px;
}

.blog-header h1 {
  font-size: 1.8rem;
  margin-bottom: 12px;
  line-height: 1.3;
}

.blog-date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-feature-settings: "tnum";
}

.post-content {
  max-width: 80ch;
  margin: 0 auto;
}

.post-content p {
  margin-bottom: 1.5rem;
  line-height: 1.75;
}

/* Inline Images in Posts */
.inline-figure {
  margin: 2rem 0;
  width: 100%;
  text-align: center;
}

.inline-figure .lightbox-trigger {
  display: inline-block;
  cursor: pointer;
  max-width: 100%;
}

.inline-figure img {
  width: 100%;
  max-width: 100%;
  max-height: 60vh;
  height: auto;
  border-radius: 2px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Portrait images get narrower constraints */
.inline-figure.is-portrait img {
  max-width: 420px;
  max-height: 70vh;
}

/* Exception: diptych portraits don't have max-width/height caps; they grow with their sibling */
.diptych-figure .inline-figure.is-portrait img {
  max-width: none;
  max-height: none;
}

.inline-figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-style: italic;
  text-align: center;
  line-height: 1.5;
}

/* Diptych: two images side by side, natural aspect ratios preserved */
.diptych-figure {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0;                /* no gap between images */
  margin: 2rem 0;        /* aligned with text column, no horizontal offset */
  width: 100%;
}

.diptych-figure .inline-figure {
  flex: var(--ar, 1) 1 0;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.diptych-figure .lightbox-trigger {
  display: block;
  width: 100%;
  max-width: none;
}

.diptych-figure .inline-figure img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}

@media (max-width: 600px) {
  .diptych-figure {
    flex-direction: column;
    align-items: stretch;
  }
}
