:root {
  --menu-w: 220px;
  --header-h: 64px;

  --pad: 16px;
  --gap: 18px;

  --radius: 18px;
  --border: 1px solid color-mix(in oklab, var(--color-base) 14%, transparent);

  --bg: #000;
  --text: color-mix(in oklab, var(--color-base) 92%, transparent);
  --text-muted: color-mix(in oklab, var(--color-base) 65%, transparent);
}

/* page layout */
.layout {
  display: grid;
  grid-template-columns: var(--menu-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* left menu */
.menu {
  position: sticky;
  top: 0;
  height: 100vh;
  background: transparent;
  display: flex;
  flex-direction: column;
}

.menuList {
  padding: 12px 10px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menuItem {
  text-decoration: none;
  color: inherit;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  opacity: 0.82;
  background: transparent;
}

.menuItem:hover { opacity: 1; background: transparent; }
.menuItem:hover .menuItemTitle { text-decoration: underline; }

/* active = bold only */
.menuItem.active { opacity: 1; border: 1px solid transparent; background: transparent; }
.menuItem.active .menuItemTitle { font-weight: 700; }

.menuItemTitle {
  font-size: 0.98rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* canvas / top bar */
.canvas { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-h);

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 0 var(--pad);
  backdrop-filter: blur(10px);
  background: color-mix(in oklab, black 92%, transparent);
  border-bottom: 1px solid transparent;
}

.topbarLeft {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.canvasTitle {
  font-size: 1.05rem;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.canvasDesc {
  font-size: 0.92rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.canvasCount {
  font-size: 0.92rem;
  color: color-mix(in oklab, var(--color-base) 50%, transparent);
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* rail */
.rail {
  height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
  gap: var(--gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-padding: var(--pad);
  padding: var(--pad);
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory; /* JS may override */
}

/* item */
.item {
  flex: 0 0 calc(100% - (var(--pad) * 2));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
  scroll-snap-align: center;

  padding: var(--pad);
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;

  transition: transform 220ms ease, opacity 220ms ease, filter 220ms ease;
}

.photoWrap {
  display: grid;
  place-items: center;
  background: transparent;
  border-radius: 0;
  border: 1px solid transparent;
  padding: 0;
  min-height: 0;
}

.photo {
  display: block;
  width: auto;
  height: calc(100vh - var(--header-h) - (var(--pad) * 2) - 60px);
  object-fit: contain;
}

.text {
  padding-top: 0;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 10px;
  line-height: 1.55;
  min-width: 0;
}

.itemTitle {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
  letter-spacing: 0.2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

.itemBody {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 42ch;
}

.itemMeta {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.itemDate,
.itemLocation {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* debug borders */
body.debug .menu { border-right: var(--border); }
body.debug .topbar { border-bottom: var(--border); }
body.debug .item { border: var(--border); }
body.debug .photoWrap {
  border: var(--border);
  border-radius: var(--radius);
  background: color-mix(in oklab, white 6%, transparent);
  padding: 14px;
}

@media (max-width: 900px) {
  :root { --menu-w: 0px; }
  .layout { grid-template-columns: 1fr; }
  .menu { display: none; }
  .item { grid-template-columns: 1fr; }
  .text { max-width: 70ch; }
}

@media (prefers-reduced-motion: reduce) {
  .item { transition: none; }
}