/* The creator's landing page. Built on the kit's own variables (library/site.css), so it looks like the rest of castomo.
   The site being built lives inside .frame, where the generated design overrides those same variables: the page
   around it never changes colour, the site inside does. */

html { scroll-behavior: smooth; }
body { min-height: 100vh; background: var(--paper); color: var(--ink); font-family: 'Inter Tight', system-ui, sans-serif; margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 18px clamp(16px, 4vw, 40px); }
/* The brand kit's lockup (icon + wordmark, text outlined so no font is needed); its own artboard has a margin, so it is pulled in. */
.logo { display: inline-flex; margin-left: -10px; }
.logo img { display: block; height: 52px; width: auto; }
.top-tag { font-size: var(--t-1); color: var(--ink-3); }

/* ------------------------------------------------------------------ the ask */
.ask { max-width: 820px; margin: 0 auto; padding: clamp(28px, 9vh, 96px) clamp(16px, 4vw, 40px) 64px; text-align: center; transition: opacity .5s var(--ease), transform .6s var(--ease); }
.ask.leaving { opacity: 0; transform: translateY(-24px); pointer-events: none; }
.ask h1 { font-size: clamp(2.4rem, 6.4vw, 4.4rem); line-height: 1.02; letter-spacing: -.035em; margin: 0 0 18px; font-weight: 700; }
.lede { font-size: var(--t1); color: var(--ink-2); max-width: 36em; margin: 0 auto 36px; line-height: 1.45; }

.prompt { text-align: left; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 22px; box-shadow: var(--shadow); padding: 14px 14px 12px; transition: border-color .2s, box-shadow .2s; }
.prompt:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.prompt textarea { width: 100%; box-sizing: border-box; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: var(--t1); line-height: 1.45; color: var(--ink); padding: 8px 8px 4px; min-height: 5.2em; max-height: 40vh; }
.prompt textarea::placeholder { color: var(--ink-3); }
.prompt-bar { display: flex; align-items: center; gap: 10px; padding-top: 6px; }
.prompt-hint { flex: 1; font-size: var(--t-1); color: var(--ink-3); }

.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--rule); background: var(--paper); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: transform .2s var(--ease), background .2s, color .2s; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--u-spring); }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent-ink); }
.icon-btn:hover svg { transform: rotate(-18deg) translateY(-1px); }
.icon-btn:focus-visible, .go:focus-visible, .pick:focus-visible, .node:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.go { display: inline-flex; align-items: center; gap: 10px; border: 0; cursor: pointer; font: inherit; font-weight: 600; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 12px 20px 12px 22px; transition: transform .2s var(--ease), background .2s; }
.go svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--u-spring); }
.go:hover svg { transform: translateX(4px); }
.go:hover { background: var(--accent-ink); }
.go:active { transform: scale(.97); }
.go:disabled { opacity: .45; cursor: default; }
.go-quiet { background: var(--field); color: var(--ink); }
.go-quiet:hover svg { transform: rotate(-120deg); }

.files { list-style: none; margin: 0; padding: 0 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.files:not(:empty) { padding-bottom: 8px; }
.file { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; background: var(--field); border-radius: 999px; font-size: var(--t-1); animation: pop .35s var(--u-spring); max-width: 100%; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }
.file small { color: var(--ink-3); }
.file button { border: 0; background: var(--paper-2); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; color: var(--ink-2); line-height: 1; font-size: 14px; }
.file button:hover { background: var(--accent-soft); color: var(--accent-ink); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }

.examples { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 22px 0 0; padding: 0; }
.pick { border: 1px solid var(--rule); background: transparent; color: var(--ink-2); font: inherit; font-size: var(--t-1); border-radius: 999px; padding: 8px 16px; cursor: pointer; transition: background .2s, color .2s, transform .2s var(--ease); }
.pick:hover { background: var(--paper-2); color: var(--ink); transform: translateY(-2px); }
.fine { margin: 28px 0 0; font-size: var(--t-1); color: var(--ink-3); }

.drop { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: blur(6px); }
.drop.on { display: grid; animation: fade .2s; }
.drop > div { display: grid; justify-items: center; gap: 14px; padding: 48px 64px; border: 2.5px dashed var(--accent); border-radius: 28px; font-size: var(--t2); font-weight: 600; color: var(--accent-ink); }
.drop svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; animation: bob 1.1s ease-in-out infinite; }
@keyframes fade { from { opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* ------------------------------------------------------------------ the work */
.work { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: clamp(16px, 3vw, 40px); padding: 8px clamp(16px, 4vw, 40px) 48px; align-items: start; animation: rise .7s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(28px); } }
.rail { display: grid; gap: 22px; position: sticky; top: 16px; }

.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.flow li { display: flex; gap: 14px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; color: var(--ink-3); transition: background .3s, color .3s; }
.flow b { display: block; font-size: var(--t0); }
.flow small { font-size: var(--t-1); }
.dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--rule); margin-top: 1px; display: grid; place-items: center; transition: all .3s; }
.flow li.active { background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow); }
.flow li.active .dot { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.flow li.done { color: var(--ink-2); }
.flow li.done .dot { background: var(--accent); border-color: var(--accent); animation: none; }
.flow li.done .dot::after { content: ''; width: 9px; height: 5px; border-left: 2.4px solid var(--on-fill); border-bottom: 2.4px solid var(--on-fill); transform: rotate(-45deg) translate(1px, -1px); }
@keyframes spin { to { transform: rotate(360deg); } }
.line { margin: 0; min-height: 2.6em; padding: 0 12px; font-size: var(--t-1); color: var(--ink-2); }
.line.bad { color: var(--bad); }

.project { padding: 18px 18px 16px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 18px; animation: rise .6s var(--ease); }
.project small { color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.project h2 { margin: 4px 0 6px; font-size: var(--t3); letter-spacing: -.02em; line-height: 1.1; }
.p-title { margin: 0 0 8px; font-weight: 600; font-size: var(--t-1); }
.p-desc { margin: 0; color: var(--ink-2); font-size: var(--t-1); line-height: 1.45; }
.caret::after { content: ''; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -.12em; background: var(--accent); animation: blink .8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.sitemap { display: grid; gap: 2px; padding: 4px 0; }
.node { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: transparent; font: inherit; color: var(--ink); padding: 8px 12px; border-radius: 12px; cursor: default; position: relative; animation: nodein .5s var(--u-spring) backwards; }
.node.sub { margin-left: 22px; }
.node.sub::before { content: ''; position: absolute; left: -12px; top: -6px; bottom: 50%; width: 10px; border-left: 2px solid var(--rule); border-bottom: 2px solid var(--rule); border-bottom-left-radius: 8px; }
.node .state { margin-left: auto; font-size: .72rem; color: var(--ink-3); }
.node .ico { width: 16px; height: 18px; border: 2px solid var(--ink-3); border-radius: 4px; flex: none; position: relative; }
.node .ico::after { content: ''; position: absolute; left: 2px; right: 2px; top: 4px; height: 2px; background: var(--ink-3); box-shadow: 0 4px 0 var(--ink-3); }
.live .node.ready { cursor: pointer; }
.live .node.ready:hover { background: var(--paper-2); }
.node.ready .state { color: var(--ok); }
.node.on { background: var(--paper-2); box-shadow: var(--shadow); }
.node.writing .ico { animation: pulse 1.1s ease-in-out infinite; }
@keyframes nodein { from { opacity: 0; transform: translateX(-16px) scale(.9); } }
@keyframes pulse { 50% { opacity: .35; } }
.actions { display: flex; gap: 10px; animation: rise .5s var(--ease); }

/* ------------------------------------------------------------------ the stage */
.stage { position: relative; overflow: hidden; border-radius: 24px; background: color-mix(in srgb, var(--ink) 6%, var(--paper)); border: 1px solid var(--rule); min-height: 70vh; height: min(86vh, 900px); }
.canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; transition: transform 1.1s var(--ease); will-change: transform; }
.frame { background: #fff; width: var(--canvas-w, 1200px); border-radius: 14px; overflow: hidden; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .45); font-family: 'Inter Tight', system-ui, sans-serif; }
.frame-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: #eceef2; border-bottom: 1px solid #d9dce4; }
.frame-bar i { width: 12px; height: 12px; border-radius: 50%; background: #c9ccd6; }
.frame-bar span { margin-left: 14px; flex: 1; max-width: 520px; background: #fff; border-radius: 8px; padding: 5px 14px; font-size: 14px; color: #5f6478; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page { transition: opacity .35s var(--ease); }
.page.swap { opacity: 0; }

/* The preview: an iframe as tall as its page (stage.js), so the stage scrolls one thing. */
.page { display: block; width: 100%; border: 0; height: 600px; background: transparent; transition: opacity .35s var(--ease); }
.page.swap { opacity: 0; }

/* Page width: three lengths a page can set. */

@media (max-width: 900px) {
  /* On a phone the show comes first: the three steps as one row, then the stage, then the details. */
  .work { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
  .rail { display: contents; }
  .flow { order: 0; display: flex; gap: 4px; }
  .flow li { flex: 1; padding: 8px 6px; gap: 6px; align-items: center; }
  .flow small { display: none; }
  .flow b { font-size: .8rem; white-space: nowrap; }
  .dot { width: 18px; height: 18px; margin-top: 0; }
  .stage { order: 1; height: 58vh; min-height: 0; }
  .line { order: 2; } .project { order: 3; } .sitemap { order: 4; } .actions { order: 6; }
  .prompt-hint { display: none; }
  .prompt-bar { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* The project's colours: small rounded swatches, each named, filled in when the design stage answers. */
.palette { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 12px; }
.palette li { display: grid; gap: 4px; justify-items: start; font-size: var(--t-2, 11px); color: var(--ink-3); animation: rise .5s var(--ease) both; }
.palette i { display: block; width: 44px; height: 28px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .35); }
.palette b { font-weight: 500; color: var(--ink-2); }

/* The assistant: a round button in the bottom-right corner that opens a chat panel above it. */
.helper-open { position: fixed; right: 24px; bottom: 24px; z-index: 40; width: 56px; height: 56px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--accent); color: #fff; box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .6); transition: transform .2s var(--ease); }
.helper-open:hover { transform: scale(1.06); }
.helper-open svg, .helper-x svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.helper { position: fixed; right: 24px; bottom: 24px; z-index: 41; width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 48px)); display: grid; grid-template-rows: auto 1fr auto;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 20px; box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .7); overflow: hidden; animation: rise .3s var(--ease); }
.helper[hidden], .helper-open[hidden] { display: none; }
.helper-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.helper-head b { flex: 1; font-size: var(--t0); }
.helper-x { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); border-radius: 8px; cursor: pointer; }
.helper-x svg { width: 18px; height: 18px; }
.helper-x:hover, .helper-quiet:hover { background: var(--field, rgba(255, 255, 255, .06)); }
.helper-quiet { border: 0; background: none; color: var(--ink-2); font: inherit; font-size: var(--t-1); padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.helper-log { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.helper-line { margin: 0; max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: var(--t-1); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.helper-assistant { background: var(--field, rgba(255, 255, 255, .06)); color: var(--ink); border-bottom-left-radius: 4px; }
.helper-you { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.helper-step, .helper-wait { max-width: 100%; padding: 2px 4px; color: var(--ink-3); font-size: 12px; }
.helper-step.bad, .helper-error { color: #ff8a78; }
.helper-error { padding: 2px 4px; max-width: 100%; }
.helper-ask { background: none; border: 1px dashed var(--rule); color: var(--ink-2); max-width: 100%; }
.helper-form { border-top: 1px solid var(--rule); padding: 12px; display: grid; gap: 8px; }
.helper-input { width: 100%; box-sizing: border-box; resize: none; font: inherit; font-size: var(--t-1); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 10px 12px; }
.helper-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.helper-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.helper-left { margin-right: auto; color: var(--ink-3); font-size: 12px; }
.helper-send { border: 0; font: inherit; font-size: var(--t-1); font-weight: 600; padding: 8px 18px; border-radius: 999px; background: var(--accent); color: #fff; cursor: pointer; }
.helper-stop { background: var(--field, rgba(255, 255, 255, .1)); color: var(--ink); }
@media (max-width: 560px) { .helper { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: min(70vh, 560px); } .helper-open { right: 16px; bottom: 16px; } }
