/* Library: the title and its filter chips, the colour row, the controls, the grid, and the states. */
.lede { padding: 40px var(--page-x) 0; }
.sentence { font: 600 var(--fs-28)/1.15 var(--sans); letter-spacing: -.02em; max-width: 1180px; text-wrap: pretty; min-height: 1.15em; }
.sentence .num, .sentence .noun { font: inherit; font-variant-numeric: tabular-nums; }
.sentence .lead { color: var(--t3); font-weight: 450; font-size: var(--fs-16); letter-spacing: 0; margin-left: 8px; }
.sentence em { font-style: normal; color: var(--t2); }

/* the filters read as one line of chips, then "Add filter" */
.filters { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; min-height: 36px; }
.fchips { display: contents; }
.clause { display: inline-flex; align-items: center; height: 36px; padding: 0 4px 0 14px; border-radius: var(--r-pill); background: var(--s2); color: var(--t1); font-size: var(--fs-14); font-weight: 500; white-space: nowrap; max-width: 100%; transition: background var(--dur-quick); }
.clause:hover { background: var(--s3); }
.clause .lead { color: var(--t3); font-weight: 450; margin-right: 6px; }
.clause .tok { display: inline-flex; align-items: center; gap: 8px; height: 100%; font: inherit; color: inherit; border-radius: var(--r-pill); cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.clause .hexm { font: 500 var(--fs-13)/1 var(--mono); }
.clause .x, .clause .lnk { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 2px; border-radius: 50%; color: var(--t3); transition: background var(--dur-quick), color var(--dur-quick); flex: none; }
.clause .x:hover, .clause .lnk:hover { background: var(--s3); color: var(--t1); }
.clause:hover .x:hover, .clause:hover .lnk:hover { background: var(--line-2); }
.clause .x .ic, .clause .lnk .ic { width: 12px; height: 12px; }
.clause .sw { width: 12px; height: 12px; }
.add-btn { height: 36px; padding: 0 12px 0 10px; gap: 8px; color: var(--t2); }
.add-btn kbd { background: var(--s2); margin-left: 4px; }
.sentence .more, .more-chip { height: 36px; padding: 0 14px; border-radius: var(--r-pill); color: var(--t2); font-size: var(--fs-13); font-weight: 500; border: 1px solid var(--line-2); }
.help-btn { color: var(--t3); }
.help-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: min(400px, calc(100vw - 32px)); padding: 20px 24px; background: var(--s2); border: 1px solid var(--line-2); border-radius: var(--r-pop); box-shadow: var(--float); font-size: var(--fs-13); line-height: 1.55; color: var(--t2); animation: popin var(--dur-base) var(--ease-out); }
.help-pop h3 { font: 600 var(--fs-16)/1.2 var(--sans); color: var(--t1); margin-bottom: 8px; }
.help-pop b { color: var(--t1); font-weight: 600; }
.help-pop p + p { margin-top: 8px; }
.help-pop dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0; }
.help-pop dt { color: var(--t1); }
@keyframes popin { from { opacity: 0; transform: translateY(-6px); } }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; margin-top: 24px; }
.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.dens { display: flex; align-items: center; gap: 12px; margin-left: 8px; }
.dens .seg { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-ctl); background: var(--s2); }
.dens .seg button { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font: 500 var(--fs-12)/1 var(--sans); color: var(--t2); transition: background var(--dur-quick), color var(--dur-quick); }
.dens .seg button[aria-pressed="true"] { background: var(--s3); color: var(--t1); }
.dens .seg button:hover:not([aria-pressed="true"]) { color: var(--t1); }
.dens input[type=range] { -webkit-appearance: none; appearance: none; width: 96px; height: 24px; background: none; cursor: pointer; }
.dens input[type=range]::-webkit-slider-runnable-track { height: 4px; background: var(--s3); border-radius: 2px; }
.dens input[type=range]::-moz-range-track { height: 4px; background: var(--s3); border-radius: 2px; }
.dens input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--t1); border: 0; }
.dens input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--t1); border: 0; }
.dens input[type=range]:focus-visible { outline-offset: 4px; }

.colour-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.colour-row .dots { display: flex; align-items: center; min-width: 0; flex-wrap: wrap; }
.colour-row .gap { width: 12px; flex: none; }
.hue { position: relative; width: 24px; height: 28px; display: grid; place-items: center; flex: none; border-radius: 8px; }
.hue::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .3); transition: transform var(--dur-quick) var(--ease-out); }
.hue:hover::before { transform: scale(1.25); }
.hue[aria-pressed="true"]::before { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--t1); }
.hue.zero { opacity: .35; }
.hue:focus-visible { outline-offset: 0; }
.hexbox { display: flex; align-items: center; gap: 8px; margin-left: 12px; flex: none; }
.hexbox .pick { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin: 0 -4px 0 -5px; padding: 5px; border: 0; border-radius: 50%; background: conic-gradient(from 0deg, oklch(.72 .16 0), oklch(.72 .16 60), oklch(.72 .16 120), oklch(.72 .16 180), oklch(.72 .16 240), oklch(.72 .16 300), oklch(.72 .16 360)); cursor: pointer; flex: none;  background-clip: content-box; }
.hexbox .pick::-webkit-color-swatch-wrapper { padding: 0; opacity: 0; }
.hexbox .pick::-webkit-color-swatch { border: 0; }
.hexbox .hex { width: 88px; height: 32px; border: 0; border-radius: var(--r-ctl); background: var(--s2); padding: 0 10px; font: 400 var(--fs-12)/1 var(--mono); outline: 0; color: var(--t1); }
.hexbox .hex:focus { outline: 2px solid var(--t1); outline-offset: 2px; }
.hexbox .hex::placeholder { color: var(--t3); }
.hex-x { width: 24px; height: 24px; display: grid; place-items: center; color: var(--t3); border-radius: 8px; }
.hex-x:hover { color: var(--t1); background: var(--s2); }
.hex-x .ic { width: 12px; height: 12px; }

/* ---------- the grid ---------- */
.wall-wrap { padding: 32px var(--page-x) 120px; }
.wall { position: relative; }
.tile { position: absolute; left: 0; top: 0; }
/* five elements per tile: .tile > a.tile-link > img, then the brand button and the sub line */
.tile-link { position: relative; display: block; overflow: hidden; border-radius: var(--r-media); background: var(--s1); cursor: pointer; outline: 0; text-decoration: none; transition: box-shadow var(--dur-quick) var(--ease-out), scale var(--dur-quick) var(--ease-out); }
.tile-link img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.tile-link img.in { opacity: 1; }
.tile-link.vector { background: #fff; }
.tile-link.vector img { object-fit: contain; padding: 8%; }
.tile-link video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--dur-quick); pointer-events: none; }
.tile-link video.live { opacity: 1; }
.tile-link.tall::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 64px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='12' cy='12' r='12' fill='%23111' fill-opacity='.72'/%3E%3Cpath d='M12 7v7M8.5 11l3.5 3.5 3.5-3.5M8.5 17h7' fill='none' stroke='%23fff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 8px bottom 8px / 24px 24px no-repeat, linear-gradient(transparent, var(--s1)); }
.tile-link.tall.video::after { background-position: left 8px bottom 8px, 0 0; }
.tile-link.video::before { content: ""; position: absolute; z-index: 2; right: 8px; bottom: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgba(17, 17, 17, .72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath d='M3.5 2l6.5 4-6.5 4z' fill='%23fff'/%3E%3C/svg%3E") center / 12px no-repeat; pointer-events: none; }
.tile:hover .tile-link { box-shadow: 0 0 0 1px var(--hover-ring); }
.tile-link:focus-visible { outline: 2px solid var(--t1); outline-offset: 3px; }
.tile.pressed .tile-link { scale: .985; transition-duration: 90ms; }
.tile.is-open .tile-link { opacity: 0; }
.cap-brand { display: block; max-width: 100%; margin-top: 10px; font-weight: 500; font-size: var(--fs-13); line-height: 18px; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--t1); border-radius: 4px; }
.cap-brand:hover { text-decoration: underline; text-decoration-color: var(--t3); text-underline-offset: 3px; }
.cap-sub { display: block; font-size: var(--fs-12); line-height: 16px; color: var(--t3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#few { margin-top: 32px; }
.few-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 24px; color: var(--t2); }
.few-row .fl { font: 500 var(--fs-16)/1.3 var(--sans); color: var(--t1); margin-right: 8px; }
.drop { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--line-2); font-size: var(--fs-13); font-weight: 500; transition: background var(--dur-quick); }
.drop:hover { background: var(--s2); }
.drop .n { color: var(--t3); font-weight: 450; }

/* ---------- states ---------- */
.state { padding: 32px var(--page-x) 120px; }
.state.empty { display: grid; justify-items: center; align-content: start; text-align: center; padding-top: 80px; }
.state .st-ic { width: 56px; height: 56px; border-radius: var(--r-card); background: var(--s1); color: var(--t2); display: grid; place-items: center; margin-bottom: 24px; }
.state .st-ic .ic { width: 22px; height: 22px; }
.state h2 { font: 600 var(--fs-20)/1.25 var(--sans); letter-spacing: -.01em; }
.state h2 em { font-style: normal; color: var(--t2); }
.state p { color: var(--t2); margin: 8px 0 24px; max-width: 460px; }
.state .fixes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.state.error { max-width: 760px; }
.state.error pre, .state code { font: 400 var(--fs-13)/1.5 var(--mono); background: var(--s1); border-radius: 6px; padding: 2px 6px; }
.state.error pre { padding: 16px; margin: 0 0 24px; overflow-x: auto; border-radius: var(--r-ctl); }
.skeleton { position: relative; padding: 32px var(--page-x); columns: 5 180px; column-gap: 24px; }
.skeleton i { display: block; break-inside: avoid; margin-bottom: 24px; border-radius: var(--r-media); background: linear-gradient(110deg, var(--s1) 30%, var(--s2) 50%, var(--s1) 70%); background-size: 220% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.placeholder { padding: 32px var(--page-x) 100px; max-width: 900px; color: var(--t2); }
.placeholder p { margin-bottom: 16px; }
.ph-list { columns: 3 200px; gap: 24px; }
.ph-list li { padding: 3px 0; }
.ph-list a { text-underline-offset: 3px; }

@media (max-width: 820px) {
  .lede { padding-top: 16px; }
  .sentence { font-size: 24px; }
  .filters { margin-top: 12px; }
  .add-btn kbd { display: none; }
  .toolbar { margin-top: 16px; gap: 12px; }
  .controls { display: none; }   /* sort moved to the bottom bar, size and shuffle are desktop controls */
  /* the dots wrap onto two lines and the hex field follows them, so nothing sits off screen */
  .colour-row { flex-wrap: wrap; gap: 4px 0; min-height: 64px; align-content: flex-start; }   /* room for two lines is reserved before the dots exist, so the grid below never moves */
  .colour-row .dots { display: contents; }
  .colour-row .gap { display: none; }
  .hexbox { margin-left: 8px; }
  .cap-brand { margin-top: 6px; line-height: 24px; }
  .wall-wrap { padding-top: 24px; }
  .state { padding-left: var(--page-x); padding-right: var(--page-x); }
  .skeleton { columns: 2 140px; column-gap: 16px; }
}

.wall.is-scrolling { pointer-events: none; }
.wall.is-scrolling .tile-link { transition: none; }
@media (max-width: 380px) { .colour-row { min-height: 96px; } }
