/* Jotary styles. Served from static assets (ASSETS binding).
 *
 * Theming: a render-blocking classic script (/js/theme.js) sets
 *   <html data-theme="light|dark" data-theme-pref="system|light|dark">
 * BEFORE first paint. Palette is driven by [data-theme]; the no-JS fallback below
 * follows the OS via prefers-color-scheme. The toggle icon shown is driven by
 * [data-theme-pref].
 *
 * Visual reference: the Jotary/Pastefire demo — warm off-white dot-grid canvas, a
 * white editor card framed by top/bottom toolbars with rounded-full control pills,
 * sharp brand-orange action buttons, and a sticky translucent header.
 */

/* ---- self-hosted fonts (served from /fonts via the ASSETS binding) ---- */
@font-face {
	font-family: 'Geist';
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url('/fonts/geist-variable.woff2') format('woff2');
}
@font-face {
	font-family: 'Geist Mono';
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url('/fonts/geist-mono-variable.woff2') format('woff2');
}

/* ---- design tokens ---- */
:root {
	color-scheme: light;
	--page-bg: #fffdfa;
	--bg: #ffffff;
	--bg-subtle: #faf9f7;
	--fg: #0a0a0a;
	--muted: #737373;
	--border: #d7d7d7;
	--input-border: #e0e0e0;
	--code-bg: #f6f7f9;
	--accent: #1447e6;
	--brand: #ff5f1f;
	--brand-hover: #e8501a;
	--brand-fg: #ffffff;
	--ring: #1447e6;
	--dot: rgba(0, 0, 0, 0.14);
	--ok: #009966;
	--ok-bg: #ecfdf5;
	--ok-border: rgba(110, 231, 183, 0.7);
	--warn: #b45309;
	--btn-secondary-bg: #f5f5f5;
	--btn-secondary-fg: #737373;
	--radius: 3px;
	--radius-pill: 999px;
	--maxw: 1120px;
	--shellw: 1200px;
	--prosew: 760px;
}

/* No-JS fallback: follow the OS when the theme script hasn't set data-theme. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) {
		color-scheme: dark;
		--page-bg: #030303;
		--bg: #141518;
		--bg-subtle: #1a1b1f;
		--fg: #fafafa;
		--muted: #a1a1a1;
		--border: #404249;
		--input-border: #4a4c52;
		--code-bg: #1c1d21;
		--accent: #6ea0ff;
		--brand: #ff7a45;
		--brand-hover: #ff5f1f;
		--brand-fg: #1a1a1a;
		--ring: #6ea0ff;
		--dot: rgba(255, 255, 255, 0.1);
		--ok: #34d399;
		--ok-bg: #052e1f;
		--ok-border: rgba(52, 211, 153, 0.4);
		--btn-secondary-bg: #1c1d21;
		--btn-secondary-fg: #a1a1a1;
	}
}

/* JS-resolved dark theme. */
:root[data-theme='dark'] {
	color-scheme: dark;
	--page-bg: #030303;
	--bg: #141518;
	--bg-subtle: #1a1b1f;
	--fg: #fafafa;
	--muted: #a1a1a1;
	--border: #404249;
	--input-border: #4a4c52;
	--code-bg: #1c1d21;
	--accent: #6ea0ff;
	--brand: #ff7a45;
	--brand-hover: #ff5f1f;
	--brand-fg: #1a1a1a;
	--ring: #6ea0ff;
	--dot: rgba(255, 255, 255, 0.1);
	--ok: #34d399;
	--ok-bg: #052e1f;
	--ok-border: rgba(52, 211, 153, 0.4);
	--btn-secondary-bg: #1c1d21;
	--btn-secondary-fg: #a1a1a1;
}

* {
	box-sizing: border-box;
}

html,
body {
	min-height: 100%;
}

body {
	margin: 0;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	font-family:
		'Geist',
		ui-sans-serif,
		system-ui,
		-apple-system,
		'Segoe UI',
		Roboto,
		Helvetica,
		Arial,
		sans-serif;
	color: var(--fg);
	line-height: 1.5;
	background-color: var(--page-bg);
	/* Subtle dot-grid canvas; the opaque editor card sits on top of it. */
	background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px);
	background-size: 24px 24px;
	background-position: -1px -1px;
	background-attachment: fixed;
}

main {
	flex: 1 0 auto;
	width: 100%;
	max-width: var(--maxw);
	margin: 0 auto;
	padding: 2.5rem 2rem 0;
}

a {
	color: var(--accent);
}

code,
pre {
	font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

button {
	font: inherit;
	cursor: pointer;
}

:focus-visible {
	outline: 2px solid var(--ring);
	outline-offset: 2px;
}

/* ---- header (sticky, translucent) ---- */
header.site {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--bg) 92%, transparent);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
}
.site__inner {
	max-width: var(--shellw);
	margin: 0 auto;
	height: 56px;
	padding: 0 1.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}
.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	text-decoration: none;
}
.brand__logo {
	height: 26px;
	width: auto;
	display: block;
	transition: transform 0.15s ease;
}
.brand:hover .brand__logo {
	transform: scale(1.04);
}
.brand__logo--dark {
	display: none;
}
:root[data-theme='dark'] .brand__logo--light {
	display: none;
}
:root[data-theme='dark'] .brand__logo--dark {
	display: block;
}
/* No-JS fallback: when the theme script hasn't set data-theme, follow the OS so the
   dark wordmark shows on a dark header (otherwise the dark-text logo is unreadable). */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) .brand__logo--light {
		display: none;
	}
	:root:not([data-theme]) .brand__logo--dark {
		display: block;
	}
}

.site-nav {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}
.site-nav a {
	display: inline-flex;
	align-items: center;
	padding: 0.375rem 0.75rem;
	border-radius: 6px;
	color: var(--muted);
	text-decoration: none;
	font-size: 0.875rem;
	font-weight: 400;
	line-height: 1.25;
	transition:
		color 0.15s,
		background-color 0.15s;
}
.site-nav a:hover {
	color: var(--fg);
	background: color-mix(in srgb, var(--muted) 18%, transparent);
}

/* theme toggle — hidden by default; shown only once the head script sets
   data-theme-pref (i.e. JS ran), so no-JS users don't see a dead control. The attr
   is set before first paint, so there is no flash of the button appearing. */
.theme-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: var(--muted);
}
:root[data-theme-pref] .theme-toggle {
	display: inline-flex;
}
.theme-toggle:hover {
	color: var(--fg);
	background: color-mix(in srgb, var(--muted) 18%, transparent);
}
.theme-toggle__icon {
	width: 18px;
	height: 18px;
	display: none;
}
:root:not([data-theme-pref]) .theme-toggle__icon--system,
:root[data-theme-pref='system'] .theme-toggle__icon--system {
	display: block;
}
:root[data-theme-pref='light'] .theme-toggle__icon--light {
	display: block;
}
:root[data-theme-pref='dark'] .theme-toggle__icon--dark {
	display: block;
}

/* ---- footer ---- */
.site-footer {
	flex-shrink: 0;
	margin-top: auto;
	background: transparent;
	border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.site-footer__inner {
	max-width: var(--shellw);
	margin: 0 auto;
	height: 48px;
	padding: 0 1.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	color: var(--muted);
	font-size: 0.75rem;
}
.site-footer__brand a {
	color: var(--fg);
	font-weight: 500;
	text-decoration: none;
}
.site-footer__brand a:hover {
	color: var(--accent);
}
.site-footer__by {
	color: var(--muted);
}
.site-footer__links {
	display: flex;
	gap: 1rem;
}
.site-footer__links a {
	color: var(--muted);
	text-decoration: none;
}
.site-footer__links a:hover {
	color: var(--accent);
}

/* ---- buttons (legacy .btn — used by created/reader/me/edit; DO NOT repurpose) ---- */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 0.95rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--fg);
	text-decoration: none;
	font-size: 0.9rem;
	line-height: 1.1;
	white-space: nowrap;
}
.btn:hover {
	border-color: var(--accent);
	color: var(--accent);
}
.btn--primary,
.btn--primary:hover {
	background: var(--brand);
	color: var(--brand-fg);
	border-color: var(--brand);
}
.btn--primary:hover {
	background: var(--brand-hover);
	border-color: var(--brand-hover);
}
.btn--ghost {
	background: transparent;
}
.btn--toggle[aria-selected='true'] {
	border-color: var(--accent);
	color: var(--accent);
}
[data-copied] {
	border-color: var(--ok) !important;
	color: var(--ok) !important;
}
[data-copy-failed] {
	border-color: var(--warn) !important;
	color: var(--warn) !important;
}
/* On the orange primary copy button, also swap the background so the green/amber
   feedback text stays legible (green-on-orange would be unreadable). */
.btn--primary[data-copied] {
	background: var(--ok) !important;
	color: #fff !important;
}
.btn--primary[data-copy-failed] {
	background: var(--warn) !important;
	color: #fff !important;
}

/* ---- form fields ---- */
.field-label {
	display: block;
	font-size: 0.8rem;
	color: var(--muted);
	margin-bottom: 0.25rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}
.field--inline {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}
.field--inline .field-label {
	display: inline;
	margin: 0;
	text-transform: none;
	letter-spacing: normal;
	font-size: 0.8rem;
}
select,
.field select {
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--input-border);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--fg);
	font-size: 0.85rem;
}

/* ---- create / edit card ---- */
.jot-form {
	width: 100%;
}
.jot-card {
	display: flex;
	flex-direction: column;
	border: 1px solid rgba(220, 220, 220, 0.4);
	border-radius: var(--radius);
	background: var(--bg);
	overflow: hidden;
	box-shadow:
		0 1px 4px 0 rgba(15, 23, 42, 0.06),
		0 12px 40px -4px rgba(15, 23, 42, 0.11);
}
.jot-card__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	padding: 12px 20px;
	background: transparent;
}
.jot-card__bar--top {
	position: relative;
	border-bottom: 1px solid var(--border);
}
.jot-card__bar--bottom {
	border-top: 1px solid var(--border);
}

/* control pills */
.pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 30px;
	padding: 6px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-pill);
	background: var(--bg);
	color: var(--fg);
	font-size: 12px;
	font-weight: 400;
	line-height: 1;
	white-space: nowrap;
	font-family: inherit;
}
.pill--mono {
	font-family: 'Geist Mono', ui-monospace, monospace;
}
.pill--tight {
	padding: 6px 10px;
}
/* language pill = the styled #syntax <select> */
.pill--lang {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	padding-right: 26px;
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
}
.pill--lang:hover {
	background-color: var(--code-bg);
}
.jot-card__lang {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.pill-dot {
	width: 6px;
	height: 6px;
	border-radius: 9999px;
	background: #9ca3af;
	flex: 0 0 auto;
}
.jot-card__left {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.jot-card__right {
	display: inline-flex;
	align-items: center;
	gap: 14px;
}
.jot-card__change {
	background: none;
	border: 0;
	padding: 0;
	color: var(--muted);
	font-size: 12px;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.jot-card__change:hover {
	color: var(--fg);
}
.pill--privacy {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	z-index: 1;
	background: var(--ok-bg);
	color: var(--ok);
	border-color: var(--ok-border);
	font-weight: 500;
	padding: 6px 10px;
}
.jot-card__wrap {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 500;
	color: var(--muted);
	cursor: pointer;
	user-select: none;
}
.jot-card__wrap:hover {
	color: var(--fg);
}
.jot-card__wrap input {
	width: 12px;
	height: 12px;
	accent-color: var(--brand);
	margin: 0;
}
.jot-card__counter {
	color: var(--muted);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

/* bottom toolbar groups */
.jot-toolbar__left {
	display: flex;
	align-items: center;
	gap: 8px;
}
.jot-toolbar__right {
	display: flex;
	align-items: center;
	gap: 12px;
	justify-content: flex-end;
	margin-left: auto;
}
.jot-gear {
	width: 28px;
	height: 28px;
	border-radius: 9999px;
	background: rgba(255, 95, 31, 0.1);
	border: 1px solid rgba(255, 95, 31, 0.4);
	color: #ff5f1f;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	flex: 0 0 auto;
}
.jot-gear:hover {
	background: rgba(255, 95, 31, 0.18);
}

/* settings popover: the gear is a <summary>; the panel pops up over the editor
   (the card clips overflow, so it opens upward, never below the card edge). */
.jot-settings {
	position: relative;
	display: inline-flex;
}
.jot-settings > summary {
	cursor: pointer;
	list-style: none;
}
.jot-settings > summary::-webkit-details-marker {
	display: none;
}
.jot-settings[open] > summary.jot-gear {
	background: rgba(255, 95, 31, 0.18);
}
.jot-settings__panel {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 0;
	z-index: 30;
	width: 280px;
	max-width: calc(100vw - 2rem);
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}
.jot-settings__row {
	display: flex;
	flex-direction: column;
	gap: 5px;
}
.jot-settings__row label {
	font-size: 12px;
	font-weight: 500;
	color: var(--fg);
}
.jot-settings__hint {
	color: var(--muted);
	font-weight: 400;
}
.jot-settings__panel select,
.jot-settings__panel input {
	width: 100%;
	padding: 7px 9px;
	border: 1px solid var(--input-border);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--fg);
	font-size: 13px;
	font-family: inherit;
}

/* rendered preview pane (toggled with the editor by the Preview button) */
.jot-preview {
	min-height: 450px;
	padding: 16px 20px 48px;
	overflow: auto;
	font-size: 14px;
	line-height: 1.7;
}
.jot-preview > :first-child {
	margin-top: 0;
}
.jot-preview__empty {
	color: var(--muted);
	font-style: italic;
}

/* pill-over-select: a visible pill with a transparent native select overlaid as the
   real form value (keeps the progressive-enhancement contract). */
.jot-pill-wrap {
	position: relative;
	display: inline-flex;
}
.jot-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 30px;
	padding: 6px 10px;
	border-radius: var(--radius-pill);
	background: var(--bg);
	border: 1px solid var(--border);
	color: var(--fg);
	font-size: 12px;
	font-weight: 400;
	line-height: 16px;
	pointer-events: none;
}
.jot-pill-select {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	border: 0;
	margin: 0;
	padding: 0;
}
.jot-pill-wrap:hover .jot-pill {
	background: var(--code-bg);
}

/* sharp action buttons (Preview / create / Copy Link) */
.jot-action {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 36px;
	padding: 0 16px;
	border: 0;
	border-radius: 0;
	background: var(--bg);
	color: var(--fg);
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	font-family: inherit;
	cursor: pointer;
}
.jot-action--primary {
	background: var(--brand);
	color: var(--brand-fg);
}
.jot-action--primary:hover {
	background: var(--brand-hover);
}
.jot-action--ghost {
	background: var(--btn-secondary-bg);
	color: var(--btn-secondary-fg);
	padding: 0 20px;
}
.jot-action--ghost:hover {
	color: var(--fg);
}

.jot-form__status {
	color: var(--muted);
	font-size: 0.85rem;
}

/* editor body fallback textarea (pre-hydration parity with CodeMirror) */
.jot-form__editor {
	display: flex;
	flex-direction: column;
	flex: 1;
}
.jot-form__textarea {
	display: block;
	width: 100%;
	min-height: 450px;
	padding: 12px 20px 48px;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--fg);
	font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 14px;
	line-height: 1.625;
	resize: vertical;
}
.jot-form__textarea::placeholder {
	color: #888;
}

/* ---- CodeMirror host (upgrades the textarea in place) ---- */
.cm-host {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 450px;
	border: 0;
	background: transparent;
	overflow: hidden;
}
/* The explicit display:flex above beats the UA [hidden] rule, so the Preview toggle's
   hidden attribute wouldn't hide the editor without this. */
.cm-host[hidden] {
	display: none;
}
.cm-host .cm-editor {
	height: 100%;
	background: transparent;
	font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 14px;
}
.cm-host .cm-scroller {
	overflow: auto;
	flex: 1 1 0%;
	min-height: 0;
	line-height: 1.625;
}
.cm-host .cm-content {
	padding: 12px 20px 48px;
	color: var(--fg);
	caret-color: var(--fg);
}
.cm-host .cm-gutters {
	background: transparent;
	border-right: none;
	font-family: 'Geist Mono', ui-monospace, monospace;
}
.cm-host .cm-lineNumbers .cm-gutterElement {
	padding: 0 12px 0 16px;
	color: color-mix(in srgb, var(--fg) 28%, transparent);
}
.cm-host .cm-selectionBackground,
.cm-host .cm-content ::selection {
	background-color: rgba(255, 95, 31, 0.2) !important;
}
.cm-host .cm-cursor {
	border-left-color: var(--fg);
}
.cm-host .cm-placeholder {
	color: #888;
}

/* ---- "Built for agents" CTA (below the card) ---- */
.agents-cta {
	display: flex;
	justify-content: center;
	margin: 2.25rem 0 3rem;
}
.agents-cta__link {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	height: 40px;
	padding: 0 1.25rem;
	font-size: 14px;
	font-weight: 500;
	color: var(--fg);
	text-decoration: none;
	background: transparent;
	border-radius: 0;
}
.agents-cta__link::before,
.agents-cta__link::after {
	content: '';
	position: absolute;
	width: 10px;
	height: 10px;
	border: 1px solid var(--border);
}
.agents-cta__link::before {
	left: 0;
	top: 0;
	border-right: 0;
	border-bottom: 0;
}
.agents-cta__link::after {
	right: 0;
	bottom: 0;
	border-left: 0;
	border-top: 0;
}
.agents-cta__link:hover {
	color: var(--accent);
}

/* ---- reader ---- */
.jot__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.75rem;
}
.jot__title {
	margin: 0;
	font-size: 1.3rem;
}
.jot-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	margin: 0.5rem 0 1rem;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
	font-size: 0.85rem;
}
.jot-meta div {
	margin: 0;
}
.jot-meta dt {
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-size: 0.7rem;
}
.jot-meta dd {
	margin: 0;
	font-variant-numeric: tabular-nums;
}
.jot-actions {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1rem;
	flex-wrap: wrap;
}
.jot-toggle__controls {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}
.jot-code,
.rawhtml pre {
	padding: 0.9rem 1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow-x: auto;
}
.jot-code--plain {
	background: var(--code-bg);
}
.rawhtml pre {
	white-space: pre-wrap;
	word-break: break-word;
}

/* ---- prose page widths ---- */
.created,
.me,
.api-docs,
.legal {
	max-width: var(--prosew);
}
/* Edit page: the heading/hint/danger stay readable-width, but the editor card itself
   spans full width (there's no reader Actions sidebar in edit mode). */
.edit__head,
.edit__danger {
	max-width: var(--prosew);
}

/* ---- legal (terms / privacy) ---- */
.legal {
	line-height: 1.65;
}
.legal h2 {
	margin-top: 1.75rem;
	font-size: 1.1rem;
}
.legal__meta {
	color: var(--muted);
	font-size: 0.85rem;
	margin-top: -0.25rem;
}

/* ---- created / fields ---- */
.created__field {
	margin: 1.25rem 0;
}
.created__row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}
.created__row code {
	flex: 1;
	min-width: 0;
	padding: 0.55rem 0.7rem;
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow-x: auto;
	word-break: break-all;
}
.created__field--warn .created__warn {
	color: var(--warn);
	font-size: 0.9rem;
}
.created__placeholder {
	color: var(--muted);
	font-style: italic;
}
.created__actions,
.me__actions,
.edit__danger {
	margin-top: 1.5rem;
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

/* ---- me ---- */
.me__hint,
.edit__hint {
	color: var(--muted);
}
.me__list {
	list-style: none;
	padding: 0;
}
.me__item {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--border);
}
.me__when {
	color: var(--muted);
	font-size: 0.85rem;
}

/* ---- api docs ---- */
.api-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
	margin: 1rem 0;
}
.api-table th,
.api-table td {
	text-align: left;
	padding: 0.5rem;
	border-bottom: 1px solid var(--border);
	vertical-align: top;
}
.sample {
	padding: 0.75rem;
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	white-space: pre;
	overflow-x: auto;
}

/* ---- unlock / state pages ---- */
.state {
	text-align: center;
	padding: 3rem 1rem;
	max-width: var(--prosew);
	margin: 0 auto;
}
.unlock-form {
	display: flex;
	gap: 0.5rem;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 1rem;
}
.unlock-form input {
	padding: 0.5rem 0.7rem;
	border: 1px solid var(--input-border);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--fg);
}
.form-error {
	color: var(--warn);
}

/* ---- corner brackets (reference frame accent) ---- */
.corner {
	position: absolute;
	width: 7px;
	height: 7px;
	pointer-events: none;
	z-index: 2;
	color: var(--border);
}
.corner::before,
.corner::after {
	content: '';
	position: absolute;
	background: currentColor;
}
.corner::before {
	left: 0;
	right: 0;
	height: 1px;
	top: 0;
}
.corner::after {
	top: 0;
	bottom: 0;
	width: 1px;
	left: 0;
}
.corner--tl {
	top: -1px;
	left: -1px;
}
.corner--tr {
	top: -1px;
	right: -1px;
}
.corner--tr::after {
	left: auto;
	right: 0;
}
.corner--bl {
	bottom: -1px;
	left: -1px;
}
.corner--bl::before {
	top: auto;
	bottom: 0;
}
.corner--br {
	bottom: -1px;
	right: -1px;
}
.corner--br::before {
	top: auto;
	bottom: 0;
}
.corner--br::after {
	left: auto;
	right: 0;
}

/* dashed frame for marketing sections */
.framed {
	position: relative;
	border: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
}

/* bracket the Preview button (corners hug its box) */
.jot-action-wrap {
	position: relative;
	display: inline-flex;
}
.jot-action-wrap .corner {
	color: color-mix(in srgb, var(--fg) 35%, transparent);
}

/* ---- agents marketing page ---- */
.agents {
	max-width: var(--maxw);
	margin: 0 auto;
}
.agents .framed + .framed {
	border-top: 0;
}
.agents-hero {
	padding: clamp(2.5rem, 6vw, 5rem) clamp(1.25rem, 4vw, 3rem);
	background: linear-gradient(to top, color-mix(in srgb, var(--brand) 6%, transparent), transparent 60%);
}
.agents-hero__eyebrow,
.agents-split__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 0.75rem;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
}
.agents-split__icon {
	display: inline-flex;
}
.agents-split__icon svg {
	width: 16px;
	height: 16px;
}
.agents-split__icon--terminal {
	color: var(--brand);
}
.agents-split__icon--browser {
	color: #2e9e5b;
}
.agents-split__icon--handoff {
	color: var(--accent);
}
.agents-split__icon--ephemeral {
	color: #a855f7;
}
.agents-hero__title {
	margin: 0 0 1rem;
	font-size: clamp(2rem, 5vw, 3.5rem);
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.05;
	max-width: 16ch;
}
.agents-hero__accent {
	color: var(--brand);
}
.agents-hero__sub {
	margin: 0 0 1.75rem;
	font-size: 1.125rem;
	color: var(--muted);
	max-width: 52ch;
}
.agents-hero__cta,
.agents-final__cta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}
.agents-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
}
.agents-grid__cell {
	padding: 1.75rem 1.5rem;
	border-left: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
}
.agents-grid__cell:first-child {
	border-left: 0;
}
.agents-grid__cell h3 {
	margin: 0 0 0.6rem;
	font-size: 1rem;
	font-weight: 600;
}
.agents-grid__cell p {
	margin: 0;
	font-size: 0.9rem;
	color: var(--muted);
	line-height: 1.55;
}
.agents-split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	align-items: stretch;
}
.agents-split__copy {
	padding: clamp(2rem, 4vw, 3rem);
}
.agents-split__title {
	margin: 0 0 1rem;
	font-size: clamp(1.5rem, 3vw, 2.25rem);
	font-weight: 600;
	letter-spacing: -0.015em;
}
.agents-split__body {
	margin: 0 0 0.85rem;
	color: var(--muted);
	line-height: 1.6;
	max-width: 46ch;
}
.agents-split__demo {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(1.5rem, 3vw, 2.5rem);
	border-left: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
	background: color-mix(in srgb, var(--bg-subtle) 60%, transparent);
}
.agents-split--flip .agents-split__copy {
	order: 2;
}
.agents-split--flip .agents-split__demo {
	order: 1;
	border-left: 0;
	border-right: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
}
/* window title bar (shared by terminal + ephemeral settings card) */
.winbar {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 12px;
	background: var(--bg-subtle);
	border-bottom: 1px solid var(--border);
}
.winbar__dot {
	width: 10px;
	height: 10px;
	border-radius: 9999px;
	background: var(--border);
}
.winbar__dot--r {
	background: #ec6a5e;
}
.winbar__dot--y {
	background: #f4bf4f;
}
.winbar__dot--g {
	background: #61c554;
}
.winbar__title {
	margin-left: 6px;
	font-size: 11px;
	color: var(--muted);
	font-family: 'Geist Mono', ui-monospace, monospace;
}

/* report syntax coloring (browser + ephemeral docs) */
.rep-h {
	color: var(--muted);
}
.rep-g {
	color: #2e9e5b;
}
:root[data-theme='dark'] .rep-g {
	color: #4ade80;
}
.rep-a {
	color: var(--brand);
}

.terminal {
	width: 100%;
	max-width: 460px;
	border: 1px solid var(--border);
	border-radius: 6px;
	overflow: hidden;
	background: var(--bg);
	box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}
.terminal__body {
	margin: 0;
	padding: 16px;
	font-family: 'Geist Mono', ui-monospace, monospace;
	font-size: 12.5px;
	line-height: 1.65;
	color: var(--fg);
	white-space: pre;
	overflow-x: auto;
}

/* browser-window mock: a raw-URL bar + plain-text body with a bottom fade */
.browser {
	width: 100%;
	max-width: 460px;
	border: 1px solid var(--border);
	border-radius: 6px;
	overflow: hidden;
	background: var(--bg);
	box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}
.browser__bar {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 14px;
	background: var(--bg-subtle);
	border-bottom: 1px solid var(--border);
	color: var(--muted);
}
.browser__url {
	font-family: 'Geist Mono', ui-monospace, monospace;
	font-size: 12px;
	color: var(--fg);
}
.browser__view {
	position: relative;
	max-height: 360px;
	overflow: hidden;
}
.browser__body {
	margin: 0;
	padding: 16px;
	font-family: 'Geist Mono', ui-monospace, monospace;
	font-size: 12.5px;
	line-height: 1.7;
	color: var(--fg);
	white-space: pre;
	overflow-x: auto;
}
.browser__fade {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 56px;
	background: linear-gradient(to top, var(--bg), transparent);
}

/* tool-handoff diagram: 6 circular agent nodes + dashed wires -> central blue pill.
   Fixed 440x460 coordinate space so the SVG wires align with the positioned nodes. */
.handoff {
	position: relative;
	width: 100%;
	max-width: 420px;
	aspect-ratio: 440 / 460;
	margin: 0 auto;
}
.handoff__wires {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.handoff__wires path {
	fill: none;
	stroke: var(--accent);
	stroke-width: 1.5;
	stroke-dasharray: 4 5;
	stroke-linecap: round;
	opacity: 0.55;
}
.handoff__node {
	position: absolute;
	width: 21%;
	aspect-ratio: 1;
	transform: translate(-50%, -50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	background: var(--bg-subtle);
	border: 1px solid var(--border);
}
.handoff__node img {
	width: 40%;
	height: 40%;
	display: block;
}
/* Near-black monochrome marks (ChatGPT, Grok) are invisible on the dark node bg;
   invert them to light in dark mode only. */
:root[data-theme='dark'] .handoff__node--mono img {
	filter: invert(1) brightness(1.4);
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) .handoff__node--mono img {
		filter: invert(1) brightness(1.4);
	}
}
.handoff__node--n1 {
	left: 17%;
	top: 15%;
}
.handoff__node--n2 {
	left: 50%;
	top: 15%;
}
.handoff__node--n3 {
	left: 83%;
	top: 15%;
}
.handoff__node--n4 {
	left: 17%;
	top: 80%;
}
.handoff__node--n5 {
	left: 50%;
	top: 80%;
}
.handoff__node--n6 {
	left: 83%;
	top: 80%;
}
.handoff__pill {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	border-radius: 9999px;
	background: var(--accent);
	color: #fff;
	font-family: 'Geist Mono', ui-monospace, monospace;
	font-size: 11.5px;
	white-space: nowrap;
	box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}
.handoff__pill code {
	color: #fff;
}
.handoff__pill-sep {
	opacity: 0.5;
}

/* ephemeral panel: a "New jot" settings window + a content card with status + doc */
.eph {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	width: 100%;
	max-width: 380px;
}
.eph__settings,
.eph__content {
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--bg);
	overflow: hidden;
	box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}
.eph__settings-body {
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
	padding: 1rem;
}
.eph-field__label {
	margin: 0 0 0.35rem;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
}
.eph-field__select {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 34px;
	padding: 0 0.7rem;
	border-radius: 6px;
	border: 1px solid color-mix(in srgb, #a855f7 45%, var(--border));
	background: color-mix(in srgb, #a855f7 8%, transparent);
	color: color-mix(in srgb, #7e22ce 100%, transparent);
	font-size: 12px;
}
:root[data-theme='dark'] .eph-field__select {
	color: #d8b4fe;
}
.eph-field__select svg {
	color: #a855f7;
}
.eph__status {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.6rem 0.9rem;
	background: color-mix(in srgb, #a855f7 8%, transparent);
	border-bottom: 1px solid var(--border);
	font-size: 11px;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}
.eph__status-left {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--fg);
}
.eph__doc {
	margin: 0;
	padding: 1rem;
	font-family: 'Geist Mono', ui-monospace, monospace;
	font-size: 12px;
	line-height: 1.7;
	color: var(--fg);
	white-space: pre;
	overflow-x: auto;
}

.agents-final {
	text-align: center;
	padding: clamp(2.5rem, 5vw, 4rem) 1.5rem;
}
.agents-final h2 {
	margin: 0 0 0.75rem;
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 600;
}
.agents-final p {
	margin: 0 0 1.5rem;
	color: var(--muted);
}
.agents-final__cta {
	justify-content: center;
}

/* ---- reader 2-column layout + Actions sidebar ---- */
.jot-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 1.5rem;
	align-items: start;
}
.jot-side {
	position: sticky;
	top: 76px;
}
.jot-side__card {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
}
.jot-side__title {
	margin: 0 0 0.25rem;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--muted);
}
.btn--block {
	width: 100%;
	justify-content: center;
}

/* ---- settings popover polish ---- */
.jot-settings__title {
	margin: 0 0 0.5rem;
	font-size: 13px;
	font-weight: 600;
	color: var(--fg);
}
.jot-settings__help {
	margin: 0 0 2px;
	font-size: 11px;
	line-height: 1.4;
	color: var(--muted);
}

/* ---- danger button (delete) ---- */
.btn--danger {
	border-color: color-mix(in srgb, var(--warn) 50%, var(--border));
	color: var(--warn);
}
.btn--danger:hover {
	background: var(--warn);
	border-color: var(--warn);
	color: #fff;
}
.edit__danger {
	align-items: center;
}
.edit__danger-status {
	color: var(--muted);
	font-size: 0.85rem;
}

/* ---- rendered prose (reader rendered-markdown + create/edit preview) ---- */
.jot-preview > :first-child,
.rawhtml > :first-child {
	margin-top: 0;
}
.jot-preview h1,
.rawhtml h1,
.jot-preview h2,
.rawhtml h2,
.jot-preview h3,
.rawhtml h3 {
	font-weight: 600;
	letter-spacing: -0.01em;
	line-height: 1.25;
	margin: 1.4em 0 0.5em;
}
.jot-preview h1,
.rawhtml h1 {
	font-size: 1.6rem;
}
.jot-preview h2,
.rawhtml h2 {
	font-size: 1.3rem;
}
.jot-preview h3,
.rawhtml h3 {
	font-size: 1.1rem;
}
.jot-preview p,
.rawhtml p {
	margin: 0 0 0.9em;
	line-height: 1.7;
}
.jot-preview ul,
.rawhtml ul,
.jot-preview ol,
.rawhtml ol {
	margin: 0 0 0.9em;
	padding-left: 1.4em;
	line-height: 1.7;
}
.jot-preview li,
.rawhtml li {
	margin: 0.2em 0;
}
.jot-preview a,
.rawhtml a {
	color: var(--accent);
}
.jot-preview blockquote,
.rawhtml blockquote {
	margin: 0 0 0.9em;
	padding: 0.2em 1em;
	border-left: 3px solid var(--border);
	color: var(--muted);
}
.jot-preview code,
.rawhtml code {
	background: var(--code-bg);
	padding: 0.15em 0.4em;
	border-radius: 4px;
	font-size: 0.9em;
}
.jot-preview pre code,
.rawhtml pre code {
	background: none;
	padding: 0;
}

/* ---- utilities ---- */
.visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- responsive ---- */
@media (max-width: 900px) {
	.jot-layout {
		grid-template-columns: 1fr;
	}
	.jot-side {
		position: static;
	}
	.agents-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.agents-grid__cell:nth-child(3) {
		border-left: 0;
	}
	.agents-split,
	.agents-split--flip {
		grid-template-columns: 1fr;
	}
	.agents-split--flip .agents-split__copy {
		order: 1;
	}
	.agents-split--flip .agents-split__demo {
		order: 2;
		border-right: 0;
	}
	.agents-split__demo {
		border-left: 0;
		border-top: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
	}
}
@media (max-width: 640px) {
	.site__inner {
		gap: 0.5rem 0.75rem;
		padding: 0 1rem;
	}
	.brand__logo {
		height: 22px;
	}
	.site-nav {
		gap: 0.125rem;
	}
	.site-nav a {
		padding: 0.375rem 0.5rem;
		font-size: 0.8rem;
	}
	main {
		padding: 1.5rem 1rem 0;
	}
	.jot-card__bar {
		gap: 0.5rem;
		padding: 10px 12px;
	}
	.pill--privacy {
		display: none;
	}
	.site-footer__inner {
		gap: 0.5rem;
		height: auto;
		padding: 0.75rem 1rem;
	}
	.agents-grid {
		grid-template-columns: 1fr;
	}
	.agents-grid__cell {
		border-left: 0;
		border-top: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
	}
	.agents-grid__cell:first-child {
		border-top: 0;
	}
}

/* ---- admin panel (/jotbdm) ---- */
.admin {
	max-width: var(--shellw);
	margin: 0 auto;
	padding: 1.5rem 1.25rem 4rem;
}
.admin h1 {
	margin: 1.25rem 0 0.25rem;
	text-transform: lowercase;
}
.admin h2 {
	margin: 2rem 0 0.75rem;
	font-size: 1.05rem;
	text-transform: lowercase;
	color: var(--muted);
}
.admin-nav {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
	padding: 0.75rem 1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
}
.admin-nav__brand {
	font-weight: 600;
}
.admin-nav__links {
	display: flex;
	gap: 0.25rem;
	flex-wrap: wrap;
}
.admin-nav__who {
	margin-left: auto;
	color: var(--muted);
	font-size: 0.85rem;
	font-family: var(--mono, ui-monospace, monospace);
}
.admin-nav__link {
	padding: 0.35rem 0.75rem;
	border-radius: var(--radius);
	color: var(--fg);
	text-decoration: none;
	font-size: 0.9rem;
}
.admin-nav__link:hover {
	background: var(--bg-subtle);
}
.admin-nav__link.is-active {
	background: var(--brand);
	color: var(--brand-fg);
}

/* tool menu cards */
.admin__cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 1rem;
	margin-top: 1.5rem;
}
.admin__card {
	display: block;
	padding: 1rem 1.1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
	color: inherit;
	text-decoration: none;
}
.admin__card:hover {
	border-color: var(--brand);
}
.admin__card h2 {
	margin: 0 0 0.35rem;
	color: var(--fg);
	text-transform: none;
	font-size: 1rem;
}
.admin__card p {
	margin: 0;
	color: var(--muted);
	font-size: 0.9rem;
}

/* stat cards */
.stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 0.75rem;
	margin: 0.5rem 0 1rem;
}
.stat-card {
	padding: 0.9rem 1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
}
.stat-card__value {
	font-size: 1.6rem;
	font-weight: 600;
	line-height: 1.1;
}
.stat-card__label {
	margin-top: 0.25rem;
	color: var(--muted);
	font-size: 0.85rem;
}
.stat-card__hint {
	margin-top: 0.15rem;
	color: var(--muted);
	font-size: 0.7rem;
	opacity: 0.8;
}

/* lookup form + meta + actions */
.admin__lookup {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.5rem;
	margin: 1rem 0;
}
.admin__lookup label {
	flex-basis: 100%;
	font-size: 0.85rem;
	color: var(--muted);
}
.admin__lookup input {
	flex: 1 1 220px;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--input-border);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--fg);
	font-family: var(--mono, ui-monospace, monospace);
}
.admin__meta {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.35rem 1rem;
	margin: 1rem 0;
	padding: 1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-subtle);
}
.admin__meta dt {
	color: var(--muted);
	font-size: 0.85rem;
}
.admin__meta dd {
	margin: 0;
	font-family: var(--mono, ui-monospace, monospace);
	font-size: 0.85rem;
}
.admin__actions {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1rem;
	margin: 1rem 0;
	padding: 1rem;
	border: 1px dashed color-mix(in srgb, var(--warn) 45%, var(--border));
	border-radius: var(--radius);
}
.admin__check {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.85rem;
	color: var(--muted);
}
.admin__note {
	color: var(--muted);
	font-size: 0.8rem;
	max-width: 60ch;
}
.admin__ok {
	padding: 0.6rem 0.85rem;
	border: 1px solid var(--ok-border);
	border-radius: var(--radius);
	background: var(--ok-bg);
	color: var(--ok);
	font-size: 0.9rem;
}
.admin__error {
	color: var(--warn);
	font-size: 0.9rem;
}

/* stats tier table */
.admin__table {
	border-collapse: collapse;
	margin: 0.5rem 0 1rem;
	min-width: 260px;
}
.admin__table th,
.admin__table td {
	text-align: left;
	padding: 0.45rem 1rem 0.45rem 0;
	border-bottom: 1px solid var(--border);
	font-size: 0.9rem;
}
.admin__table th {
	color: var(--muted);
	font-weight: 600;
}
.admin__table td {
	font-family: var(--mono, ui-monospace, monospace);
}
