:root {
  --hako-gap: 0.75rem;
}

body {
  min-height: 100vh;
}

.hako-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.hako-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.hako-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.hako-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hako-folders {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.hako-folder-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
  text-decoration: none;
  font-size: 0.92rem;
}

.hako-folder-link:hover {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-secondary-color);
}

.hako-icon,
.hako-folder-icon,
.hako-video-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  filter: invert(1);
}

.hako-folder-icon {
  width: 1rem;
  height: 1rem;
}

.hako-thumb-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--bs-tertiary-bg);
  border-radius: 0.375rem;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.hako-thumb-btn img,
.hako-thumb-btn video {
  display: block;
  width: 100%;
  height: auto;
}

.hako-video-badge {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  pointer-events: none;
}

/* 1. Masonry layout */
.hako-masonry {
  column-count: 1;
  column-gap: var(--hako-gap);
}

@media (min-width: 576px) {
  .hako-masonry {
    column-count: 2;
  }
}

@media (min-width: 992px) {
  .hako-masonry {
    column-count: 3;
  }
}

@media (min-width: 1200px) {
  .hako-masonry {
    column-count: 4;
  }
}

.hako-masonry-item {
  break-inside: avoid;
  margin-bottom: var(--hako-gap);
}

/* 2. Justified gallery layout */
.hako-justified {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hako-justified::after {
  content: "";
  flex-grow: 999;
}

.hako-justified-item {
  flex: 1 1 auto;
  height: 220px;
  min-width: 160px;
  max-width: 480px;
}

.hako-justified-item .hako-thumb-btn {
  height: 100%;
}

.hako-justified-item img,
.hako-justified-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 3. Classic gallery layout */
.hako-classic-card .hako-thumb-btn {
  aspect-ratio: 4 / 3;
}

.hako-classic-card .hako-thumb-btn img,
.hako-classic-card .hako-thumb-btn video {
  height: 100%;
  object-fit: cover;
}

/* 4. Single image pager (manga reader) */
.hako-pager {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.hako-pager-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 60vh;
}

.hako-pager-stage img,
.hako-pager-stage video {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: 0.25rem;
}

.hako-pager-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

/* 5. Single page strip (vertical manga strip with small gaps) */
.hako-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  max-width: 920px;
  margin: 0 auto;
}

.hako-strip-item {
  width: 100%;
}

.hako-strip-item img,
.hako-strip-item video {
  display: block;
  width: 100%;
  height: auto;
}

/* Lightbox modal */
.hako-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1060;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
}

.hako-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.hako-lightbox-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hako-lightbox-media {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hako-lightbox-nav {
  position: absolute;
  top: 0;
  bottom: 3.5rem;
  z-index: 2;
  width: min(15%, 140px);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  border: 0;
  background: transparent;
  color: #fff;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.hako-lightbox-nav-prev {
  left: 0;
  justify-content: flex-start;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.55), transparent);
}

.hako-lightbox-nav-next {
  right: 0;
  justify-content: flex-end;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.55), transparent);
}

.hako-lightbox-nav:hover,
.hako-lightbox-nav:focus-visible {
  opacity: 1;
}

.hako-lightbox-arrow {
  width: 2rem;
  height: 2rem;
  filter: invert(1);
  pointer-events: none;
}

.hako-lightbox-media img,
.hako-lightbox-media video {
  max-width: 100%;
  max-height: calc(100vh - 6rem);
  width: auto;
  height: auto;
}

/* Cookie banner */
.hako-cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  background: var(--bs-tertiary-bg);
  border-top: 1px solid var(--bs-border-color);
  padding: 0.65rem 1rem;
}

.hako-landing,
.hako-gate {
  min-height: 75vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
}
