:root {
  color-scheme: light;
  --bg-start: #f6efe6;
  --bg-end: #e2d8cb;
  --ink: #2b2520;
  --ink-muted: #6c5d50;
  /*
   * Demo-page chrome only, and deep enough for white labels to clear 4.5:1.
   *
   * Deliberately NOT named `--accent`: custom properties inherit through the
   * shadow boundary, so a host declaring `--accent` overrides every embedded
   * viewer's own theme accent — which meant the demos painted all five themes
   * the same orange.
   */
  --demo-accent: #b4551f;
  --demo-accent-dark: #8b3f1f;
  --panel: rgba(255, 255, 255, 0.72);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, var(--bg-start), var(--bg-end));
  color: var(--ink);
}

.page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  padding: clamp(20px, 4vw, 56px);
  box-sizing: border-box;
}

.hero {
  display: grid;
  gap: 12px;
  max-width: 720px;
}

.hero__title {
  font-size: clamp(32px, 6vw, 54px);
  font-weight: 700;
  line-height: 1.05;
}

.hero__subtitle {
  margin: 0;
  font-size: 16px;
  color: var(--ink-muted);
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(43, 37, 32, 0.08);
}

.viewer-actions__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid rgba(43, 37, 32, 0.12);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  background: linear-gradient(140deg, var(--demo-accent), #cf6835);
  color: #fffaf6;
  box-shadow: 0 10px 16px rgba(139, 63, 31, 0.18);
}

.viewer-actions__link:hover {
  background: linear-gradient(140deg, var(--demo-accent-dark), #713018);
}

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

.viewer-shell mango-annotation-editor {
  display: block;
  flex: 0 0 auto;
  min-height: 0;
  width: 100%;
  --viewer-frame-shadow: none;
}

@media (max-width: 700px) {
  .viewer-shell {
    min-height: auto;
  }

  .viewer-actions__link {
    width: 100%;
  }
}

.page--editor {
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding-block: 20px;
}

.breadcrumbs {
  display: flex;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-muted);
}

.breadcrumbs a {
  color: var(--demo-accent-dark);
}

.notice {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--panel);
  font-size: 14px;
  color: var(--ink-muted);
}

.page--editor mango-annotation-editor {
  --mango-viewer-height: min(820px, calc(100vh - 140px));
}

.catalogue {
  display: grid;
  gap: 20px;
  max-width: 1080px;
}

.catalogue__form {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.catalogue__form div {
  display: flex;
  gap: 8px;
}

.catalogue__form input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(43, 37, 32, 0.2);
  border-radius: 10px;
  font: inherit;
  font-weight: 400;
}

.catalogue__form button {
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--demo-accent);
  color: #fffaf6;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.catalogue__items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.catalogue__item a {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(43, 37, 32, 0.08);
  color: inherit;
  text-decoration: none;
}

.catalogue__item a:hover {
  box-shadow: inset 0 0 0 2px var(--demo-accent);
}

.catalogue__item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.catalogue__item div {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.catalogue__item span {
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.catalogue__item p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
}
