:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #1f1f1f;
  --muted: #9b9b9b;
  --hair: #e9e9e9;
  --hair-strong: #1f1f1f;
  --font-ui: Verdana, Tahoma, Arial, sans-serif;
  --font-display: "Trebuchet MS", Verdana, Tahoma, sans-serif;
  --font-mono: "Lucida Console", Monaco, monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

.page {
  width: min(100% - 56px, 1080px);
  margin: 0 auto;
  padding: 64px 0 80px;
}

.topline {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: -14px 0 30px;
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--hair);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.brand {
  flex: 0 0 auto;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-decoration: none;
  text-transform: uppercase;
}

.tagline {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

.showcase-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.showcase-kicker {
  margin: 0 0 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.showcase-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.95;
}

.showcase-toolbar {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.showcase-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 31px;
  border: 1px solid var(--hair);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1;
}

.showcase-button {
  min-width: 72px;
  padding: 0 12px;
  text-transform: uppercase;
}

.showcase-button:hover,
.showcase-button:focus-visible {
  border-color: var(--hair-strong);
  outline: none;
}

.showcase-button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.showcase-frame {
  position: relative;
  min-height: clamp(460px, 62vw, 700px);
  overflow: visible;
  border: 0;
  background: transparent;
}

.showcase-frame::before {
  display: none;
}

.showcase-live,
.showcase-layers {
  position: absolute;
  inset: 0;
  transition: opacity 0.45s ease;
}

.showcase-live {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  justify-items: center;
  gap: 12px;
  padding: clamp(18px, 4vw, 42px) 0 clamp(12px, 3vw, 28px);
  opacity: 1;
}

.showcase-live-stage {
  display: grid;
  align-content: start;
  justify-items: center;
  width: 100%;
  min-height: 0;
}

.showcase-loading {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.showcase-layers {
  display: grid;
  place-items: center;
  padding: clamp(34px, 7vw, 72px) clamp(44px, 10vw, 108px);
  opacity: 0;
  pointer-events: none;
}

[data-mode="layers"] .showcase-live {
  opacity: 0;
  pointer-events: none;
}

[data-mode="layers"] .showcase-layers {
  opacity: 1;
  pointer-events: auto;
}

.layer-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  width: min(100%, 940px);
  height: min(100%, 610px);
  min-height: 0;
}

.layer-viewer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  align-items: stretch;
  gap: 18px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.layer-preview {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.layer-preview canvas,
.layer-preview img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border: 1px solid rgba(31, 31, 31, 0.14);
  background: #f7f7f7;
}

.layer-workbench {
  display: grid;
  grid-template-rows: minmax(130px, 0.86fr) minmax(0, 1.14fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.layer-dropzone,
.layer-palette {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  padding: 8px;
  border: 1px solid var(--hair);
  background: rgba(255, 255, 255, 0.78);
}

.layer-dropzone {
  border-style: dashed;
}

.layer-dropzone.is-drag-over {
  border-color: var(--ink);
  background: rgba(31, 31, 31, 0.04);
}

.layer-panel-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}

.layer-stack {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.layer-stack-item {
  appearance: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-align: left;
}

.layer-stack-item:hover,
.layer-stack-item:focus-visible {
  outline: none;
  background: #333;
}

.layer-stack-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.layer-stack-copy strong,
.layer-stack-copy span {
  display: block;
  overflow: hidden;
  font-family: var(--font-mono);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-stack-copy strong {
  font-size: 9px;
  font-weight: 400;
  text-transform: uppercase;
}

.layer-stack-copy span {
  font-size: 8px;
  opacity: 0.58;
}

.layer-stack-remove {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
}

.layer-source-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(31, 31, 31, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}

.layer-preview figcaption {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  padding: 7px 9px;
  border: 1px solid rgba(31, 31, 31, 0.1);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: uppercase;
}

.layer-preview figcaption strong {
  color: var(--ink);
  font-weight: 400;
}

.layer-rail {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding: 0 4px 0 0;
  scrollbar-width: thin;
}

.layer-item {
  appearance: none;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  padding: 7px;
  border: 1px solid var(--hair);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  cursor: grab;
  text-align: left;
}

.layer-item:active,
.layer-item.is-dragging {
  cursor: grabbing;
}

.layer-item:hover,
.layer-item:focus-visible,
.layer-item[aria-pressed="true"] {
  border-color: var(--ink);
  outline: none;
}

.layer-item[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.layer-thumb {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid rgba(31, 31, 31, 0.08);
  background: #f7f7f7;
}

.layer-thumb--mask {
  background: #050505;
}

.layer-thumb--mask img {
  filter: grayscale(1) contrast(1.24) brightness(1.28);
  mix-blend-mode: screen;
}

.layer-thumb img,
.layer-thumb canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.layer-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.layer-copy strong,
.layer-copy span {
  display: block;
  overflow: hidden;
  font-family: var(--font-mono);
  letter-spacing: 0;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-copy strong {
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
}

.layer-copy span {
  color: currentColor;
  font-size: 9px;
  opacity: 0.58;
}

.layer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 0;
}

.layer-preset {
  appearance: none;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--hair);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.layer-preset:hover,
.layer-preset:focus-visible,
.layer-preset[aria-pressed="true"] {
  border-color: var(--ink);
  outline: none;
}

.layer-preset[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.vibe-photo-motion {
  display: grid;
  gap: 10px;
  width: min(100%, 900px);
  margin: 0 auto;
}

.showcase-live .vibe-photo-motion {
  gap: 0;
  width: min(100%, 840px);
}

.vibe-photo-stage {
  --device-top: 6.43%;
  --device-height: 85.71%;
  --device-right: 41.43%;
  --device-mid: 49.29%;
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(31, 31, 31, 0.08);
  background: #f7f7f7;
}

.showcase-live .vibe-photo-stage {
  border: 0;
  background: transparent;
}

.vibe-photo-stage canvas {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 820px) {
  .showcase-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .showcase-toolbar {
    justify-content: flex-start;
  }

  .showcase-frame {
    min-height: clamp(410px, 78vw, 620px);
  }

  .showcase-live,
  .showcase-layers {
    inset: 0;
  }

  .showcase-layers {
    padding: 54px 30px 44px;
  }

  .showcase-live {
    padding: 28px 0 24px;
  }

  .layer-viewer {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
    width: 100%;
    height: 100%;
  }

  .layer-workbench {
    grid-template-rows: auto auto;
  }

  .layer-stack {
    grid-auto-flow: column;
    grid-auto-columns: minmax(140px, 176px);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 4px;
  }

  .layer-rail {
    grid-auto-flow: column;
    grid-auto-columns: minmax(168px, 190px);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 4px;
  }

  .layer-item {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  @media (min-width: 621px) {
    .showcase-layers {
      padding: 46px 24px 40px;
    }

    .layer-viewer {
      grid-template-columns: minmax(0, 1fr) minmax(168px, 220px);
      grid-template-rows: minmax(0, 1fr);
      gap: 14px;
      height: min(100%, 520px);
    }

    .layer-rail {
      grid-auto-flow: row;
      grid-auto-columns: auto;
      overflow-x: hidden;
      overflow-y: auto;
      padding: 0 4px 0 0;
    }

    .layer-stack {
      grid-auto-flow: row;
      grid-auto-columns: auto;
      overflow-x: hidden;
      overflow-y: auto;
      padding: 0;
    }

    .layer-item {
      grid-template-columns: 58px minmax(0, 1fr);
      min-height: 58px;
    }
  }

  .vibe-photo-stage {
    display: grid;
  }
}

@media (max-width: 500px) {
  .page {
    width: min(100% - 36px, 1080px);
    padding-top: 44px;
  }

  .showcase-frame {
    min-height: 380px;
  }

  .showcase-live,
  .showcase-layers {
    inset: 0;
  }

  .showcase-layers {
    padding: 48px 22px 36px;
  }

  .layer-rail {
    grid-auto-columns: minmax(150px, 170px);
  }

  .layer-stack {
    grid-auto-columns: minmax(132px, 156px);
  }

  .layer-item {
    grid-template-columns: 54px minmax(0, 1fr);
    min-height: 56px;
  }
}
