/* gallery.casama.ai chrome matches casama.ai: Libre Baskerville headings, Google Sans text, plain
   white (light) or dark grey (dark) and a neutral frame, so the previews carry the color. */
@font-face {
  font-family: "Google Sans";
  src: url("/assets/fonts/GoogleSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Google Sans";
  src: url("/assets/fonts/GoogleSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Google Sans";
  src: url("/assets/fonts/GoogleSans-Bold.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libre Baskerville";
  src: url("/assets/fonts/LibreBaskerville-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libre Baskerville";
  src: url("/assets/fonts/LibreBaskerville-Bold.ttf") format("truetype");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("/assets/fonts/Lato-Regular.ttf") format("truetype");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("/assets/fonts/Lato-Bold.ttf") format("truetype");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  --ground: #f5f5f6;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --raised: #efeff1;
  --border: #e4e4e7;
  --border-strong: #cdcdd2;
  --text: #1b1b1f;
  --muted: #55555c;
  --accent: #7a3fa8;
  --accent-ink: #ffffff;
  --accent-soft: rgba(122, 63, 168, 0.12);
  --page: #ffffff;
  --radius-card: 18px;
  --radius-control: 14px;
  --gap: 16px;
  --side: 24px;
  --font: "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #242427;
    --surface: #232326;
    --surface-solid: #202023;
    --raised: #2d2d31;
    --border: #36363b;
    --border-strong: #4a4a50;
    --text: #ececef;
    --muted: #b9b9c0;
    --accent: #d9b6f7;
    --accent-ink: #25102f;
    --accent-soft: rgba(217, 182, 247, 0.14);
    --page: #1c1c1e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #242427;
  --surface: #232326;
  --surface-solid: #202023;
  --raised: #2d2d31;
  --border: #36363b;
  --border-strong: #4a4a50;
  --text: #ececef;
  --muted: #b9b9c0;
  --accent: #d9b6f7;
  --accent-ink: #25102f;
  --accent-soft: rgba(217, 182, 247, 0.14);
  --page: #1c1c1e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 16.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, .logo, .foot-name { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; }
h3 { font-family: var(--font); }
a { color: inherit; }
code { font: 0.92em var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-control); z-index: 10; }
.skip:focus { left: 8px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 var(--side); }

/* Bar: the name, where you are, three links and the one action. */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--page) 84%, transparent);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}
.bar-inner { display: flex; align-items: center; height: 64px; gap: 10px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-size: 22px; text-decoration: none; color: var(--text); }
/* The animated brand mascot (assets/brand/casama-mark.js) fills these boxes; it fades in once drawn. */
[data-casama-mark] { display: block; flex: none; width: 34px; height: 34px; contain: layout paint style; opacity: 0; transition: opacity .4s ease; }
[data-casama-mark].is-ready { opacity: 1; }
[data-casama-mark] svg { display: block; }
.crumb { color: var(--border-strong); font-size: 20px; }
.crumb-page { font-size: 16px; font-weight: 500; text-decoration: none; color: var(--muted); }
.bar-nav { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.bar-nav a:not(.btn) { color: var(--muted); text-decoration: none; font-size: 15px; }
.bar-nav a:not(.btn):hover { color: var(--text); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 999px;
  font: 600 15px/1 var(--font); text-decoration: none; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms ease;
}
.btn:hover { border-color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); padding: 0 10px; }
.btn.quiet:hover { color: var(--text); }
.btn svg { width: 17px; height: 17px; }

/* Title row */
.title-row { padding: 36px 0 20px; }
h1 { margin: 0; font-size: clamp(36px, 4vw, 48px); line-height: 1.05; }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 16px; max-width: 62ch; }

/* Tabs for the kinds, on one rule */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; background: none; border: 0; cursor: pointer; color: var(--muted);
  font: 500 15px/1 var(--font); padding: 12px 0 13px; white-space: nowrap; position: relative;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.tab .n { margin-left: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 16px; padding: 20px 0 8px; flex-wrap: wrap; }
.search { position: relative; display: block; width: min(320px, 100%); }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.search-icon svg { width: 17px; height: 17px; }
.search input {
  width: 100%; height: 38px; border-radius: var(--radius-control); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 15px var(--font); padding: 0 12px 0 36px;
}
.search input::placeholder { color: var(--muted); }
.count { margin: 0 0 0 auto; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--raised); border: 1px solid var(--border); }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 600 14px/1 var(--font); height: 30px; padding: 0 14px; border-radius: 999px;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* Sections */
.section { padding-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 12px; gap: 12px; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.section-head h2 .n { color: var(--muted); font-weight: 500; margin-left: 8px; font-variant-numeric: tabular-nums; }
.see-all { appearance: none; background: none; border: 0; cursor: pointer; color: var(--text); font: 500 15px var(--font); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); padding: 4px 0; }
.see-all:hover { text-decoration-color: var(--text); }

/* Grids of peer cards: equal columns, one gap */
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
.featured { --cols: 3; }

.card {
  display: block; text-decoration: none; color: inherit; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-card); padding: 6px;
  box-shadow: 0 2px 8px rgba(30, 26, 32, 0.04);
  transition: border-color 150ms ease, transform 150ms ease;
}
.card:hover { border-color: var(--border-strong); }
.card:active { transform: scale(0.995); }
.card .cg-frame { --cg-radius: 12px; }
.cap { display: flex; align-items: center; gap: 10px; padding: 10px 6px 4px; }
.cap-text { min-width: 0; flex: 1; }
.cap .name { display: block; font-size: 15px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.featured .cap .name { font-size: 17px; }
.cap .line { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: inline-flex; flex: none; }
.dots i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--surface); margin-left: -4px; }

/* Skills read as a list: the identity, what it does, its category and license */
.skills { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.skill {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) 120px 110px auto; align-items: center; gap: 16px;
  padding: 14px 4px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit;
}
.skill:hover .skill-name { text-decoration: underline; text-underline-offset: 3px; }
.skill svg { width: 20px; height: 20px; color: var(--muted); }
.skill-name { font-weight: 600; }
.skill-desc { display: block; color: var(--muted); font-size: 14px; line-height: 1.4; }
.skill-meta { color: var(--muted); font-size: 14px; }
.skill-go { color: var(--muted); display: flex; }
/* Apps (D-239): the skills list, with the app's mark on its brand color */
.app-row { grid-template-columns: 32px minmax(0, 1fr) 120px 110px auto; }
.app-logo { display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06); }
.app-logo i { display: block; width: 52%; height: 52%; }
.app-logo b { font-weight: 800; line-height: 1; }
.app-hero { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 220px; width: 100%; }
.app-can { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.app-can li { display: flex; align-items: center; gap: 8px; }
.app-can svg { color: var(--accent); flex: none; }

/* Phones: rows of looks scroll sideways; the list keeps two lines per skill */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: var(--w, 200px); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 calc(var(--side) * -1); padding: 0 var(--side) 4px; scroll-padding: 0 var(--side); }
.shelf::-webkit-scrollbar { display: none; }
.shelf > * { scroll-snap-align: start; }

/* States */
.empty { border: 1px dashed var(--border-strong); border-radius: var(--radius-card); padding: 40px 24px; text-align: center; margin-top: 28px; }
.empty p { margin: 0 0 14px; }
.empty p.small { color: var(--muted); }
.skeleton .cg-frame, .bar-line { background: var(--raised); }
.bar-line { display: block; height: 11px; border-radius: 6px; margin: 4px 0; }
.note { color: var(--muted); }

/* Contribute */
.contribute {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 40px; align-items: start;
  margin: 72px 0 0; padding: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
}
.contribute h2 { margin: 0 0 12px; font-size: 26px; letter-spacing: -0.02em; line-height: 1.15; }
.contribute p { margin: 0 0 14px; max-width: 64ch; }
.steps { margin: 0 0 16px; padding-left: 22px; }
.steps li { margin: 6px 0; padding-left: 4px; }
.small { font-size: 14px; color: var(--muted); }
.sample { margin: 0; background: var(--ground); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 18px; overflow-x: auto; font: 13.5px/1.55 var(--mono); }

/* Footer: the name returns */
.foot { margin-top: 72px; border-top: 1px solid var(--border); padding: 32px 0 48px; }
.foot-name { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.foot p { margin: 4px 0; }

/* Detail */
.detail {
  border: 1px solid var(--border); padding: 0; border-radius: 24px; width: min(980px, calc(100vw - 48px)); max-height: calc(100vh - 48px);
  background: var(--surface-solid); color: var(--text); box-shadow: 0 28px 64px -14px rgba(0, 0, 0, 0.28);
}
.detail::backdrop { background: rgba(20, 20, 24, 0.46); }
.detail-inner { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.detail-pic { padding: 24px; background: var(--ground); display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; }
.detail-pic .cg-frame { width: 100%; --cg-radius: 8px; }
.detail-pic .seg { align-self: center; }
.detail-info { padding: 28px 28px 24px; display: flex; flex-direction: column; min-width: 0; max-height: calc(100vh - 48px); overflow: auto; }
.detail-close { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.detail-close svg { width: 18px; height: 18px; }
.detail h2 { margin: 0 40px 4px 0; font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 600; }
.meta { color: var(--muted); margin: 0 0 16px; font-size: 15px; }
.desc { margin: 0 0 16px; font-size: 17px; line-height: 1.5; }
.facts { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 15px; }
.facts th { text-align: left; color: var(--muted); font-weight: 500; width: 110px; padding: 10px 12px 10px 0; vertical-align: top; }
.facts td { padding: 10px 0; }
.facts tr + tr th, .facts tr + tr td { border-top: 1px solid var(--border); }
.pair { display: grid; gap: 8px; }
.pair > span { display: flex; align-items: center; gap: 10px; }
.pair-label { width: 40px; color: var(--muted); font-size: 14px; }
.chips { display: inline-flex; gap: 5px; vertical-align: middle; }
.chips i { width: 20px; height: 20px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.08); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.tag { appearance: none; border: 1px solid var(--border-strong); background: transparent; color: var(--text); border-radius: 999px; font: 14px var(--font); padding: 4px 12px; cursor: pointer; }
.tag:hover { border-color: var(--text); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.instructions { margin: 0 0 18px; max-height: 300px; overflow: auto; white-space: pre-wrap; background: var(--ground); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 14px 16px; font: 13px/1.55 var(--mono); }
.skill-hero { display: flex; align-items: center; justify-content: center; min-height: 220px; color: var(--muted); }
.skill-hero svg { width: 72px; height: 72px; }

@media (max-width: 900px) {
  .detail-inner { grid-template-columns: 1fr; }
  .detail-info { max-height: none; overflow: visible; }
  .detail { overflow: auto; }
  .contribute { grid-template-columns: 1fr; padding: 28px; }
}
@media (max-width: 640px) {
  :root { --side: 16px; }
  .bar-nav a:not(.btn) { display: none; }
  .title-row { padding: 24px 0 14px; }
  h1 { font-size: 26px; }
  .toolbar { gap: 10px; }
  .search { width: 100%; }
  .count { margin-left: 0; }
  .seg { margin-left: auto; }
  .skill { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; }
  .skill .skill-meta { display: none; }
  .skill .skill-meta-line { display: block; }
  .app-row { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .detail { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .detail-pic { padding: 56px 16px 16px; }
  .detail-info { padding: 20px 16px 24px; }
  .detail h2 { font-size: 26px; }
  .actions .btn { flex: 1 1 auto; }
  .contribute { padding: 22px 18px; margin-top: 56px; }
}
.skill-meta-line { display: none; color: var(--muted); font-size: 13px; margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------------------------------------------------------------- Gallery v2 (D-315) */
/* Filters: a topic and three switches, under the search. */
.filters { display: flex; align-items: center; gap: 8px; padding: 4px 0 4px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--side) * -1); padding-left: var(--side); padding-right: var(--side); }
.filters::-webkit-scrollbar { display: none; }
.select {
  appearance: none; height: 34px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2388888f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text); font: 500 14px var(--font); padding: 0 32px 0 14px; flex: none; cursor: pointer;
}
.chip {
  appearance: none; flex: none; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 500 14px var(--font); cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip.quiet { border-color: transparent; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* Rows on the home page: mixed cards that scroll sideways. */
.section-note { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.shelf.row { --w: 236px; padding-bottom: 6px; }
.shelf.row > .card { display: flex; flex-direction: column; }
.card-pic { position: relative; display: block; }
.badge-new {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font: 700 11.5px/1 var(--font); letter-spacing: 0.02em; vertical-align: middle;
}
.card-pic .badge-new { position: absolute; right: 8px; top: 8px; }
.skill-name .badge-new { margin-left: 8px; }
.tile { padding: 14px 14px 12px; gap: 6px; min-height: 100%; }
.tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tile-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--raised); color: var(--text); }
.tile-mark .app-logo { width: 40px !important; height: 40px !important; }
.tile-name { font-weight: 600; font-size: 15px; line-height: 1.25; }
.tile-desc { color: var(--muted); font-size: 13.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { margin-top: auto; padding-top: 6px; color: var(--muted); font-size: 12.5px; }

/* Empty search: request it, or ask Casama. */
.empty-title { font-size: 18px; font-weight: 600; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 4px 0 16px; }
.linkish { appearance: none; border: 0; background: none; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* Detail additions */
.stats-line { margin: -8px 0 14px; color: var(--muted); font-size: 14px; }
.pick-note { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-control); background: var(--raised); font-size: 14.5px; }
.pick-note svg { color: var(--accent); flex: none; margin-top: 2px; }
.block { margin: 0 0 16px; }
.block h3, .changelog summary { margin: 0 0 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.changelog summary { cursor: pointer; }
.changelog ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14.5px; }
.access, .examples { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 15px; }
.access li { display: flex; gap: 10px; align-items: flex-start; }
.access svg { flex: none; margin-top: 3px; color: var(--muted); }
.examples a { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-control); border: 1px solid var(--border); text-decoration: none; }
.examples a:hover { border-color: var(--border-strong); }
.examples svg { flex: none; margin-top: 3px; color: var(--accent); }
.inline-list { margin: 0; }
.instructions.full { max-height: none; width: 100%; margin: 0; }
.pics { display: flex; gap: 12px; width: 100%; align-items: center; }
.detail-inner.single { grid-template-columns: 1fr; }
.detail-info.wide { max-width: 720px; }
.set-list { margin: 0 0 18px; }
.set-list .skill { grid-template-columns: 32px minmax(0, 1fr) auto; }
