/*
  Bluebird design tokens — the ONLY place raw hex may appear. Semantic,
  theme-paired custom properties. Every fill carries its intended ink; the
  pairs are contrast-tested (tests/unit/brand-tokens.test.ts).

  Palette: a bluebird day on the mountain — clear sky blue over warm snow, with
  deep evergreen ink. Adjusted by eye for WCAG AA (the contrast test is the
  gate); final tuning of the palette by eye is on the human checklist.

  Two-layer vocabulary: token NAMES stay durable (colour + role nouns), never
  mountain terms. The mountain metaphor lives in UI copy, not here.

  Theming: light is the default, always — the app does not follow the device's
  system dark mode. Dark applies only when the explorer explicitly picks it via
  the theme toggle (an explicit data-theme="dark"; see src/brand/theme.ts).
*/

:root {
  /* ---- Brand palette (the new semantic hues) ---------------------------- */
  --sky: #3BA3E8;        /* bluebird-day blue — the clear saturated sky */
  --snow: #FAF6EF;       /* warm off-white — fresh snow under morning light */
  --evergreen: #123A2A;  /* deep forest green — text & accents */

  /* Trail-rating markers: the three trust tiers, drawn as the mountain draws
     them — green circle (easiest / inside the garden), blue square (more / one
     hop beyond), black diamond (expert / the open network). A trust rating,
     never a content rating. */
  --trail-green: #2F9E44;
  --trail-blue: #1C7ED6;
  --trail-black: #212529;

  /* Ski patrol wears the one loud colour on the mountain, so everyone can find
     help fast. SCOPE RULE (enforced by convention + review): --patrol may ONLY
     be used on sponsor/Patrol surfaces (patrol.html and Patrol-only
     components). It must never appear on an explorer-facing surface — the calm
     of the mountain depends on the loud colour meaning exactly one thing. */
  --patrol: #E8590C;     /* safety orange */

  /* ---- Semantic tokens (what components consume) ------------------------ */
  /* Light theme (default) */
  --bg: #FAF6EF;          /* Snow — warm off-white */
  --bg-raised: #FFFFFF;   /* raised cards, a touch brighter than the snow */
  --bg-sunken: #EDE6D8;   /* recessed wells */

  --ink: #123A2A;         /* Evergreen — body text, deep and legible on snow */
  --ink-muted: #4B5D53;   /* muted evergreen-grey */

  --accent: #2D8BCC;      /* Sky (AA-safe interactive fill; white ink, large) */
  --accent-ink: #FFFFFF;  /* large text only */
  --link: #1B6FB0;        /* text-safe blue on raised surfaces */
  --cta: #3BA3E8;         /* Bluebird sky — calm primary action, never loud */
  --cta-ink: #123A2A;     /* Evergreen on sky (white-on-sky fails AA; forbidden) */
  --highlight: #FFDD00;   /* Sunbeam — momentary highlight */
  --highlight-ink: #123A2A;

  --border: #DAD2C3;      /* warm decorative separation */
  --navy: #123A2A;        /* deep ink — wordmark, deepest evergreen */
  --danger: #C0392B;      /* error text */
  --header-mark: url("/icons/brand/header-light.png");

  --radius: 20px;

  color-scheme: light;
}

/* Dark is opt-in only: it applies when the explorer picks it via the theme
   toggle (data-theme="dark"). The app never auto-switches to system dark. */
:root[data-theme="dark"] {
  --bg: #172420;
  --bg-raised: #1F2E28;
  --bg-sunken: #101A16;

  --ink: #FFFFFF;
  --ink-muted: #A9C3B5;

  --accent: #1E88E5;
  --accent-ink: #FFFFFF;
  --link: #7FB3E3;
  --cta: #2A72AE;         /* calm blue action (white ink ≥4.5); orange stays a Patrol-only token */
  --cta-ink: #FFFFFF;
  --highlight: #F1C40F;
  --highlight-ink: #172420;

  --border: #33403A;
  --navy: #0E2019;
  --danger: #FF9A9A;
  --header-mark: url("/icons/brand/header-dark.png");

  /* A black-diamond marker vanishes on a dark slope; lift it to read. */
  --trail-black: #E9ECEF;

  color-scheme: dark;
}

/* Bluebird — brand tokens live in tokens.css (the only place raw hex is allowed).
   The legacy night-sky variable names below are now ALIASES onto the semantic
   tokens, so every existing rule re-themes for free (light/dark) with no hex
   here. RUN-BRAND P4 replaces these aliases with direct token usage. */
:root {
  --sky-deep: var(--bg);
  --sky-indigo: var(--bg);
  --sky-indigo-soft: var(--border);
  --card: var(--bg-raised);
  --card-soft: var(--bg-sunken);
  --moon: var(--highlight);
  --star: var(--ink);
  --ink-dim: var(--ink-muted);
  /* --link is owned by tokens.css per theme: --accent is a FILL colour and fails
     as text on light/dark cards; --link is a darker/lighter text-safe blue. */
  /* --ink, --radius come from tokens.css */
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  /* Mobile-first safety net: a stray long token must never widen the page. */
  overflow-x: clip;
  background:
    radial-gradient(1200px 900px at 50% -10%, var(--sky-indigo-soft), transparent 60%),
    linear-gradient(180deg, var(--sky-indigo) 0%, var(--sky-deep) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 4rem;
}

/* --- top bar --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: max(0.9rem, env(safe-area-inset-top)) 1rem 0.9rem;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, var(--sky-deep) 60%, transparent);
  backdrop-filter: blur(6px);
}

/* Theme-swapping header mark: day-window in light, constellation in dark. The
   --header-mark token flips with the theme; CSS rounding hides the source's
   white corners over any background. */
.topbar__mark {
  width: 2.1rem;
  height: 2.1rem;
  flex: none;
  border-radius: 28%;
  background: var(--header-mark) center / cover no-repeat;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.topbar__wordmark {
  margin: 0;
  display: flex;
  align-items: center;
}

.wordmark {
  display: block;
  height: 1.5rem;
  width: auto;
  color: var(--ink);
}

.topbar__tagline {
  margin: 0;
  margin-left: auto;
  color: var(--accent);
  font-size: 0.85rem;
}

.topbar__nav {
  display: flex;
  gap: 0.9rem;
  margin-left: auto;
}

.topbar__nav a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.9rem;
}

.topbar__nav a:hover {
  color: var(--ink);
}

.topbar__help {
  margin-left: 0.8rem;
  background: var(--moon);
  color: var(--highlight-ink);
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  flex: none;
}

.garden__note {
  max-width: 640px;
  margin: 0.5rem auto 0;
  padding: 0 1rem;
  color: var(--ink-dim);
  font-size: 0.9rem;
  text-align: center;
}

/* --- garden --- */
.garden {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.garden__status {
  text-align: center;
  color: var(--ink-dim);
  font-size: 1.15rem;
  padding: 3rem 1rem;
}

.garden__list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* --- post card --- */
.post {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.post__header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

.post__avatar {
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--card-soft);
}

.post__avatar--blank {
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--accent);
}

.post__id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.post__name {
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post__handle {
  color: var(--ink-dim);
  font-size: 0.85rem;
}

.post__time {
  margin-left: auto;
  color: var(--ink-dim);
  font-size: 0.85rem;
  flex: none;
}

.post__text {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.seg--link {
  color: var(--link);
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.seg--tag {
  color: var(--accent);
}

.seg--mention {
  color: var(--link);
}

/* --- media --- */
.post__images {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.post__images--1 {
  grid-template-columns: 1fr;
}

.post__images--2,
.post__images--3,
.post__images--4 {
  grid-template-columns: 1fr 1fr;
}

.post__image-wrap {
  position: relative;
  margin: 0;
  display: block;
  min-width: 0;
}

.post__image {
  width: 100%;
  border-radius: 14px;
  display: block;
  background: var(--card-soft);
}

/* "ALT" badge — shown only in the full skin (bsky-style), and only rendered at
   all when the image carries alt text. A small dark pill, bottom-right. */
.post__alt-badge {
  display: none;
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.66);
}

[data-skin="full"] .post__alt-badge {
  display: block;
}

.post__video {
  position: relative;
  margin-top: 0.8rem;
}

.post__video-poster {
  width: 100%;
  border-radius: 14px;
  display: block;
  background: var(--card-soft);
  min-height: 8rem;
}

.post__video-poster--blank {
  display: grid;
  place-items: center;
  color: var(--ink-dim);
  aspect-ratio: 16 / 9;
}

.post__video-badge {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  background: rgba(13, 14, 43, 0.8);
  color: var(--ink);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

.post__external {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: left;
  width: 100%;
  margin-top: 0.8rem;
  padding: 0.8rem 0.9rem;
  background: var(--card-soft);
  border: 1px solid rgba(143, 211, 255, 0.25);
  border-radius: 14px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.post__external-domain {
  color: var(--link);
  font-size: 0.85rem;
}

.post__external-title {
  font-weight: 700;
}

.post__external-desc {
  color: var(--ink-dim);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post__quote {
  margin-top: 0.8rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--sky-indigo-soft);
  background: rgba(38, 42, 110, 0.4);
  border-radius: 10px;
}

.post__quote-author {
  font-weight: 700;
  font-size: 0.9rem;
}

.post__quote-text {
  margin: 0.3rem 0 0;
  color: var(--ink-dim);
}

/* --- leave interstitial (D7) --- */
.leave {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(6, 7, 24, 0.72);
  backdrop-filter: blur(3px);
}

.leave__dialog {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem 1.4rem;
  max-width: 22rem;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.leave__title {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  font-weight: 800;
}

.leave__domain {
  margin: 0 0 1.2rem;
  color: var(--link);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  word-break: break-all;
}

.leave__actions {
  display: flex;
  gap: 0.7rem;
}

.leave__stay,
.leave__go {
  flex: 1;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: none;
}

.leave__stay {
  background: var(--card-soft);
  color: var(--ink);
}

.leave__go {
  background: var(--moon);
  color: var(--highlight-ink);
}

/* --- lock screens + offline banner --- */
.lock {
  max-width: 28rem;
  margin: 4rem auto 0;
  padding: 2rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.lock__glyph {
  font-size: 3.5rem;
  line-height: 1;
}

.lock__title {
  margin: 0.4rem 0 0;
  font-size: 1.7rem;
  font-weight: 800;
}

.lock__body {
  margin: 0;
  color: var(--ink-dim);
  font-size: 1.15rem;
  line-height: 1.5;
}

.banner {
  display: flex;
  align-items: center;
  gap: 0.6ch;
  justify-content: center;
  background: var(--card-soft);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
}

.banner__glyph {
  font-size: 1.1rem;
}

/* --- sponsor setup page --- */
.sponsor {
  max-width: 680px;
  margin: 0 auto;
  padding: 1rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* Column-flex children default to min-width:auto, so one wide child (a long
   label or token) can push a whole card past the viewport. Let them shrink;
   their text then wraps at the real container width. */
.sponsor > *,
.garden > *,
.explain > * {
  min-width: 0;
}

.g-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.3rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.g-card h2 {
  margin: 0 0 0.6rem;
  font-size: 1.25rem;
}

.g-hint {
  margin: 0 0 0.9rem;
  color: var(--ink-dim);
  font-size: 0.95rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.g-hint code,
.g-card code,
.g-msg code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--link);
  overflow-wrap: anywhere;
}

.g-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.7rem;
}

.g-field__label {
  font-size: 0.85rem;
  color: var(--ink-dim);
  overflow-wrap: anywhere;
}

.g-input,
.g-json {
  width: 100%;
  background: var(--sky-deep);
  color: var(--ink);
  border: 1px solid var(--sky-indigo-soft);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  font: inherit;
}

.g-json {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.g-channel {
  border: 1px solid var(--sky-indigo-soft);
  border-radius: 12px;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.g-channel__head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.g-channel__head .g-input {
  flex: 1;
  min-width: 8rem;
}

.g-account {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.g-account .g-input {
  flex: 1 1 9rem;
  min-width: 0;
}

/* Toggle labels are full sentences; they must wrap on a phone, never widen
   the card (the old nowrap here was the Android text-overrun bug). */
.g-toggle {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--ink);
}

.g-toggle--big {
  font-size: 1.1rem;
}

.g-check {
  width: 1.3rem;
  height: 1.3rem;
  accent-color: var(--accent);
  flex: none;
}

.g-btn {
  display: inline-block;
  background: var(--card-soft);
  color: var(--ink);
  border: none;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

/* §Phase 3B — the decrypted search-history timeline in the audit view. */
.audit__history {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.audit__history-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.audit__history-q {
  font-weight: 600;
}
.audit__history-row[data-blocked] .audit__history-q {
  color: var(--danger);
}

/* §Phase 3 — the encrypted-archive sub-panel inside the search card. */
.g-subcard {
  margin-top: 0.8rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.g-btn--primary {
  background: var(--cta);
  color: var(--cta-ink);
  font-weight: 700;
}

.g-btn--ghost {
  background: transparent;
  border: 1px solid var(--sky-indigo-soft);
  color: var(--ink-dim);
}

.g-btn--icon {
  padding: 0.4rem 0.6rem;
  background: transparent;
  color: var(--ink-dim);
}

.g-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.4rem 0;
}

.g-row > * {
  min-width: 0;
}

.g-msg {
  color: var(--accent);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

/* --- friends' hearts (B2) — relational, count-free "Liked by <friends>" --- */
.post__friends {
  margin: 0.75rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.post__friends::before {
  content: '♥';
  color: var(--cta);
}

/* --- post save button --- */
.post__actions {
  margin-top: 0.9rem;
  display: flex;
}

.post__save {
  background: var(--card-soft);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.post__save--on {
  background: var(--moon);
  color: var(--highlight-ink);
}

/* §B3 share button — sits beside Save; available in every mode (no account). */
.post__share {
  background: var(--card-soft);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* §D1 follow button — adds the author to My Sky; available in every mode. */
.post__follow {
  background: var(--card-soft);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.post__follow--on {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* §D1 follow-from-quoted: a small follow control beside the inert quoted author.
   It records a device-local follow only — never a door into the outside feed. */
.post__quote-authorrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.post__follow--quote {
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
}

/* §D1 "In your sky" header — a calm, count-free line naming who you follow. */
.mysky__header {
  max-width: 640px;
  margin: 0 auto;
  padding: 0.4rem 1rem 0;
  color: var(--ink-muted);
  font-weight: 600;
}

/* §D Telescope — the approved-feed picker (rung 1). */
.telescope__picker {
  max-width: 640px;
  margin: 0 auto;
  padding: 0.6rem 1rem 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.telescope__feed {
  background: var(--card-soft);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.telescope__feed[aria-current="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* §Telescope rung 2 — search. */
.telescope__search {
  max-width: 640px;
  margin: 0 auto;
  padding: 0.6rem 1rem 0;
}

.telescope__search-row {
  display: flex;
  gap: 0.5rem;
}

.telescope__search-input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font: inherit;
}

.telescope__search-go {
  background: var(--cta);
  color: var(--cta-ink);
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.telescope__search-msg {
  display: block;
  color: var(--danger);
  font-weight: 600;
  min-height: 1.2em;
  padding: 0.3rem 0.2rem 0;
}

.telescope__history {
  max-width: 640px;
  margin: 0.3rem auto 0;
  padding: 0 1rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.telescope__history-list {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.telescope__history-list [data-blocked] {
  color: var(--danger);
}

/* Care-aware refusal (self-harm category) — a gentle door, not a wall. */
.telescope__care {
  max-width: 480px;
  margin: 0.6rem auto 0;
  padding: 1.1rem 1.2rem 1.2rem;
  background: var(--card);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.telescope__care-glyph {
  font-size: 1.8rem;
  line-height: 1;
}

.telescope__care-body {
  margin: 0.6rem 0 1rem;
  color: var(--ink);
}

.telescope__care-help {
  display: inline-block;
  width: 100%;
  background: var(--moon);
  color: var(--highlight-ink);
  border: 0;
  font: inherit;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  cursor: pointer;
}

/* --- saves --- */
.clip__list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.clip {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.clip__head {
  display: flex;
  gap: 0.8rem;
}

.clip__thumb {
  width: 4rem;
  height: 4rem;
  border-radius: 12px;
  object-fit: cover;
  flex: none;
  background: var(--card-soft);
}

.clip__author {
  font-weight: 700;
}

.clip__text {
  margin: 0.3rem 0 0;
  line-height: 1.45;
}

.clip__note {
  width: 100%;
  margin-top: 0.7rem;
  background: var(--sky-deep);
  color: var(--ink);
  border: 1px solid var(--sky-indigo-soft);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  font: inherit;
  resize: vertical;
}

.clip__actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.clip__remove {
  background: transparent;
  border: 1px solid var(--sky-indigo-soft);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

/* §B3 saves controls: open the full post-view, or share the permalink. */
.clip__open {
  margin-right: auto;
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}
.clip__open:hover {
  text-decoration: underline;
}

.clip__share {
  background: var(--card-soft);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* --- "how it works" explainer --- */
.explain {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.explain__card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.explain__card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  color: var(--accent);
}

.explain__card p {
  margin: 0;
  line-height: 1.55;
  font-size: 1.05rem;
}

.explain__card .topbar__help {
  margin: 0.9rem 0 0;
  font-size: 1rem;
  padding: 0.6rem 1.1rem;
}

/* Multi-paragraph and list cards (the sponsor guide). */
.explain__card p + p,
.explain__card p + ol,
.explain__card p + ul {
  margin-top: 0.8rem;
}

.explain__steps,
.explain__list {
  margin: 0.8rem 0 0;
  padding-left: 1.4rem;
  line-height: 1.55;
  font-size: 1.05rem;
}

.explain__steps li,
.explain__list li {
  margin: 0.4rem 0;
}

/* --- help handoff modal --- */
.handoff {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(6, 7, 24, 0.72);
  backdrop-filter: blur(3px);
}

.handoff__dialog {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem;
  max-width: 22rem;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.handoff__glyph {
  font-size: 2.6rem;
}

.handoff__title {
  margin: 0;
  font-size: 1.35rem;
}

.handoff__body {
  margin: 0;
  color: var(--ink-dim);
  line-height: 1.5;
}

.handoff__go {
  display: inline-block;
  width: 100%;
  background: var(--moon);
  color: var(--highlight-ink);
  text-decoration: none;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-radius: 12px;
}

.handoff__hint {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
}

.handoff__close {
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font: inherit;
  cursor: pointer;
  padding: 0.4rem;
}

/* --- PIN lock (D6) --- */
.pinlock {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: linear-gradient(180deg, var(--sky-indigo) 0%, var(--sky-deep) 100%);
}

.pinlock__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  max-width: 18rem;
  text-align: center;
}

.pinlock__glyph {
  font-size: 3rem;
}

.pinlock__title {
  margin: 0;
  font-size: 1.5rem;
}

.pinlock__input {
  width: 100%;
  text-align: center;
  font-size: 2rem;
  letter-spacing: 0.5em;
  padding: 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--sky-indigo-soft);
  background: var(--sky-deep);
  color: var(--ink);
}

.pinlock__err {
  color: var(--danger);
  min-height: 1.2em;
  font-size: 0.95rem;
}

.pinlock__btn {
  width: 100%;
  padding: 0.8rem;
  border: none;
  border-radius: 12px;
  background: var(--moon);
  color: var(--highlight-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* --- build stamp --- */
.build {
  position: fixed;
  inset: auto 0 max(0.4rem, env(safe-area-inset-bottom)) 0;
  display: flex;
  gap: 0.5ch;
  align-items: baseline;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--ink-dim);
  /* Opaque so the attribution keeps its contrast over whatever content scrolls
     under this fixed bar (a11y: never muted text over a coloured button). */
  background: var(--bg);
  pointer-events: none;
}

.build__croft {
  pointer-events: auto; /* the footer is pointer-events:none; the attribution is clickable */
  color: var(--ink-dim);
  text-decoration: none;
}
.build__croft:hover {
  text-decoration: underline;
}

.build__label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.6rem;
}

.build code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--ink-dim);
}

/* --- S1 landing + role funnel --- */
.topbar[hidden] {
  display: none;
}

.landing {
  max-width: 42rem;
  margin: 0 auto;
  padding: max(1.4rem, env(safe-area-inset-top)) 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.landing__hero {
  text-align: center;
  padding-top: 2.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

/* Owner hero render — the framed butterfly window in its lit niche. Rounded,
   softly shadowed, responsive; sits above the crisp SVG wordmark. */
.landing__hero-img {
  width: min(100%, 30rem);
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
  margin-bottom: 0.6rem;
}

.landing__moon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--moon);
  box-shadow: 0.9rem -0.2rem 0 0 var(--sky-deep) inset;
  margin-bottom: 0.6rem;
}

.landing__title {
  margin: 0;
  font-size: 2.8rem;
  letter-spacing: 0.01em;
  color: var(--star);
}

.landing__subtitle {
  margin: 0;
  font-size: 1.3rem;
  color: var(--accent);
}

.landing__lede {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.5;
  text-align: center;
  color: var(--ink);
}

.landing__para {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink);
}

.landing__para strong {
  color: var(--star);
}

.landing__honesty {
  color: var(--ink-dim);
  font-size: 0.98rem;
}

.landing__doors {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 0.4rem 0;
}

.landing__door-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.landing__door {
  display: block;
  width: 100%;
  text-align: center;
  padding: 1.05rem 1.25rem;
  font-size: 1.15rem;
  font-weight: 650;
  border-radius: var(--radius);
  border: 2px solid var(--sky-indigo-soft);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.landing__door[data-door='sponsor'] {
  background: var(--cta);
  color: var(--cta-ink);
  border-color: var(--cta);
}

.landing__door:hover,
.landing__door:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

.landing__paste {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  padding: 0.9rem;
  border-radius: var(--radius);
  background: var(--sky-indigo);
  border: 1px solid var(--sky-indigo-soft);
}

.landing__paste[hidden] {
  display: none;
}

.landing__paste-input {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.8rem 0.9rem;
  font-size: 1.05rem;
  border-radius: 12px;
  border: 1px solid var(--sky-indigo-soft);
  background: var(--sky-deep);
  color: var(--ink);
}

.landing__btn--go {
  padding: 0.8rem 1.2rem;
  font-size: 1.05rem;
  font-weight: 650;
  border-radius: 12px;
  border: none;
  background: var(--link);
  color: var(--accent-ink);
  cursor: pointer;
}

.landing__paste-msg {
  flex-basis: 100%;
  font-size: 0.95rem;
  color: var(--accent);
  min-height: 1.2em;
}

.landing__footer {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.6ch;
  justify-content: center;
  align-items: baseline;
  font-size: 0.9rem;
  color: var(--ink-dim);
}

.landing__foot-link {
  color: var(--ink-dim);
  text-decoration: underline;
}

/* --- S5 backup & restore (Saves page) --- */
.g-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.saves-backup {
  max-width: 42rem;
  margin: 0 auto 1.2rem;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--sky-indigo-soft);
  border-radius: var(--radius);
}

.saves-backup__title {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  color: var(--star);
}

/* --- S6 refresh control + pull-to-refresh --- */
.topbar__refresh {
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid var(--sky-indigo-soft);
  background: var(--card);
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.topbar__refresh[hidden] {
  display: none;
}

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

.topbar__refresh-icon {
  display: block;
}

.topbar__refresh--spin .topbar__refresh-icon {
  animation: bluebird-spin 0.8s linear infinite;
}

@keyframes bluebird-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar__refresh--spin .topbar__refresh-icon {
    animation: none;
  }
  .pull__spinner {
    animation: none;
  }
}

.pull {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3rem;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 4;
  transform: translateY(calc(var(--pull, 0px) - 3.2rem));
  opacity: clamp(0, calc(var(--pull, 0px) / 70), 1);
}

.pull__spinner {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  border: 3px solid var(--sky-indigo-soft);
  border-top-color: var(--accent);
  opacity: 0.6;
}

.pull--armed .pull__spinner {
  opacity: 1;
}

.pull--loading .pull__spinner {
  animation: bluebird-spin 0.8s linear infinite;
}

/* --- S2 sponsor multi-explorer dashboard --- */
.g-section .g-toggle {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin: 0.5rem 0;
}

/* A flat sub-section within an explorer card: a divider + heading, then its
   controls. Deliberately NOT a raised card — the explorer card is one column
   of fields, not a stack of nested bubbles. */
.g-section {
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

.g-section > h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.g-explorers {
  max-width: 46rem;
  margin: 0 auto;
}

.g-explorers__head,
.g-explorer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.g-explorer {
  border-left: 4px solid var(--moon);
}

.g-explorer__head h2 {
  margin: 0;
}

/* Collapsible advanced disclosures (raw record, no-account setup). */
.g-details {
  margin-top: 0.9rem;
}

.g-details > summary {
  cursor: pointer;
  color: var(--link);
  font-weight: 600;
  padding: 0.2rem 0;
}

.g-provision code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--accent);
  word-break: break-all;
}

/* --- S7 label audit --- */
.audit__title {
  max-width: 46rem;
  margin: 0.5rem auto 0;
}
.audit__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.audit__table th,
.audit__table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--sky-indigo-soft);
  vertical-align: top;
}
.audit__label {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--accent);
  white-space: nowrap;
}

@media (max-width: 640px) {
  /* Monospace label NSIDs would otherwise stretch the audit table off-screen. */
  .audit__label {
    white-space: normal;
    word-break: break-all;
  }
}
.audit__account {
  padding: 0.7rem 0;
  border-top: 1px solid var(--sky-indigo-soft);
}
.audit__account-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: baseline;
}
.audit__account-name {
  font-weight: 700;
}
.audit__account-count {
  color: var(--accent);
  font-size: 0.9rem;
  white-space: nowrap;
}
.audit__example {
  padding: 0.4rem 0.6rem;
  margin: 0.35rem 0;
  background: var(--sky-indigo);
  border-radius: 10px;
}
.audit__example-labels {
  color: var(--accent);
  font-size: 0.8rem;
}
.audit__example-text {
  margin: 0.2rem 0 0;
  color: var(--ink-dim);
}

/* --- §3 garden-change notice --- */
.banner--change {
  background: rgba(255, 214, 92, 0.14);
  border: 1px solid rgba(255, 214, 92, 0.4);
  color: var(--ink);
}

/* --- B1/B2 likes + explorer sign-in --- */
.post__actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.post__like {
  background: var(--card-soft);
  color: var(--ink);
  border: 1px solid rgba(255, 214, 92, 0.3);
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.post__like--on {
  background: rgba(255, 214, 92, 0.18);
  color: var(--accent);
  border-color: var(--accent);
}

.post__like[data-like-signedout] {
  color: var(--ink-dim);
  font-weight: 500;
}

.signin {
  align-items: flex-start;
  gap: 0.7rem;
}

.signin__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.signin__lede {
  margin: 0;
}

.signin__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.signin__input {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  border-radius: 12px;
  border: 1px solid var(--sky-indigo-soft);
  background: var(--sky-deep);
  color: var(--ink);
}

.signin__btn {
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-weight: 650;
  border-radius: 12px;
  border: none;
  background: var(--moon);
  color: var(--highlight-ink);
  cursor: pointer;
}

.signin__msg {
  color: var(--accent);
  font-size: 0.9rem;
  min-height: 1.1em;
}

/* --- P4 theme toggle + landing brand mark --- */
.topbar__theme {
  flex: none;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

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

.landing__title {
  display: flex;
  justify-content: center;
}

.landing__title .wordmark {
  height: 2.8rem;
  width: auto;
  color: var(--ink);
}

/* ============================================================
   §B4 — the "full" skin. A cosmetic `skin` value (config.skin === 'full')
   that echoes bsky.app's flat, edge-to-edge, hairline-divided feed — the
   owner reference is assets/brand/reference/bsky-*.png. It is PURELY
   presentational: it re-lays the SAME post DOM and NEVER gates a capability
   (capabilities-key-on-localOnly-never-skin), and — like every Bluebird
   surface — it still shows NO like/repost/reply counts. The calm, spacious
   card look is the default "simple" skin; "full" trades the floating cards
   for a denser, more app-like reading feed. Token-only (no raw hex here), so
   both themes and the contrast sweep carry over unchanged.
   ============================================================ */

/* Edge-to-edge feed: the side gutter moves from the container onto each row. */
[data-skin="full"] .garden {
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}
[data-skin="full"] .garden__list {
  gap: 0;
}

/* Flat rows separated by a hairline, instead of floating, shadowed cards. */
[data-skin="full"] .post {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1rem 1.05rem;
}
[data-skin="full"] .post:last-child {
  border-bottom: none;
}

/* bsky sets the display name, @handle and time on one inline row. */
[data-skin="full"] .post__header {
  align-items: flex-start;
  margin-bottom: 0.4rem;
}
[data-skin="full"] .post__id {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.4rem;
  row-gap: 0.1rem;
}
[data-skin="full"] .post__handle {
  font-size: 0.9rem;
}

/* Body text sits at a calmer reading size in the denser feed. */
[data-skin="full"] .post__text {
  font-size: 1.08rem;
}

/* Media reads a touch larger and stays rounded, bsky-style. */
[data-skin="full"] .post__images,
[data-skin="full"] .post__video {
  margin-top: 0.6rem;
}

/* Status/empty text keeps its own comfortable gutter without the container one. */
[data-skin="full"] .garden__status {
  padding-left: 1rem;
  padding-right: 1rem;
}

/* ============================================================
   Mobile as a first-class client. Phones get slimmer gutters — the sponsor
   dashboard nests cards three deep, and at desktop paddings that leaves too
   little room for a form row on a 360px screen.
   ============================================================ */
@media (max-width: 480px) {
  .sponsor {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }

  .g-card {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  /* Cards nested inside an explorer card (Channels, Search, provisioning…). */
  .g-card .g-card,
  .g-subcard {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .g-channel {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .garden,
  .explain {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .post {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
}
