/* The answer's generated files (js/artifact-cards.js): export entries, images and interactive frames.
   Moved out of base.css, shared-components.css and features.css in their
   original cascade order; loaded after features.css and before type.css. */

.data-export-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.data-export-image {
  position: relative;
  margin: 0;
  width: fit-content;
  max-width: min(480px, 100%);
  border-radius: var(--r-2xl);
  overflow: hidden;
}

.data-export-image-preview {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.data-export-image-preview img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(480px, 100%);
  max-height: 480px;
}

/* A loading image has no intrinsic size, and `width: auto` above gives the
   browser nothing to derive a box from, so the figure would collapse and a
   reloaded page would read as an empty answer. The placeholder rebuilds the
   box the clamped image will occupy: the width formula is the same 480px
   and 100% clamps resolved against the ratio, so a portrait picture reserves
   a narrow box rather than a square one. Images published before the size
   was recorded, and SVG, fall back to 3:2. */
/* The width lives on the figure. Asking the button for 100% of a
   `fit-content` figure that is itself sized by the button resolves to zero. */
.data-export-image.is-loading {
  width: min(480px, 100%, calc(480px * var(--image-ratio, 1.5)));
}

.data-export-image.is-loading .data-export-image-preview {
  width: 100%;
  aspect-ratio: var(--image-ratio, 1.5);
  border-radius: var(--r-2xl);
  background: var(--skeleton);
  background-size: 220% 100%;
  animation: subtleSkeleton 1.9s ease-in-out infinite;
  cursor: default;
}

.data-export-image.is-loading .data-export-image-preview img {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .data-export-image.is-loading .data-export-image-preview {
      animation: none;
    }
}
.data-export-image-download {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  background: rgb(0 0 0 / 65%);
  text-decoration: none;
}

.data-export-image-download:hover {
  background: rgb(0 0 0 / 85%);
}

.data-export-image-download svg {
  width: 18px;
  height: 18px;
}

.data-export-image-download:focus-visible,
.data-export-image-preview:focus-visible {
  outline: 3px solid var(--accent, #477a36);
  outline-offset: -3px;
}

/* A generated interactive page takes the answer's full width: it is the
   output itself, not an attachment beside it. */
.data-export-interactive {
  position: relative;
  flex: 1 1 100%;
  min-width: 0;
  margin: 0;
}

.data-export-interactive-frame {
  display: block;
  width: 100%;
  /* Until the page reports its height; see interactive-views.js. */
  height: min(70vh, 640px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: #fff;
}

/* Hidden until its page reports a height; the figure holds the box. */
.data-export-interactive-frame {
  transition: opacity .18s ease;
}

.data-export-interactive-frame[data-view-pending] {
  opacity: 0;
}

.data-export-interactive:has(> .data-export-interactive-frame[data-view-pending]) {
  border-radius: var(--r-xl);
  background: var(--skeleton);
  background-size: 220% 100%;
  animation: subtleSkeleton 1.9s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .data-export-interactive-frame {
      transition: none;
    }

  .data-export-interactive:has(> .data-export-interactive-frame[data-view-pending]) {
      animation: none;
    }
}
.interactive-view-stopped {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  color: var(--muted);
}

.data-export-file {
  appearance: none;
  display: inline-grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(480px, 100%);
  max-width: 100%;
  min-width: 0;
  min-height: 62px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .08s ease;
}

.data-export-entry {
  position: relative;
  display: inline-flex;
  width: min(480px, 100%);
  max-width: 100%;
}

.data-export-entry .data-export-file { width: 100%; padding-right: 50px; }

.data-export-entry.has-secondary-action .data-export-file { padding-right: 82px; }

.data-export-entry-actions {
  position: absolute;
  top: 50%;
  right: 9px;
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity .14s ease;
}

.data-export-entry:hover .data-export-entry-actions,
.data-export-entry:focus-within .data-export-entry-actions {
  opacity: 1;
  pointer-events: auto;
}

.data-export-direct-download,
.data-export-workbook-switch {
  appearance: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-decoration: none;
  letter-spacing: 1px;
  cursor: pointer;
}

.data-export-direct-download svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.data-export-direct-download:hover,
.data-export-workbook-switch:hover { background: var(--hover-bg); color: var(--ink); }

.data-export-direct-download:focus-visible,
.data-export-workbook-switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

@media (hover: none) {
  .data-export-entry-actions { opacity: 1; pointer-events: auto; }
}
.data-export-file:has(.data-export-icon[data-visual-kind="image"]) {
  grid-template-columns: 36px minmax(0, 1fr);
}

.data-export-file .data-export-icon.chat-attachment-icon[data-visual-kind="spreadsheet"] svg {
  width: 31px;
  height: 31px;
}

.data-export-file:hover {
  background: var(--surface-inset);
  border-color: var(--border-card-hover);
  box-shadow: 0 3px 9px rgba(15, 23, 42, .06);
}

.data-export-file:active {
  transform: translateY(1px);
}

.data-export-file:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.data-export-file.is-unavailable {
  cursor: not-allowed;
  opacity: .58;
  filter: grayscale(.35);
}

.data-export-file.is-unavailable:hover {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.data-export-icon.chat-attachment-icon {
  width: 32px;
  height: 32px;
  border-radius: 0;
  background: transparent;
  color: var(--green);
}

.data-export-icon.chat-attachment-icon[data-visual-kind="image"] {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--blue);
  color: var(--on-accent);
}

.data-export-icon.chat-attachment-icon[data-visual-kind="pdf"] {
  color: var(--red);
}

.data-export-icon.chat-attachment-icon[data-visual-kind="document"] { color: var(--blue); }

.data-export-icon.chat-attachment-icon[data-visual-kind="presentation"] { color: var(--presentation); }

.data-export-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.data-export-name {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-export-type {
  color: var(--muted);
  font-size: var(--text-2xs);
  line-height: 15px;
}
