:root {
	color-scheme: light;
	--canvas: #fdfcfc;
	--soft: #f8f7f7;
	--card: #f1eeee;
	--ink: #201d1d;
	--charcoal: #302c2c;
	--body: #424245;
	--mute: #646262;
	--ash: #898686;
	--hairline: rgba(15, 0, 0, 0.14);
	--accent: #007aff;
	--danger: #c62828;
	--success: #21823b;
	--terminal: #201d1d;
	--terminal-raised: #302c2c;
	--terminal-text: #fdfcfc;
	--terminal-muted: #b4aeae;
	--radius: 4px;
	font-family: "Berkeley Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	color: var(--ink);
	background: var(--canvas);
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--canvas: #201d1d;
	--soft: #302c2c;
	--card: #393535;
	--ink: #fdfcfc;
	--charcoal: #e8e4e4;
	--body: #e2dddd;
	--mute: #b4aeae;
	--ash: #898383;
	--hairline: rgba(253, 252, 252, 0.16);
	--accent: #70aaff;
	--danger: #ff6961;
	--success: #30d158;
	--terminal: #302c2c;
	--terminal-raised: #393535;
	--terminal-text: #fdfcfc;
	--terminal-muted: #c3bdbd;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
	min-width: 320px;
	min-height: 100vh;
	margin: 0;
	background: var(--canvas);
	color: var(--ink);
	transition: background-color 160ms ease, color 160ms ease;
}

button, input { font: inherit; }
a { color: inherit; }

.site-shell {
	width: min(100% - 32px, 960px);
	min-height: 100vh;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
}

.site-header {
	min-height: 64px;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 12px;
	border-bottom: 1px solid var(--hairline);
}

.wordmark {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: -0.06em;
	text-decoration: none;
	white-space: nowrap;
}

.brand-icon { width: 24px; height: 24px; flex: 0 0 auto; object-fit: contain; }
:root[data-theme="dark"] .brand-icon { filter: invert(1); }

.header-note, .eyebrow, .site-footer, .field-label, .terminal-meta {
	color: var(--mute);
	font-size: 10px;
	letter-spacing: 0.035em;
}

.header-note { justify-self: end; white-space: nowrap; }
.header-note span { padding: 0 4px; color: var(--ash); }

.theme-toggle {
	min-height: 40px;
	padding: 0 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	border: 1px solid var(--hairline);
	border-radius: var(--radius);
	background: var(--soft);
	color: var(--ink);
	cursor: pointer;
	font-size: 9px;
	letter-spacing: 0.02em;
}

.theme-toggle:hover { border-color: var(--mute); }
.theme-toggle:active { background: var(--card); }

main { flex: 1; }

.page {
	width: min(100%, 760px);
	margin: 0 auto;
	padding: clamp(56px, 8vh, 96px) 0 64px;
}

.eyebrow { margin: 0 0 18px; }

h1 {
	max-width: 680px;
	margin: 0;
	font-size: clamp(30px, 5vw, 42px);
	line-height: 1.3;
	font-weight: 500;
	letter-spacing: -0.06em;
}

.lede {
	max-width: 580px;
	margin: 16px 0 0;
	color: var(--body);
	font-size: 13px;
	line-height: 1.8;
}

.shorten-form { margin-top: 32px; }

.field-label { display: block; margin-bottom: 8px; }

.form-row, .copy-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.url-input, .copy-input {
	width: 100%;
	min-width: 0;
	min-height: 46px;
	padding: 0 12px;
	border: 1px solid var(--hairline);
	border-radius: var(--radius);
	background: var(--soft);
	color: var(--ink);
	font-size: 12px;
}

.url-input::placeholder { color: var(--ash); opacity: 1; }
.url-input:focus, .copy-input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.copy-input { color: var(--body); }
.copy-input.short { border-color: var(--hairline); color: var(--ink); }

.button {
	min-height: 46px;
	padding: 0 16px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: 1px solid var(--ink);
	border-radius: var(--radius);
	background: var(--ink);
	color: var(--canvas);
	cursor: pointer;
	font-size: 11px;
	font-weight: 600;
	white-space: nowrap;
	transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:hover { background: var(--charcoal); color: var(--canvas); }
.button:active { transform: translateY(1px); }

.form-note {
	margin: 10px 0 0;
	color: var(--mute);
	font-size: 10px;
	line-height: 1.7;
}

.terminal {
	margin-top: 36px;
	padding: 16px;
	border: 1px solid var(--hairline);
	border-radius: var(--radius);
	background: var(--terminal);
	color: var(--terminal-text);
}

.terminal-meta { display: flex; justify-content: space-between; color: var(--terminal-muted); }
.terminal-line { margin: 18px 0 4px; font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
.terminal-line strong { color: #fff; font-weight: 500; }
.terminal-line .marker { color: var(--terminal-muted); }
.terminal-hint { margin: 0; color: var(--terminal-muted); font-size: 10px; line-height: 1.8; }

.result-block { margin-top: 28px; }
.result-block + .result-block { margin-top: 22px; }
.copy-status { min-height: 18px; margin: 8px 0 0; color: var(--success); font-size: 10px; line-height: 1.7; }
.text-link { display: inline-block; margin-top: 24px; font-size: 11px; text-underline-offset: 4px; }

.error-code {
	display: inline-block;
	margin: 0 0 16px;
	padding: 5px 8px;
	border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
	border-radius: var(--radius);
	color: var(--danger);
	font-size: 10px;
}

.error-title { color: var(--danger); }
.error-detail { margin-top: 24px; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.error-detail summary { min-height: 44px; padding: 13px 0; cursor: pointer; color: var(--mute); font-size: 10px; }
.error-detail pre {
	max-height: 320px;
	overflow: auto;
	margin: 0 0 12px;
	padding: 12px;
	border-radius: var(--radius);
	background: var(--soft);
	color: var(--body);
	font-family: inherit;
	font-size: 10px;
	line-height: 1.7;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.site-footer {
	min-height: 52px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	border-top: 1px solid var(--hairline);
	font-size: 9px;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--mute); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

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

@media (min-width: 700px) {
	.site-shell { width: min(100% - 64px, 960px); }
	.site-header { min-height: 72px; gap: 20px; }
	.wordmark { font-size: 16px; }
	.brand-icon { width: 26px; height: 26px; }
	.header-note, .eyebrow, .site-footer, .field-label, .terminal-meta { font-size: 11px; }
	.theme-toggle { min-height: 42px; padding: 0 12px; font-size: 10px; }
	.page { padding: clamp(64px, 9vh, 96px) 0 72px; }
	h1 { font-size: clamp(38px, 4vw, 48px); }
	.lede { font-size: 14px; }
	.shorten-form { margin-top: 36px; }
	.url-input, .copy-input, .button { min-height: 48px; font-size: 12px; }
	.terminal { margin-top: 40px; padding: 18px; }
	.terminal-line { font-size: 12px; }
	.terminal-hint, .form-note, .copy-status, .error-detail summary, .error-detail pre { font-size: 11px; }
	.site-footer { min-height: 58px; font-size: 10px; }
}

@media (max-width: 380px) {
	.site-shell { width: min(100% - 24px, 960px); }
	.site-header { grid-template-columns: auto 1fr auto; gap: 6px; }
	.wordmark { font-size: 12px; }
	.brand-icon { width: 20px; height: 20px; }
	.header-note { font-size: 8px; }
	.theme-toggle { gap: 3px; padding: 0 6px; font-size: 8px; }
	h1 { font-size: 28px; }
	.site-footer { align-items: flex-start; padding: 12px 0; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
