/* The owner app. Eat Your Cake's colours (from the promo site's design), system fonts. */
:root {
  --brand: #a3214a;
  --brand-strong: #850036;
  --ink: #3a2420;
  --muted: #6e5c55;
  --paper: #fffbf5;
  --surface: #fbf4ea;
  --border: #ded8d0;
  --problem: #9b1c1c;
  --radius: 0.75rem;
  color-scheme: light;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 100%;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 0.75rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand); text-underline-offset: 0.15em; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.125rem; color: var(--brand); text-decoration: none; }
.bar__end { display: flex; align-items: center; gap: 0.75rem; margin: 0; }
.muted { color: var(--muted); }

.page { max-width: 32rem; margin: 2.5rem auto; padding: 0 1.25rem; }
.stack > * + * { margin-top: 1rem; }
.field { display: grid; gap: 0.375rem; }
label { font-weight: 600; }
input {
  font: inherit;
  padding: 0.75rem 0.875rem;
  border: 1px solid #8a7a72;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.code-input { font-size: 1.5rem; letter-spacing: 0.3em; max-width: 12rem; }

.button {
  font: inherit;
  font-weight: 600;
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}
.button:hover { background: var(--brand-strong); }
.link-button {
  font: inherit;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}
.again { margin-top: 2rem; }
.problem { padding: 0.75rem 1rem; border-left: 4px solid var(--problem); background: #fdecec; color: var(--problem); }

.sites { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.card {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}
.card:hover { border-color: var(--brand); }

@media (width <= 30rem) {
  .hide-small { display: none; }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.button:disabled { background: #8a7a72; cursor: not-allowed; }
h2 { font-size: 1.125rem; line-height: 1.3; margin: 0; }

/* The editing screen: chat beside the preview, filling the window below the bar. */
body.has-editor { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.editor-page, .editor-root { flex: 1; min-height: 0; min-width: 0; display: flex; }
.editor {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(20rem, 28rem) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.editor__loading { padding: 1.5rem 1.25rem; }
.editor__switch { display: none; }

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper);
  border-right: 1px solid var(--border);
}
.chat__head { padding: 1rem 1.25rem 0.75rem; border-bottom: 1px solid var(--border); }
.chat__head h1 { font-size: 1.375rem; margin: 0.25rem 0 0; overflow-wrap: anywhere; }
.chat__back { font-size: 0.9375rem; }

.lines { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 1.25rem; }
.lines ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.line {
  max-width: 90%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
.line p { margin: 0; }
.line p + p { margin-top: 0.5rem; }
.line--owner { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 0.25rem; }
.line--assistant { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 0.25rem; }
.line--intro { max-width: 100%; background: var(--surface); }
.line__text { white-space: pre-wrap; }
.line__changed { font-size: 0.9375rem; font-weight: 600; color: #2f6b3a; margin-top: 0.375rem !important; }
.line__at { display: block; margin-top: 0.25rem; font-size: 0.8125rem; color: var(--muted); }
.line--owner .line__at { color: #fbe4ec; text-align: right; }

.progress { margin: 0 1.25rem 0.75rem; padding: 0.625rem 0.875rem; border-radius: var(--radius); background: var(--surface); }
.progress ol { list-style: none; margin: 0; padding: 0; font-size: 0.9375rem; }
.progress__done { color: var(--muted); }
.progress__done::before { content: "✓ "; }
.progress__now { font-weight: 600; }
.progress__now::before {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-right: 0.5em;
  border: 2px solid var(--brand);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .progress__now::before { animation: none; } }

.chat__see { display: none; margin: 0 1.25rem 0.75rem; }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 0 1.25rem 0.75rem; }
.offer { margin: 0 1.25rem 0.75rem; padding: 0.75rem 0.875rem; border-radius: var(--radius); background: var(--surface); }
.offer p { margin: 0 0 0.625rem; font-size: 0.9375rem; }
.offer__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.offer .button { padding: 0.5rem 1.25rem; }
.notice { margin: 0 1.25rem 0.75rem; padding: 0.625rem 0.875rem; border-left: 4px solid var(--brand); background: #fdf0f3; }

.composer { padding: 0.75rem 1.25rem 1rem; border-top: 1px solid var(--border); display: grid; gap: 0.5rem; }
.composer textarea {
  font: inherit;
  width: 100%;
  resize: vertical;
  min-height: 4.5rem;
  max-height: 40vh;
  padding: 0.625rem 0.75rem;
  border: 1px solid #8a7a72;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
.composer__end { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; font-size: 0.9375rem; }
.composer .button { padding: 0.5rem 1.25rem; }

.preview { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.preview__bar, .preview__live {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.375rem 1rem;
  padding: 0.625rem 1.25rem;
  background: var(--paper);
  font-size: 0.9375rem;
}
.preview__bar { border-bottom: 1px solid var(--border); }
.preview__live { border-top: 1px solid var(--border); }
.preview__actions { display: flex; flex-wrap: wrap; gap: 0.375rem 1rem; margin-left: auto; }
.preview__frame { flex: 1; min-height: 0; background: #fff; }
.preview__frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.preview__note { padding: 2rem 1.25rem; color: var(--muted); }

/* Dialogs: the phone link and History. */
.dialog {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.dialog::backdrop { background: rgb(58 36 32 / 0.5); }
.dialog h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.dialog__actions { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; }
.dialog__actions:has(> :nth-child(2)) { justify-content: space-between; }
.dialog__actions form { margin: 0; }

.phone { max-width: min(24rem, calc(100vw - 2rem)); }
.phone p { font-size: 0.9375rem; }
.qr { display: block; width: 13.75rem; height: 13.75rem; margin: 0 auto 1rem; }

/* Phones: one panel at a time, with a switch above. */
@media (width <= 48rem) {
  .editor { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .editor__switch { display: flex; background: var(--paper); border-bottom: 1px solid var(--border); }
  .editor__switch button {
    flex: 1;
    font: inherit;
    font-weight: 600;
    padding: 0.625rem;
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    color: var(--muted);
    cursor: pointer;
  }
  .editor__switch button[aria-pressed="true"] { color: var(--brand); border-bottom-color: var(--brand); }
  .dot { display: inline-block; width: 0.5rem; height: 0.5rem; margin-left: 0.375rem; border-radius: 50%; background: var(--brand); vertical-align: middle; }
  .chat { border-right: 0; }
  .editor[data-view="chat"] .preview, .editor[data-view="preview"] .chat { display: none; }
  .chat__see { display: block; }
  .chat__head h1 { font-size: 1.25rem; }
}

/* Publish, under the preview: what isn't live yet, the button, and anything stopping it. */
.publish { border-top: 1px solid var(--border); background: var(--paper); }
.publish__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.625rem 1.25rem; }
.publish__status { flex: 1 1 12rem; margin: 0; font-size: 0.9375rem; color: var(--muted); }
.publish__bar .button { padding: 0.5rem 1.5rem; }
.publish__note { margin: 0 1.25rem 0.75rem; padding: 0.625rem 0.875rem; border-left: 4px solid var(--brand); background: #fdf0f3; font-size: 0.9375rem; }
.publish__problems { margin: 0 1.25rem 0.75rem; padding: 0.75rem 1rem; border-left: 4px solid var(--problem); background: #fdf0f0; font-size: 0.9375rem; }
.publish__problems p { margin: 0 0 0.5rem; font-weight: 600; }
.publish__problems ul { margin: 0 0 0.75rem; padding-left: 1.25rem; }
.publish__problems li + li { margin-top: 0.25rem; }
.publish__fix { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }

/* History: what's changed on the live site, newest first. */
.history { width: min(32rem, calc(100vw - 2rem)); max-height: min(40rem, calc(100vh - 2rem)); }
.history__list { margin: 0 0 1rem; padding: 0; list-style: none; }
.history__item { padding: 0.75rem 0; border-top: 1px solid var(--border); }
.history__item:first-child { border-top: 0; padding-top: 0; }
.history__summary { margin: 0 0 0.25rem; }
.history__item--undo .history__summary, .history__item--redo .history__summary { color: var(--muted); }
.history__meta { margin: 0; font-size: 0.875rem; color: var(--muted); }

/* Under the latest reply that changed the draft. */
.line__undo { display: block; margin: 0.125rem 0 0.25rem; font-size: 0.875rem; }

/* Rating a reply: two quiet thumbs beside the time; the chosen one fills in. */
.line__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.rating { display: contents; }
.rating__buttons { display: inline-flex; gap: 0.125rem; margin-left: auto; }
.rating__button {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.rating__button:hover { background: var(--surface); color: var(--ink); }
.rating__button path { fill-opacity: 0; }
.rating__button[aria-pressed="true"] { color: var(--brand); }
.rating__button[aria-pressed="true"] path { fill-opacity: 1; }
.rating__thanks { flex-basis: 100%; font-size: 0.875rem; color: var(--muted); }
.rating__note { flex-basis: 100%; display: grid; gap: 0.375rem; margin-top: 0.25rem; font-size: 0.875rem; }
.rating__note textarea { width: 100%; padding: 0.375rem 0.5rem; border: 1px solid var(--border); border-radius: 0.5rem; font: inherit; resize: vertical; }
.rating__actions { display: flex; align-items: center; gap: 0.75rem; }
.rating__actions .button { padding: 0.25rem 1rem; font-size: 0.875rem; }

/* Making a site: the address, the scan's findings to choose from, and progress, in one column. */
.making { width: 100%; max-width: 36rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; overflow-y: auto; }
.making--wide { max-width: 48rem; }
.making h1 { margin-top: 0.5rem; overflow-wrap: anywhere; }
.making h2 { font-size: 1.375rem; margin-bottom: 0.5rem; }
.making .notice { margin: 0 0 1rem; }
.making__now { padding: 1.25rem; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); }
.making__bar { position: relative; height: 0.375rem; margin: 1rem 0; overflow: hidden; border-radius: 999px; background: var(--surface); }
.making__bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 35%;
  border-radius: inherit;
  background: var(--brand);
  animation: making-slide 1.6s ease-in-out infinite;
}
@keyframes making-slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) { .making__bar::after { animation: none; width: 100%; opacity: 0.4; } }

.scan__counts { font-size: 1.125rem; }
.scan__look { display: grid; gap: 1.5rem; margin: 1.5rem 0 2rem; }
.scan__logo { justify-self: start; max-width: 100%; padding: 0.75rem 1rem; border-radius: var(--radius); }
.scan__logo img { display: block; max-width: min(16rem, 100%); max-height: 6rem; object-fit: contain; }
.scan__photos { list-style: none; margin: 0; padding: 0 0 0.5rem; display: flex; gap: 0.5rem; overflow-x: auto; scroll-snap-type: x proximity; }
.scan__photos li { flex: 0 0 auto; scroll-snap-align: start; }
.scan__photos img { display: block; height: 7.5rem; width: auto; max-width: 14rem; object-fit: cover; border-radius: 0.5rem; background: var(--paper); }
.scan__part h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.scan__colours { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.scan__colours li { width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--border); }
.scan__font { margin: 0 0 0.5rem; font-size: 1.125rem; }
.scan__font--heading { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.scan__path { display: block; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 0.875rem; font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }

.scan__choose fieldset { margin: 0 0 1.25rem; padding: 0; border: 0; min-width: 0; }
.scan__choose legend { padding: 0; }
.scan__pages, .scan__sets { list-style: none; margin: 0 0 1rem; padding: 0; }
.scan__pages li { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.625rem 0; border-top: 1px solid var(--border); }
.scan__pages li:last-child { border-bottom: 1px solid var(--border); }
.scan__pages input { flex: none; width: 1.25rem; height: 1.25rem; margin: 0.15rem 0 0; padding: 0; accent-color: var(--brand); }
.scan__pages label { font-weight: 600; overflow-wrap: anywhere; }
.scan__pages input:disabled:not(:checked) + label { color: var(--muted); }
.scan__sets li { padding: 0.625rem 0.875rem; background: var(--paper); border-radius: var(--radius); }
.scan__sets li + li { margin-top: 0.5rem; }
.scan__elsewhere { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
