/* The site's pages outside the editor: landing, Home, settings and account pages (allauth's). */

:root {
	--font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	--text: #2b2b2b;
	--muted: #6f6f6f;
	--border: #e3e3e3;
	--accent: #0d99ff;
	--accent-dark: #0a7fd6;
	--accent-soft: #e5f3ff;
	--danger: #d1242f;
	--page-bg: #fbfbfb;
	--tile-bg: #efefef;
	--shadow: 0 2px 10px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

[x-cloak] { display: none !important; }

body {
	margin: 0;
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.5;
	color: var(--text);
	background: var(--page-bg);
}

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

h1, h2 { font-weight: 600; line-height: 1.25; }

.muted { color: var(--muted); }

/* ---------- Buttons ---------- */

.button, .auth-card button[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 36px;
	padding: 0 16px;
	border: 1px solid #c9c9c9;
	border-radius: 8px;
	background: #fff;
	color: var(--text);
	font: inherit;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
}
.button:hover { background: #f4f4f4; }
.button.primary, .auth-card button[type="submit"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.button.primary:hover, .auth-card button[type="submit"]:hover { background: var(--accent-dark); }
.button.large { height: 44px; padding: 0 22px; font-size: 16px; }
.button:focus-visible, .icon-button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: none;
	color: #444;
	cursor: pointer;
}
.icon-button:hover { background: #ececec; }
.icon-button svg { fill: currentColor; }
.icon-button svg path, .icon-button svg circle[fill="none"] { fill: none; }

/* ---------- Header ---------- */

.site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	max-width: 1120px;
	margin: 0 auto;
	padding: 18px 16px;
}

.wordmark {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	color: var(--text);
	font-size: 19px;
	font-weight: 600;
	text-decoration: none;
}

.header-actions { display: flex; align-items: center; gap: 16px; }
.header-link { color: var(--text); text-decoration: none; font-weight: 500; }
.header-link:hover { text-decoration: underline; }

.messages { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 10; }
.message {
	margin: 0 0 8px;
	padding: 10px 16px;
	border-radius: 8px;
	background: #2b2b2b;
	color: #fff;
	box-shadow: var(--shadow);
	font-size: 14px;
}

/* ---------- Landing ---------- */

.landing-page { background: #fff; }

.landing-header { max-width: none; padding: 18px 32px; }
.landing-header .header-actions { gap: 24px; }
.landing-header .header-link { color: var(--accent-dark); }

.hero { padding: 24px 16px 56px; text-align: center; }
.hero h1 { margin: 0 0 10px; font-size: clamp(40px, 6vw, 64px); font-weight: 500; letter-spacing: -0.01em; }
.tagline { margin: 0; color: #444; font-size: 18px; }

/* The editor to try out, as a card on the page (the editor's styles do the rest). */
.playground { position: relative; width: min(calc(100% - 64px), 1480px); margin: 0 auto 72px; }
.playground-editor {
	height: clamp(520px, calc(100vh - 160px), 820px);
	overflow: hidden;
	border-radius: 14px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.06);
}
/* Saving: on the card's top edge, where it's seen first. */
.playground-banner {
	position: absolute;
	top: 0;
	left: 50%;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 16px;
	max-width: calc(100% - 32px);
	padding: 8px 8px 8px 24px;
	transform: translate(-50%, -50%);
	border: 1px solid #a9d6fb;
	border-radius: 30px;
	background: #e6f3ff;
	box-shadow: 0 4px 14px rgba(13, 153, 255, 0.18);
	color: #0b3d63;
	font-size: 15px;
	white-space: nowrap;
}
.playground-banner span { overflow: hidden; text-overflow: ellipsis; }
.playground-banner .button { flex-shrink: 0; border-radius: 20px; }

.site-footer { padding: 40px 16px; background: #e6e7ea; color: #444; font-size: 14px; text-align: center; }
.site-footer p { margin: 0; }

/* The sign-up dialog (native <dialog>, opened by Alpine). */
.signup-dialog {
	width: min(380px, calc(100vw - 32px));
	padding: 28px 32px 20px;
	border: 0;
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	color: var(--text);
	font-size: 15px;
}
.signup-dialog::backdrop { background: rgba(20, 20, 20, 0.35); }
.signup-dialog h2 { margin: 0 0 20px; font-size: 20px; font-weight: 500; line-height: 1.35; text-align: center; }
.dialog-close {
	position: absolute;
	top: 12px;
	right: 12px;
	display: inline-flex;
	padding: 6px;
	border: 0;
	border-radius: 6px;
	background: none;
	color: #555;
	cursor: pointer;
}
.dialog-close:hover { background: #f0f0f0; }
.signup-form p { margin: 0 0 12px; }
.signup-form input:not([type="hidden"]) {
	display: block;
	width: 100%;
	height: 40px;
	padding: 0 12px;
	border: 1px solid #b9b9b9;
	border-radius: 4px;
	font: inherit;
}
.signup-form input:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.signup-form .errorlist { margin: 0 0 4px; padding: 0; list-style: none; color: var(--danger); font-size: 13px; }
.signup-form .button { width: 100%; height: 40px; margin-top: 6px; }
.link-button {
	display: block;
	margin: 12px auto 0;
	padding: 4px 8px;
	border: 0;
	background: none;
	color: var(--accent-dark);
	font: inherit;
	cursor: pointer;
}
.link-button:hover { text-decoration: underline; }
.honeypot { position: absolute !important; left: -9999px; width: 1px !important; height: 1px !important; opacity: 0; }

/* ---------- Home ---------- */

.home-header {
	position: relative;
	display: flex;
	justify-content: center;
	max-width: 1120px;
	margin: 0 auto;
	padding: 32px 16px 24px;
}
.home-header .wordmark { font-size: 24px; font-weight: 500; }
.settings-link { position: absolute; top: 28px; right: 16px; border: 1px solid #c9c9c9; background: #fff; }

.tiles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 20px;
	max-width: 1120px;
	margin: 0 auto;
	padding: 8px 16px 64px;
}

.tile { position: relative; display: flex; flex-direction: column; min-width: 0; }

.new-tile button {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	width: 100%;
	aspect-ratio: 1;
	border: 1.5px solid #3a3a3a;
	border-radius: 4px;
	background: #fff;
	color: #333;
	font: inherit;
	font-size: 14px;
	cursor: pointer;
}
.new-tile button:hover { background: #f7f7f7; }
.new-tile button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tile-preview {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1;
	overflow: hidden;
	border: 1px solid #d9d9d9;
	border-radius: 4px;
	background: var(--tile-bg);
}
.tile-preview:hover { border-color: #b5b5b5; }
.tile-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.tile-placeholder { fill: #c9c9c9; }

.tile-footer { display: flex; align-items: flex-start; gap: 4px; padding: 8px 0 0 2px; }
.tile-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tile-name {
	overflow: hidden;
	color: var(--text);
	font-weight: 500;
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.tile-name:hover { text-decoration: underline; }
.tile-name-input { width: 100%; padding: 1px 4px; border: 1px solid var(--accent); border-radius: 4px; font: inherit; font-weight: 500; }
.tile-meta { color: var(--muted); font-size: 13px; }

.menu { position: relative; }
.menu-list {
	position: absolute;
	right: 0;
	top: 34px;
	z-index: 5;
	min-width: 180px;
	padding: 4px;
	border-radius: 8px;
	background: #fff;
	box-shadow: var(--shadow);
}
.menu-list button {
	display: block;
	width: 100%;
	padding: 7px 10px;
	border: 0;
	border-radius: 5px;
	background: none;
	color: var(--text);
	font: inherit;
	font-size: 14px;
	text-align: left;
	cursor: pointer;
}
.menu-list button:hover { background: var(--accent-soft); }
.menu-list button.danger { color: var(--danger); }
.menu-list button.danger:hover { background: #fdecec; }

/* ---------- Account pages and settings ---------- */

.auth-card {
	max-width: 420px;
	margin: 24px auto 64px;
	padding: 28px 28px 20px;
	border-radius: 12px;
	background: #fff;
	box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 12px; font-size: 22px; }
.auth-card h2 { margin: 24px 0 8px; font-size: 16px; }
.auth-card p { margin: 0 0 14px; }
.auth-card label { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 500; }
.auth-card input:not([type="checkbox"]):not([type="radio"]) {
	display: block;
	width: 100%;
	height: 38px;
	padding: 0 10px;
	border: 1px solid #c9c9c9;
	border-radius: 6px;
	font: inherit;
}
.auth-card input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.auth-card input[type="checkbox"] + label, .auth-card input[type="radio"] + label { display: inline; margin-left: 6px; font-weight: 400; }
.auth-card .help, .auth-card .helptext, .auth-card p > span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.auth-card .errorlist { margin: 0 0 6px; padding: 0; list-style: none; color: var(--danger); font-size: 13px; }
.auth-card button[type="submit"] { width: 100%; margin-top: 4px; }
.auth-card button[type="submit"] + button { margin-top: 8px; }
.auth-card ul:not(.errorlist):not(.link-list) { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.auth-card table { width: 100%; border-collapse: collapse; }

.settings button[type="submit"] { width: auto; }
.settings section + section { margin-top: 8px; border-top: 1px solid var(--border); }
.back-link { font-size: 14px; }
.back-link a { text-decoration: none; }
.link-list { margin: 0 0 16px; padding-left: 18px; }
.form-actions { display: flex; align-items: center; gap: 12px; }
.saved { color: #1f8a4c; font-size: 14px; }
.settings .button:not(.primary) { width: auto; background: #fff; border-color: #c9c9c9; color: var(--text); }
