/* Edit inline (how-it-works.html #edit-inline).
   An example animation: only the outer .home-media frame follows the contract.
   Everything inside (the acme.com site and the Grum extension mock) copies the
   real extension and can use any value. See AGENTS.md "Homepage example animations".
   The stage is drawn at 960 x 534 and scaled to the frame by home-edit-inline.js. */

.home-media.ei-media {
  position: relative;
  height: auto;
  aspect-ratio: 960 / 534;
  overflow: hidden;
}

.ei-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 960px;
  height: 534px;
  transform: scale(var(--ei-s, 1));
  transform-origin: 0 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-on-base);
  transition: opacity 0.5s ease;
  /* Raised surfaces for cards and the extension's panels, on the site's dark base */
  --ei-surface: color-mix(in srgb, var(--text-on-base) 6%, var(--base-background));
}

.ei-media[data-fade] .ei-stage {
  opacity: 0;
}

.ei-stage svg {
  display: block;
  flex: none;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- browser window ---------- */
.ei-win {
  position: absolute;
  top: 32px;
  left: 32px;
  width: 896px;
  height: 503px;
  overflow: hidden;
  border: 1px solid var(--fade-20);
  border-radius: 12px 12px 0 0;
  background: var(--base-background);
  box-shadow: var(--shadow-modal-base);
}

.ei-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  background: var(--code-background);
}

.ei-bar > i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--error-base);
}

.ei-bar > i:nth-child(2) {
  background: var(--yellow-base);
}

.ei-bar > i:nth-child(3) {
  background: var(--green-base);
}

.ei-url {
  width: 340px;
  margin-left: 14px;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--fade-10);
  color: var(--text-warm);
  font-size: 11px;
  line-height: 16px;
}

.ei-view {
  position: absolute;
  inset: 32px 0 0;
  overflow: hidden;
}

/* ---------- the example site ---------- */
.ei-site {
  position: absolute;
  inset: 0;
  padding: 0 36px;
}

.ei-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 52px;
  border-bottom: 1px solid var(--fade-10);
  color: var(--text-warm);
}

.ei-logo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-on-base);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ei-logo i {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--primary-base), var(--primary-pink));
}

.ei-links {
  display: flex;
  gap: 20px;
}

.ei-signin {
  margin-left: auto;
}

.ei-hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 460px;
  padding-top: 40px;
}

.ei-eyebrow {
  color: var(--primary-pink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ei-h {
  font-size: 32px;
  font-weight: 700;
  line-height: 38px;
  letter-spacing: -0.02em;
}

.ei-p {
  color: var(--text-warm);
  font-size: 15px;
  line-height: 22px;
}

.ei-cta-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 10px;
}

/* The off-contract button: purple, square, odd padding. The editor swaps the first two. */
.ei-cta,
.ei-choose.ei-off {
  padding: 13px 22px;
  border-radius: 0;
  background: var(--variant-base);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  transition:
    background-color 0.5s ease,
    border-radius 0.5s ease;
}

.ei-media[data-bg] .ei-cta {
  background: var(--primary-base);
}

.ei-media[data-radius] .ei-cta {
  border-radius: 8px;
}

.ei-ghost {
  color: var(--text-on-base);
  font-weight: 600;
}

.ei-cards {
  display: flex;
  gap: 16px;
  margin-top: 44px;
}

.ei-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 168px;
  padding: 16px;
  border: 1px solid var(--fade-10);
  border-radius: 8px;
  background: var(--ei-surface);
}

.ei-card > i {
  height: 7px;
  border-radius: 4px;
  background: var(--fade-10);
}

.ei-card > i + i {
  width: 70%;
}

.ei-price {
  font-size: 22px;
  font-weight: 700;
  line-height: 28px;
}

.ei-choose {
  align-self: flex-start;
  margin-top: 6px;
  padding: 7px 14px;
  border: 1px solid var(--fade-20);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

.ei-choose.ei-off {
  padding: 7px 14px;
  border-color: var(--variant-base);
  font-size: 12px;
  line-height: 16px;
}

/* ---------- the extension overlay ---------- */
.ei-contour,
.ei-outline {
  position: absolute;
  pointer-events: none;
  border: 2.5px solid var(--primary-base);
  border-radius: 4px;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.ei-media[data-marks] .ei-contour {
  opacity: 1;
}

.ei-media[data-hot] .ei-contour {
  border-color: var(--yellow-base);
  background: color-mix(in srgb, var(--yellow-base) 18%, transparent);
}

.ei-outline {
  border-width: 2px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--base-background);
}

.ei-media[data-editing] .ei-contour {
  opacity: 0;
}

.ei-media[data-editing] .ei-outline {
  opacity: 1;
}

/* Shared extension card look */
.ei-label,
.ei-tray,
.ei-panel,
.ei-tab,
.ei-menu {
  position: absolute;
  border: 1px solid var(--fade-20);
  background: var(--ei-surface);
  color: var(--text-on-base);
  box-shadow: var(--shadow-modal-base);
}

.ei-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--fade-20);
  border-radius: 10px;
  background: var(--ei-surface);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  transition:
    transform 0.12s ease,
    background-color 0.2s ease;
}

.ei-btn.ei-primary {
  border-color: var(--primary-base);
  background: var(--primary-base);
  color: var(--white);
}

.ei-press {
  transform: scale(0.94);
}

.ei-label {
  width: 280px;
  padding: 8px 12px 12px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.ei-media[data-label] .ei-label {
  opacity: 1;
  transform: none;
}

.ei-label-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
}

.ei-label-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.ei-label-meta svg {
  color: var(--primary-base);
}

.ei-edit svg {
  color: var(--text-warm);
}

.ei-label-title {
  display: block;
  margin-top: 2px;
  font-weight: 600;
}

/* Collapsed tab on the right edge */
.ei-tab {
  right: -1px;
  bottom: 70px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px 7px 9px;
  border-radius: 10px 0 0 10px;
  font-weight: 600;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ei-tab img,
.ei-tray-head img {
  width: 18px;
  height: 18px;
}

.ei-media[data-tray] .ei-tab,
.ei-media[data-editing] .ei-tab {
  transform: translateX(110%);
}

/* Issues tray */
.ei-tray {
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  width: 300px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--ei-surface) 94%, transparent);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateX(calc(100% + 16px));
  transition:
    transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.3s ease;
}

.ei-media[data-tray] .ei-tray {
  opacity: 1;
  transform: none;
}

.ei-tray-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--fade-10);
}

.ei-tray-head b {
  font-weight: 600;
}

.ei-count {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--fade-primary);
  color: var(--primary-pink);
  font-size: 12px;
  font-weight: 600;
}

.ei-tray-head svg:first-of-type {
  margin-left: auto;
}

.ei-tray-head svg,
.ei-tray-foot svg {
  color: var(--text-warm);
}

.ei-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  column-gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--fade-10);
  transition: background-color 0.2s ease;
}

.ei-row svg {
  margin-top: 2px;
  color: var(--primary-base);
}

.ei-row small {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
}

.ei-row.ei-hover {
  background: var(--fade-10);
}

.ei-tray-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

/* Element editor: Properties panel */
.ei-panel {
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 300px;
  border-width: 0 0 0 1px;
  transform: translateX(105%);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ei-media[data-editing] .ei-panel {
  transform: none;
}

.ei-phead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--fade-10);
}

.ei-phead b {
  font-size: 14px;
  font-weight: 600;
}

.ei-badge {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--fade-10);
  color: var(--text-warm);
  font-size: 12px;
}

.ei-bare {
  color: var(--text-tertiary);
  font-size: 12px;
}

.ei-sub {
  padding: 6px 12px;
  border-bottom: 1px solid var(--fade-10);
  color: var(--text-warm);
}

.ei-actions {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--fade-10);
}

.ei-gname {
  padding: 5px 12px;
  background: var(--fade-10);
  color: var(--text-warm);
  font-size: 12px;
  font-weight: 600;
}

.ei-field {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  row-gap: 5px;
  padding: 5px 12px;
}

.ei-flabel {
  color: var(--text-warm);
}

.ei-ctl {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ei-sw {
  flex: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--fade-20);
  border-radius: 4px;
  background: var(--variant-base);
  transition: background-color 0.4s ease;
}

.ei-media[data-bg] [data-ei="bg-sw"] {
  background: var(--primary-base);
}

.ei-input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--fade-20);
  border-radius: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}

.ei-select {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  border: 1px solid var(--fade-20);
  border-radius: 10px;
  color: var(--text-warm);
  font-size: 12px;
  transition: border-color 0.2s ease;
}

.ei-select.ei-open {
  border-color: var(--primary-base);
}

.ei-select.ei-set {
  color: var(--text-on-base);
}

.ei-tnote {
  grid-column: 2;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 14px;
  white-space: nowrap;
}

.ei-tnote:empty {
  display: none;
}

.ei-menu {
  top: calc(100% - 4px);
  left: 88px;
  right: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: 4px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.ei-menu.ei-open {
  opacity: 1;
  transform: none;
}

.ei-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}

.ei-opt.ei-hover {
  background: var(--fade-10);
}

.ei-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
  padding: 10px 12px;
  border-top: 1px solid var(--fade-10);
}

.ei-status {
  flex: 1 1 100%;
  color: var(--text-warm);
  font-size: 12px;
}

.ei-status:empty {
  display: none;
}

/* Pointer */
.ei-cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  width: 20px;
  height: 24px;
  opacity: 0;
  transform: translate(var(--x, 700px), var(--y, 560px));
  transition:
    transform 0.7s cubic-bezier(0.45, 0, 0.2, 1),
    opacity 0.3s ease;
  filter: drop-shadow(0 2px 3px var(--fade-dark-20));
}

.ei-cursor svg {
  width: 20px;
  height: 24px;
  stroke: none;
  transition: transform 0.12s ease;
  transform-origin: 2px 2px;
}

.ei-media[data-cursor] .ei-cursor {
  opacity: 1;
}

.ei-cursor.ei-down svg {
  transform: scale(0.82);
}

/* ---------- steps under the frame (contract styles) ---------- */
.ei-steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--corner-small);
  color: var(--text-warm);
  font-size: var(--body-small-size);
}

.ei-step {
  display: inline-flex;
  align-items: center;
  gap: var(--corner-small);
  padding: var(--number) calc(var(--number) * 2);
  border: 1px solid var(--fade-10);
  border-radius: var(--corner-full);
  opacity: 0.55;
  transition:
    opacity 0.3s,
    border-color 0.3s,
    color 0.3s;
}

.ei-step b {
  font-family: var(--font-token);
  font-weight: var(--token-regular-weight);
}

.ei-step.on {
  border-color: var(--primary-pink);
  color: var(--text-on-base);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .ei-stage *,
  .ei-stage {
    transition: none !important;
  }
}
