/* Stylesheet for GrainFed's anonymous public pages.
 *
 * Deliberately small and framework-free. Upstream loads a 200 KB Bootstrap 4
 * bundle here because the same layout hosts a Vue app; these pages host no
 * application, so the only job is to make the server-rendered content readable
 * before any script runs. It is served hashed and immutable from /assets. */

:root {
	--bg: #fff;
	--fg: #212529;
	--muted: #6c757d;
	--line: rgba(0, 0, 0, 0.125);
	--link: #2c78bf;
	--accent: #10c5f8;
	--card: #fff;
	--hover: rgba(0, 0, 0, 0.04);
	--danger: #dc3545;
	--ok: #1a7f5a;
	--radius: 12px;
	--shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #000;
		--fg: #e5e7eb;
		--muted: #9ca3af;
		--line: rgba(255, 255, 255, 0.15);
		--link: #60a5fa;
		--card: #161618;
		--hover: rgba(255, 255, 255, 0.06);
		--ok: #34d399;
		--shadow: none;
	}
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 700px; margin: 0 auto; padding: 24px 16px 64px; }

.site-head { border-bottom: 1px solid var(--line); }
.site-head .wrap { padding: 12px 16px; display: flex; align-items: center; gap: 8px; }
.site-head strong { font-size: 15px; }
.site-brand { display: flex; align-items: center; gap: 8px; }
.site-brand:hover { text-decoration: none; }
.site-logo { width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0; }

.acct { display: flex; align-items: center; gap: 12px; }
.acct img { width: 72px; height: 72px; border-radius: 100%; object-fit: cover; background: var(--line); }
.acct .name { font-weight: 700; margin: 0; font-size: 20px; }
.acct .handle { color: var(--muted); margin: 0; font-size: 14px; }

.counts { list-style: none; display: flex; gap: 20px; padding: 0; margin: 16px 0; color: var(--muted); font-size: 14px; }
.counts b { color: var(--fg); }

.bio { margin: 0 0 8px; }
.bio-link { font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 24px; padding: 0; list-style: none; }
.grid li { aspect-ratio: 1 / 1; overflow: hidden; background: var(--line); }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

.post { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.post-head { display: flex; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.post-head img { width: 32px; height: 32px; border-radius: 100%; }
.post figure { margin: 0; }
.post figure img { width: 100%; display: block; }
.post figcaption { display: none; }
.post-body { padding: 12px; }
.post-body p { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-meta { padding: 0 12px 12px; color: var(--muted); font-size: 13px; }

.sensitive { padding: 24px 12px; text-align: center; color: var(--muted); border-bottom: 1px solid var(--line); }

.notice { text-align: center; padding: 48px 16px; color: var(--muted); }
.notice h1 { font-size: 20px; color: var(--fg); }

.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-foot .wrap { padding: 16px; }

/* ---------------------------------------------------------------------------
   Forms.
 *
 * These pages -- portfolio settings, the report and follow interstitials, sudo
 * mode, email verification -- are served by internal/internalweb, which used to
 * carry its own three-line <style> and so rendered as unstyled text next to the
 * profile and status pages this file already dressed. They are the same kind of
 * page and now share the same stylesheet.
 *
 * The markup is bare and label-wrapped -- <label>Caption<select></label> and
 * <label><input type="checkbox"> Caption</label> -- so these rules key off
 * elements and their nesting rather than classes. That is what lets a page
 * added later be styled without touching this file.
 */

.panel {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px;
	margin: 0 0 20px;
	box-shadow: var(--shadow);
}

.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

form label {
	display: block;
	margin: 16px 0 0;
	font-size: 14px;
	font-weight: 600;
}

/* A label wrapping a checkbox is a choice, not a caption: one compact row,
   control first, and the text at normal weight because it is the option rather
   than a heading for one. */
form label:has(> input[type="checkbox"]),
form label:has(> input[type="radio"]) {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 400;
	font-size: 15px;
	margin: 10px 0;
	cursor: pointer;
}

form input[type="checkbox"],
form input[type="radio"] {
	width: 17px;
	height: 17px;
	margin: 0;
	accent-color: var(--accent);
	flex: none;
}

/* Everything text-ish, including <input> with no type attribute -- which is a
   text input to a browser and matches no [type=text] selector. */
form input:not([type]),
form input[type="text"],
form input[type="email"],
form input[type="url"],
form input[type="password"],
form input[type="search"],
form input[type="number"],
form select,
form textarea {
	display: block;
	width: 100%;
	margin-top: 6px;
	padding: 10px 12px;
	font: inherit;
	color: inherit;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 10px;
}

form textarea { min-height: 120px; resize: vertical; }

form select {
	appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
		linear-gradient(135deg, var(--muted) 50%, transparent 50%);
	background-position: right 16px center, right 11px center;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	padding-right: 34px;
}

button,
input[type="submit"],
.btn {
	display: inline-block;
	font: inherit;
	font-weight: 600;
	padding: 10px 18px;
	border-radius: 10px;
	border: 1px solid transparent;
	background: var(--accent);
	color: #04202a;
	cursor: pointer;
	text-decoration: none;
}

button:hover, input[type="submit"]:hover, .btn:hover { filter: brightness(0.95); }

button.secondary, .btn.secondary {
	background: var(--card);
	border-color: var(--line);
	color: inherit;
}

button.danger, .btn.danger {
	background: var(--danger);
	border-color: transparent;
	color: #fff;
}

fieldset {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 4px 16px 14px;
	margin: 20px 0;
	min-width: 0;
}

legend {
	padding: 0 8px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--muted);
}

.note { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; }

h1 { font-size: 22px; margin: 0 0 4px; }
.lede { color: var(--muted); margin: 0 0 22px; }

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

/* The portfolio visibility panel.

   It sits above the settings form and owns the public/private decision on its
   own, because that decision is the one people come to this page to make and
   it used to be a checkbox among eight others with a Save button below the
   fold. The state is stated in words, the colour only agrees with the words --
   nobody should have to know that green means public. */
.visibility {
	border-left: 3px solid var(--muted);
	padding: 16px;
	margin-bottom: 22px;
}
.visibility.is-public { border-left-color: var(--ok); }
.visibility .state {
	margin: 0 0 6px;
	font-size: 16px;
	display: flex;
	align-items: center;
	gap: 8px;
}
.visibility .dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--muted);
	flex: none;
}
.visibility.is-public .dot { background: var(--ok); }
.visibility .detail {
	margin: 0 0 14px;
	color: var(--muted);
	font-size: 14px;
	line-height: 1.5;
}
.visibility form { margin: 0; }

/* ---------------------------------------------------------------------------
   The settings layout.

   Thirty-five screens behind one wrapper, so they get a rail. Below 860px it
   stacks above the content rather than disappearing, because a settings page
   with no navigation is a set of paths to memorise.
*/

.set-wrap { max-width: 1000px; }

@media (min-width: 860px) {
	.set-wrap {
		display: grid;
		grid-template-columns: 220px minmax(0, 1fr);
		gap: 36px;
		align-items: start;
	}
	.set-side { position: sticky; top: 20px; }
}

.set-main { min-width: 0; }
.set-main h1 { margin-top: 0; }

.set-group {
	margin: 16px 0 6px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--muted);
}
.set-group:first-child { margin-top: 0; }

.set-nav a {
	display: block;
	padding: 6px 10px;
	margin: 1px 0;
	border-radius: 8px;
	color: inherit;
	font-size: 14px;
	text-decoration: none;
}

.set-nav a:hover { background: var(--hover); text-decoration: none; }

.set-nav a[aria-current="page"] {
	background: var(--card);
	border: 1px solid var(--line);
	font-weight: 700;
}

/* Settings pages emit bare tables for block lists and application lists. */
.set-main table {
	width: 100%;
	border-collapse: collapse;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	margin: 16px 0;
	font-size: 14px;
}
.set-main th {
	text-align: left;
	font-size: 12px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--muted);
	padding: 10px 12px;
	border-bottom: 1px solid var(--line);
}
.set-main td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.set-main tbody tr:last-child td { border-bottom: 0; }

/* ---------------------------------------------------------------------------
   The landing page.

   The instance's front door, for somebody who has never been here. It has to
   answer three questions in the first screen -- what is this, is anyone here,
   and how do I join -- and then show the work, because this is a server for
   photographs and a front door that shows none is a brochure.
*/

.hero {
	border-bottom: 1px solid var(--line);
	background:
		radial-gradient(60rem 30rem at 50% -12rem,
			color-mix(in srgb, var(--accent) 16%, transparent), transparent);
}

.hero .wrap { padding-top: 56px; padding-bottom: 44px; text-align: center; }

.hero h1 {
	font-size: clamp(32px, 6vw, 46px);
	line-height: 1.1;
	letter-spacing: -.02em;
	margin: 0 0 10px;
}

.hero-sub {
	font-size: 18px;
	color: var(--muted);
	max-width: 34rem;
	margin: 0 auto;
}

.hero-stats {
	list-style: none;
	display: flex;
	justify-content: center;
	gap: 36px;
	padding: 0;
	margin: 26px 0 0;
}

.hero-stats b {
	display: block;
	font-size: 24px;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

.hero-stats span { color: var(--muted); font-size: 13px; }

.hero-actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 28px;
}

.landing .section {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--muted);
	margin: 36px 0 14px;
}

/* The landing grid is denser than a profile's: it is a sample, not a feed. */
.landing .grid {
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 6px;
}

.landing .grid li { border-radius: 8px; }

.landing .grid a { display: block; width: 100%; height: 100%; }

.landing .rules { color: var(--fg); padding-left: 20px; }
.landing .rules li { margin: 6px 0; }

.landing .links {
	list-style: none;
	padding: 0;
	margin: 36px 0 0;
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	font-size: 14px;
	border-top: 1px solid var(--line);
	padding-top: 18px;
}

/* The attribution line.
 *
 * Subtle on purpose: it belongs to the operator's footer, not to the software,
 * and an instance's own name should read louder than the thing it runs on.
 * rel="nofollow" for the same reason -- this is a credit, not a campaign to
 * rank the project on every instance that deploys it.
 */
.site-foot .wrap {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
}

.site-foot .powered {
	color: var(--muted);
	text-decoration: none;
	font-size: 12px;
}

.site-foot .powered:hover { color: var(--link); text-decoration: underline; }

/* ---------------------------------------------------------------------------
   The portfolio.

   A standalone page of somebody's photographs, so the photographs are the
   page: no card chrome, no captions under the tiles, nothing competing with
   the images. It rendered as a bulleted list of snowflake ids until the day
   the default flipped to public and people started opening it.

   profile_layout and profile_container are the two presentation columns the
   settings form has always written; `is-fluid` and .pf-masonry are what
   finally reads them. */

.pf-head {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 22px;
}
.pf-avatar {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	object-fit: cover;
	flex: none;
	background: var(--hover);
}
.pf-id { min-width: 0; }
.pf-handle { margin: 0; font-weight: 600; }
.pf-bio { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

.pf-grid,
.pf-masonry {
	list-style: none;
	padding: 0;
	margin: 0 0 22px;
}

/* Three columns, the same as .grid on the profile page. A photo grid is a
   thing this site already has, and a portfolio that laid its out differently
   would read as a different site.

   Not auto-fill with a minimum: at 375px that resolves to a single column, so
   a 24-photo portfolio became 24 screens of scrolling on a phone. */
.pf-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 4px;
}
.pf-grid img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	background: var(--hover);
}

/* CSS columns, so tiles keep their own proportions and fill by height. Counted
   rather than sized, for the same reason the grid is: a width-based column
   collapses to one on a phone. */
.pf-masonry {
	column-count: 2;
	column-gap: 4px;
}
@media (min-width: 700px) {
	.pf-masonry { column-count: 3; }
}
.pf-masonry li {
	break-inside: avoid;
	margin-bottom: 4px;
}
.pf-masonry img {
	display: block;
	width: 100%;
	height: auto;
	background: var(--hover);
}

/* `fluid` is upstream's container setting: the gallery escapes the 700px
   reading column that .wrap imposes.

   Centred by the 50% + translateX pair rather than by negative margins,
   because .wrap's max-width -- not its padding -- is what constrains it, so
   undoing the padding would have widened it by 32px and no more.

   Bounded at 1200px and at the viewport less 32px. A bare 100vw is wider than
   the content box whenever a vertical scrollbar is present, and the page would
   then scroll sideways on every screen that has one. */
.pf-grid.is-fluid,
.pf-masonry.is-fluid {
	width: calc(100vw - 32px);
	max-width: 1200px;
	margin-left: 50%;
	transform: translateX(-50%);
}
/* Fluid has the room for more, and auto-fill is right HERE because the width
   is no longer the fixed reading column. */
.pf-grid.is-fluid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pf-masonry.is-fluid { column-count: 4; }

.pf-photo img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0 0 16px;
	background: var(--hover);
}
.pf-caption { white-space: pre-wrap; line-height: 1.6; }
.pf-meta { margin-top: 0; }
.pf-foot { margin-top: 22px; }
