/* Facet: framed-sheet app style. Tinted frame from the brand teal, white sheet, IBM Plex Sans. */
:root {
  --ground: #f3f6f6;
  --sheet: #ffffff;
  --raised: #f2f5f5;
  --active: #e6ebeb;
  --border: #e5e9e9;
  --rule: #eef1f1;
  --control: #c9cfd0;
  --text: #131416;
  --muted: #5a5f61;
  --accent: #1b6c80;
  --accent-soft: #e3f0f3;
  --on-accent: #ffffff;
  --icon: #131416;
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-sheet: 16px;
  --sheet-inset: 8px;
  --side: 228px;
  --rail: 384px;
  --gap: 24px;
  --top: 48px;
  --font: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace; /* taste-skill-ignore: only for the copied code in <pre> */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ground: #0e1011; --sheet: #16191a; --raised: #1d2122; --active: #252a2b; --border: #262b2c; --rule: #1f2324;
    --control: #3a4142; --text: #eef1f1; --muted: #a2aaab; --accent: #4fb3c8; --accent-soft: #15333a; --on-accent: #0e1011; --icon: #eef1f1;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --ground: #0e1011; --sheet: #16191a; --raised: #1d2122; --active: #252a2b; --border: #262b2c; --rule: #1f2324;
  --control: #3a4142; --text: #eef1f1; --muted: #a2aaab; --accent: #4fb3c8; --accent-soft: #15333a; --on-accent: #0e1011; --icon: #eef1f1;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- shell: tinted L-frame, sheet inset 8px right and bottom ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  grid-template-rows: var(--top) 1fr;
  height: 100vh;
  height: 100dvh;
}
.side { grid-row: 1 / 3; display: flex; flex-direction: column; min-height: 0; padding: 12px 12px 16px; }
.top { grid-column: 2; display: flex; align-items: center; gap: 12px; padding-right: calc(var(--sheet-inset) + 16px); position: relative; }
.sheet {
  grid-column: 2;
  margin: 0 var(--sheet-inset) var(--sheet-inset) 0;
  background: var(--sheet);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail);
  min-height: 0;
  overflow: hidden;
}

/* ---------- sidebar ---------- */
.brand { display: flex; align-items: center; gap: 8px; padding: 2px 8px 0; height: 36px; text-decoration: none; }
.brand-name { font-weight: 600; font-size: 16px; }
.brand-by { color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav { flex: 1; overflow-y: auto; margin-top: 12px; scrollbar-width: thin; }
.nav-group { margin: 20px 8px 6px; color: var(--muted); font-size: 12px; }
.nav-group:first-child { margin-top: 4px; }
.nav-item {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px;
  height: 32px; margin-bottom: 2px; padding: 0 10px; border: 0; border-radius: 8px; background: none;
  text-align: left; font-size: 14px;
}
.nav-item:hover { background: var(--raised); }
.nav-item[aria-current='page'] { background: var(--active); font-weight: 500; }
.count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.side-foot { display: grid; gap: 2px; padding-top: 12px; }
.side-link { display: block; padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: 13px; text-decoration: none; }
.side-link:hover { color: var(--text); background: var(--raised); }

/* ---------- top bar ---------- */
.search {
  position: absolute; left: 50%; transform: translateX(calc(-50% - var(--side) / 2));
  width: min(548px, calc(100% - 160px)); height: 32px;
  display: flex; align-items: center; gap: 8px; padding: 0 8px 0 10px;
  background: var(--sheet); border: 1px solid var(--border); border-radius: var(--radius-control);
}
.search:focus-within { border-color: var(--accent); }
.search-icon { display: inline-flex; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; height: 30px; font-size: 14px; }
.search input::-webkit-search-cancel-button { display: none; }
.kbd { font: 500 12px var(--font); color: var(--muted); background: var(--raised); border-radius: 4px; padding: 1px 6px; }
.top-right { margin-left: auto; display: flex; gap: 4px; }
.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-control); background: none; color: var(--muted);
}
.icon-btn:hover { background: var(--active); color: var(--text); }
.menu-btn { display: none; }

/* ---------- work area ---------- */
.work { min-width: 0; overflow-y: auto; padding: 20px 24px 40px; scrollbar-width: thin; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
h1 { font-size: 22px; font-weight: 600; line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
.sub { margin: 4px 0 0; color: var(--muted); }

.tabs { display: flex; gap: 20px; margin-top: 16px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0;
  border: 0; background: none; color: var(--muted); white-space: nowrap; font-size: 14px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected='true'] { color: var(--text); font-weight: 600; }
.tab[aria-selected='true']::after { content: ''; position: absolute; left: -4px; right: -4px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.tab svg { color: var(--icon); }

.controls, .oss-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 28px; margin: 16px 0 20px; }
.ctl { display: grid; gap: 6px; }
.ctl-label { color: var(--muted); font-size: 12px; }
.ctl-label output { color: var(--text); font-variant-numeric: tabular-nums; }
input[type='range'] { width: 150px; accent-color: var(--accent); margin: 0; height: 32px; }
.ctl-colour { grid-auto-flow: column; grid-template-rows: auto 32px; align-items: center; column-gap: 8px; }
.ctl-colour .ctl-label { grid-column: 1 / 3; }
.swatches { display: flex; gap: 6px; }
.swatch {
  width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0;
  background: var(--c); outline: 1px solid rgba(0, 0, 0, 0.12); outline-offset: -1px;
}
.swatch[aria-checked='true'] { outline: 2px solid var(--text); outline-offset: 2px; }
input[type='color'] { width: 32px; height: 28px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--sheet); padding: 2px; }
select {
  height: 32px; min-width: 260px; padding: 0 32px 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control);
  background: var(--sheet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a5f61' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
}
.oss-note { margin: 0 0 6px; color: var(--muted); font-size: 13px; max-width: 520px; }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.cell {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 92px; min-width: 0; padding: 10px 6px 10px; border: 0; border-radius: var(--radius-card);
  background: var(--raised); color: var(--icon);
}
.cell:hover { background: var(--active); }
.cell[aria-selected='true'] { background: var(--accent-soft); outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
.cell .ico { display: flex; align-items: center; justify-content: center; min-height: 32px; flex: none; }
.cell .ico img { display: block; }
.cell-name { max-width: 100%; color: var(--muted); font-size: 12px; line-height: 1.25; text-align: center; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { color: var(--muted); padding: 40px 0; }
.ph { display: block; border-radius: 4px; background: var(--active); }
.more { margin: 20px auto 0; display: block; }

/* collections list in the open-source view */
.sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.set {
  display: grid; gap: 10px; padding: 14px 14px 12px; border: 0; border-radius: var(--radius-card);
  background: var(--raised); text-align: left;
}
.set:hover { background: var(--active); }
.set-icons { display: flex; gap: 12px; color: var(--icon); min-height: 24px; }
.set-name { font-weight: 500; }
.set-meta { color: var(--muted); font-size: 12px; }

/* ---------- detail rail ---------- */
.detail { border-left: 1px solid var(--rule); overflow-y: auto; padding: 20px 24px 32px; scrollbar-width: thin; }
.stage {
  display: flex; align-items: center; justify-content: center; height: 208px; border-radius: var(--radius-card);
  background: var(--raised); color: var(--icon);
}
.stage img { width: 120px; height: 120px; }
.d-name { margin: 16px 0 2px; font-size: 16px; font-weight: 600; }
.d-meta { margin: 0; color: var(--muted); font-size: 13px; }
.facets { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 16px; }
.facet {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 6px; border: 0; border-radius: 6px;
  background: none; color: var(--icon);
}
.facet span { font-size: 10.5px; color: var(--muted); line-height: 1.2; text-align: center; }
.facet:hover { background: var(--raised); }
.facet[aria-pressed='true'] { background: var(--active); }
.facet[aria-pressed='true'] span { color: var(--text); }
.section-h { margin: 22px 0 8px; font-size: 13px; font-weight: 600; }
.formats { display: flex; flex-wrap: wrap; gap: 4px; }
.fmt { height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; }
.fmt:hover { color: var(--text); background: var(--raised); }
.fmt[aria-pressed='true'] { background: var(--active); color: var(--text); font-weight: 500; }
pre.code {
  margin: 8px 0 0; padding: 12px; max-height: 188px; overflow: auto; border-radius: var(--radius-card);
  background: var(--raised); font: 400 11.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; scrollbar-width: thin;
}
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn {
  height: 32px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control);
  background: var(--sheet); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--raised); }
.btn-primary { background: var(--text); border-color: var(--text); color: var(--sheet); }
.btn-primary:hover { background: var(--text); opacity: 0.88; }
.btn:active { transform: translateY(1px); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag { height: 22px; padding: 0 8px; border: 0; border-radius: 11px; background: var(--raised); color: var(--muted); font-size: 12px; }
.tag:hover { color: var(--text); background: var(--active); }
.licence { margin-top: 16px; color: var(--muted); font-size: 12px; }
.licence a { color: var(--muted); }

/* ---------- dialog and toast ---------- */
.dialog {
  max-width: 480px; padding: 24px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--sheet); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18); /* taste-skill-ignore: dialog floats */
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.32); }
.dialog h2 { margin: 0 0 8px; font-size: 18px; }
.dialog p { margin: 0 0 12px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); opacity: 0;
  padding: 8px 14px; border-radius: 8px; background: var(--text); color: var(--sheet); font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); pointer-events: none; /* taste-skill-ignore: toast floats */
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cell { animation: rise 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(min(var(--i, 0), 40) * 8ms); }
.cell, .tab, .nav-item, .facet, .fmt, .btn, .tag, .set { transition: background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease; }
.stage svg { animation: rise 0.24s ease both; }
@media (prefers-reduced-motion: reduce) {
  .cell, .stage svg { animation: none; }
  .toast { transition: none; }
}

/* ---------- narrower screens ---------- */
@media (max-width: 1180px) {
  :root { --rail: 320px; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 20; background: var(--ground);
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, 0.2); /* taste-skill-ignore: drawer floats */
  }
  .side.open { transform: none; }
  .top { grid-column: 1; padding: 0 12px; background: var(--ground); }
  .menu-btn { display: inline-flex; }
  .search { position: static; transform: none; flex: 1; width: auto; }
  .kbd { display: none; }
  .sheet { grid-column: 1; margin: 0; border-radius: 0; border-width: 1px 0 0; grid-template-columns: 1fr; overflow: visible; }
  .shell { height: auto; min-height: 100dvh; }
  .work { overflow: visible; padding: 16px; }
  .detail { border-left: 0; border-top: 1px solid var(--rule); padding: 20px 16px 32px; overflow: visible; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  input[type='range'] { width: 120px; }
  select { min-width: 0; width: 100%; }
  .oss-bar .ctl { width: 100%; }
}
@media (max-width: 960px) and (prefers-reduced-motion: reduce) {
  .side { transition: none; }
}
