/* Demos catalogue, detail, and staff-panel composition. Foundations live in design-system.css. */

body {
  display: flex;
  flex-direction: column;
  background: var(--color-surface-alt);
}

.demos-header .site-header__inner {
  justify-content: space-between;
}

.demos-main {
  flex: 1 0 auto;
  padding-top: calc(var(--header-height) + 72px);
  padding-bottom: 100px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.catalogue-heading h1,
.catalogue-gate h1,
.detail-card h1,
.admin-heading h1,
.admin-login h1 {
  margin: 0;
  color: var(--color-ink);
  font-size: clamp(42px, 6vw, 56px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.catalogue-gate {
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 56px);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.catalogue-gate__instruction {
  margin: 18px 0 32px;
  color: var(--color-muted);
  line-height: 1.6;
}

.catalogue-access-form .input-row {
  flex-direction: column;
}

.catalogue-access-form input {
  min-height: 52px;
}

.catalogue-access-form button[type="submit"] {
  width: 100%;
}

.catalogue-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border-soft);
}

.catalogue-actions {
  margin: 0;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 30px;
}

.demo-card,
.detail-card,
.admin-login {
  border: 1px solid var(--color-surface-alt);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.demo-card {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  padding: 32px;
}

.admin-editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.badge {
  display: inline-flex;
  width: fit-content;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge.public {
  color: var(--color-success-ink);
  background: var(--color-success-soft);
}

.badge.invite {
  color: var(--color-warning-ink);
  background: var(--color-warning-soft);
}

.demo-card h2 {
  margin: 0 0 18px;
  color: var(--color-ink);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.demo-card > p {
  margin: 0 0 8px;
  line-height: 1.6;
}

.primary-link {
  margin-top: auto;
  padding-top: 28px;
  color: var(--color-accent);
  font-size: 17px;
  font-weight: 500;
  text-decoration: none;
}

.back-link {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--color-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--color-accent);
}

.detail-card {
  padding: clamp(32px, 6vw, 72px);
}

.detail-card h1 {
  max-width: 800px;
}

.descriptions {
  max-width: 730px;
  margin: 36px 0;
  color: var(--color-muted);
  font-size: 17px;
  line-height: 1.65;
}

.launch-link,
.access-form button,
.admin-login button,
.project-form > button,
.code-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 50px;
  padding: 14px 22px;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--color-on-accent);
  background: var(--color-accent);
  font-size: 17px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--motion-standard), box-shadow var(--motion-standard), background-color var(--motion-standard);
}

.launch-link:hover,
.access-form button:hover,
.admin-login button:hover,
.project-form > button:hover,
.code-form button:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-button);
  transform: translateY(-2px);
}

.access-form {
  max-width: 620px;
}

label {
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 600;
}

.input-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.dev-access-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--color-muted);
  font-size: 12px;
}

.access-form .dev-quick-fill,
.admin-login .dev-quick-fill {
  min-height: auto;
  padding: 8px 11px;
  border: 1px dashed var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-soft);
  font-size: 12px;
  box-shadow: none;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-ink);
  background: var(--color-surface);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-accent);
  outline: none;
  box-shadow: var(--shadow-focus);
}

.form-error,
.notice.error {
  color: var(--color-danger);
}

.inline-form {
  display: inline;
  margin-left: 16px;
}

.text-button {
  padding: 8px;
  border: 0;
  color: var(--color-muted);
  background: transparent;
  cursor: pointer;
  text-decoration: underline;
}

.text-button:hover {
  color: var(--color-accent);
}

.admin-login {
  width: min(440px, 100%);
  margin: 2vh auto 6vh;
  padding: 38px;
}

.admin-login h1 {
  margin-bottom: 28px;
  font-size: 42px;
}

.admin-login label {
  display: block;
  margin: 14px 0 7px;
}

.admin-login > form > button {
  width: 100%;
  margin-top: 20px;
}

body.admin-app {
  overflow: hidden;
  background: var(--color-surface-alt);
}

.admin-app .site-header {
  height: 52px;
  background: var(--color-header);
}

.admin-app .site-header__inner {
  max-width: none;
  padding-inline: 14px;
}

.admin-app .site-brand__logo {
  height: 29px;
}

.admin-app .site-nav {
  gap: 24px;
}

.admin-app .site-nav a {
  font-size: 13px;
}

.admin-app .site-nav a[aria-current="page"]::after {
  bottom: -6px;
}

.admin-app .site-footer {
  display: none;
}

.admin-app .admin-main {
  width: 100%;
  max-width: none;
  height: 100vh;
  min-height: 0;
  margin: 0;
  padding: 52px 0 0;
}

.admin-shell {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.admin-toolbar {
  display: flex;
  min-height: 42px;
  flex: 0 0 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.admin-toolbar-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.admin-toolbar h1 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.admin-toolbar-title > span:last-child {
  color: var(--color-muted);
  font-size: 11px;
}

.admin-product-mark {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--color-accent);
}

.admin-toolbar .text-button {
  padding: 4px 6px;
  font-size: 11px;
  text-decoration: none;
}

.admin-workspace {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
}

.admin-sidebar {
  width: 242px;
  min-width: 242px;
  overflow-y: auto;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.admin-sidebar-heading {
  display: flex;
  height: 32px;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 12px;
  color: var(--color-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-sidebar-heading span:last-child {
  color: var(--color-subtle);
  font-variant-numeric: tabular-nums;
}

.admin-project-tabs {
  padding-bottom: 8px;
}

.admin-project-tab {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 52px;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 6px 9px 6px 10px;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--color-ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.admin-project-tab:hover {
  background: var(--color-surface-hover);
}

.admin-project-tab.is-active {
  border-left-color: var(--color-accent);
  background: var(--color-surface-active);
}

.project-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.project-status-dot.public {
  background: var(--color-success-dot);
}

.project-status-dot.invite {
  background: var(--color-warning-dot);
}

.project-tab-copy {
  display: block;
  min-width: 0;
}

.project-tab-copy strong,
.project-tab-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-tab-copy strong {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.project-tab-copy span {
  margin-top: 1px;
  color: var(--color-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
  line-height: 1.3;
}

.project-tab-meta {
  color: var(--color-subtle);
  font-size: 9px;
  line-height: 1.35;
  text-align: right;
  white-space: nowrap;
}

.admin-editor {
  min-width: 0;
  overflow-y: auto;
  flex: 1 1 auto;
  padding: 14px 18px 24px;
  background: var(--color-surface);
}

.admin-project-panel {
  width: min(100%, 1080px);
  margin: 0 auto;
}

.admin-project-panel[hidden] {
  display: none;
}

.admin-editor-heading {
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.admin-editor-heading p {
  margin: 0 0 2px;
  color: var(--color-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  line-height: 1.3;
}

.admin-editor-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.admin-editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-editor-actions .badge {
  padding: 3px 7px;
  font-size: 9px;
}

.admin-editor-actions a {
  color: var(--color-accent);
  font-size: 11px;
  text-decoration: none;
}

.admin-editor-actions a:hover {
  text-decoration: underline;
}

.admin-project-panel .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 12px 0 10px;
}

.admin-project-panel .form-grid label,
.admin-project-panel .code-form label {
  display: grid;
  gap: 3px;
  color: var(--color-muted);
  font-size: 10px;
  font-weight: 600;
}

.admin-project-panel input,
.admin-project-panel textarea,
.admin-project-panel select {
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.35;
}

.admin-project-panel textarea {
  min-height: 52px;
}

.admin-project-panel .checks {
  display: flex;
  flex-direction: row;
  align-items: center;
  align-self: end;
  gap: 14px;
  min-height: 30px;
}

.admin-project-panel .checks label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.admin-project-panel .checks input {
  width: auto;
  min-height: auto;
}

.admin-project-panel .project-form > button,
.admin-project-panel .code-form > button {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1.2;
  box-shadow: none;
  transform: none;
}

.admin-project-panel .project-form > button:hover,
.admin-project-panel .code-form > button:hover {
  box-shadow: none;
  transform: none;
}

.admin-project-panel .codes {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.admin-project-panel .codes h3 {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.3;
}

.admin-project-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.admin-project-panel th,
.admin-project-panel td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.admin-project-panel th {
  color: var(--color-muted);
  font-size: 10px;
  font-weight: 600;
}

.small-button {
  padding: 3px 6px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-surface);
  font-size: 10px;
  cursor: pointer;
}

.small-button.danger {
  color: var(--color-danger);
}

.admin-project-panel .code-form {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(150px, 1fr) minmax(120px, 0.8fr) auto;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
}

.created-code {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 1080px);
  margin: 0 auto 12px;
  padding: 8px 10px;
  border-radius: 3px;
  color: var(--color-inverse-ink);
  background: var(--color-inverse-surface);
  flex-wrap: wrap;
  font-size: 11px;
}

.created-code code {
  padding: 4px 7px;
  border-radius: 3px;
  background: var(--color-inverse-soft);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.created-code span {
  color: var(--color-inverse-muted);
  font-size: 10px;
}

.empty-state {
  padding: 45px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-card);
  color: var(--color-muted);
  background: var(--color-surface);
  text-align: center;
}

@media (max-width: 860px) {
  .admin-project-panel .code-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .demos-header .site-nav__optional {
    display: none;
  }

  .demos-main {
    padding-top: calc(var(--header-height) + 44px);
    padding-bottom: 72px;
  }

  body.admin-app {
    overflow: auto;
  }

  .admin-app .admin-main {
    height: auto;
    min-height: 100vh;
    padding: 52px 0 0;
  }

  .admin-shell {
    min-height: calc(100vh - 52px);
  }

  .admin-workspace {
    display: block;
  }

  .admin-sidebar {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .admin-sidebar-heading {
    height: 28px;
  }

  .admin-project-tabs {
    display: flex;
    width: max-content;
    padding-bottom: 0;
  }

  .admin-project-tab {
    width: 210px;
    border-bottom: 2px solid transparent;
    border-left: 0;
  }

  .admin-project-tab.is-active {
    border-bottom-color: var(--color-accent);
  }

  .admin-editor {
    overflow: visible;
    padding: 12px;
  }

  .catalogue-heading h1,
  .catalogue-gate h1,
  .detail-card h1,
  .admin-heading h1,
  .admin-login h1 {
    font-size: 36px;
  }

  .demo-grid,
  .form-grid,
  .code-form {
    grid-template-columns: 1fr;
  }

  .admin-project-panel .form-grid,
  .admin-project-panel .code-form {
    grid-template-columns: 1fr;
  }

  .demo-grid {
    gap: 20px;
  }

  .demo-card {
    min-height: 0;
    padding: 24px;
  }

  .demo-card h2 {
    font-size: 24px;
  }

  .input-row {
    flex-direction: column;
  }

  .inline-form {
    display: block;
    margin: 16px 0 0;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .demos-header .site-brand__logo {
    height: 28px;
  }

  .detail-card,
  .admin-login {
    padding: 24px;
  }

  .catalogue-gate {
    padding: 32px 24px;
  }

  .catalogue-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 24px;
  }

  .admin-heading,
  .admin-project-heading,
  .admin-editor-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
