/*
 * One stylesheet for every page on this site. No build step, no script, no third-party
 * request: a store reviewer opens these on a phone, and the whole site is a handful of
 * same-origin fetches. The tokens are the app's own, from docs/design-guidelines.md, so
 * the pages read as part of Scrolly rather than as a site that happens to mention it:
 * Sora for display, DM Sans for body, dark as the default theme, coral as the accent.
 *
 * The fonts are served from /fonts rather than from a Google Fonts stylesheet, so
 * reading the privacy policy does not hand the reader's IP address to a company the
 * policy never mentions.
 *
 * The accent is the coral default. The app lets a host recolor their group, but these
 * pages belong to no group, so they take the value src/lib/colors.ts ships as the
 * default: #FF6B35 on dark with black text, #D4551F on light with white text, which is
 * the contrast pairing the guidelines fix for CTAs in each theme.
 */

@font-face {
	font-family: 'Sora';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url('/fonts/sora-600.woff2') format('woff2');
}
@font-face {
	font-family: 'Sora';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('/fonts/sora-700.woff2') format('woff2');
}
@font-face {
	font-family: 'DM Sans';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/fonts/dmsans-400.woff2') format('woff2');
}
@font-face {
	font-family: 'DM Sans';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url('/fonts/dmsans-500.woff2') format('woff2');
}
@font-face {
	font-family: 'DM Sans';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url('/fonts/dmsans-600.woff2') format('woff2');
}
@font-face {
	font-family: 'DM Sans';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('/fonts/dmsans-700.woff2') format('woff2');
}

:root {
	color-scheme: light dark;

	/* Dark theme, the default. */
	--bg-primary: #000000;
	--bg-elevated: #111111;
	--bg-surface: #1a1a1a;
	--bg-subtle: #222222;
	--text-primary: #ffffff;
	--text-secondary: #999999;
	--text-muted: #666666;
	--border: #333333;

	/* Coral, and the ink that sits on it in this theme. */
	--accent: #ff6b35;
	--accent-ink: #000000;

	--font-display: 'Sora', system-ui, sans-serif;
	--font-body: 'DM Sans', system-ui, -apple-system, sans-serif;

	--radius-sm: 8px;
	--radius-md: 12px;
	--radius-lg: 16px;
	--radius-full: 9999px;

	--space-xs: 0.25rem;
	--space-sm: 0.5rem;
	--space-md: 0.75rem;
	--space-lg: 1rem;
	--space-xl: 1.5rem;
	--space-2xl: 2rem;
	--space-3xl: 3rem;

	/* The hairline around raster/vector artwork, so an edge never dissolves into the page. */
	--edge: rgba(255, 255, 255, 0.1);
}

@media (prefers-color-scheme: light) {
	:root {
		--bg-primary: #ffffff;
		--bg-elevated: #f5f5f5;
		--bg-surface: #eeeeee;
		--bg-subtle: #e0e0e0;
		--text-primary: #000000;
		--text-secondary: #555555;
		--text-muted: #999999;
		--border: #dddddd;

		/* The darker coral face: white text on #FF6B35 fails contrast, this pair passes. */
		--accent: #d4551f;
		--accent-ink: #ffffff;

		--edge: rgba(0, 0, 0, 0.1);
	}
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

/* bodyLarge: reading text that wraps. */
body {
	margin: 0;
	background: var(--bg-primary);
	color: var(--text-primary);
	font-family: var(--font-body);
	font-size: 17px;
	line-height: 1.47;
	-webkit-font-smoothing: antialiased;
}

::selection {
	background: var(--accent);
	color: var(--accent-ink);
}

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

/*
 * The top bar every page shares, shaped like the app's own nav bar on non-feed pages:
 * sticky, solid, one hairline underneath. The wordmark is the title4 role and the
 * section name beside it is the micro role, the same pairing a screen title and its
 * smallest metadata get in the app.
 */
.masthead {
	position: sticky;
	top: 0;
	z-index: 10;
	background: var(--bg-primary);
	border-bottom: 1px solid var(--border);
}

.masthead-inner {
	display: flex;
	align-items: center;
	gap: var(--space-md);
	max-width: 520px;
	margin: 0 auto;
	min-height: 44px;
	padding: var(--space-sm) var(--space-lg);
}

.wordmark {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--text-primary);
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 17px;
	line-height: 22px;
	letter-spacing: -0.006em;
	text-decoration: none;
}

.masthead-section {
	color: var(--text-secondary);
	font-family: var(--font-body);
	font-weight: 500;
	font-size: 11px;
	line-height: 14px;
	letter-spacing: 0.045em;
	text-transform: uppercase;
	margin-top: 2px;
}

.page {
	max-width: 520px;
	margin: 0 auto;
	padding: var(--space-2xl) var(--space-lg) var(--space-3xl);
}

/* The app icon, shown at the size and corner radius an icon tile carries. */
.mark {
	display: block;
	width: 72px;
	height: 72px;
	border-radius: var(--radius-lg);
	margin-bottom: var(--space-lg);
	box-shadow: 0 0 0 1px var(--edge);
}

h1,
h2,
h3 {
	text-wrap: balance;
}

p,
li {
	text-wrap: pretty;
}

/* title1 */
h1 {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 28px;
	line-height: 34px;
	letter-spacing: -0.014em;
	margin: 0 0 var(--space-md);
}

/*
 * The one accent mark a page carries: the same 52x2 seam the app draws at the top-left
 * of a provider plate. It marks identity, never separation, which is why it is under
 * the title and nowhere else.
 */
h1::after {
	content: '';
	display: block;
	width: 52px;
	height: 2px;
	background: var(--accent);
	margin-top: var(--space-md);
}

/* title3 */
h2 {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 20px;
	line-height: 26px;
	letter-spacing: -0.01em;
	margin: var(--space-2xl) 0 var(--space-sm);
}

/* title4 */
h3 {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 17px;
	line-height: 22px;
	letter-spacing: -0.006em;
	margin: var(--space-xl) 0 var(--space-xs);
}

p,
ul,
ol {
	margin: 0 0 var(--space-lg);
}

ul,
ol {
	padding-left: var(--space-xl);
}

li {
	margin-bottom: var(--space-sm);
}

li::marker {
	color: var(--text-muted);
}

a {
	color: var(--accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	transition: color 120ms ease;
}

a:hover {
	text-decoration-thickness: 2px;
}

strong {
	font-weight: 700;
}

/* bodySmall, in the secondary emphasis level: the line under a title. */
.dateline {
	color: var(--text-secondary);
	font-size: 13px;
	line-height: 18px;
	margin: 0 0 var(--space-2xl);
}

/*
 * A card, per the guidelines: elevated background, no border, structure from contrast.
 * Used for the contact block on every page.
 */
.callout {
	background: var(--bg-elevated);
	border-radius: var(--radius-lg);
	padding: var(--space-lg);
	margin: 0 0 var(--space-xl);
}

.callout p:last-child,
.callout ol:last-child,
.callout ul:last-child {
	margin-bottom: 0;
}

.callout p {
	color: var(--text-secondary);
	font-size: 13px;
	line-height: 18px;
	margin-bottom: 0;
}

/* The primary CTA, exactly as the app draws one: pill, accent, title4 label. */
.pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: var(--space-md) var(--space-xl);
	margin-bottom: var(--space-md);
	background: var(--accent);
	color: var(--accent-ink);
	border-radius: var(--radius-full);
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 17px;
	line-height: 22px;
	letter-spacing: -0.006em;
	text-decoration: none;
	word-break: break-word;
	transition:
		opacity 120ms ease,
		transform 120ms ease;
}

.pill:hover {
	opacity: 0.9;
	color: var(--accent-ink);
}

/* The app's one press treatment: opacity 0.9, scale 0.96, nothing deeper. */
.pill:active {
	opacity: 0.9;
	transform: scale(0.96);
}

/*
 * The index's navigation, shaped like the app's settings rows: a card of rows, label
 * over a muted description, hairline dividers in the surface tone, 44px targets.
 */
.rows {
	background: var(--bg-elevated);
	border-radius: var(--radius-lg);
	padding: var(--space-xs) var(--space-lg);
	margin: 0 0 var(--space-xl);
}

.row {
	display: flex;
	align-items: center;
	gap: var(--space-md);
	min-height: 44px;
	padding: var(--space-md) var(--space-sm);
	margin-inline: calc(-1 * var(--space-sm));
	border-radius: var(--radius-sm);
	color: inherit;
	text-decoration: none;
	transition: background-color 120ms ease;
}

.row:hover,
.row:active {
	background: var(--bg-surface);
}

.row + .row {
	border-top: 1px solid var(--bg-surface);
}

.row-text {
	flex: 1;
}

/* label: single-line row text. */
.row-name {
	display: block;
	color: var(--text-primary);
	font-weight: 600;
	font-size: 15px;
	line-height: 20px;
}

/* bodySmall, secondary: the description under a setting name. */
.row-desc {
	display: block;
	color: var(--text-secondary);
	font-size: 13px;
	line-height: 18px;
	margin-top: 2px;
}

.row::after {
	content: '\203A';
	color: var(--text-muted);
	font-family: var(--font-body);
	font-size: 20px;
	line-height: 1;
}

/* Wide content scrolls inside itself; the page body never scrolls sideways. */
.scroll {
	overflow-x: auto;
	margin: 0 0 var(--space-xl);
	-webkit-overflow-scrolling: touch;
}

table {
	border-collapse: collapse;
	width: 100%;
	min-width: 30rem;
	font-size: 13px;
	line-height: 18px;
}

th,
td {
	border-bottom: 1px solid var(--bg-subtle);
	padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
	text-align: left;
	vertical-align: top;
}

/* overline: the uppercase section header role. */
th {
	color: var(--text-secondary);
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 11px;
	line-height: 14px;
	letter-spacing: 0.064em;
	text-transform: uppercase;
}

code {
	font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
	font-size: 0.875em;
	background: var(--bg-surface);
	border-radius: var(--radius-sm);
	padding: 0.1em 0.4em;
}

footer {
	margin-top: var(--space-3xl);
	padding-top: var(--space-lg);
	border-top: 1px solid var(--border);
}

footer nav {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs) var(--space-lg);
	margin-bottom: var(--space-md);
}

footer nav a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--text-secondary);
	font-size: 13px;
	line-height: 18px;
	text-decoration: none;
}

footer nav a:hover {
	color: var(--text-primary);
}

/* micro: the smallest metadata. */
footer > p {
	color: var(--text-secondary);
	font-family: var(--font-body);
	font-weight: 500;
	font-size: 11px;
	line-height: 14px;
	letter-spacing: 0.045em;
	margin: 0;
}

@media (max-width: 34rem) {
	/*
	 * A phone is too narrow for three columns, and a table a reviewer has to swipe
	 * sideways is a table they read the first column of. Below this width each row
	 * becomes a block and the column headers move into the cells, from `data-label`.
	 */
	.scroll {
		overflow-x: visible;
	}

	table {
		display: block;
		min-width: 0;
	}

	thead {
		display: none;
	}

	tbody,
	tr,
	td {
		display: block;
		width: 100%;
	}

	tr {
		border-bottom: 1px solid var(--bg-subtle);
		padding: var(--space-md) 0;
	}

	tr:last-child {
		border-bottom: 0;
	}

	td {
		border: 0;
		padding: 0 0 var(--space-sm);
	}

	td:last-child {
		padding-bottom: 0;
	}

	td::before {
		content: attr(data-label);
		display: block;
		color: var(--text-secondary);
		font-family: var(--font-display);
		font-weight: 600;
		font-size: 11px;
		line-height: 14px;
		letter-spacing: 0.064em;
		text-transform: uppercase;
		margin-bottom: 2px;
	}
}

@media (prefers-reduced-motion: reduce) {
	a,
	.pill,
	.row {
		transition: none;
	}
}
