/*
 * The desktop app's section: on the homepage, and (compact) at the foot of every blog post.
 * It carries its own palette, framefields.dev's graphite room, so it reads the same inside the
 * docs theme: graphite for the tools, black for the picture, signal yellow only on the
 * playhead. Sizes follow the section's own width (container queries), not the window's, since
 * a blog column is much narrower than the homepage.
 */
.desk {
	--d-bg: #1f2022;
	--d-raise: #2a2b2e;
	--d-line: #3a3c3f;
	--d-text: #e8e9e7;
	--d-dim: #9a9da0;
	--d-side: #18191a;
	--d-chat: #141516;
	--d-code: #c4c7c7;
	--d-signal: #f5e300;
	--d-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
	--d-mono: "Martian Mono", ui-monospace, Menlo, monospace;
	--d-ease: cubic-bezier(0.16, 1, 0.3, 1);
	container: desk / inline-size;
	background: var(--d-bg);
	color: var(--d-text);
	font: 400 1rem/1.5 var(--d-sans);
	-webkit-font-smoothing: antialiased;
}
.desk *,
.desk *::before,
.desk *::after { box-sizing: border-box; }
:where(.desk) a { color: inherit; } /* no weight, so a link styled as a button keeps its own color */
.desk img, .desk video { display: block; max-width: 100%; }

.desk-wrap { max-width: 1320px; margin-inline: auto; padding: clamp(88px, 13vh, 150px) 24px clamp(80px, 12vh, 132px); }

/* The pitch: the promise big on the left; what it does and the download on the right. */
.desk-top { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); gap: 32px 56px; align-items: end; }
.desk-kicker {
	display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0 0 22px;
	font: 400 0.78rem/1.4 var(--d-mono); font-stretch: 87.5%; letter-spacing: 0.04em; text-transform: uppercase; color: var(--d-dim);
}
.desk-kicker span + span::before { content: "·"; margin: 0 10px; }
.desk h2 {
	margin: 0; font: 800 clamp(3.25rem, 9.4cqi, 10rem)/0.86 var(--d-sans); font-stretch: 68%; letter-spacing: -0.012em;
	color: var(--d-text); text-wrap: balance;
}
.desk h2 em { font-style: normal; color: var(--d-dim); }
.desk-lede { margin: 0 0 28px; max-width: 30rem; font-size: 1.22rem; line-height: 1.45; color: var(--d-text); }

.desk-dl-btn {
	display: inline-flex; align-items: center; gap: 12px; padding: 18px 28px 18px 24px; border-radius: 4px;
	background: var(--d-text); color: #000; font: 700 1.2rem/1 var(--d-sans); text-decoration: none;
	transition: background 0.2s, transform 0.2s var(--d-ease);
}
.desk-dl-btn:hover { background: #fff; text-decoration: none; transform: translateY(-1px); }
.desk-dl-btn:focus-visible { outline: 2px solid var(--d-text); outline-offset: 3px; box-shadow: 0 0 0 5px var(--d-signal); }
.desk-dl-btn svg { width: 22px; height: 22px; flex: none; }
.desk-dl-btn[aria-disabled="true"] { background: var(--d-raise); color: var(--d-dim); pointer-events: none; transform: none; }
.desk-dl-meta { margin: 12px 0 0; min-height: 1.4em; font: 400 0.76rem/1.4 var(--d-mono); font-stretch: 87.5%; color: var(--d-dim); }
.desk-dl-others { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 0; font-size: 0.9rem; }
.desk-dl-others a { color: var(--d-dim); text-underline-offset: 0.18em; }
.desk-dl-others a:hover { color: var(--d-text); }

/* The stage the demo stands on. */
.desk-stage { position: relative; margin: clamp(56px, 7cqi, 96px) 0 0; }
.desk-stage::before {
	content: ""; position: absolute; inset: 12% 6% -6%; z-index: 0; pointer-events: none;
	background: radial-gradient(60% 60% at 50% 40%, rgb(255 255 255 / 0.07), transparent 70%);
}
.desk-stage > * { position: relative; z-index: 1; }
.desk-fallback { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 10px; border: 1px solid var(--d-line); background: #000; }

/* ── The app window, drawn to its real layout: projects, the chat beside the preview. ── */
.dw {
	border-radius: 10px; overflow: hidden; background: var(--d-bg); border: 1px solid var(--d-line);
	box-shadow: 0 40px 120px rgb(0 0 0 / 55%), 0 2px 0 rgb(255 255 255 / 0.03) inset;
	font: 400 13px/1.45 var(--d-sans); color: var(--d-text); text-align: left;
}
.dw :where(button) { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.dw-bar { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; border-bottom: 1px solid var(--d-line); white-space: nowrap; }
.dw-lights { display: flex; gap: 7px; margin-right: 6px; }
.dw-lights i { width: 11px; height: 11px; border-radius: 50%; background: var(--d-line); }
.dw-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.dw-path { font: 400 12px var(--d-sans); color: var(--d-dim); overflow: hidden; text-overflow: ellipsis; }
.dw-toggles { display: flex; gap: 6px; margin-left: auto; }
.dw-toggles span { padding: 3px 9px; border: 1px solid var(--d-line); border-radius: 4px; font-weight: 600; font-size: 11.5px; }
.dw-toggles .on { background: var(--d-text); border-color: var(--d-text); color: #000; }
.dw-toggles .busy { border-color: var(--d-text); }

/* The preview sets the height: a 16:9 picture over its transport bar. */
.dw-body { display: grid; grid-template-columns: 210px minmax(280px, 0.86fr) minmax(0, 1.3fr); }

.dw-side { display: flex; flex-direction: column; gap: 3px; padding: 14px 10px; background: var(--d-side); border-right: 1px solid var(--d-line); color: var(--d-dim); overflow: hidden; }
.dw-brand { font: 800 17px/1 var(--d-sans); font-stretch: 68%; color: var(--d-text); margin: 2px 4px 12px; }
.dw-new { padding: 6px 9px; border: 1px solid var(--d-line); border-radius: 5px; color: var(--d-text); margin-bottom: 12px; }
.dw-group { font-size: 10.5px; margin: 0 4px 4px; }
.dw-session { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 5px; color: var(--d-text); transition: background 0.2s; }
.dw-session small { color: var(--d-dim); font-size: 10.5px; }
.dw-session span, .dw-session small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw-session:hover { background: rgb(255 255 255 / 0.04); }
.dw-session[aria-pressed="true"] { background: var(--d-raise); box-shadow: inset 2px 0 0 var(--d-text); }
.dw-session:focus-visible { outline: 2px solid var(--d-text); outline-offset: -2px; }

.dw-chat { display: flex; flex-direction: column; min-width: 0; background: var(--d-chat); border-right: 1px solid var(--d-line); }
.dw-log { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; padding: 18px 18px 12px; overflow: hidden; }
.dw-user { margin: 0 0 4px; padding: 9px 12px; border-radius: 4px; background: var(--d-raise); }
.dw-caret { display: inline-block; width: 7px; height: 1.05em; margin-left: 1px; vertical-align: -0.18em; background: var(--d-text); animation: dw-blink 1s steps(2) infinite; }
.dw-step { display: flex; align-items: center; gap: 9px; margin: 0; color: var(--d-dim); font-size: 12px; animation: dw-in 0.35s var(--d-ease); }
.dw-step i { position: relative; flex: none; width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--d-dim); }
.dw-step.run i { border-color: var(--d-text); border-right-color: transparent; animation: dw-spin 0.8s linear infinite; }
.dw-step.done i { border-color: var(--d-text); background: var(--d-text); }
.dw-step.done i::after { content: ""; position: absolute; left: 3.5px; top: 1px; width: 3px; height: 6px; border: solid #000; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.dw-step code, .dw-reply code { font: 400 10.5px var(--d-mono); font-stretch: 87.5%; color: var(--d-code); background: var(--d-raise); padding: 1px 6px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dw-reply { margin: 4px 0 0; animation: dw-in 0.45s var(--d-ease); }
.dw-reply u { text-decoration-color: var(--d-dim); text-underline-offset: 0.2em; }
.dw-job { display: flex; align-items: center; gap: 10px; margin: 0 18px 12px; padding: 8px 11px; border: 1px solid var(--d-line); border-radius: 6px; font-size: 11.5px; transition: border-color 0.3s; }
.dw-job b { font-weight: 600; white-space: nowrap; }
.dw-job .track { flex: 1; height: 4px; background: var(--d-line); border-radius: 2px; overflow: hidden; }
.dw-job .track i { display: block; height: 100%; width: 0; background: var(--d-text); }
.dw-job .pct { font: 400 10.5px var(--d-mono); font-stretch: 87.5%; color: var(--d-dim); min-width: 4.5ch; text-align: right; }
.dw-job.done { border-color: var(--d-text); }
.dw-composer { display: flex; align-items: center; gap: 10px; margin: 0 18px 16px; padding: 10px 12px; border: 1px solid var(--d-line); border-radius: 6px; color: var(--d-dim); }
.dw-composer span { flex: 1; }
.dw-composer kbd { font: 400 10px var(--d-mono); padding: 2px 6px; border: 1px solid var(--d-line); border-radius: 3px; }

.dw-preview { display: flex; flex-direction: column; min-width: 0; background: #000; }
.dw-picture { position: relative; flex: 1; display: grid; place-items: center; overflow: hidden; }
.dw-chat, .dw-side { min-height: 0; }
.dw-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; }
.dw-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; transition: opacity 0.35s ease; }
.dw-frame video.out { opacity: 0; }
.dw-look { position: absolute; left: 12px; bottom: 12px; padding: 4px 8px; border-radius: 3px; background: rgb(0 0 0 / 72%); font: 400 10.5px var(--d-mono); font-stretch: 87.5%; letter-spacing: 0.04em; text-transform: uppercase; color: var(--d-text); }
.dw-transport { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 14px; border-top: 1px solid #1c1d1f; color: var(--d-dim); }
.dw-play { width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent var(--d-text); }
.dw-time { font: 400 10.5px var(--d-mono); font-stretch: 87.5%; color: var(--d-text); }
.dw-scrub { position: relative; flex: 1; height: 3px; border-radius: 2px; background: rgb(255 255 255 / 0.2); }
.dw-scrub i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 2px; background: var(--d-signal); }
.dw-scrub b { position: absolute; top: -5px; width: 2px; height: 13px; margin-left: -1px; background: var(--d-signal); left: 0; }

@keyframes dw-blink { 50% { opacity: 0; } }
@keyframes dw-spin { to { transform: rotate(360deg); } }
@keyframes dw-in { from { opacity: 0; transform: translateY(6px); } }

/* ── Looks: the six the app starts from. Picking one plays its project above. ── */
.desk-looks { margin-top: 28px; }
.desk-looks-head { display: flex; justify-content: space-between; gap: 16px; margin: 0 0 12px; font: 400 0.74rem var(--d-mono); font-stretch: 87.5%; letter-spacing: 0.04em; text-transform: uppercase; color: var(--d-dim); }
.desk-looks ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.desk-look { display: block; width: 100%; padding: 0; border: 0; background: none; color: var(--d-dim); font: 400 0.82rem/1.3 var(--d-sans); text-align: left; cursor: pointer; }
.desk-look video { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; outline: 1px solid var(--d-line); outline-offset: -1px; transition: outline-color 0.2s, opacity 0.2s; opacity: 0.72; }
.desk-look span { display: block; margin-top: 8px; }
.desk-look:hover video { opacity: 1; }
.desk-look[aria-pressed="true"] { color: var(--d-text); }
.desk-look[aria-pressed="true"] video { opacity: 1; outline: 2px solid var(--d-text); outline-offset: 2px; }
.desk-look:focus-visible { outline: none; }
.desk-look:focus-visible video { outline: 2px solid var(--d-signal); outline-offset: 2px; }

/* ── What it does. ── */
.desk-points { list-style: none; margin: clamp(64px, 8cqi, 104px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 48px; counter-reset: desk; }
.desk-points li { padding-top: 18px; border-top: 2px solid var(--d-line); color: var(--d-dim); font-size: 1rem; line-height: 1.5; counter-increment: desk; }
.desk-points li::before { content: counter(desk, decimal-leading-zero); display: block; margin-bottom: 14px; font: 400 0.74rem var(--d-mono); font-stretch: 87.5%; color: var(--d-dim); }
.desk-points b { display: block; margin-bottom: 6px; font: 800 1.7rem/1 var(--d-sans); font-stretch: 68%; color: var(--d-text); }

/* The closing ask. */
.desk-close { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px 40px; margin-top: clamp(64px, 8cqi, 104px); padding-top: 36px; border-top: 2px solid var(--d-text); }
.desk-close p { flex: 1 1 30rem; max-width: 56rem; margin: 0; font: 800 clamp(2rem, 4.2cqi, 3.6rem)/0.92 var(--d-sans); font-stretch: 68%; text-wrap: balance; }
.desk-close .desk-dl-btn { flex: none; }
.desk-close p span { color: var(--d-dim); }

/* ── Narrower sections. ── */
@container desk (max-width: 1060px) {
	.desk-top { grid-template-columns: minmax(0, 1fr); }
	.dw-body { grid-template-columns: 190px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
	.dw-side { grid-row: 1 / span 2; }
	.dw-preview { grid-column: 2; grid-row: 1; }
	.dw-chat { grid-column: 2; grid-row: 2; border-right: 0; border-top: 1px solid var(--d-line); }
	.dw-log { min-height: 230px; }
	.desk-looks ul { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.desk-points { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container desk (max-width: 640px) {
	.desk-wrap { padding-inline: 16px; }
	.desk-lede { font-size: 1.08rem; }
	.desk-dl-btn { width: 100%; justify-content: center; }
	.dw-body { grid-template-columns: minmax(0, 1fr); }
	.dw-side, .dw-path, .dw-toggles .files, .dw-composer kbd { display: none; }
	.dw-preview, .dw-chat { grid-column: 1; }
	.dw-log { min-height: 210px; padding-inline: 14px; }
	.dw-job, .dw-composer { margin-inline: 14px; }
	.desk-looks ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.desk-points { grid-template-columns: minmax(0, 1fr); gap: 28px; }
	.desk-looks-head span + span { display: none; }
	.desk-kicker span:nth-child(3) { display: none; }
}

/* ── Compact: at the foot of a blog post. ── */
.desk--compact { margin-top: 4rem; border-radius: 6px; }
.desk--compact .desk-wrap { padding: 44px 28px 32px; }
.desk--compact h2 { font-size: clamp(2.5rem, 8cqi, 4.4rem); }
.desk--compact .desk-top { grid-template-columns: minmax(0, 1fr); gap: 22px; }
.desk--compact .desk-lede { font-size: 1.05rem; margin-bottom: 20px; }
.desk--compact .desk-stage { margin-top: 36px; }
.desk--compact .dw-log { min-height: 200px; }
.desk--compact .desk-more { margin: 22px 0 0; font-size: 0.9rem; color: var(--d-dim); }
.desk--compact .desk-more a { color: var(--d-text); }

@media (prefers-reduced-motion: reduce) {
	.desk *, .desk *::before, .desk *::after { animation: none !important; transition: none !important; }
}
