:root {
  --accent-underline: #a3be8c;
}

.paginav {
  background: var(--theme);
  border-color: var(--theme);
  border-radius: 0;
}

.paginav a {
  border-radius: 0;
}

.centered-image {
  text-align: center;
}

.centered-image .gallery-link {
  display: inline-block;
}

.gallery-link {
  text-decoration: none;
}

.carousel-gallery {
  position: relative;
  width: 100%;
  margin: 1.5rem 0;
}

.carousel-container {
  overflow: hidden;
  width: 100%;
}

.carousel-track {
  display: flex;
  transition: transform 0.35s ease;
  will-change: transform;
}

.carousel-slide {
  /* One slide per “viewport” (matches .carousel-container width); use flex-basis, not only min-width, so the track width is predictable */
  box-sizing: border-box;
  flex: 0 0 100%;
  flex-shrink: 0;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.carousel-image {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  display: block;
  object-fit: contain;
}

.carousel-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
}

.carousel-prev {
  left: 0.5rem;
}

.carousel-next {
  right: 0.5rem;
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.carousel-indicator {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.carousel-indicator.active {
  background: rgba(0, 0, 0, 0.6);
}

.homepage-intro {
  margin: 0.5rem 0 2rem;
}

.homepage-intro h1 {
  font-size: 2rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.85rem;
}

.homepage-intro p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
}

.latest-feed {
  margin-top: 2rem;
}

.feed-posts {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.feed-post {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.feed-post:last-child {
  border-bottom: 0;
}

.feed-post-header {
  margin-bottom: 0.5rem;
}

.feed-date {
  font-size: 0.9rem;
  color: var(--secondary);
}

.feed-post-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  line-height: 1.3;
}

.feed-post-title a {
  text-decoration: none;
}

.feed-post-title a:hover {
  text-decoration: underline;
}

.feed-post-summary {
  margin: 0;
  color: var(--content);
}

.feed-post-body {
  margin: 0;
}

.latest-feed .feed-post-body img {
  margin: 0.75rem 0;
}

.post-content a.gallery-link {
  box-shadow: none;
}

.side-by-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: flex-start;
  width: 100%;
}

.side-by-side img {
  width: 100%;
  height: auto;
  display: block;
}

.side-by-side + * {
  margin-top: 1rem;
}

@media (max-width: 700px) {
  .side-by-side {
    grid-template-columns: 1fr;
  }
}

.blog-entry-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.blog-list a,
.post-content a,
.post-single .breadcrumbs a,
.microblog-feed a,
.latest-feed a,
.homepage-intro a {
  text-decoration: underline;
  text-decoration-color: var(--accent-underline);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.blog-entry-link {
  color: var(--primary);
  font-weight: 600;
}

.blog-entry-meta {
  display: inline-flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--secondary);
  white-space: nowrap;
  text-align: right;
}

@media (max-width: 600px) {
  .blog-entry-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .blog-entry-meta {
    text-align: left;
  }
}

/* Gallery section — image grid landing page */
.gallery-header {
  margin: 0 0 2.25rem;
  text-align: center;
}

.gallery-title {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.gallery-description {
  color: var(--secondary);
  font-size: 1.05rem;
  margin: 0 auto;
  max-width: 36rem;
}

.gallery-intro {
  margin: 1rem auto 0;
  max-width: 36rem;
  color: var(--secondary);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 720px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.gallery-tile {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: var(--code-bg);
  text-decoration: none !important;
}

.gallery-tile--text-light,
.gallery-tile--text-light .gallery-tile-title,
.gallery-tile--text-light .gallery-tile-subtitle {
  color: #fff;
}

.gallery-tile--text-dark,
.gallery-tile--text-dark .gallery-tile-title,
.gallery-tile--text-dark .gallery-tile-subtitle {
  color: #111;
}

.gallery-tile-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease, filter 0.4s ease;
  filter: brightness(0.92);
}

.gallery-tile-image--placeholder {
  background: linear-gradient(135deg, #2c2f36 0%, #4a4f5a 100%);
}

.gallery-tile-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem 1.25rem;
  transition: background 0.3s ease;
}

.gallery-tile-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.01em;
}

.gallery-tile-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  opacity: 0.88;
}

/* Light text variant — darkened scrim under white text */
.gallery-tile--text-light .gallery-tile-overlay {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.15) 50%,
    rgba(0, 0, 0, 0) 100%
  );
}

.gallery-tile--text-light .gallery-tile-title,
.gallery-tile--text-light .gallery-tile-subtitle {
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.gallery-tile--text-light:hover .gallery-tile-overlay,
.gallery-tile--text-light:focus-visible .gallery-tile-overlay {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0.35) 60%,
    rgba(0, 0, 0, 0.15) 100%
  );
}

/* Dark text variant — light scrim under near-black text */
.gallery-tile--text-dark .gallery-tile-overlay {
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 0.7) 0%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0) 100%
  );
}

.gallery-tile--text-dark .gallery-tile-title,
.gallery-tile--text-dark .gallery-tile-subtitle {
  text-shadow: 0 1px 6px rgba(255, 255, 255, 0.55);
}

.gallery-tile--text-dark:hover .gallery-tile-overlay,
.gallery-tile--text-dark:focus-visible .gallery-tile-overlay {
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(255, 255, 255, 0.45) 60%,
    rgba(255, 255, 255, 0.2) 100%
  );
}

/* Hover image treatment is shared, but dark-text tiles get a subtle lift
   instead of darkening so the bright scrim stays readable. */
.gallery-tile:hover .gallery-tile-image,
.gallery-tile:focus-visible .gallery-tile-image {
  transform: scale(1.04);
}

.gallery-tile--text-light:hover .gallery-tile-image,
.gallery-tile--text-light:focus-visible .gallery-tile-image {
  filter: brightness(0.78);
}

.gallery-tile--text-dark:hover .gallery-tile-image,
.gallery-tile--text-dark:focus-visible .gallery-tile-image {
  filter: brightness(1.05);
}

.gallery-tile:focus-visible {
  outline: 2px solid var(--accent-underline);
  outline-offset: 3px;
}

.gallery-empty {
  text-align: center;
  color: var(--secondary);
  font-style: italic;
  margin: 3rem 0;
}

/* Gallery — individual project page */
.gallery-project {
  max-width: 1100px;
  margin: 0 auto;
}

.gallery-project-header {
  text-align: center;
  margin: 0 0 2.5rem;
}

.gallery-project-title {
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
}

.gallery-project-description {
  color: var(--secondary);
  font-size: 1.05rem;
  margin: 0 auto;
  max-width: 38rem;
}

.gallery-project-date {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
}

.gallery-project-prose {
  max-width: 38rem;
  margin: 0 auto 2.5rem;
  color: var(--primary);
}

.gallery-project-stream {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.gallery-project-photo {
  margin: 0;
}

.gallery-project-photo a {
  display: block;
}

.gallery-project-photo img {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-project-photo figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--secondary);
  text-align: center;
}
