/* Style: base — Two-column body + cascading photo column, plus expandable bottom grid gallery */

.post-base {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Post Header */
.post-header {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 28px;
  box-shadow: var(--shadow);
}

.post-header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.post-header-crumbs {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Series Navigation in Upper Right of Title Block */
.series-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 10px 12px;
  margin-left: auto;
}

.series-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.series-label {
  color: var(--ink);
  font-weight: 600;
}

.series-part {
  color: var(--muted);
}

.series-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.series-btn {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.series-btn:hover:not(.is-disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.series-btn.is-disabled {
  color: var(--border-strong);
  border-color: var(--border-soft);
  background: transparent;
  cursor: default;
}

.back-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.back-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.post-title {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 3.4vw, 2.65rem);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.02em;
}

.post-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

/* Cascade Layout: Body Text alongside up to 8 Cascading Photos */
.base-cascade {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 32px;
  align-items: start;
}

.base-cascade.is-text-only {
  grid-template-columns: minmax(0, 780px);
}

.base-body {
  position: sticky;
  top: 24px;
}

.base-body-inner {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 28px;
  box-shadow: var(--shadow);
}

.base-photos {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Refined Cubic Photo Outlines for Cascading Frames */
.cascade-frame {
  margin: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow);
}

.cascade-image-wrap {
  border: 1px solid var(--border-soft);
  background: var(--bg);
}

.cascade-image-wrap img {
  width: 100%;
  height: auto;
}

.cascade-caption {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 4px 2px;
  font-size: 0.9rem;
  color: var(--muted);
  border-top: 1px solid var(--border-soft);
  margin-top: 12px;
}

.photo-index {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink);
  font-weight: 600;
  flex-shrink: 0;
}

/* Bottom Grid Gallery (shown when post has > 8 photos) */
.base-gallery {
  border-top: 1px solid var(--border);
  padding-top: 28px;
}

.gallery-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

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

.gallery-count {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
}

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

.gallery-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 6px;
  margin: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.gallery-tile:hover,
.gallery-tile:focus-visible {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
  outline: none;
}

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

.gallery-tile-index {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  background: rgba(32, 32, 30, 0.84);
  color: var(--surface);
}

/* Full-View Lightbox Modal */
.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(18, 18, 16, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-frame {
  width: min(1080px, 100%);
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  flex-shrink: 0;
}

.lightbox-counter {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.lightbox-controls {
  display: flex;
  gap: 6px;
}

.lightbox-btn {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1;
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.lightbox-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.lightbox-stage {
  background: #161614;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 68vh;
  max-height: 68dvh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-caption {
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.5;
  flex-shrink: 0;
  max-height: 24dvh;
  overflow-y: auto;
}

.lightbox-caption[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .base-cascade {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .base-body {
    position: static;
  }
}

@media (max-width: 600px) {
  .post-base {
    gap: 24px;
  }

  .post-header,
  .base-body-inner {
    padding: 18px;
  }

  .cascade-frame {
    padding: 8px;
  }

  .series-box {
    width: 100%;
    align-items: flex-start;
    margin-left: 0;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .lightbox {
    padding: 10px;
  }

  .lightbox-btn {
    min-width: 42px;
    height: 42px;
  }

  .lightbox-stage {
    padding: 10px;
  }

  .lightbox-stage img {
    max-height: 60dvh;
  }

  .lightbox-caption {
    padding: 12px 14px;
    font-size: 0.9rem;
  }
}
