/* paja layout. Colours, type and buttons come from /tokens.css. */
html, body { height: 100%; }
[hidden] { display: none !important; }

button.icon { width: 34px; height: 34px; padding: 0; justify-content: center; border-color: transparent; background: none; color: var(--muted); font-size: 18px; }
button.icon:hover { background: var(--sunken); }
.only-narrow { display: none; }

/* ------------------------------------------------------ public landing */
.landing { min-height: 100%; max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.landing-top { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 22px 0; }
.landing-top .brand { margin-right: auto; }
.landing-nav { display: flex; align-items: center; gap: 12px; }
.app-link { display: inline-flex; align-items: center; flex-shrink: 0; min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: 13px; white-space: nowrap; }
.app-link:hover { background: var(--sunken); }
.lang { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.lang button { padding: 3px 7px; border: 0; background: none; color: var(--muted); font: 500 11px/1.4 var(--mono); }
.lang button.active { background: var(--sunken); color: var(--text); }
.pending-note { margin: 16px 0 0; padding: 11px 14px; border: 1px solid var(--accent); border-radius: var(--radius-sm); color: var(--text); text-align: center; }
.landing-hero { padding: clamp(64px, 12vw, 132px) 0 clamp(68px, 11vw, 116px); }
.landing-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--muted); font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .14em; }
.landing-kicker::before { content: ""; width: 28px; height: 1px; background: var(--accent); }
.landing-hero h1 { max-width: 980px; margin: 0; font: 400 clamp(48px, 9vw, 94px)/.98 var(--display); letter-spacing: -.04em; }
.landing-lead { max-width: 670px; margin: 28px 0 0; color: var(--muted); font-size: clamp(17px, 2vw, 21px); line-height: 1.58; }
.landing-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.journey { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.journey article { min-width: 0; min-height: 220px; padding: 24px 22px 30px; border-left: 1px solid var(--line); }
.journey article:first-child { border-left: 0; padding-left: 0; }
.journey article:last-child { padding-right: 0; }
.journey span { display: block; margin-bottom: 54px; color: var(--accent); font: 500 11px/1 var(--mono); }
.journey strong { display: block; font: 400 20px/1.25 var(--serif); }
.journey p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.access-note { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(36px, 9vw, 120px); padding: clamp(68px, 10vw, 110px) 0; }
.access-note h2 { max-width: 430px; margin: 12px 0 10px; font: 400 clamp(28px, 4vw, 42px)/1.08 var(--serif); letter-spacing: -.02em; }
.access-note p { max-width: 480px; margin: 0; color: var(--muted); font-size: 15px; }
.landing-footer { display: flex; justify-content: space-between; gap: 24px; padding: 24px 0 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ shell */
.shell { height: 100%; display: grid; grid-template-columns: 240px minmax(0, 1fr) 360px; }
/* Nothing to show beside the chat until a thread exists. */
.shell.empty { grid-template-columns: 240px minmax(0, 1fr); }
.shell.empty .canvas, .shell.empty #toggle-canvas { display: none; }
.scrim { display: none; position: fixed; inset: 0; z-index: 4; background: rgba(11, 31, 51, 0.35); }

.rail { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--sunken); min-height: 0; }
.rail-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 10px 18px; }
.threads { flex: 1; overflow-y: auto; padding: 4px 8px; }
.thread { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; font-weight: 400; text-align: left; color: var(--muted); }
.thread:hover { background: color-mix(in oklab, var(--surface) 60%, transparent); }
.thread.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.thread span { overflow: hidden; text-overflow: ellipsis; }
.thread .who { margin-left: auto; font-size: 11px; color: var(--faint); }
.rail-bottom { display: grid; gap: 2px; padding: 10px 8px 14px; border-top: 1px solid var(--line); }
.rail-bottom > * { justify-content: flex-start; }

/* Stage is shown as how much of the dot is filled: quarter, half, three quarters, full. */
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--accent); background: conic-gradient(var(--accent) var(--fill, 25%), transparent 0); }
.dot[data-stage="idea"] { --fill: 50%; }
.dot[data-stage="prototype"] { --fill: 75%; }
.dot[data-stage="experiment"] { --fill: 100%; }

/* ------------------------------------------------------------- chat */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.chat-top { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 20px; }
.chat-title { flex: 1; font: 400 17px var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.start { flex: 1; display: grid; place-content: center; text-align: center; padding: 0 24px 8vh; }
.start h1 { margin: 0; font: 400 clamp(34px, 5vw, 56px)/1.05 var(--display); letter-spacing: -0.02em; }

.messages { flex: 1; overflow-y: auto; padding: 8px 20px 24px; scroll-behavior: smooth; }
.messages > * { max-width: 720px; margin-inline: auto; }
.msg { margin-top: 22px; line-height: 1.6; overflow-wrap: anywhere; }
.msg.user { width: fit-content; max-width: min(560px, 85%); margin-right: max(0px, calc((100% - 720px) / 2)); padding: 10px 16px; border-radius: 18px 18px 4px 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); white-space: pre-wrap; }
.msg p { margin: 0 0 10px; }
.msg p:last-child, .msg ul:last-child, .msg ol:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 0 0 10px; padding-left: 22px; }
.msg h3 { margin: 16px 0 6px; font: 400 17px var(--serif); }
.msg a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.msg code { padding: 1px 5px; border-radius: 5px; background: var(--sunken); }
.msg pre { margin: 0 0 10px; padding: 12px 14px; border-radius: 12px; background: var(--sunken); overflow-x: auto; }
.msg pre code { padding: 0; background: none; }
.msg.error { color: var(--bad); }

/* Saved, reviewable actions inside the conversation. */
.action-cards { display: grid; gap: 12px; margin-top: 12px; }
.action-cards:empty { display: none; }
.action-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.action-card.pending { border-color: var(--accent); }
.action-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.action-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; color: var(--accent); background: var(--sunken); font-size: 22px; }
.action-heading h3 { flex: 1; min-width: 120px; margin: 0; font: 400 19px var(--serif); }
.action-status { font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.action-card.completed .action-status { color: var(--accent); }
.action-card.failed .action-status, .action-error { color: var(--bad); }
.action-card.dismissed { opacity: .7; }
.action-description { white-space: pre-wrap; color: var(--muted); font-size: 14px; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.action-buttons button, .action-buttons a { min-height: 42px; }
.msg .action-buttons a { text-decoration: none; }
.action-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 14px 0; }
.action-metrics strong, .action-metrics span { display: block; }
.action-metrics strong { font: 400 25px var(--serif); }
.action-metrics span { font-size: 11px; color: var(--muted); }
.action-card blockquote { margin: 8px 0; padding-left: 12px; border-left: 2px solid var(--line); font-size: 14px; }
.action-card.running .action-icon { animation: action-pulse 1.2s ease-in-out infinite alternate; }
@keyframes action-pulse { to { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .action-card.running .action-icon { animation: none; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); font: 500 10px/1.6 var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.thinking { display: inline-block; width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.1s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.7); } }

.composer { display: flex; align-items: flex-end; gap: 8px; width: min(760px, calc(100% - 32px)); margin: 0 auto 20px; padding: 8px 8px 8px 18px; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow-md); }
.composer:focus-within { border-color: color-mix(in oklab, var(--accent) 50%, var(--line)); }
.composer textarea { flex: 1; max-height: 200px; padding: 8px 0; border: 0; border-radius: 0; background: none; resize: none; outline: none; line-height: 1.5; }
.send { width: 36px; height: 36px; padding: 0; justify-content: center; font-size: 17px; }

/* ----------------------------------------------------------- canvas */
.canvas { overflow-y: auto; padding: 18px 20px 40px; border-left: 1px solid var(--line); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; }
.step { position: relative; display: grid; justify-items: center; gap: 7px; padding: 0; border: 0; border-radius: 0; background: none; font: 500 10px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); }
.step::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--bg); z-index: 1; transition: all 200ms var(--ease); }
.step:not(:first-child)::after { content: ""; position: absolute; top: 5.5px; right: 50%; width: 100%; height: 1.5px; background: var(--line); }
.step.done::before { border-color: var(--accent); background: var(--accent); }
.step.done:not(:first-child)::after { background: var(--accent); }
.step.current { color: var(--text); }
.step.current::before { box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 22%, transparent); }
.step:hover { border: 0; color: var(--text); }

.canvas-title { width: 100%; margin-bottom: 4px; padding: 4px 0; border: 0; border-radius: 0; background: none; font: 400 24px/1.2 var(--serif); letter-spacing: -0.01em; }
.canvas-title:focus { outline: none; }
.stage-block { margin-top: 20px; }
.stage-block.past { opacity: 0.72; }
.field { margin-top: 12px; }
.field label { display: block; margin-bottom: 2px; }
.field textarea { padding: 2px 0; border: 0; border-bottom: 1px solid transparent; border-radius: 0; background: none; resize: none; overflow: hidden; line-height: 1.5; }
.field textarea:hover { border-bottom-color: var(--line); }
.field textarea:focus { outline: none; border-bottom-color: var(--accent); }

.panel { margin-top: 22px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel a.open { color: var(--accent); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.numbers { display: flex; gap: 18px; margin-top: 10px; }
.number b { display: block; font: 400 22px/1.1 var(--serif); }
.quote { margin: 10px 0 0; padding-left: 10px; border-left: 2px solid var(--line); font-size: 13px; color: var(--muted); }
.pill { padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; font: 500 10px/1.6 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.pill.validated { color: var(--ok); }
.pill.invalidated { color: var(--bad); }
.pill.running { color: var(--accent); }
.pill.strong { color: var(--ok); }
.pill.promising { color: var(--accent); }
.pill.needs_sharpening { color: var(--muted); }
.assessment-overall { display: flex; align-items: baseline; gap: 7px; margin: 12px 0 10px; }
.assessment-overall b { font: 400 28px/1 var(--serif); }
.assessment-overall span { font-size: 12px; color: var(--muted); }
.assessment-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 26px; align-items: center; gap: 8px; margin-top: 7px; font-size: 11px; color: var(--muted); }
.assessment-row > b { font: 500 10px var(--mono); text-align: right; color: var(--text); }
.assessment-track { height: 5px; overflow: hidden; border-radius: 999px; background: var(--sunken); }
.assessment-track > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.assessment-note { margin: 11px 0 0; font-size: 11px; line-height: 1.45; color: var(--muted); }
.experiment p { margin: 8px 0 0; }
.experiment .small { font-size: 13px; color: var(--muted); }
.share { display: flex; align-items: center; gap: 8px; margin-top: 26px; font-size: 13px; color: var(--muted); }
.share input, .switch input { width: auto; accent-color: var(--accent); }
.readonly textarea, .readonly .canvas-title { pointer-events: none; }

/* ------------------------------------------------------------ sheet */
.sheet { width: min(560px, calc(100vw - 24px)); max-height: min(720px, calc(100vh - 48px)); padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); color: var(--text); box-shadow: var(--shadow-md); }
.sheet::backdrop { background: rgba(11, 31, 51, 0.45); backdrop-filter: blur(2px); }
.sheet-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-section { display: block; margin: 22px 0 8px; }
.kb-form { display: grid; gap: 8px; }
.kb-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.kb-list { display: grid; margin-top: 14px; }
.kb-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kb-item span.name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error { margin: 0; color: var(--bad); font-size: 13px; }

/* ----------------------------------------------------------- narrow */
.walkthrough { width: min(860px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--bg); color: var(--text); box-shadow: var(--shadow-md); }
.walkthrough::backdrop { background: rgba(11, 31, 51, .62); backdrop-filter: blur(4px); }
.walkthrough-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.walkthrough h1 { max-width: 620px; margin: 10px 0 12px; font: 400 clamp(27px, 4vw, 40px)/1.1 var(--serif); letter-spacing: -.02em; }
.walkthrough > p { color: var(--muted); margin: 0 0 18px; }
.walkthrough-player { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #0b1f33; }
.walkthrough video { display: block; width: 100%; aspect-ratio: 80 / 51; }
.walkthrough-play { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; width: 100%; border: 0; border-radius: 0; background: transparent; color: white; text-shadow: 0 1px 4px #0008; }
.walkthrough-play span:first-child { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; background: var(--accent); color: var(--accent-text); padding-left: 3px; font-size: 22px; box-shadow: 0 4px 22px #0004; }
.walkthrough .walkthrough-note { font-size: 12px; margin: 10px 0 14px; }
.walkthrough-transcript { font-size: 14px; color: var(--muted); }
.walkthrough-transcript summary { cursor: pointer; color: var(--text); }
.walkthrough-transcript li { padding: 3px 0; }
.walkthrough-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.walkthrough-help { flex-shrink: 0; }
@media (max-width: 480px) {
  .walkthrough { padding: 16px; width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .walkthrough-play { font-size: 12px; gap: 8px; }
  .walkthrough-play span:first-child { width: 44px; height: 44px; font-size: 16px; }
}

@media (max-width: 1080px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .shell.empty { grid-template-columns: 220px minmax(0, 1fr); }
  .canvas { position: fixed; inset: 0 0 0 auto; width: min(380px, 88%); background: var(--bg); box-shadow: var(--shadow-md); transform: translateX(100%); transition: transform 200ms var(--ease); z-index: 5; }
  .canvas.open { transform: none; }
  .canvas.open ~ .scrim { display: block; }
  #toggle-canvas { display: inline-flex; }
}
@media (max-width: 720px) {
  .landing { padding-inline: 18px; }
  .landing-nav > .button { display: none; }
  .landing-hero { padding-top: 72px; }
  .journey { grid-template-columns: 1fr 1fr; }
  .journey article, .journey article:first-child, .journey article:last-child { min-height: 190px; padding: 22px 16px; border-left: 0; border-top: 1px solid var(--line); }
  .journey article:nth-child(odd) { padding-left: 0; border-right: 1px solid var(--line); }
  .journey article:nth-child(-n+2) { border-top: 0; }
  .journey span { margin-bottom: 34px; }
  .access-note { grid-template-columns: 1fr; }
  .landing-footer { flex-direction: column; }
  .shell, .shell.empty { grid-template-columns: minmax(0, 1fr); }
  .rail.open ~ .scrim { display: block; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform 200ms var(--ease); z-index: 6; box-shadow: var(--shadow-md); }
  .rail.open { transform: none; }
  .only-narrow { display: inline-flex; }
}
