:root {
  --ground: #eceef4;
  --surface: #ffffff;
  --ink: #14172b;
  --muted: #5a5f78;
  --line: #d9dce8;
  --indigo: #25349b;
  --indigo-soft: #e6e9f6;
  --peg: #f2b705;
  --danger: #a3261b;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --bar: 56px;
  --mobile-nav: 56px;
}

* , *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.45 'Schibsted Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

[hidden] { display: none !important; }

/* Top bar */
.bar {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: var(--bar);
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  justify-self: start;
  grid-column: 1;
  grid-row: 1;
}

.bar__left {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 92px;
  min-width: 0;
}

.ghost--small { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 7px; font-size: 14px; white-space: nowrap; }

.brand__mark {
  width: 8px;
  height: 22px;
  background: var(--peg);
  border-radius: 2px;
}

.bar__site {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.devices {
  grid-column: 2;
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--ground);
  border-radius: 8px;
}

.device {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
  transition: transform 160ms var(--ease);
}

.device:active { transform: scale(0.97); }
.device[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(20 23 43 / 0.14); }

.bar__actions {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status { margin-right: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: none;
  border: 0;
  border-radius: 6px;
  transition: transform 160ms var(--ease);
}

.icon-button:active { transform: scale(0.94); }
.icon-button:disabled { opacity: 0.32; cursor: default; }

@media (hover: hover) {
  .icon-button:not(:disabled):hover { background: var(--ground); }
}

.publish {
  margin-left: 6px;
  padding: 7px 16px;
  background: var(--peg);
  border: 0;
  border-radius: 6px;
  color: #10131f;
  font-weight: 600;
  transition: transform 160ms var(--ease);
}

.publish:active { transform: scale(0.97); }

/* Layout */
.layout { flex: 1; min-height: 0; display: flex; }

.panel {
  flex: none;
  display: flex;
  flex-direction: column;
  width: 372px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.tabs {
  flex: none;
  display: flex;
  gap: 18px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 12px 0 11px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 500;
}

.tab[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--indigo); }

.pane { flex: 1; min-height: 0; display: none; overflow-y: auto; padding: 16px; }
.pane.is-active { display: block; }
.pane[data-pane='chat'].is-active { display: flex; flex-direction: column; padding: 0; }

/* Chat */
.messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.message { max-width: 92%; }
.message--studio { align-self: flex-start; }
.message--you {
  align-self: flex-end;
  padding: 8px 12px;
  background: var(--indigo-soft);
  border-radius: 10px 10px 2px 10px;
}
.message--note { color: var(--muted); font-size: 13px; }
.message--thinking { color: var(--muted); }
.send:disabled, .chip:disabled { opacity: 0.45; cursor: default; }

.suggestions { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }

.chip {
  flex: none;
  padding: 5px 10px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  transition: transform 160ms var(--ease);
}

.chip:active { transform: scale(0.97); }

@media (hover: hover) {
  .chip:hover { border-color: var(--indigo); }
}

.composer { flex: none; position: relative; padding: 0 16px 16px; }

.composer textarea {
  display: block;
  width: 100%;
  padding: 10px 46px 10px 12px;
  background: var(--ground);
  border: 1px solid transparent;
  border-radius: 10px;
  resize: none;
}

.composer textarea:focus { outline: 0; border-color: var(--indigo); background: var(--surface); }

.send {
  position: absolute;
  right: 24px;
  bottom: 26px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--indigo);
  border: 0;
  border-radius: 8px;
  color: #fff;
  transition: transform 160ms var(--ease);
}

.send:active { transform: scale(0.94); }

/* Panels */
.group { margin-bottom: 26px; }
.group__title { margin-bottom: 10px; font-size: 15px; font-weight: 600; }
.group__note { margin-top: 8px; color: var(--muted); font-size: 13px; }

.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.swatch {
  padding: 8px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  transition: transform 160ms var(--ease);
}

.swatch:active { transform: scale(0.98); }
.swatch[aria-pressed='true'] { border-color: var(--indigo); box-shadow: 0 0 0 1px var(--indigo); }
.swatch__chips { display: flex; height: 30px; margin-bottom: 6px; overflow: hidden; border-radius: 4px; }
.swatch__chips i { flex: 1; }
.swatch__chips i:first-child { flex: 2; }

.colour-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.colour-row input[type='color'] { width: 38px; height: 30px; padding: 0; background: none; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.link-button { padding: 0; background: none; border: 0; color: var(--indigo); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.font-option {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 12px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  transition: transform 160ms var(--ease);
}

.font-option:active { transform: scale(0.99); }
.font-option[aria-pressed='true'] { border-color: var(--indigo); box-shadow: 0 0 0 1px var(--indigo); }
.font-option b { display: block; font-weight: 600; }
.font-option span { color: var(--muted); font-size: 13px; }

.row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
}

.row__name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row.is-hidden .row__name { color: var(--muted); text-decoration: line-through; }
.row .icon-button { width: 30px; height: 30px; }
.row--fixed { padding-right: 10px; color: var(--muted); }

.add {
  width: 100%;
  margin-top: 2px;
  padding: 8px;
  background: none;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--indigo);
  font-weight: 500;
}

.version { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.version__text { flex: 1; min-width: 0; }
.version__time { display: block; color: var(--muted); font-size: 13px; }
.ghost { padding: 6px 12px; background: none; border: 1px solid var(--line); border-radius: 6px; font-weight: 500; }
.empty { color: var(--muted); }

/* Preview */
.stage { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.hint {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--indigo);
  color: #fff;
  font-size: 14px;
}

.hint[hidden] { display: none; }
.hint__close { padding: 2px 10px; background: none; border: 1px solid rgb(255 255 255 / 0.5); border-radius: 5px; color: inherit; font-size: 13px; }

.stagebar { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px 0; font-size: 14px; color: var(--muted); }
.stagebar select { max-width: min(70vw, 320px); padding: 5px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font-weight: 500; }

.frame { flex: 1; min-height: 0; position: relative; overflow: hidden; }

#preview {
  position: absolute;
  top: 16px;
  left: 50%;
  border: 0;
  background: #fff;
  transform-origin: 50% 0;
  box-shadow: 0 1px 3px rgb(20 23 43 / 0.2), 0 12px 34px -16px rgb(20 23 43 / 0.34);
}

.page-group { margin-bottom: 14px; padding: 10px; background: var(--ground); border-radius: 10px; }
.page-group.is-hidden { opacity: 0.55; }
.page-group__head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.page-group__name { flex: 1; min-width: 0; padding: 4px 6px; background: none; border: 1px solid transparent; border-radius: 6px; font-weight: 600; }
.page-group__name:focus { background: var(--surface); border-color: var(--indigo); outline: 0; }
.page-group .row { background: var(--surface); }
.row__page { flex: none; width: 92px; padding: 3px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; font-size: 13px; }

/* Choosing a design. It matches the landing page, and its light comes from the
   design you're pointing at. */
@property --glow { syntax: '<color>'; inherits: true; initial-value: #2333b4; }
@property --deep { syntax: '<color>'; inherits: true; initial-value: #060927; }
.picker {
  --paper: #f8f5ee;
  --dim: rgb(248 245 238 / 0.74);
  --hair: rgb(248 245 238 / 0.22);
  --glow: #2333b4;
  --deep: #060927;
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow-y: auto;
  padding: clamp(18px, 3vw, 40px) clamp(18px, 4vw, 60px) 60px;
  background: radial-gradient(70% 60% at 50% 70%, color-mix(in srgb, var(--glow) 72%, transparent), transparent 74%) fixed, var(--deep);
  color: var(--paper);
  transition: --glow 900ms ease, --deep 900ms ease;
}
.picker__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.picker__actions { display: flex; flex: none; gap: 8px; }
.picker h1 { font: 900 clamp(52px, 8vw, 120px)/0.9 'Big Shoulders Display', Impact, sans-serif; }
.picker__note { max-width: 52ch; margin: 20px 0 clamp(24px, 3.4vw, 44px); color: var(--dim); font-size: 18px; }
.picker__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: clamp(20px, 2.6vw, 36px); }
.picker .ghost { background: none; color: var(--paper); border-color: var(--hair); }
.card__preview { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; padding: 0; overflow: hidden; background: #000; border: 0; border-radius: 12px; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.12), 0 30px 70px rgb(0 0 0 / 0.45); cursor: pointer; transition: transform 500ms cubic-bezier(0.23, 1, 0.32, 1); }
.card__preview img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.card__preview:active { transform: scale(0.99); }
@media (hover: hover) { .card__preview:hover { transform: scale(1.015); } }
.card__text { padding-top: 14px; }
.card__kind { color: var(--dim); font-size: 15px; font-weight: 500; }
.card h3 { margin: 0 0 6px; font: 800 clamp(38px, 3.6vw, 54px)/0.95 'Big Shoulders Display', Impact, sans-serif; }
.card__blurb { max-width: 46ch; margin-bottom: 14px; color: var(--dim); }
.card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.card .publish { margin-left: 0; background: var(--paper); color: #0b0d18; border-color: var(--paper); border-radius: 999px; }
.card .link-button { color: var(--paper); }

/* Toast */
.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 24px;
  max-width: min(92vw, 460px);
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.toast.is-open { opacity: 1; transform: translate(-50%, 0); }

/* Dialog */
.dialog {
  margin: auto;
  width: min(92vw, 460px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  box-shadow: 0 24px 60px -18px rgb(20 23 43 / 0.5);
}

.dialog::backdrop { background: rgb(20 23 43 / 0.45); }
.dialog__body { display: flex; flex-direction: column; gap: 16px; padding: 22px; }
.dialog h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.note { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.field .note { font-weight: 400; }
.address { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.address:focus-within { border-color: var(--indigo); }
.address input { flex: 1; min-width: 0; padding: 9px 4px 9px 12px; background: none; border: 0; outline: 0; font-weight: 400; }
.address span { padding-right: 12px; color: var(--muted); font-weight: 400; }
.dialog__actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 4px; }
.dialog__download { margin-right: auto; }
.publish-draft, .publish-live { display: flex; flex-direction: column; gap: 14px; }
.publish-draft[hidden], .publish-live[hidden] { display: none; }
.address-hint { min-height: 18px; color: var(--muted); font-size: 13px; font-weight: 400; }
.address-hint.is-good { color: #14795c; }
.address-hint.is-bad { color: #b3261e; }
.live-link { font-size: 18px; font-weight: 600; color: var(--indigo); overflow-wrap: anywhere; text-underline-offset: 4px; }
.live-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.live-actions a.ghost { display: inline-block; color: inherit; text-decoration: none; }
.live-remove { margin-left: auto; color: var(--muted); font-size: 13px; }
.publish.has-changes { box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 28%, transparent); }
.publish:disabled { opacity: 0.6; }
.text-input { width: 100%; padding: 9px 12px; background: none; border: 1px solid var(--line); border-radius: 8px; font-weight: 400; }
.text-input:focus { border-color: var(--indigo); outline: 0; }
.account-button { max-width: 130px; overflow: hidden; text-overflow: ellipsis; display: inline-block; padding-left: 10px; }
.add-row { display: flex; gap: 6px; margin-top: 8px; }
.add-row select, .add-row input { flex: 1; min-width: 0; padding: 7px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.add-row .ghost { flex: none; background: var(--surface); font-size: 14px; }
.row__field { width: 100%; margin-top: 6px; padding: 6px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.block-row { flex-wrap: wrap; }
.row__colour { flex: none; width: 34px; height: 28px; padding: 1px; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.dialog__actions .publish { margin-left: 0; }

/* Phones: one view at a time, with a nav at the bottom */
.mobile-nav { display: none; }

@media (max-width: 860px) {
  .bar { grid-template-columns: 1fr auto; padding: 0 10px; }
  .devices, .bar__site, .status { display: none; }
  .bar__left { margin-left: 76px; }
  .bar__actions { grid-column: 2; }
  .tabs { display: none; }
  .panel { width: 100%; border-right: 0; }
  body[data-view='preview'] .panel { display: none; }
  body:not([data-view='preview']) .stage { display: none; }
  .hint { font-size: 13px; }

  #preview { top: 0; left: 0; width: 100% !important; height: 100% !important; transform: none !important; box-shadow: none; }

  .mobile-nav {
    flex: none;
    display: flex;
    height: var(--mobile-nav);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }

  .mobile-nav button { flex: 1; min-width: 0; padding: 0 2px; background: none; border: 0; color: var(--muted); font-size: 13px; font-weight: 500; }
  .mobile-nav button[aria-current='true'] { color: var(--indigo); box-shadow: inset 0 2px 0 var(--indigo); }
  .composer textarea { font-size: 16px; }
  .toast { bottom: calc(var(--mobile-nav) + 12px); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; }
}

.picker__filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(18px, 2.4vw, 30px); }
.picker__filter { min-height: 38px; padding: 0 16px; border: 1px solid var(--hair); border-radius: 999px; background: none; color: var(--paper); font: 500 15px/1 inherit; cursor: pointer; transition: transform 160ms cubic-bezier(.23,1,.32,1), background-color 160ms ease, color 160ms ease; }
.picker__filter:active { transform: scale(0.97); }
.picker__filter[aria-pressed="true"] { background: var(--paper); color: #0b0d18; border-color: var(--paper); }
.add-row--section { flex-wrap: wrap; }
.add-row--section select { flex: 1 1 130px; min-width: 0; }
.crop { max-width: min(640px, calc(100vw - 24px)); padding: clamp(16px, 3vw, 26px); }
.crop__note { margin: 6px 0 14px; color: var(--dim); }
.crop__canvas { display: block; margin-inline: auto; max-width: 100%; border-radius: 6px; background: #111; cursor: grab; touch-action: none; }
.crop__canvas:active { cursor: grabbing; }
#crop-zoom { display: block; width: 100%; margin: 16px 0; }
.crop__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.picker__sub { margin: 0 0 12px; font: 600 18px/1.2 inherit; }
.mine { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(22px, 3vw, 36px); }
.mine__site { display: flex; align-items: stretch; border: 1px solid var(--hair); border-radius: 10px; overflow: hidden; }
.mine__open { display: grid; gap: 2px; padding: 10px 14px; background: none; border: 0; color: var(--paper); text-align: left; font: inherit; cursor: pointer; transition: background-color 160ms ease; }
.mine__open span { color: var(--dim); font-size: 14px; }
@media (hover: hover) { .mine__open:hover { background: rgb(255 255 255 / .06); } }
.mine__remove { width: 34px; background: none; border: 0; border-left: 1px solid var(--hair); color: var(--dim); font-size: 18px; cursor: pointer; }
.composer .chat-photo { position: absolute; left: 24px; bottom: 26px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; background: none; border: 0; border-radius: 8px; color: var(--dim); cursor: pointer; }
.chat-photo[hidden] { display: none !important; }
.composer:has(.chat-photo:not([hidden])) textarea { padding-left: 46px; }
.attached-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.attached-row[hidden] { display: none; }
.attached { position: relative; display: grid; gap: 2px; width: 62px; }
.attached img { width: 62px; height: 62px; object-fit: cover; border-radius: 6px; }
.attached small { font-size: 12px; color: var(--dim); }
.attached button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; padding: 0; background: #fff; color: #10131f; border: 0; border-radius: 50%; line-height: 1; cursor: pointer; }
.versions__title { margin-top: 18px; }
.own-domain .row small { display: block; color: var(--dim); font-size: 13px; }
.own-domain .note { margin-top: 8px; }
.legal-note { font-size: 14px; }
.legal-note a { color: inherit; }

.only-phone { display: none; }
@media (max-width: 860px) {
  .only-wide { display: none; }
  .only-phone { display: inline; }
  .brand { font-size: 0; gap: 0; }
  .bar__left { margin-left: 30px; }
  .bar__actions { gap: 4px; }
  .bar__actions .icon-button { width: 32px; }
  .bar .publish, .bar .ghost--small { padding-inline: 10px; }
}
@media (max-width: 370px) {
  #redo { display: none; }
}
