/* PlugBits — 類似図面検索デモ「自分の図面で試す」
   /drawing/style.css のトークン (--paper, --ink, --sub, --line, --blue 等) を
   そのまま使い、このファイルにはデモページ固有のパーツだけを書く。 */

.demo-hero { padding-top: 40px; }

.demo-h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 5.4vw, 44px);
  line-height: 1.35;
  color: var(--ink);
  max-width: 16em;
}

@media (max-width: 600px) {
  .demo-h1-br { display: none; }
}

.demo-lead {
  color: var(--sub);
  max-width: 40em;
  margin: 0 0 28px;
}

/* ---------- drop zone ---------- */

.demo-dropzone {
  margin-top: 4px;
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.demo-dropzone:hover,
.demo-dropzone:focus-visible {
  border-color: var(--blue);
}

.demo-dropzone.is-dragging {
  border-color: var(--blue);
  background: var(--blue-tint);
}

.demo-dropzone.is-uploading {
  opacity: 0.6;
  pointer-events: none;
}

.demo-dropzone-label {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
}

.demo-dropzone-sub {
  margin: 0 0 4px;
  font-size: 13.5px;
  color: var(--sub);
  max-width: 34em;
  margin-left: auto;
  margin-right: auto;
}

.demo-dropzone-filetypes {
  margin: 0 0 18px;
  font-size: 12px;
  color: var(--sub);
}

.demo-dropzone-browse {
  display: inline-block;
  padding: 10px 22px;
  border-radius: var(--radius);
  background: var(--blue-btn);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 14px;
}

.demo-dropzone-message {
  margin: 16px 0 0;
  min-height: 1.4em;
  font-size: 14px;
  font-weight: 700;
  color: var(--error);
}

.demo-dropzone-message:empty { display: none; }

/* API未接続時: ドロップ枠の中身をこちらに差し替える */
.demo-dropzone-unavailable-text {
  margin: 0 0 16px;
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--sub);
}

.demo-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

/* ---------- upload progress ---------- */

.demo-progress {
  margin-top: 20px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.demo-progress-label {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.demo-progress-bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--paper-alt);
  overflow: hidden;
}

.demo-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--blue-btn);
  transition: width 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .demo-progress-bar-fill { transition: none; }
}

.demo-progress-file {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--sub);
  font-family: 'Roboto Mono', 'Liberation Mono', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-progress-extra {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--error);
  min-height: 1.2em;
}

.demo-progress-extra:empty { display: none; }

/* ---------- 図面の扱い ---------- */

.demo-handling-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: 40em;
}

.demo-handling-list li {
  position: relative;
  padding-left: 22px;
  font-size: 14.5px;
  color: var(--sub);
  line-height: 1.8;
}

.demo-handling-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--blue);
}

/* ---------- results: query row ---------- */

.demo-query-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0;
}

.demo-query-card {
  width: 96px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 6px;
  cursor: pointer;
  text-align: center;
}

.demo-query-card:hover,
.demo-query-card:focus-visible {
  border-color: var(--blue);
}

.demo-query-card.is-active {
  border-color: var(--blue);
  background: var(--blue-tint);
}

.demo-query-card.is-disabled {
  opacity: 0.5;
  cursor: default;
}

.demo-thumb-img,
.demo-thumb-fallback {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: var(--paper-alt);
  display: block;
}

.demo-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1.4;
  color: var(--sub);
  padding: 4px;
  overflow: hidden;
  word-break: break-all;
}

.demo-query-card-name {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- ranked list (results + sample panel) ---------- */

.demo-ranked-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 560px;
}

.demo-ranked-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.demo-ranked-rank {
  font-family: 'Roboto Mono', 'Liberation Mono', monospace;
  font-weight: 700;
  color: var(--sub);
  width: 2em;
  flex-shrink: 0;
}

.demo-ranked-thumb,
.demo-ranked-thumb-fallback {
  width: 44px;
  height: 33px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--paper-alt);
  flex-shrink: 0;
}

.demo-ranked-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-badge-near {
  font-family: 'Roboto Mono', 'Liberation Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--blue-btn);
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.demo-ranked-item.is-unreadable .demo-ranked-name {
  color: var(--error);
}

.demo-restart-btn {
  margin-top: 24px;
  display: inline-block;
  padding: 10px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
}

.demo-restart-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ---------- samples grid ---------- */

.demo-samples-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 24px;
}

@media (min-width: 720px) {
  .demo-samples-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
  }
}

.demo-sample-item {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  padding: 0;
}

.demo-sample-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--paper-alt);
}

.demo-sample-item:hover,
.demo-sample-item:focus-visible {
  border-color: var(--blue);
}

/* ---------- sample result panel (lightbox) ---------- */

.demo-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 20, 32, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.demo-panel-overlay[hidden] {
  display: none;
}

.demo-panel {
  background: var(--surface);
  border-radius: 8px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
}

.demo-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}

.demo-panel-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--ink);
}

.demo-panel-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--sub);
  cursor: pointer;
  padding: 4px 8px;
}

.demo-panel-close:hover { color: var(--ink); }

/* ---------- kintone CTA ---------- */

.demo-cta-lead { margin: 8px 0 24px; }

.demo-cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
}

.demo-cta-secondary {
  color: var(--blue);
  font-weight: 700;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- 統一紹介文言 ---------- */

.demo-intro-line { padding: 32px 0; }

.demo-intro-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.9;
  color: var(--sub);
  max-width: 44em;
}
