/* Owner: share-image. Component states and responsive rules live here. See AGENTS.md. */

.share-image-dialog {
  width: min(1360px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  overflow: hidden;
  border: 1px solid var(--pencil-strong);
  border-radius: var(--radius-md);
  background: var(--paper-main);
  color: var(--ink-strong);
  box-shadow: var(--shadow-dialog);
  padding: 0;
}

.share-image-dialog::backdrop {
  background: rgba(42, 38, 32, 0.55);
  backdrop-filter: blur(3px);
}

.share-image-panel {
  display: grid;
  max-height: calc(100dvh - 30px);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.share-image-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  background: var(--paper-muted);
  border-bottom: 1px solid var(--pencil-soft);
}

.share-image-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  background: var(--paper-muted);
  border-top: 1px solid var(--pencil-soft);
}

.share-image-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.share-image-header p {
  margin: 0;
}

.share-image-footer p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.share-image-header > div > p:last-child {
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.share-image-preview {
  position: relative;
  min-height: 0;
  overflow: auto;
  background: var(--paper-deep);
  padding: 18px;
}

.share-image-preview canvas {
  display: block;
  width: min(100%, 1280px);
  height: auto;
  margin: auto;
  background: #f7f3e9;
  box-shadow: 0 8px 28px rgba(35, 28, 19, 0.25);
}

.share-image-loading {
  position: absolute;
  inset: 18px;
  display: grid;
  place-items: center;
  background: rgba(247, 243, 233, 0.88);
  color: #25231f;
  font-size: 0.88rem;
  font-weight: 800;
}

.share-image-loading[hidden] {
  display: none;
}

.share-image-footer > div {
  display: flex;
  gap: 8px;
}

@media (max-width: 580px) {
  .share-image-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .share-image-panel {
    max-height: calc(100dvh - 18px);
  }

  .share-image-header {
    padding: 12px;
  }

  .share-image-footer {
    padding: 12px;
    justify-content: flex-end;
  }

  .share-image-header > div > p:last-child,
.share-image-footer > p {
    display: none;
  }
}
