/* dsh-widgets showcase — section styles.
   Pages: Widgets Gallery · Design philosophy (slim) · Playground (REAL rail
   grid: 150px cards, 24px gaps) · Create (how-to + requirement form) ·
   Contribute (workflow slim + links). Install/terminal live in hero.css. */

section {
  padding: clamp(3.2rem, 6vw, 5rem) 0;
  scroll-margin-top: calc(var(--nav-top) + 48px);
}

/* ═══ Gallery ═════════════════════════════════════════════════ */
.gallery { background: var(--bg-1); border-block: 1px solid var(--line); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }

.filter {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.filter:hover { color: var(--brand); border-color: var(--brand-line); }
.filter.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.widget-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-card);
  padding: 14px;
  gap: 12px;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.widget-card:hover { transform: translateY(-3px); border-color: var(--brand-line); box-shadow: var(--shadow-1); }
.widget-card.is-hidden { display: none; }

.widget-preview {
  position: relative;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 14px;
  display: flex;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(200px 90px at 88% 0%, var(--brand-soft), transparent),
    linear-gradient(180deg, var(--bg-2), var(--bg-1));
}

.widget-stage-lg { transform-origin: center; }

.w-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2px 10px 5px;
  font-size: 10px;
  color: var(--text-3);
  background: linear-gradient(transparent, color-mix(in srgb, var(--bg-1) 88%, transparent));
  pointer-events: none;
  text-align: right;
}

.widget-body { display: flex; flex-direction: column; gap: 8px; min-height: 0; }

.widget-name-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

.widget-name { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; min-width: 0; }
.widget-name-en { margin-left: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.widget-id { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); white-space: nowrap; }

.widget-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.widget-desc-en { color: var(--text-3); font-size: 12px; }

.widget-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue { border-color: var(--brand-line); color: var(--brand); background: var(--brand-soft); }
.badge-warn { border-color: rgba(245, 158, 11, 0.4); color: var(--warn); background: rgba(245, 158, 11, 0.1); }
.badge-ok { border-color: rgba(34, 197, 94, 0.4); color: var(--ok); background: rgba(34, 197, 94, 0.1); }
.badge-size { font-family: var(--font-mono); font-size: 10.5px; padding: 2px 7px; }

.gallery-empty { padding: 40px; text-align: center; color: var(--text-3); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ═══ Design (philosophy, slim) ════════════════════════════════ */
.design-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }

.design-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--brand-line);
  background: var(--brand-soft);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
}

.design-chip span { font-size: 11px; color: var(--brand); font-weight: 700; }

.good-bad { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.gb-card { margin: 0; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-card); }
.gb-good { border-color: rgba(34, 197, 94, 0.35); }
.gb-bad { border-color: rgba(242, 90, 90, 0.35); }

.gb-card figcaption { font-size: 13px; font-weight: 700; margin-bottom: 12px; color: var(--text-1); display: flex; align-items: center; gap: 8px; }
.gb-good figcaption { color: var(--ok); }
.gb-bad figcaption { color: var(--danger); }
.gb-card figcaption::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.gb-stage {
  min-height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background:
    radial-gradient(200px 90px at 88% 0%, var(--brand-soft), transparent),
    var(--bg-1);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gb-stage .wg-card { box-shadow: var(--dsw-card-shadow); }

.gb-bad-card {
  width: 150px;
  min-height: 150px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: var(--bg-card-solid);
  overflow: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.gb-bad-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gb-clutter { margin-top: auto; display: flex; flex-direction: column; gap: 5px; }
.gb-clutter i { height: 6px; border-radius: 3px; background: var(--line-strong); }

.gb-card p { margin: 12px 0 0; font-size: 12.5px; color: var(--text-3); }

/* ═══ Create (how-to + requirement form) ═══════════════════════ */
.create { background: var(--bg-1); border-block: 1px solid var(--line); }

.pipe-simple {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.pipe-simple li {
  padding: 13px 12px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand-line);
  background: var(--bg-card);
  position: relative;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
}

.pipe-simple li:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand);
  font-size: 14px;
  z-index: 2;
}

.create-lead {
  margin: 0 0 20px;
  color: var(--text-2);
  font-size: 0.98rem;
  max-width: 640px;
}

.create-lead b { color: var(--brand); font-weight: 600; }

.create-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
}

.create-cta .btn { padding: 12px 26px; font-size: 15px; }

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--text-2);
}

.detail-links a { font-weight: 500; }

/* requirement form + spec output (inside Create) */
.req-panel {
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  padding: clamp(20px, 3vw, 30px);
}

.req-panel-title { margin: 0 0 4px; font-size: 17px; }
.req-panel-sub { margin: 0 0 22px; color: var(--text-2); font-size: 13px; max-width: 720px; }

.req-layout { display: grid; grid-template-columns: 1.15fr 1fr; gap: 26px; align-items: start; }

.req-form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-1); }
.req { color: var(--danger); font-weight: 700; font-size: 11px; margin-left: 4px; }
.opt { color: var(--text-3); font-weight: 500; font-size: 11px; margin-left: 4px; }

.field input,
.field select,
.field textarea {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg-card-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea { resize: vertical; min-height: 52px; line-height: 1.55; }

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%2381858c' d='M2 4l4 4 4-4z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.req-actions { display: flex; gap: 10px; margin-top: 4px; }
.req-hint { margin: 0; font-size: 12.5px; color: var(--text-3); }

.req-output {
  position: sticky;
  top: calc(var(--nav-top) + 84px);
  border-radius: var(--radius);
  border: 1px solid var(--brand-line);
  background: var(--bg-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.req-output-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.req-output-head h3 { margin: 0; font-size: 16px; }

.spec-pre {
  margin: 0;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-terminal);
  overflow-x: auto;
  min-height: 280px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #dfe3ec;
  white-space: pre-wrap;
  word-break: break-word;
}

.req-output-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.req-output-actions .btn { padding: 10px 18px; font-size: 14px; }
.req-note { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.55; }

/* ═══ Contribute (slim workflow + links) ══════════════════════ */
.ct-track {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  counter-reset: ct;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.ct-track li {
  counter-increment: ct;
  position: relative;
  padding: 12px 10px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand-line);
  background: var(--bg-card);
}

.ct-track li::before {
  content: counter(ct, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1;
  display: block;
  margin-bottom: 4px;
}

.ct-track li:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand);
  font-size: 14px;
  z-index: 2;
}

.ct-track b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.ct-track span { display: block; color: var(--text-2); font-size: 11.5px; line-height: 1.45; }

.gates { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.gate {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.ct-lead { margin: 0 0 16px; color: var(--text-2); font-size: 0.95rem; max-width: 760px; }
.ct-lead b { color: var(--brand); font-weight: 600; }

.ct-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 30px; }

.ct-card {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-card);
}

.ct-card h3 { font-size: 15px; margin-bottom: 8px; }
.ct-card p { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.ct-card a { font-weight: 600; }

.roadmap { padding: 20px; border-radius: var(--radius); border: 1px dashed var(--line-strong); background: var(--bg-card); }

.roadmap h3 {
  font-size: 15px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.roadmap ul { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }

/* ═══ Responsive ══════════════════════════════════════════════ */
@media (max-width: 1080px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 960px) {
  .good-bad, .req-layout, .ct-cards { grid-template-columns: 1fr; }
  .pipe-simple { grid-template-columns: repeat(3, 1fr); }
  .pipe-simple li:nth-child(3)::after { display: none; }
  .ct-track { grid-template-columns: repeat(3, 1fr); }
  .ct-track li:nth-child(3)::after { display: none; }
  .req-output { position: static; }
}

@media (max-width: 720px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }

  .pipe-simple { grid-template-columns: 1fr; }
  .pipe-simple li:not(:last-child)::after { content: "↓"; right: auto; left: 50%; top: auto; bottom: -13px; transform: translateX(-50%); }

  .ct-track { grid-template-columns: 1fr 1fr; }
  .ct-track li:not(:last-child)::after { display: none; }
}

@media (max-width: 520px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .field-pair { grid-template-columns: 1fr; }
}