/* MERIDIAN — travel photo library demo. The photography is the color. */
:root {
  --bg: #0a0a0b;
  --panel: #121214;
  --line: #232327;
  --text: #f2f2f0;
  --muted: #9a9aa2;
  --dim: #5b5b64;
  --accent: #e8c46a;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---- header ---- */
header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 20px;
  background: rgba(10, 10, 11, 0.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: 5px; font-size: 15px; white-space: nowrap; }
.brand em { color: var(--accent); font-style: normal; }
.brand small { color: var(--dim); font-weight: 400; letter-spacing: 1px; margin-left: 8px; font-size: 11px; }

.searchbox { position: relative; flex: 1; max-width: 640px; }
.searchbox input {
  width: 100%; padding: 10px 40px 10px 38px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: inherit; outline: none;
}
.searchbox input:focus { border-color: #3d3d45; }
.searchbox .mag { position: absolute; left: 12px; top: 9px; color: var(--dim); }
.searchbox .clear {
  position: absolute; right: 8px; top: 7px; display: none;
  background: none; border: 0; color: var(--dim); font-size: 16px; padding: 2px 6px;
}
.searchbox.has-q .clear { display: block; }

.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; display: none;
}
.suggest.open { display: block; }
.suggest button {
  display: flex; justify-content: space-between; width: 100%;
  padding: 9px 14px; background: none; border: 0; color: var(--text); text-align: left;
}
.suggest button:hover, .suggest button.active { background: #1b1b1f; }
.suggest .type { color: var(--dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; }

.lightbox-btn {
  background: none; border: 1px solid var(--line); border-radius: 10px;
  color: var(--muted); padding: 9px 14px; white-space: nowrap;
}
.lightbox-btn b { color: var(--accent); }

/* ---- hero (browse mode only) ---- */
.hero { text-align: center; padding: 72px 20px 30px; }
.hero h1 { font-size: clamp(26px, 4.6vw, 44px); font-weight: 800; letter-spacing: -0.5px; }
.hero p { color: var(--muted); margin-top: 8px; }
.trending { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.trending button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); padding: 7px 16px;
}
.trending button:hover { color: var(--text); border-color: var(--accent); }
.hidden { display: none !important; }

/* ---- layout: rail + grid ---- */
.layout { display: flex; gap: 0; align-items: flex-start; }
.rail {
  position: sticky; top: 61px; width: 230px; flex-shrink: 0;
  max-height: calc(100vh - 61px); overflow-y: auto;
  padding: 18px 16px 40px 20px;
}
.rail h3 {
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--dim); margin: 18px 0 8px;
}
.rail h3:first-child { margin-top: 0; }
.facet { display: flex; justify-content: space-between; width: 100%;
  background: none; border: 0; color: var(--muted); padding: 5px 8px; border-radius: 7px; text-align: left; }
.facet:hover { background: var(--panel); color: var(--text); }
.facet.on { background: #26231a; color: var(--accent); }
.facet .n { color: var(--dim); font-size: 12.5px; }

.results { flex: 1; min-width: 0; padding: 14px 14px 80px; }
.statusline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 4px 12px; color: var(--dim); font-size: 13px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #26231a; color: var(--accent); border: 0; border-radius: 999px;
  padding: 5px 12px; font-size: 13px;
}
.chip:hover { background: #322d1e; }

/* justified rows */
#grid { width: 100%; }
.jrow { display: flex; gap: 6px; margin-bottom: 6px; }
.jrow a { position: relative; display: block; overflow: hidden; border-radius: 4px; background: #17171a; }
.jrow img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.jrow a:hover img { transform: scale(1.03); }
.jrow .cap {
  position: absolute; inset: auto 0 0 0; padding: 24px 10px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  font-size: 12px; color: #eee; opacity: 0; transition: opacity 0.2s ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.jrow a:hover .cap { opacity: 1; }

#sentinel { height: 1px; }
.loading { text-align: center; color: var(--dim); padding: 30px; }

/* ---- detail page ---- */
.detail { max-width: 1280px; margin: 0 auto; padding: 26px 20px 80px; }
.crumbs { color: var(--dim); font-size: 13px; margin-bottom: 16px; }
.crumbs a:hover { color: var(--text); }
.detail-main { display: flex; gap: 28px; align-items: flex-start; }
.stage { flex: 1; min-width: 0; }
.stage img { width: 100%; border-radius: 6px; background: #17171a; }
.stage .credit { color: var(--dim); font-size: 12.5px; margin-top: 8px; }

.buybox {
  width: 340px; flex-shrink: 0; position: sticky; top: 80px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px;
}
.buybox h1 { font-size: 18px; line-height: 1.4; margin-bottom: 4px; }
.buybox .loc { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; }
.lictoggle { display: flex; gap: 6px; margin-bottom: 6px; }
.lictoggle button {
  flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--line);
  background: none; color: var(--muted);
}
.lictoggle button.on { border-color: var(--accent); color: var(--accent); background: #26231a; }
.licnote { color: var(--dim); font-size: 12px; margin-bottom: 14px; line-height: 1.5; }
.pricerow { display: flex; justify-content: space-between; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.pricerow:last-of-type { border-bottom: 0; }
.pricerow .sz b { display: block; font-size: 14px; }
.pricerow .sz span { color: var(--dim); font-size: 12px; }
.pricerow .amt { color: var(--accent); font-weight: 700; align-self: center; }
.currency { float: right; background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: 7px; padding: 3px 6px; }
.cta { display: flex; gap: 8px; margin-top: 16px; }
.cta button { flex: 1; padding: 11px; border-radius: 9px; border: 0; font-weight: 700; }
.cta .buy { background: var(--accent); color: #221a05; }
.cta .lb { background: none; border: 1px solid var(--line); color: var(--text); }
.cta .lb.added { border-color: var(--accent); color: var(--accent); }
.demo-note { margin-top: 12px; color: var(--dim); font-size: 11.5px; text-align: center; }

.kwrap { margin-top: 22px; }
.kwrap h3, .strip h3 {
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--dim); margin-bottom: 10px;
}
.kw { display: inline-block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; margin: 0 6px 8px 0; font-size: 12.5px; color: var(--muted); }
.kw:hover { color: var(--accent); border-color: var(--accent); }

.strip { margin-top: 34px; }
.strip .row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.strip a { flex-shrink: 0; }
.strip img { height: 130px; border-radius: 5px; display: block; }
.strip img:hover { outline: 2px solid var(--accent); }

footer { border-top: 1px solid var(--line); padding: 18px 20px; color: var(--dim); font-size: 12px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

@media (max-width: 860px) {
  .rail { display: none; }
  .detail-main { flex-direction: column; }
  .buybox { width: 100%; position: static; }
  .brand small { display: none; }
}

/* lightbox drawer (AWL 7) */
#lbDrawer {
  position: fixed; top: 0; right: -340px; bottom: 0; width: 330px; z-index: 60;
  background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; transition: right 0.22s ease;
}
#lbDrawer.open { right: 0; }
#lbDrawer.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; }
.lbd-head { display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); }
.lbd-head select { flex: 1; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px; font: inherit; }
.lbd-head button { background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); width: 34px; }
.lbd-head button:hover { color: var(--accent); border-color: var(--accent); }
.lbd-share { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.lbd-share button { background: none; border: 0; color: var(--accent); font-size: 13px; }
.lbd-share span { color: var(--dim); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbd-items { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.lbd-item { position: relative; }
.lbd-item img { height: 86px; border-radius: 4px; display: block; }
.lbd-item button {
  position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,0.65);
  border: 0; color: #eee; border-radius: 5px; font-size: 11px; padding: 2px 5px; display: none;
}
.lbd-item:hover button { display: block; }
.lbd-drop { padding: 12px; text-align: center; color: var(--dim); font-size: 12px; border-top: 1px dashed var(--line); }

/* tier selection + quote form (AWL 10) */
.pricerow { cursor: pointer; border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.pricerow.sel { background: #26231a; }
.pricerow.sel .sz b { color: var(--accent); }
.quoteform { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.quoteform.hidden { display: none; }
.quoteform input, .quoteform textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 9px 10px; font: inherit; outline: none; resize: vertical;
}
.quoteform button { padding: 11px; border-radius: 9px; border: 0; font-weight: 700; background: var(--accent); color: #221a05; }

/* detail zoom + prev/next (AWL 14) */
.stage { position: relative; }
.imgwrap { overflow: hidden; border-radius: 6px; cursor: zoom-in; }
.imgwrap img { width: 100%; display: block; background: #17171a; transition: transform 0.15s ease; }
.imgwrap.zoomed { cursor: zoom-out; }
.imgwrap.zoomed img { transform: scale(2.4); }
.stage-nav button {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 44px; height: 64px; border: 0; border-radius: 8px;
  background: rgba(10,10,11,0.6); color: #fff; font-size: 28px; line-height: 1;
  backdrop-filter: blur(4px);
}
.stage-nav button:hover { background: rgba(10,10,11,0.85); color: var(--accent); }
#prevBtn { left: 10px; }
#nextBtn { right: 10px; }

/* mobile filters bottom-sheet (AWL 15) */
.mobile-filter-btn { display: none; }
.rail-sheet-head { display: none; }
@media (max-width: 860px) {
  .mobile-filter-btn {
    display: block; position: sticky; top: 61px; z-index: 25;
    width: 100%; padding: 11px; border: 0; border-bottom: 1px solid var(--line);
    background: var(--panel); color: var(--text); font-weight: 700; letter-spacing: 0.5px;
  }
  .rail {
    display: block; position: fixed; inset: auto 0 0 0; top: auto; width: auto;
    max-height: 72vh; z-index: 70; transform: translateY(100%);
    background: var(--panel); border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0; padding: 0 18px 28px;
    transition: transform 0.24s ease; box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  }
  body.rail-open .rail { transform: translateY(0); }
  body.rail-open::after {
    content: ''; position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,0.5);
  }
  .rail-sheet-head {
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; background: var(--panel);
    padding: 16px 0 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
  }
  .rail-sheet-head b { font-size: 16px; }
  #railClose { background: var(--accent); color: #221a05; border: 0; border-radius: 8px; padding: 7px 18px; font-weight: 700; }
}

/* sort dropdown (AWL 16) */
.sortwrap { margin-left: auto; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }
.sortsel { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13px; outline: none; }
.sortsel:hover { border-color: var(--accent); }

/* lightbox drawer tools + comments (AWL 17) */
.lbd-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.lbd-tools button { background: none; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 12px; padding: 5px 9px; }
.lbd-tools button:hover { color: var(--accent); border-color: var(--accent); }
.lbd-tools button.danger:hover { color: #ff8f9a; border-color: #ff8f9a; }
.lbd-tools #lbdShared { color: var(--dim); font-size: 11.5px; width: 100%; }
.lbd-comments { border-top: 1px dashed var(--line); padding: 10px 12px; max-height: 30%; overflow-y: auto; }
.lbd-ctitle { color: var(--dim); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
.lbd-cmt { font-size: 12.5px; padding: 4px 0; color: var(--muted); }
.lbd-cmt b { color: var(--accent); }

/* librarian dashboard (AWL 20) */
.statspanel { max-width: 1000px; margin: 0 auto; padding: 26px 20px 80px; }
.statspanel h2 { margin-bottom: 16px; }
.tiles { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.tile { flex: 1; min-width: 130px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.tile b { display: block; font-size: 26px; color: var(--accent); }
.tile span { color: var(--muted); font-size: 12.5px; }
.stats-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.stats-cols h3 { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); margin-bottom: 10px; }
.stats-cols .hint { text-transform: none; letter-spacing: 0; }
.srow { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.srow a { color: var(--text); }
.srow a:hover { color: var(--accent); }
.srow .n { color: var(--dim); font-size: 12.5px; }
@media (max-width: 700px) { .stats-cols { grid-template-columns: 1fr; } }
