/* ArgilCAD gallery — the gallery page, model pages and the homepage
   showcase. Built on the tokens in /styles.css; nothing here overrides them. */

/* ----- Gallery page ----- */
.g-head { padding-top: clamp(40px, 6vw, 72px); padding-bottom: 28px; }
.g-head .eyebrow { margin-bottom: 16px; }
.g-head h1 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); margin-bottom: 14px; }
.g-head .lead { font-size: 1.05rem; }

.g-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 28px; }
.g-chip {
  font: 500 13.5px var(--font); color: var(--text-muted); cursor: pointer;
  padding: 7px 14px; border-radius: 999px; background: transparent;
  border: 1px solid var(--border); transition: color .2s, border-color .2s, background .2s;
}
.g-chip:hover { color: var(--text); border-color: var(--border-strong); }
.g-chip[aria-pressed="true"] { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }

.g-grid { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); padding-bottom: 72px; }
@media (max-width: 960px) { .g-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .g-grid { grid-template-columns: 1fr; } }

.g-card {
  display: block; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.g-card:hover, .g-card:focus-visible { border-color: var(--border-strong); transform: translateY(-2px); }
.g-shot { aspect-ratio: 4 / 3; background: var(--surface-2); position: relative; }
.g-shot img { width: 100%; height: 100%; object-fit: contain; }
.g-body { padding: 14px 16px 16px; }
.g-body h2, .g-body h3 { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 4px; }
.g-meta { font-size: 13.5px; color: var(--text-dim); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.g-badge {
  position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px;
  font: 500 11.5px var(--mono); letter-spacing: .02em; color: var(--text-muted);
  background: color-mix(in srgb, var(--bg) 70%, transparent); border: 1px solid var(--border);
  padding: 4px 9px; border-radius: 999px;
}
.g-badge svg { width: 11px; height: 11px; }
.g-empty { color: var(--text-dim); padding: 24px 0 72px; }

.g-repo-note { border-top: 1px solid var(--border); padding: 22px 0 64px; color: var(--text-dim); font-size: 14.5px; }
.g-repo-note a { color: var(--text-muted); border-bottom: 1px solid var(--border-strong); }

/* ----- Model page ----- */
.m-crumb { padding-top: 28px; font-size: 14px; color: var(--text-dim); }
.m-crumb a { color: var(--text-muted); }
.m-crumb a:hover { color: var(--text); }
.m-top { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 32px; padding: 18px 0 40px; align-items: start; }
@media (max-width: 900px) { .m-top { grid-template-columns: 1fr; } }

.m-viewer { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.m-viewer model-viewer { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; --poster-color: transparent; background: transparent; }
.m-tools { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.m-tool {
  font: 500 13px var(--font); color: var(--text-muted); background: transparent; cursor: pointer;
  border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; display: inline-flex; align-items: center; gap: 6px;
}
.m-tool:hover { color: var(--text); background: var(--surface-2); }
.m-tool[aria-pressed="true"] { color: var(--text); border-color: var(--border); background: var(--surface-2); }
.m-tool svg { width: 15px; height: 15px; }
.m-tools .sep { flex: 1; }
.m-play { color: var(--accent); border-color: var(--border); }
.m-play .i-pause { display: none; }
.m-play[aria-pressed="true"] .i-play { display: none; }
.m-play[aria-pressed="true"] .i-pause { display: inline; }

.m-info h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); margin-bottom: 12px; }
.m-sum { color: var(--text-muted); margin-bottom: 22px; }
.m-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

.m-needs {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 26px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  padding: 12px 14px; font-size: 14px; color: var(--text-muted);
}
.m-needs > svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--accent); }
.m-needs b { color: var(--text); font-weight: 560; }
.m-needs ol { margin: 6px 0 0 18px; }
.m-needs li { margin: 2px 0; }

.m-specs { border-top: 1px solid var(--border); }
.m-specs div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.m-specs dt { color: var(--text-dim); }
.m-specs dd { color: var(--text); text-align: right; }
.m-specs a { border-bottom: 1px solid var(--border-strong); }

.m-section { padding-bottom: 36px; }
.m-section h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 12px; display: flex; align-items: baseline; gap: 12px; }
.m-section h2 .sub { font: 400 13px var(--mono); color: var(--text-dim); letter-spacing: 0; }

.m-code { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2); position: relative; overflow: hidden; }
.m-code pre { font: 13px/1.6 var(--mono); padding: 16px 18px; overflow-x: auto; color: var(--text-muted); tab-size: 4; }
.m-code.collapsed pre { max-height: 300px; overflow: hidden; }
.m-code.collapsed::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; pointer-events: none;
  background: linear-gradient(transparent, var(--bg-2));
}
.m-code .tc { color: var(--text-dim); }
.m-code .ts { color: var(--accent); }
.m-code .tk { color: var(--text); font-weight: 500; }
.m-code-bar { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.m-params { width: 100%; border-collapse: collapse; font-size: 14px; }
.m-params th, .m-params td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.m-params th { color: var(--text-dim); font-weight: 500; font-size: 13px; }
.m-params code { font-family: var(--mono); font-size: 13px; color: var(--text); }
@media (max-width: 600px) { .m-params { font-size: 13px; } .m-params th, .m-params td { padding: 8px 6px; } }

.m-license { font-size: 13.5px; color: var(--text-dim); padding: 4px 0 32px; }
.m-license a { color: var(--text-muted); border-bottom: 1px solid var(--border-strong); }

/* ----- Homepage showcase ----- */
.h-show { padding-block: clamp(36px, 5vw, 64px) clamp(56px, 7vw, 96px); }
.h-show .sec-head { margin-bottom: 28px; }
.h-box { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.h-stage { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 900px) { .h-stage { grid-template-columns: 1fr; } }
.h-view { position: relative; background: var(--surface-2); min-height: 420px; }
@media (max-width: 600px) { .h-view { min-height: 300px; } }
.h-view model-viewer { position: absolute; inset: 0; width: 100%; height: 100%; --poster-color: transparent; background: transparent; }
.h-hint {
  position: absolute; left: 14px; bottom: 12px; font: 500 12px var(--mono); color: var(--text-dim);
  display: inline-flex; gap: 6px; align-items: center; pointer-events: none;
}
.h-hint svg { width: 14px; height: 14px; }
.h-view .m-play { position: absolute; right: 12px; bottom: 10px; background: var(--surface); }
.h-side { padding: 26px 26px 22px; display: flex; flex-direction: column; gap: 12px; border-left: 1px solid var(--border); }
@media (max-width: 900px) { .h-side { border-left: 0; border-top: 1px solid var(--border); } }
.h-side h3 { font-size: 1.4rem; letter-spacing: -0.02em; }
.h-side p { color: var(--text-muted); font-size: 15px; }
.h-meta { font-size: 13.5px; color: var(--text-dim); }
.h-acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.h-strip { display: flex; gap: 10px; overflow-x: auto; padding: 12px; border-top: 1px solid var(--border); background: var(--bg-2); scrollbar-width: thin; }
.h-thumb {
  flex: none; width: 128px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
  cursor: pointer; overflow: hidden; text-align: left; color: var(--text-muted); font: 500 12px var(--font); padding: 0;
  transition: border-color .2s;
}
.h-thumb:hover { border-color: var(--border-strong); }
.h-thumb[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.h-thumb img { width: 100%; height: 88px; object-fit: contain; }
.h-thumb span { display: block; padding: 6px 8px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-thumb.all { display: grid; place-items: center; text-align: center; color: var(--accent); padding: 10px; min-height: 120px; }

/* ----- Toast ----- */
.g-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 12px 16px; font-size: 14.5px; box-shadow: var(--shadow); transition: opacity .3s var(--ease), transform .3s var(--ease);
  max-width: min(92vw, 560px); z-index: 80;
}
.g-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* `hidden` must win over the display rules above (the filter hides cards,
   a model without motion hides its play button). */
.g-card[hidden], .m-tool[hidden], .h-view .m-play[hidden] { display: none; }
