/* Asset catalog (catalogo.html). Same type and ink as the map HUD; tiles take each category's color. */
:root {
  --ink: #1e2430;
  --muted: #5d6b7e;
  --line: rgba(30, 36, 48, 0.12);
  --bg: #e3f5fc;
  --card: #ffffff;
  --accent: #ffd23f;
  --radius: 18px;
  --top: 64px;
  font: 14px/1.45 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
canvas { display: block; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #2e7cb8; outline-offset: 2px; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 2; height: var(--top);
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: rgba(227, 245, 252, 0.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { color: var(--ink); text-decoration: none; font-weight: 600; white-space: nowrap; padding: 6px 10px; border-radius: 10px; }
.top .back:hover { background: rgba(30, 36, 48, 0.06); }
.top-extra { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.button {
  font: inherit; font-weight: 600; color: var(--ink); text-decoration: none; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--ink); border-radius: 10px; padding: 6px 12px;
  box-shadow: 0 2px 0 var(--ink); transition: transform 0.06s, box-shadow 0.06s;
}
.button:hover { background: var(--accent); }
.button:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }
.button.big { padding: 10px 14px; font-size: 15px; }

/* home: the categories fill the screen */
.home {
  display: grid; gap: 14px; padding: 14px;
  grid-template-columns: 1.3fr 1fr 1fr; grid-template-rows: 1fr 1fr 0.55fr;
  height: calc(100dvh - var(--top));
}
.tile {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--tile); color: var(--ink); text-decoration: none;
  border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--ink); }
.tile:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.tile-bld { grid-row: span 2; }
.tile-text { display: flex; flex-direction: column; padding: 18px 20px 0; z-index: 1; }
.tile-name { font-size: clamp(26px, 3.2vw, 44px); font-weight: 900; letter-spacing: -0.02em; line-height: 1.05; }
.tile-hint { font-size: 15px; opacity: 0.8; margin-top: 4px; }
.tile-count { margin-top: 10px; align-self: flex-start; font-weight: 700; font-size: 13px; background: rgba(255, 255, 255, 0.7); border-radius: 999px; padding: 2px 10px; }
.tile-art { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); place-items: center; padding: 8px; }
.tile-art canvas { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.tile-bld .tile-art { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
.tile-snd { grid-column: 1 / -1; flex-direction: row; } /* sounds: a wide strip under the others, waves side by side */
.tile-snd .tile-text { padding-bottom: 18px; min-width: 220px; }
.tile-snd .tile-art { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.tile-ped .tile-art::after { content: "?"; font-size: 120px; font-weight: 900; opacity: 0.25; }

/* category: cards */
.category { padding: 6px 18px 40px; max-width: 1400px; margin: 0 auto; }
.category h2 { font-size: 18px; margin: 22px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; overflow: hidden; color: var(--ink); text-decoration: none;
  background: var(--card); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.card canvas { width: 100%; aspect-ratio: 4 / 3; height: auto; border-bottom: 2px solid var(--ink); }
.card-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.card-id { font-size: 13px; font-weight: 700; background: var(--tile); align-self: flex-start; padding: 1px 7px; border-radius: 6px; }
.card-name { font-size: 15px; font-weight: 600; }
.card-meta { font-size: 12px; color: var(--muted); }
.empty { margin: 30px auto; max-width: 560px; text-align: center; background: var(--card); border: 2px dashed var(--ink); border-radius: var(--radius); padding: 30px; }
.empty-title { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.empty code { background: var(--tile); padding: 1px 6px; border-radius: 6px; }

/* asset: big live viewer + info */
.asset {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; padding: 14px;
  height: calc(100dvh - var(--top));
}
.viewer { position: relative; min-height: 0; border: 2px solid var(--ink); border-radius: var(--radius); overflow: hidden; box-shadow: 0 5px 0 var(--ink); background: #e3f5fc; }
.viewer-canvas { width: 100%; height: 100%; touch-action: none; cursor: grab; }
.viewer-canvas:active { cursor: grabbing; }
.viewer-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0; font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, 0.8); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.panel-info { overflow-y: auto; background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 16px; }
.panel-info h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 0 8px; }
.id-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.asset-id { font-size: 20px; font-weight: 800; background: var(--accent); padding: 2px 10px; border-radius: 8px; border: 2px solid var(--ink); }
.panel-info dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 14px 0 0; }
.panel-info dt { color: var(--muted); }
.panel-info dd { margin: 0; overflow-wrap: anywhere; }
.variants { display: flex; flex-wrap: wrap; gap: 6px; }
.variant { padding: 0; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; background: none; }
.variant canvas { width: 64px; height: 48px; }
.variant[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--accent); }
.control { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.control.check { flex-direction: row; align-items: center; gap: 8px; }
.control input[type="range"] { width: 100%; }
.segmented { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 10px; overflow: hidden; align-self: flex-start; }
.segmented button { font: inherit; border: 0; background: var(--card); padding: 6px 12px; cursor: pointer; color: var(--ink); }
.segmented button + button { border-left: 1.5px solid var(--ink); }
.segmented button[aria-checked="true"] { background: var(--accent); font-weight: 700; }
.actions { display: grid; gap: 8px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); margin: 0; z-index: 5; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); }
#toast[hidden] { display: none; }

@media (max-width: 860px) {
  .home { grid-template-columns: 1fr 1fr; grid-template-rows: none; grid-auto-rows: minmax(200px, 1fr); height: auto; min-height: calc(100dvh - var(--top)); }
  .tile-bld { grid-column: span 2; grid-row: auto; min-height: 320px; }
  .tile-snd { grid-column: span 2; flex-direction: column; }
  .asset { grid-template-columns: 1fr; height: auto; }
  .viewer { height: 62dvh; }
}
@media (max-width: 520px) {
  .home { grid-template-columns: 1fr; padding: 12px; }
  .tile-bld, .tile-snd { grid-column: auto; }
  .top { padding: 0 10px; gap: 8px; }
  .top h1 { font-size: 17px; }
  .top-extra .muted { display: none; }
}

/* sounds: an oscilloscope instead of the 3D view */
.sound-scope { cursor: default; }
.sound-play { position: absolute; left: 16px; top: 16px; font-size: 18px; padding: 12px 22px; background: var(--tile); }
