/* The live demo on the landing page: Diffline's real review page (dist/demo/) in an editor-like window.
   Uses the site's tokens from styles.css. The page inside the frame brings its own styles. */

.demo-window {
  margin: 0;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--sheet);
  box-shadow: var(--shadow-2);
}

.demo-window-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--sheet-2);
  color: var(--ink-3);
  font-size: 12px;
}

.demo-traffic {
  display: flex;
  gap: 7px;
}

.demo-traffic i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff6f68;
}

.demo-traffic i:nth-child(2) { background: #f5c65b; }
.demo-traffic i:nth-child(3) { background: #69ce78; }

.demo-window-title {
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-open {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-weight: 560;
  white-space: nowrap;
}

.demo-open svg,
.demo-try svg,
.demo-caption svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.demo-viewport {
  position: relative;
  overflow: hidden;
  background: var(--ground);
}

.demo-viewport iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--ground);
}

/* Hero: a preview of the page at desktop width, scaled to fit (app.js sets --demo-scale and --demo-width). */

.demo-hero .demo-viewport {
  height: clamp(380px, 54vw, 740px);
}

.demo-hero .demo-viewport iframe {
  width: var(--demo-width, 100%);
  height: calc(100% / var(--demo-scale, 1));
  transform: scale(var(--demo-scale, 1));
  transform-origin: 0 0;
  pointer-events: none;
}

.demo-hero .demo-viewport::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 150px;
  background: linear-gradient(to bottom, transparent, var(--sheet) 72%);
  pointer-events: none;
}

.demo-try {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--blue);
  color: var(--on-blue);
  font-size: 15px;
  font-weight: 620;
  white-space: nowrap;
  box-shadow: var(--shadow-2);
  transition: background-color .15s, transform .15s;
}

.demo-try:hover {
  background: var(--blue-2);
  transform: translateX(-50%) translateY(-1px);
}

.demo-caption {
  margin-top: 14px;
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
}

.demo-caption a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  color: var(--blue);
  font-weight: 560;
}

/* Examples: the page itself, to click through, with tabs that switch its view. */

.demo-tabs {
  display: flex;
  gap: 6px;
  margin-top: 35px;
  padding: 0 35px;
  overflow-x: auto;
  scrollbar-width: none;
}

.demo-tabs button {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--sheet);
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  font-weight: 560;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}

.demo-tabs button:hover {
  border-color: var(--line-2);
  color: var(--ink);
}

.demo-tabs button[aria-selected=true] {
  background: var(--blue-soft);
  border-color: var(--blue-line);
  color: var(--blue);
}

.demo-tab-note {
  min-height: 1.5em;
  margin: 14px 0 18px;
  padding: 0 35px;
  color: var(--ink-2);
  font-size: 15px;
}

.demo-live .demo-viewport {
  height: clamp(560px, 82vh, 880px);
}

@media (max-width: 760px) {
  .demo-window-bar { grid-template-columns: auto 1fr auto; font-size: 11px; height: 34px; }
  .demo-window-title { text-align: center; }
  .demo-hero .demo-viewport { height: 520px; }
  .demo-hero .demo-viewport::after { height: 130px; }
  .demo-try { bottom: 20px; font-size: 14px; padding: 11px 18px; }
  .demo-tabs { margin-top: 28px; padding: 0; }
  .demo-tabs button { font-size: 13px; padding: 7px 13px; }
  .demo-tab-note { padding: 0; font-size: 14px; }
  .demo-live .demo-viewport { height: 600px; }
}

@media (max-width: 420px) {
  .demo-open span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-try, .demo-tabs button { transition: none; }
}
