/* ==========================================================================
   Schema Markup Generator (JSON-LD) — tool page only (/tools/schema-markup-generator/)
   Uses the design tokens from main.css, so both themes work automatically.
   ========================================================================== */

.sg [hidden] { display: none !important; }

.sg .textarea.sg-mono { min-height: 170px; font: 0.84rem/1.6 var(--font-mono); white-space: pre; tab-size: 2; }
.sg-foot { margin: 0; padding-top: 1rem; border-top: 1px solid var(--border); line-height: 1.55; }

/* Import panel */
.sg-import {
  display: flex; flex-direction: column; gap: 0.85rem;
  padding: 1rem;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: var(--radius);
  background: var(--surface);
}
.sg-import-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.sg-import-report { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.sg-import-report:empty { display: none; }
.sg-import-ok { display: flex; gap: 0.5rem; margin: 0; color: var(--success-text); font-size: 0.9rem; line-height: 1.5; }
.sg-import-ok .icon { flex: none; width: 18px; height: 18px; margin-top: 0.1rem; color: var(--success); }
.sg-import-note { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }

/* Type picker + note */
.sg-types .segmented-options { gap: 0.35rem; }
.sg-types label { padding: 0.45rem 0.8rem; font-size: 0.84rem; }
.sg-note {
  display: flex; gap: 0.55rem;
  margin: -0.25rem 0 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.07);
  color: var(--text-2);
  font-size: 0.86rem;
  line-height: 1.55;
}
.sg-note .icon { flex: none; width: 18px; height: 18px; margin-top: 0.1rem; color: var(--lilac); }
.sg-note.is-caution { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); color: var(--warn-text); }
.sg-note.is-caution .icon { color: var(--warn-text); }

/* Form */
.sg-form { display: flex; flex-direction: column; gap: 1.25rem; }
.sg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem 0.85rem; align-items: start; }
.sg-field { grid-column: 1 / -1; }
.sg-field.is-half { grid-column: auto; }
@media (max-width: 520px) { .sg-field.is-half { grid-column: 1 / -1; } }
.sg .field-label { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.45rem; }
.sg .input, .sg .select { min-height: 44px; padding-top: 0.6rem; padding-bottom: 0.6rem; font-size: 0.93rem; }
.sg-ta { min-height: 0; font-size: 0.93rem; }
.sg-ta.is-lines { white-space: pre; overflow-wrap: normal; overflow-x: auto; }

.sg-badge {
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
}
.sg-badge.is-req { background: rgba(251, 113, 133, 0.14); color: var(--danger-text); }
.sg-badge.is-rec { background: rgba(139, 92, 246, 0.14); color: var(--lilac); }

.sg-unit { display: flex; align-items: center; gap: 0.5rem; }
.sg-unit .input { flex: 1; min-width: 0; }
.sg-unit span { color: var(--muted); font-size: 0.86rem; }

.sg-dt { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.1fr); gap: 0.5rem; }
@media (max-width: 520px) {
  .sg-dt { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sg-dt .select { grid-column: 1 / -1; }
}

.sg-days { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sg-day { position: relative; cursor: pointer; }
.sg-day input { position: absolute; opacity: 0; pointer-events: none; }
.sg-day span {
  display: inline-grid; place-items: center;
  min-width: 3.1rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.84rem;
  font-weight: 600;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.sg-day abbr { text-decoration: none; }
.sg-day:hover span { color: var(--text); border-color: rgba(var(--ink), 0.24); }
.sg-day input:checked + span { color: var(--on-soft); background: var(--grad-soft); border-color: rgba(139, 92, 246, 0.6); }
.sg-day input:focus-visible + span { outline: 2px solid var(--lilac); outline-offset: 2px; }

.sg-sec, .sg-rep { min-width: 0; margin: 0; padding: 1rem; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface); }
.sg-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; padding: 0 0.4rem; color: var(--text); font: 600 0.95rem/1.3 var(--font-display); }
.sg-sec .sg-grid { margin-top: 0.35rem; }
.sg-rep { display: flex; flex-direction: column; gap: 0.85rem; }
.sg-rep-hint { margin: 0; line-height: 1.5; }
.sg-rep-list { display: flex; flex-direction: column; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.sg-rep-item { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.85rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.sg-rep-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.sg-rep-title { color: var(--lilac); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.sg-rep-tools { display: flex; gap: 0.3rem; }
.sg-rep-tools .icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; }
.sg-rep-tools .icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.sg-rep-tools .icon-btn:disabled:hover { color: var(--text-2); border-color: var(--border-2); background: var(--surface-2); }
.sg-rep-add { align-self: flex-start; }
.sg-rep-add .icon { width: 16px; height: 16px; }
@media (max-width: 520px) {
  .sg-sec, .sg-rep { padding: 0.8rem; }
  .sg-rep-item { padding: 0.7rem; }
}

/* Output */
.sg-sticky { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 961px) {
  /* "clip" (unlike "hidden") lets the output column stick while the form scrolls. */
  .workspace.sg { overflow: clip; }
  .sg-sticky { position: sticky; top: calc(var(--nav-h) + 16px); }
  .sg-code { max-height: min(52vh, 560px); }
  .sg-checks .check-list { max-height: 9.5rem; overflow-y: auto; padding-right: 0.25rem; }
}
.sg-checks { display: flex; flex-direction: column; gap: 0.7rem; }
.sg-status {
  display: flex; align-items: flex-start; gap: 0.6rem;
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
}
.sg-status .icon { flex: none; width: 18px; height: 18px; margin-top: 0.1rem; stroke-width: 2.4; }
.sg-status strong { color: inherit; }
.sg-status.is-bad { border: 1px solid rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.1); color: var(--danger-text); }
.sg-status.is-warn { border: 1px solid rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.08); color: var(--warn-text); }
.sg-status.is-good { border: 1px solid rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.08); color: var(--success-text); }
.sg .check-item { font-size: 0.86rem; overflow-wrap: anywhere; }
.sg .check-item.is-info .check-dot { background: rgba(139, 92, 246, 0.15); color: var(--lilac); }

.sg-code { min-height: 200px; font-size: 0.8rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.sg-key { color: var(--code-f); }
.sg-str { color: var(--code-s); }
.sg-num { color: #f59e0b; }
.sg-lit { color: var(--pink); }
.sg-tag { color: var(--code-k); }
:root[data-theme="light"] .sg-num { color: #b45309; }
:root[data-theme="light"] .sg-lit { color: #be185d; }
:root[data-theme="light"] .sg-str { color: #047857; }
:root[data-theme="light"] .sg-key { color: #0369a1; }

.sg-out-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: -0.5rem; }
.sg-where { margin: 0; line-height: 1.55; }
.sg-where code { font: 0.78rem var(--font-mono); color: var(--text-2); }
.sg-test { display: flex; flex-direction: column; gap: 0.6rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.sg-test-title { margin: 0; color: var(--text); font-size: 0.9rem; font-weight: 600; }
.sg-test-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sg-test-links .btn { white-space: normal; text-align: center; }
.sg-test .field-hint { margin: 0; line-height: 1.55; }
