/* Minimal, 1x-inspired calm layout (no image background). */
:root{
  --header-h: 0px; /* JS will set this to the header height */
  --header-pad: 0px; /* visible header height */
  --header-ty: 0px; /* header translateY */
  --header-h: 0px; /* JS will set this to the header height */
  --bg: #ffffff;
  --fg: #111111;
  --muted: rgba(0,0,0,.62);
  --hair: rgba(0,0,0,.12);
  --chip: rgba(0,0,0,.06);
  --chipOn: rgba(0,0,0,.12);
  --shadow: 0 10px 30px rgba(0,0,0,.06);
}

@media (prefers-color-scheme: dark){
  :root{
    --bg: #0c0c0d;
    --fg: rgba(255,255,255,.92);
    --muted: rgba(255,255,255,.62);
    --hair: rgba(255,255,255,.14);
    --chip: rgba(255,255,255,.08);
    --chipOn: rgba(255,255,255,.16);
    --shadow: 0 12px 34px rgba(0,0,0,.35);
  }
}

*{ box-sizing: border-box; }
html,body{ height: 100%; }
body{
  margin: 0;
  padding-top: var(--header-pad);
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

code{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); border:0;
}

.topbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
}

.topbar-inner{
  display: grid;
  grid-template-columns: 1fr minmax(280px, 520px);
  gap: 16px;
  align-items: start;
  padding: 18px 18px 10px;
  max-width: 1500px;
  margin: 0 auto;
}

.brand-title{
  font-size: 18px;
  letter-spacing: .02em;
}
.brand-sub{
  color: var(--muted);
  margin-top: 4px;
  font-size: 12px;
}

.controls{ display: grid; gap: 10px; }
.search input{
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--hair);
  background: transparent;
  color: inherit;
  outline: none;
}
.search input:focus{ border-color: color-mix(in srgb, var(--fg) 28%, var(--hair)); }

.control-row{ display:flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
select{
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--hair);
  background: transparent;
  color: inherit;
  outline: none;
}

.btn{
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--hair);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.btn:hover{ background: var(--chip); }

.filters{
  max-width: 1500px;
  margin: 0 auto;
  /* keep left/right padding so it aligns with header; vertical padding animates */
  padding: 0 18px 0;

  display: grid;
  gap: 10px;

  /* collapsed by default */
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;

  transition: max-height .22s ease, opacity .22s ease, transform .22s ease, padding-bottom .22s ease;
}

/* expanded */
.filters.open{
  max-height: min(var(--filters-max, 720px), 70vh);
  opacity: 1;
  transform: translateY(0);
  padding-bottom: 14px;
  pointer-events: auto;
}


.filter-group{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filter-label{
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px;
  letter-spacing: .03em;
}
.chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: var(--chip);
  cursor: pointer;
  user-select: none;
}
.chip[aria-pressed="true"]{
  background: var(--chipOn);
  border-color: color-mix(in srgb, var(--fg) 22%, var(--hair));
}
.chip .count{
  font-size: 11px;
  color: var(--muted);
}

.wrap{
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px;
}

.status{
  color: var(--muted);
  margin: 8px 0 14px;
  font-size: 12px;
}

.feed{
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
}

/* On wide screens, keep one column but allow image to go wider. */
@media (min-width: 900px){
  .feed{ gap: 34px; }
}

.card{
  border-top: 1px solid var(--hair);
  padding-top: 22px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .6s ease, transform .7s ease;
}
.card.in{
  opacity: 1;
  transform: translateY(0);
}

.figure{
  margin: 0;
}
.figure a{
  display: block;
  text-decoration: none;
  color: inherit;
}

/* No gray background; keep image true. */
.figure img{
  width: auto;
  height: auto;
  display: block;
  border-radius: 0;
  /* avoid browser smoothing artifacts as much as possible */
  image-rendering: auto;
  box-shadow: var(--shadow);
}

.meta{
  margin-top: 12px;
  text-align: center;
  display: grid;
  gap: 4px;
}
.meta .line1{
  font-size: 12px;
  letter-spacing: .02em;
}
.meta .line2{
  font-size: 12px;
  color: var(--muted);
}

.badges{
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.badge{
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--muted);
}

.footer{
  border-top: 1px solid var(--hair);
  padding: 18px;
  margin-top: 34px;
}
.footer-inner{
  max-width: 1500px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 12px;
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items:center;
}
.dot{ opacity: .6; }


/* Lightbox */
.modal-open{ overflow: hidden; }

.lightbox{
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(0,0,0,.72);
}

@media (prefers-color-scheme: dark){
  .lightbox{ background: rgba(0,0,0,.78); }
}

.lightbox.open{ display: flex; }

.lb-panel{
  width: 100%;
  max-height: 100vh;
  background: transparent;
  color: rgba(255,255,255,.92);
border-radius: 0;
  border: none;
  box-shadow: none;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.lb-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.28);
  backdrop-filter: blur(10px);
}

.lb-title{
  font-size: 12px;
  color: rgba(255,255,255,.68);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-btns{ display:flex; gap: 8px; align-items:center; }

.lb-iconbtn{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--hair);
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lb-iconbtn:hover{ background: var(--chip); }
.lb-iconbtn:disabled{
  opacity: .45;
  cursor: default;
}

.lb-body{
  min-height: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 0;
}

.lb-img{
  max-width: 100%;
  max-height: calc(100vh - 170px);
  height: auto;
  width: auto;
  display: block;
  border-radius: 0;
  box-shadow: none;
}

.lb-bottom{
  border-top: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
  padding: 10px 14px 14px;
}

.lb-meta{
  text-align: center;
  display: grid;
  gap: 4px;
}

.lb-meta .line1{ font-size: 12px; letter-spacing: .02em; }
.lb-meta .line2{ font-size: 12px; color: rgba(255,255,255,.68);
}
.lb-badges{
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce){
  .lightbox, .lb-panel{ transition: none !important; }
}


  .figure img{
    border-radius: 0;
    /* shadow can't render outside viewport on full-bleed; keep it subtle */
    box-shadow: none;
  }
}



/* Header icon links */
.header-links{
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.iconbtn{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--hair);
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.iconbtn:hover{ background: var(--chip); }

.iconbtn svg{
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: .9;
}


/* Keep controls from overflowing on small screens */
.control-row{ flex-wrap: wrap; justify-content: flex-end; }


/* Header layout polish */
.search-row{
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.search{ flex: 1; }

/* Normalize control heights for pixel-perfect alignment */
.search input,
select,
.btn,
.iconbtn{
  height: 38px;
}

.search input{
  padding: 0 12px;
}

select{
  padding: 0 10px;
}

.btn{
  padding: 0 12px;
}

/* Prevent wrapping oddities on wide screens; allow wrap on narrow */
@media (min-width: 900px){
  .control-row{ flex-wrap: nowrap; }
}


/* Lightbox UI on dark overlay */
.lightbox .lb-iconbtn{
  border: 1px solid rgba(255,255,255,.18);
}
.lightbox .lb-iconbtn:hover{
  background: rgba(255,255,255,.08);
}
.lightbox .badge{
  border-color: rgba(255,255,255,.18);
  color: rgba(255,255,255,.72);
}


/* Header alignment fixes */
.search input{
  -webkit-appearance: none;
  appearance: none;
}

/* Make all header controls share the same box model */
.search-row{
  align-items: stretch;
}

.header-links{
  align-self: stretch;
}

.iconbtn{
  padding: 0;
  line-height: 0;
}

.iconbtn svg{
  display: block;
}

/* On some browsers, search inputs render slightly taller unless line-height is set */
.search input{
  line-height: 38px;
}


/* Icon sizing */
.iconbtn svg{
  width: 22px;
  height: 22px;
}


/* List image sizing (before opening lightbox) */
:root{
  --list-max-width: 1200px; /* tweak this if you want narrower/wider */
}

.figure a{
  display: flex;
  justify-content: center;
}

.figure img{
  /* Keep true aspect ratio: let the browser scale within constraints */
  width: auto;
  height: auto;
  max-width: min(var(--list-max-width), 100%);
}


/* Auto-hide header (scroll-synced) */
.topbar{
  transition: none;
  will-change: transform;
  transform: translateY(var(--header-ty)) translateZ(0);
}


/* Lightbox: image-only */
.lb-stage{
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.lightbox{
  padding: 0;
}

.lb-img{
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
  cursor: zoom-out;
}

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


/* Optional film line (only shown when item.film exists) */
.meta .lineFilm{
  font-size: 12px;
  color: var(--muted);
}


/* List images: fit within viewport height on desktop (portrait-friendly) */
@media (min-width: 900px){
  .feed .figure img{
    /* keep most of the image visible even when it's vertical */
    max-height: calc(100vh - var(--header-h) - 160px);
  }
}


/* Ensure list styling wins (avoid stray overrides) */
.feed .figure img{
  border-radius: 18px;
  box-shadow: var(--shadow);
}


/* List: no rounded corners */
.feed .figure a,
.feed .figure img{
  border-radius: 0 !important;
}


@media (max-width: 640px){
  .control-row{ justify-content: flex-start; }
  #filtersToggle{ width: auto; }
}


/* Control row split: left (filters/clear) and right (order) */
.control-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.control-left, .control-right{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.control-right{
  margin-left: auto;
  justify-content: flex-end;
}

/* On small screens, keep it tidy */
@media (max-width: 640px){
  .control-row{ gap: 8px; }
  .control-left, .control-right{ gap: 8px; }
}


/* Caption line styling */
.meta .line1{
  color: var(--fg);
}

.meta .line2{
  color: var(--muted);
}


/* Lightbox: copyright label in bottom-right of the image display area */
.lb-cr{
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: 12px;
font-size: 12px;
  line-height: 1;
  letter-spacing: .02em;

  color: rgba(255,255,255,0.92);
  text-shadow: 0 1px 2px rgba(0,0,0,0.65);
pointer-events: none;
  user-select: none;
}

@media (min-width: 900px){
  .lb-cr{ font-size: 13px; padding: 7px 12px; }
}


/* Lightbox: wrapper sized to the image so overlays sit on the image */
.lb-media{
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
}

@supports (padding: max(0px)){
  .lb-stage{
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-top: env(safe-area-inset-top);
  }
}
