:root {
  --primary: #ff4800;
  --primary-dark: #e33f00;
  --ink: #111111;
  --muted: #666666;
  --canvas: #f5f6fd;
  --surface: #ffffff;
  --line: #dfe3ef;
  --danger: #e21919;
  --brand-color: #fff44f;
  color: var(--ink);
  font-family: "IBM Plex Sans", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { background: var(--canvas); scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  letter-spacing: 0.25px;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0.25px;
}

button { color: inherit; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.material-symbols-rounded {
  font-size: 20px;
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
  letter-spacing: normal;
  line-height: 1;
}

.project-width {
  width: min(1040px, 100%);
  margin-inline: auto;
}

.topbar-shell {
  position: sticky;
  z-index: 50;
  top: 0;
  padding: 0 5.5vw;
  background: #fff;
  pointer-events: none;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(1040px, 100%);
  min-height: 88px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  pointer-events: auto;
}

.brand {
  width: fit-content;
  color: var(--ink);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.25px;
  text-decoration: none;
}

.topbar__center {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-chip,
.discard-button,
.publish-button {
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
}

.link-chip {
  min-height: 40px;
  padding: 0 14px;
  background: #edf0ff;
  color: var(--primary);
  font-size: 14px;
}

.topbar__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.discard-button {
  padding: 0 24px;
  background: transparent;
  color: #666666;
  font-weight: 400;
}

.publish-button {
  padding: 0 24px;
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

.publish-button:hover { background: var(--primary-dark); }

button:disabled { cursor: not-allowed; opacity: 0.4; }

.builder-canvas {
  width: 100%;
  min-height: calc(100vh - 88px);
  min-height: calc(100dvh - 88px);
  margin-top: 0;
  background: var(--canvas);
}

.inline-project {
  width: 100%;
  min-height: calc(100vh - 88px);
  padding-bottom: 80px;
  background: var(--canvas);
}

.brand-block {
  min-height: 96px;
  padding: 118px 5.5vw 38px;
}

.brand-logo-editor {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 160px;
  min-height: 54px;
  padding: 8px;
}

.brand-logo-editor img {
  display: block;
  width: auto;
  max-width: min(365px, 72vw);
  max-height: 96px;
  object-fit: contain;
  object-position: left center;
}

.brand-wordmark-input {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #111;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: 0.25px;
  line-height: 1;
}

.brand-wordmark-input:focus { background: transparent; }

.direct-upload-input {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.brand-logo-editor:not(:has(img)) .direct-upload-input { display: none; }

.editable-block,
.selectable-element { position: relative; outline: 0; }

.editable-block.is-selected::after {
  position: absolute;
  z-index: 8;
  inset: 0;
  border: 1.5px solid var(--primary);
  pointer-events: none;
  display: none;
  content: "";
}

.selectable-element.is-selected {
  outline: 0;
}

.block-toolbar,
.element-toolbar {
  position: absolute;
  z-index: 12;
  top: 10px;
  left: 12px;
  display: none;
  align-items: center;
  min-height: 38px;
  padding: 4px;
  border: 1px solid rgba(7, 19, 47, 0.06);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(7, 19, 47, 0.12);
}

.element-toolbar { display: none !important; }

.editable-block.is-selected > .block-toolbar,
.editable-block:hover > .block-toolbar { display: flex; }

.content-section > .block-toolbar {
  top: 18px;
  right: 5.5vw;
  left: auto;
}

.selection-handles,
.is-selected > .selection-handles { display: none !important; }

.is-selected > .selection-handles i {
  position: absolute;
  z-index: 14;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--primary);
  background: #fff;
  pointer-events: none;
}

.selectable-element.is-selected > .selection-handles i:nth-child(1) { top: -29px; left: -29px; }
.selectable-element.is-selected > .selection-handles i:nth-child(2) { top: -29px; right: -29px; }
.selectable-element.is-selected > .selection-handles i:nth-child(3) { right: -29px; bottom: -29px; }
.selectable-element.is-selected > .selection-handles i:nth-child(4) { bottom: -29px; left: -29px; }

.editable-block.is-selected > .selection-handles i:nth-child(1) { top: -5px; left: -5px; }
.editable-block.is-selected > .selection-handles i:nth-child(2) { top: -5px; right: -5px; }
.editable-block.is-selected > .selection-handles i:nth-child(3) { right: -5px; bottom: -5px; }
.editable-block.is-selected > .selection-handles i:nth-child(4) { bottom: -5px; left: -5px; }

.toolbar-button,
.toolbar-upload {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 30px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
}

.toolbar-button:hover,
.toolbar-upload:hover { background: #eef1ff; }
.toolbar-button--danger { color: var(--danger); }
.toolbar-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.intro-block {
  padding: 80px 5.5vw 40px;
  background: var(--canvas);
}

.intro-inner { display: block; }

.status-editor {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-bottom: 52px;
  width: fit-content;
  padding: 0 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(18, 27, 60, 0.05);
}

.status-editor input {
  width: auto;
  min-width: 1ch;
  max-width: 80vw;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 20px;
  font-weight: 400;
  field-sizing: content;
}

.inline-field {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 3px;
  outline: 0;
  background: transparent;
  color: inherit;
  resize: none;
  overflow: hidden;
}

.inline-field:hover { background: transparent; }
.inline-field:focus { background: transparent; box-shadow: none; }

.text-element { width: 100%; }
.intro-title {
  margin: 0 0 24px;
  font-size: 64px;
  font-weight: 600;
  letter-spacing: 0.25px;
  line-height: 1.02;
}

.intro-subtitle {
  margin: 0 0 24px;
  font-family: inherit;
  font-size: 28px;
  font-style: italic;
  line-height: 1.3;
}

.intro-copy,
.item-copy {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.intro-copy { max-width: 820px; margin: 0 0 64px; }

.image-editor {
  position: relative;
  display: grid;
  width: 100%;
  overflow: hidden;
  place-items: center;
  background: #e9eaf3;
}

.hero-image-editor { aspect-ratio: 3 / 2; min-height: 0; }
.image-editor img { display: block; width: 100%; height: auto; }
.hero-image-editor img { width: 100%; height: 100%; object-fit: cover; }

.image-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.content-section {
  position: relative;
  padding: 0 5.5vw 40px;
  background: var(--canvas);
}

.reveal-component {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 560ms cubic-bezier(0.22, 1, 0.36, 1), transform 560ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-component.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.component-shell { position: relative; }

.content-grid { display: grid; gap: 40px; }
.content-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; }
.content-item { min-width: 0; }

.item-title {
  margin: 0 0 12px;
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 600;
  letter-spacing: 0.25px;
  line-height: 1.15;
}

.item-copy { margin: 0 0 30px; }
.content-grid--two .item-title { font-size: clamp(21px, 1.8vw, 26px); }
.content-grid--two .item-copy { font-size: clamp(15px, 1.25vw, 17px); }
.content-grid--two .image-editor { aspect-ratio: 1 / 1; }
.content-grid--two .image-editor img { width: 100%; height: 100%; object-fit: cover; }
.content-grid:not(.content-grid--two) .image-editor { aspect-ratio: 3 / 2; min-height: 0; }
.content-grid:not(.content-grid--two) .image-editor img { width: 100%; height: 100%; object-fit: cover; }

.component-controls {
  position: absolute;
  z-index: 24;
  top: 34px;
  left: 34px;
  opacity: 0;
  transition: opacity 140ms ease;
}

.component-shell:hover > .component-controls,
.component-controls:focus-within,
.component-controls.is-open { opacity: 1; }

.component-menu-trigger {
  display: grid;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: none;
  place-items: center;
}

.component-menu-trigger .material-symbols-rounded { font-size: 25px; font-weight: 400; }

.component-menu {
  position: absolute;
  top: -4px;
  left: 56px;
  width: 220px;
  padding: 10px;
  border: 1px solid rgba(7, 19, 47, 0.08);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(7, 19, 47, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-16px) scale(0.985);
  transform-origin: left center;
  transition: opacity 180ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 240ms;
  visibility: hidden;
}

.component-controls.is-open .component-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
  transition-delay: 0s;
  visibility: visible;
}

.component-menu > button {
  display: grid;
  grid-template-columns: 1fr 20px;
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  align-items: center;
  background: transparent;
  cursor: pointer;
  gap: 14px;
  font-size: 15px;
  font-weight: 400;
  text-align: left;
}

.component-menu > button:hover { background: #f1f3ff; }
.component-menu > .component-menu__delete { color: var(--ink); }

.component-menu__icon {
  display: block;
  object-fit: contain;
}

.component-menu__icon-box {
  display: grid;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-items: center;
}

.component-menu__icon--pack {
  width: 14px;
  height: 14px;
}

.component-menu__icon--arrow {
  width: 18px;
  height: 18px;
}

.component-menu__icon--trash {
  width: 16px;
  height: 18px;
}

.color-picker { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.private-link-row button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}

.publish-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(7, 19, 47, 0.2);
}

.publish-dialog::backdrop { background: rgba(7, 19, 47, 0.54); backdrop-filter: blur(5px); }
.publish-form,
.publish-result { padding: 48px; }

.dialog-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 24px;
}

.eyebrow { margin: 0 0 12px; color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: 0.25px; text-transform: uppercase; }
.publish-dialog h2 { margin: 0 0 14px; font-size: 30px; letter-spacing: 0.25px; line-height: 1.12; }
.dialog-copy { margin: 0 0 28px; color: var(--muted); line-height: 1.55; }
.dialog-field { display: grid; gap: 8px; font-size: 13px; font-weight: 600; }

.dialog-field > input,
.private-link-row input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

.dialog-field > input:focus,
.private-link-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,47,255,0.1); }
.dialog-message { min-height: 20px; margin: 10px 0; color: var(--danger); font-size: 13px; }
.dialog-submit { width: 100%; min-height: 50px; }
.private-link-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 22px; }

.undo-toast {
  position: fixed;
  z-index: 80;
  bottom: 24px;
  left: 50%;
  display: flex;
  min-height: 48px;
  padding: 0 10px 0 18px;
  border-radius: 10px;
  align-items: center;
  background: #07132f;
  color: #fff;
  box-shadow: 0 14px 36px rgba(7, 19, 47, 0.22);
  gap: 18px;
  transform: translateX(-50%);
}

.undo-toast button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9aafff;
  cursor: pointer;
  font-weight: 700;
}

.undo-toast button:hover { background: rgba(255, 255, 255, 0.08); }

@media (hover: none) {
  .component-controls { opacity: 0.55; }
}

@media (max-width: 720px) {
  .topbar-shell { padding: 0 22px; }
  .topbar { grid-template-columns: 1fr auto; width: 100%; min-height: 72px; padding: 0; }
  .topbar__center { display: none; }
  .topbar button { min-height: 44px; font-size: 16px; }
  .discard-button { padding: 0 10px; }
  .publish-button { padding: 0 14px; }
  .builder-canvas { margin-top: 0; }
  .intro-block { padding: 46px 22px 40px; }
  .intro-title { font-size: 42px; }
  .intro-subtitle { font-size: 22px; }
  .intro-copy { font-size: 16px; }
  .intro-copy { margin-bottom: 64px; }
  .hero-image-editor { aspect-ratio: 3 / 2; min-height: 0; }
  .content-section { padding: 0 22px 40px; }
  .content-grid--two { grid-template-columns: 1fr; gap: 40px; }
  .content-grid:not(.content-grid--two) .image-editor { aspect-ratio: 3 / 2; min-height: 0; }
  .content-grid--two .image-editor { aspect-ratio: 1 / 1; }
  .component-controls { top: 18px; left: 18px; }
  .component-menu { width: min(220px, calc(100vw - 112px)); }
  .publish-form,
  .publish-result { padding: 42px 24px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
  .reveal-component { opacity: 1 !important; transform: none !important; }
}
