:root {
  --bg: #fff;
  --text: #0a0a0a;
  --muted: #757575;
  --accent: #444;

  /* Layout */
  --max-width: 1000px;

  /* Type scale */
  --fs-base: clamp(0.9rem, 0.85rem + 0.25vw, 1rem);
  --fs-small: clamp(0.8rem, 0.775rem + 0.125vw, 0.9rem);
  --fs-caption: clamp(0.75rem, 0.725rem + 0.125vw, 0.85rem);
  --h1-size: clamp(1.35rem, 1.2rem + 0.75vw, 1.75rem);
  --fs-subtitle: 1rem;
  /* ~16.8px (used for photo titles) */
  --h1-size-lg: 1.75rem;
  /* larger screens */
  --lh-base: 1.6;
  --font-serif: "Libre Baskerville", "Times New Roman", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 16px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

/* Page header: centered, elegant site/page title */
.site-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 0;
}

/* Default page title styling */
.page-title {
  margin: 0;
  font-family: 'Outfit';
  font-size: var(--h1-size);
  line-height: 1.2;
  text-align: center;
  color: inherit;
  font-weight: 800;
  letter-spacing: -0.01em;
}

@media (min-width: 768px) {
  .page-title {
    font-size: var(--h1-size-lg);
  }
}

/* Vertical gallery: one item per row; images scale to container width and keep natural height */
.gallery-vertical {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 clamp(4px, 2vw, 16px);
}

.gallery-item {
  width: 100%;
}

.gallery-item a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.gallery-item img {
  display: block;
  width: 100%;
  /* scale to container width */
  height: auto;
  /* preserve natural aspect ratio (height scales proportionally) */
  border: 1px solid #CCC;
  background: #f4f4f4;
  object-fit: contain;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.gallery-item a:hover img,
.gallery-item a:focus-visible img,
.map a:hover img,
.map a:focus-visible img{
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

/* Footer */
.site-footer {
  margin-top: 2rem;
  font-size: var(--fs-small);
  padding-top: 1rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  justify-content: center;
  font-size: var(--fs-small);
}

.footer-nav a {
  color: var(--muted);
  text-decoration: underline;
  padding: 0.25rem 0.5rem;
  margin: -0.25rem -0.5rem;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.footer-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.legal {
  font-size: var(--fs-caption);
  text-align: center;
  color: var(--muted);
}

a {
  color: var(--text);
}

a:visited {
  color: var(--text);
}

img {
  max-width: 100%;
}

/* Ensure page containers are responsive */
.bigger-container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-left: clamp(8px, 4vw, 32px);
  padding-right: clamp(8px, 4vw, 32px);
  box-sizing: border-box;
}

/* Navigation links */
.navigation {
  font-size: var(--fs-small);
  margin: 0 0 1rem 0;
  color: inherit;
}

.nav-link {
  color: var(--muted);
  text-decoration: underline;
  padding: 0.25rem 0.5rem;
  margin: -0.25rem -0.5rem;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s, text-decoration 0.2s, background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.nav-link:visited {
  color: var(--muted);
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text);
  text-decoration: none;
}

/* Shared navigation list styles */
.navigation ul,
.footer-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-nav li,
.navigation li {
  margin: 0;
}

@media (min-width: 640px) {

  .navigation ul,
  .footer-nav ul {
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
  }
}

/* Title banner image responsiveness (if used elsewhere) */
#homepageImage {
  height: auto;
  display: block;
  margin: 0.5rem auto 1rem;
  border: 0;
}

/* Information box (single definition; media query below overrides small-screen padding/font-size) */
.information {
  margin: 0 0 1rem;
  padding: 0.9rem;
  font-size: var(--fs-base);
  line-height: 1.4;
  background: #f7f9fb;
  color: #111;
  border: 1px solid #e1e6ea;
  border-radius: 6px;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Smallprint styling (for sources/upload date, etc.) */
.smallprint {
  font-size: var(--fs-caption);
  color: var(--muted);
  margin: 0.5rem 0 0;
}

/* Map image */
.map {
  display: flex;
  justify-content: center;
}

.map img {
  max-width: 320px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0.5rem 0 1rem;
  border: 1px solid #CCC;
}

/* Photo block spacing */
.photo {
  margin-bottom: 2rem;
  display: block;
  width: 100%;
}

/* Photo title (targets the h2.photo-title or .title inside article headers) */
.photo .title {
  font-family: 'Outfit';
  text-align: center;
  margin-bottom: 0.5rem;
  font-size: var(--fs-subtitle);
}

/* Make inline height styles non-blocking: allow natural responsive sizing */
.image-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  /* remove fixed height from inline style on small screens */
  height: auto !important;
}

.image-container img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border: 0;
  box-shadow: none;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Description and technical info */
.description {
  padding: 0.5rem 0.25rem;
  color: #111;
  line-height: 1.45;
  font-size: var(--fs-base);
  display: block;
  text-indent: 0;
}

.technical {
  color: #666;
  font-style: italic;
  font-size: var(--fs-caption);
  margin-top: 0.25rem;
}

/* Add focus-visible for better keyboard navigation */
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Sources collapsible section */
.sources {
  margin: 2rem 0 1rem;
  padding: 1rem;
  background: var(--bg-alt, #f9f9f9);
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  margin-bottom: 2rem;
}

.sources summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-base);
  padding: 0.5rem 0;
  list-style: none;
  user-select: none;
}

.sources summary::-webkit-details-marker {
  display: none;
}

.sources summary::before {
  content: '\25B6 '; /* right-pointing triangle */
  display: inline-block;
  margin-right: clamp(0.35em, 2vw, 0.5em);
  transition: transform 0.2s;
}

.sources[open] summary::before {
  transform: rotate(90deg);
}

.sources ul {
  margin-top: 0.75rem;
  padding-left: 1.25rem;
  list-style: none;
}

.sources li {
  margin-bottom: 0.5rem;
  word-break: break-word;
  overflow-wrap: break-word;
}

.sources a {
  display: inline-block;
  max-width: 100%;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.sources:target {
  animation: highlight-pulse 2s ease-in-out;
  scroll-margin-top: 2rem;
}

@keyframes highlight-pulse {
  0%, 100% {
    background: var(--bg-alt, #f9f9f9);
    border-color: var(--border-color, #ddd);
  }
  50% {
    background: var(--accent, #e8e8e8);
    border-color: var(--text, #333);
  }
}

/* Small screens: tighten spacing */
@media (max-width: 640px) {
  .information {
    padding: 0.6rem;
    font-size: var(--fs-small);
  }

  .photo {
    margin-bottom: 1.25rem;
  }

  .photo .title {
    font-size: var(--fs-base);
  }

  .description {
    font-size: var(--fs-small);
  }

  .footer-nav ul {
    gap: 0.5rem;
  }

  .about-compass {
    float: none;
    display: block;
    margin: 0 auto 1.5rem;
    max-width: 200px;
  }
}

/* Desktop: limit extreme image height but keep responsive width/height */
@media (min-width: 768px) {
  .image-container img {
    /* keep images responsive (fill container width) while limiting max-height */
    width: 100%;
    height: auto;
    max-height: 1400px;
    object-fit: contain;
  }
}

@media (min-resolution: 192dpi),
(min-resolution: 2dppx) {

  .gallery-item img,
  .image-container img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

@media print {

  .navigation,
  .site-footer {
    display: none;
  }

  .photo {
    page-break-inside: avoid;
    margin-bottom: 12pt;
  }

  .image-container img {
    max-height: none;
    page-break-inside: avoid;
  }

  body {
    font-size: 12pt;
    line-height: 1.4;
  }

  .page-title {
    font-size: 18pt;
    margin-bottom: 12pt;
  }

  .description {
    font-size: 11pt;
  }

  .technical {
    font-size: 10pt;
  }

  .information {
    background: none !important;
    border: 1pt solid #ccc !important;
  }

  .smallprint {
    font-size: 9pt;
  }

  .about-compass {
    max-width: 150px;
    break-inside: avoid;
  }

  .about-intro {
    font-size: 11pt
  }
}

/* About Me Page Styles */

.about-section {
  margin: 2rem 0;
}

.about-hero {
  margin: 0 0 2rem 0;
}

.about-hero img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.about-content {
  position: relative;
}

.about-text {
  line-height: 1.7;
  font-size: clamp(1rem, 2.5vw, 1.125rem);
}

.about-compass {
  float: right;
  margin: 0 0 1.5rem 1.5rem;
  max-width: clamp(150px, 30vw, 300px);
  height: auto;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  shape-outside: circle(50%);
  shape-margin: 1rem;
}

.about-intro {
  font-size: clamp(1.125rem, 3vw, 1.25rem);
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.about-text p {
  margin-bottom: 1.25rem;
}

.about-text strong {
  color: var(--text, #0a0a0a);
  font-weight: 600;
}

/* Email obfuscation - reverse text */
.email-obfuscated {
  unicode-bidi: bidi-override;
  direction: rtl;
  color: var(--text, #0a0a0a);
  text-decoration: underline;
  font-family: monospace;
  font-size: 0.95em;
  user-select: all;
  cursor: text;
}
  
.email-obfuscated:hover {
  color: var(--muted,  #757575);
  text-decoration-style: dotted;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --text: #e4e4e4;
    --muted: #a0a0a0;
    --accent: #666;
    --bg-alt: #2a2a2a;
    --border-color: #404040;
  }

  .information {
    background: #2a2a2a;
    color: #e4e4e4;
    border-color: #404040;
  }

  .gallery-item img,
  .image-container img {
    background: #2a2a2a;
    border-color: #333;
  }

  .description {
    color: #e4e4e4;
  }

  .technical {
    color: #b0b0b0;
  }

  .map img {
    border-color: #666;
  }

  .site-footer {
    color: #a0a0a0;
  }

  .sources {
    background: #2a2a2a;
    border-color: #404040;
  }

  .sources summary {
    color: #e4e4e4;
  }

  .sources a {
    color: #a0a0a0;  
  }

  .sources a:hover,
  .sources a:focus-visible {
    color: #ffffff;
  }

  @keyframes highlight-pulse {
    0%, 100% {
      background: var(--bg-alt);
      border-color: var(--border-color);
    }
    50% {
      background: var(--accent, #3a3a3a);
      border-color: var(--text, #888);
    }
  }

  a:focus-visible {
    outline-color: #888;
  }

  .nav-link:hover,
  .nav-link:focus-visible,
  .footer-nav a:hover {
    color: #ffffff;
  }

  .about-hero img,
  .about-compass {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  }
  
  .about-text strong {
    color: var(--text);
  }

  .email-obfuscated {
    color: var(--text);
  }
  
  .email-obfuscated:hover {
    color: var(--muted);
  }
}