/* ── Kipinä design system ─────────────────────────────────────── */
/* Light, high-contrast theme for a senior (50+) audience — see
   research/FINDINGS.md Track 1 on the EU Accessibility Act/WCAG 2.2 AA
   baseline. Every pair below is checked against the real WCAG contrast
   formula, not eyeballed:
     - text / text-muted on bg / surface / surface-2 all clear 4.5:1
       (several clear 6-7:1+).
     - --gold and --online-text (the *text/border* roles) clear 4.5:1 on
       bg and surface-2; --gold-fill and --online (the *solid-fill*
       roles, used with dark text on top — .btn-gold, .badge-premium,
       .online-dot, .chip-online.chip-active) keep their original values,
       since that pairing (dark text on a bright fill) doesn't depend on
       the page's own background color.
     - --border clears 3:1 (the UI-component/non-text threshold) against
       bg, surface and surface-2. */
:root {
  --bg: #fbf6f1;
  --surface: #ffffff;
  --surface-2: #e6d9cb;
  --border: #8a7a6d;
  --text: #241c17;
  --text-muted: #5c5047;
  --accent: #c2375f;
  --accent-fill: #9c2348;
  /* Text/border role (badges, "featured" borders, the founding-offer
     widget) — distinct from --gold-fill below because a gold *dark-text*
     badge and gold *as text on the page* need opposite brightness to both
     clear 4.5:1. */
  --gold: #765512;
  /* Fill role: unchanged from the original bright gold — #241505 text on
     top of it clears 10:1, and that pairing doesn't involve --bg at all,
     so it doesn't need to move with the rest of the theme. */
  --gold-fill: #f5b942;
  --online-text: #156339;
  --online: #3ddc84;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(20, 12, 8, .12);
}

/* Root font-size bump (16px -> 20px): every size below is in rem, so this
   scales the entire UI's type ~25% larger in one place rather than
   touching each rule — the senior-accessibility equivalent of what the
   marketing site's style.css does by bumping each px value individually. */
html { color-scheme: light; font-size: 125%; }

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Baseline safety net: an <img> with no sizing rules of its own (or hit
   before its component CSS loads) renders at its native pixel size —
   uploaded photos are re-encoded up to 2000px, which blows out any layout
   it lands in. Every current photo/avatar class already sets its own
   width/height/object-fit and overrides this; it's a floor, not the
   real sizing mechanism. */
img { max-width: 100%; height: auto; display: block; }

/* Several components below (.btn, .verify-actions, ...) set an explicit
   `display`, which has equal CSS specificity to the browser's native
   [hidden]{display:none} rule and loads later — so a hidden .btn/.verify-
   actions element renders anyway instead of staying hidden. Confirmed on
   #verify-badge (an empty visible pill) and latent on #verify-actions
   (would show real "Vastaavat"/"Eivät vastaa" buttons prematurely). This
   is a systemic pattern, not a one-off — [hidden] should always win. */
[hidden] { display: none !important; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.no-scroll { overflow: hidden; }

/* main.container (not plain `main`): base.html always renders
   <main class="container">, and .container's own `padding: 0 16px`
   shorthand has higher specificity than a bare element selector, so it
   was silently overriding this padding-bottom to 0 on every page — the
   intended clearance before the footer never actually applied anywhere. */
/* Shared top spacing for every page's content, set once here rather than
   repeated (and sometimes forgotten, causing pages to line up at
   different heights) per-page — pages that deliberately want more than
   this baseline add their own extra on top of it (see .auth-page,
   .premium-page) rather than duplicating it from scratch. */
main.container { flex: 1; width: 100%; padding-top: 16px; padding-bottom: 96px; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

a { color: var(--accent); text-decoration: none; }

.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.accent { color: var(--accent); }
.gold { color: var(--gold); }

/* Visually hidden until focused (keyboard-only skip past the header nav
   straight to <main>) — moves on-screen only on :focus so sighted mouse
   users never see it. */
.skip-link {
  position: absolute; top: -100%; left: 8px; z-index: 200;
  background: var(--accent-fill); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-weight: 700;
  transition: top .15s;
}
.skip-link:focus { top: 8px; }

/* ── Header ───────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(251, 246, 241, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; gap: 8px;
}

.logo { font-size: 1.35rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.logo-dot { color: var(--accent); }

.header-nav {
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
}
.header-nav::-webkit-scrollbar { display: none; }
.inline-form { display: inline; }

.premium-pill {
  color: var(--gold); font-weight: 700; font-size: .85rem;
  padding: 6px 10px; border: 1px solid var(--gold); border-radius: 999px;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-block; border: none; cursor: pointer;
  font: inherit; font-weight: 700; text-align: center;
  padding: 12px 22px; border-radius: 999px;
  transition: background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--accent-fill); color: #fff; }
/* Darkens rather than brightens on hover: brightening a fill this close
   to the AA floor would push its white-text contrast back under 4.5:1. */
.btn-primary:hover { filter: brightness(.85); }

.btn-gold { background: var(--gold-fill); color: #241505; }
.btn-gold:hover { filter: brightness(1.08); }

.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--text-muted); }

.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-lg { padding: 15px 28px; font-size: 1.05rem; }
.btn-block { display: block; width: 100%; }

/* ── Hero ─────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 44px 8px 36px; }

.hero h1 {
  font-size: clamp(1.9rem, 6vw, 3rem);
  font-weight: 800; letter-spacing: -.03em; line-height: 1.15;
  margin-bottom: 12px;
}

.hero-sub {
  color: var(--text-muted); max-width: 460px;
  margin: 0 auto 22px; font-size: 1.05rem;
}

.hero-note { margin-top: 14px; font-size: .85rem; color: var(--text-muted); }

/* Founding-member launch offer — shown on the home hero and signup page
   (core/templates/core/_founding_offer.html) while slots remain. Reuses
   the site's existing gold "premium/featured" language (.premium-pill,
   .price-card-featured) rather than introducing a new visual vocabulary. */
.founding-offer {
  background: var(--surface-2); border: 1px solid var(--gold);
  border-radius: var(--radius); padding: 14px 18px; margin: 20px auto;
  max-width: 420px; text-align: center;
}
.founding-offer-text { color: var(--gold); font-weight: 700; font-size: .95rem; margin-bottom: 10px; }
.founding-offer-bar { background: var(--border); border-radius: 999px; height: 8px; overflow: hidden; }
.founding-offer-fill { background: var(--gold); height: 100%; border-radius: 999px; }
.founding-offer-count { color: var(--text-muted); font-size: .8rem; margin-top: 6px; }
.founding-offer-sub { font-size: .85rem; }

/* Free tier's daily opener cap, shown above the chat composer. */
.opener-remaining { font-size: .9rem; margin: 8px 0; }
.opener-limit p { margin: 0 0 10px; }
.nav-premium { color: var(--gold); }

/* ── Filters ──────────────────────────────────────────────────── */
.filters { padding: 12px 0 4px; }

.filter-group { margin-bottom: 20px; }
.filter-group:last-child { margin-bottom: 0; }

.filter-group-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.chip-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; row-gap: 10px;
}

.chip {
  flex: 0 0 auto;
  padding: 8px 16px; border-radius: 999px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  font-size: .9rem; font-weight: 600; white-space: nowrap;
}

.chip-active { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.chip-online { color: var(--online-text); }
.chip-online.chip-active { background: var(--online); color: #06230f; border-color: var(--online); }

.chip-suggested {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
}
.chip-suggested:hover { color: var(--text); border-color: var(--text-muted); }

.chip-row-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin: 10px 0 2px;
}

.city-add {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}
.city-add input[type="text"] {
  width: 150px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; font: inherit; font-size: .9rem;
}
.city-add .btn-add-city {
  flex: 0 0 auto;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.city-add .btn-add-city:hover { background: var(--surface); }

/* ── Profile grid ─────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px 0 32px;
}

@media (min-width: 640px)  { .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 900px)  { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1080px) { .grid { grid-template-columns: repeat(5, 1fr); } }

.card {
  display: block; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; color: var(--text);
  transition: transform .12s, border-color .12s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }

.card-avatar {
  position: relative; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,
    hsl(var(--hue), 55%, 38%),
    hsl(calc(var(--hue) + 40), 60%, 24%));
}

.card-initial { font-size: 2.6rem; font-weight: 800; color: rgba(255, 255, 255, .85); }

.card-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.online-dot {
  position: absolute; bottom: 10px; right: 10px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--online); border: 2px solid var(--surface);
}
.online-dot-lg { width: 18px; height: 18px; bottom: 6px; right: 6px; }

.badge-premium {
  position: absolute; top: 8px; right: 8px;
  background: var(--gold-fill); color: #241505;
  font-size: .8rem; font-weight: 800;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.card-body { padding: 10px 12px 12px; }

.card-name {
  font-weight: 700; font-size: .95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.verified { color: var(--online-text); font-weight: 800; margin-left: 2px; }

.card-meta { color: var(--text-muted); font-size: .85rem; margin-bottom: 6px; }

.card-prompt {
  color: var(--text-muted); font-style: italic; font-size: .85rem;
  margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.tag {
  background: var(--surface-2); color: var(--text-muted);
  font-size: .78rem; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.tag-lg { font-size: .85rem; padding: 6px 12px; color: var(--text); }

.empty-state { grid-column: 1 / -1; text-align: center; color: var(--text-muted); padding: 48px 0; }

/* ── Sticky CTA (mobile conversion) ───────────────────────────── */
.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(251, 246, 241, .97) 60%, transparent);
}
.sticky-cta .btn { box-shadow: var(--shadow); max-width: 480px; margin: 0 auto; }

/* ── Profile page ─────────────────────────────────────────────── */
.profile-page { max-width: 620px; margin: 0 auto; }

.back-link { color: var(--text-muted); font-size: .9rem; display: inline-block; margin-bottom: 16px; }

.profile-hero { display: flex; gap: 18px; align-items: center; margin-bottom: 24px; }

.profile-avatar {
  position: relative; flex: 0 0 auto;
  width: 96px; height: 96px; border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; font-weight: 800; color: rgba(255, 255, 255, .85);
  background: linear-gradient(135deg,
    hsl(var(--hue), 55%, 38%),
    hsl(calc(var(--hue) + 40), 60%, 24%));
}

.profile-avatar-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 24px;
}

.profile-headline h1 { font-size: 1.5rem; letter-spacing: -.02em; }

.online-text { color: var(--online-text); font-weight: 600; }

.badge-premium-inline {
  display: inline-block; margin-top: 6px;
  color: var(--gold); border: 1px solid var(--gold);
  font-size: .8rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
}

.profile-section { margin-bottom: 22px; }
.profile-section h2 {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); margin-bottom: 8px;
}

.prompt-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.prompt-question {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin-bottom: 4px;
}
.prompt-answer { font-size: 1.02rem; font-weight: 600; }

/* flex column + gap so the message button and its note get space
   between them. */
.profile-cta { margin-top: 32px; display: flex; flex-direction: column; gap: 10px; }
.cta-note { text-align: center; color: var(--text-muted); font-size: .85rem; margin-top: 10px; }

/* ── Premium page ─────────────────────────────────────────────── */
/* 16px on top of main.container's own 16px baseline — deliberately more
   breathing room for a centered form/marketing page than the default. */
.premium-page { max-width: 560px; margin: 0 auto; text-align: center; padding-top: 16px; }
.premium-page h1 { font-size: 2rem; letter-spacing: -.02em; margin-bottom: 8px; }

.benefit-list {
  list-style: none; text-align: left;
  max-width: 340px; margin: 24px auto;
}
.benefit-list li { padding: 7px 0; color: var(--text); }

/* Stacked full-width by default: 3 columns at the ~8px side padding this
   needs to fit narrow phones squeezes price/CTA text too tight to read
   comfortably. Row layout only kicks back in once there's enough width
   (matches .premium-page's own 560px cap) for 3 columns to breathe. */
.price-cards { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 24px; }

.price-card {
  flex: 1; position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px 16px;
}
.price-card-featured { border-color: var(--gold); background: var(--surface-2); }

.price-flag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--gold-fill); color: #241505;
  font-size: .7rem; font-weight: 800;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}

.price-term { color: var(--text-muted); font-size: .85rem; font-weight: 600; }
.price-amount { font-size: 1.3rem; font-weight: 800; margin: 4px 0 2px; }
.price-note { color: var(--text-muted); font-size: .7rem; }

.price-card form { margin-top: 10px; }

.subscription-summary, .payment-history {
  text-align: left; margin-top: 32px;
}
.subscription-summary h2, .payment-history h2 {
  font-size: 1.05rem; margin-bottom: 12px;
}
.subscription-details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: grid; grid-template-columns: auto 1fr; gap: 6px 16px;
}
.subscription-details dt { color: var(--text-muted); font-size: .85rem; }
.subscription-details dd { font-weight: 600; }

.history-table {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.history-table th, .history-table td {
  padding: 10px 14px; text-align: left; font-size: .85rem;
}
.history-table th {
  color: var(--text-muted); font-weight: 600; font-size: .75rem;
  border-bottom: 1px solid var(--border);
}
.history-table tr:not(:last-child) td { border-bottom: 1px solid var(--border); }

.payment-status { font-weight: 600; }
.payment-status-ok { color: var(--online-text); }
.payment-status-fail { color: var(--accent); }
.price-card .btn { padding: 10px 16px; font-size: .9rem; line-height: 1.2; }

@media (min-width: 560px) {
  .price-cards { flex-direction: row; }
  .price-card { padding: 18px 8px 14px; }
  .price-card .btn { padding: 8px 4px; font-size: .78rem; }
}

/* ── Privacy policy page ──────────────────────────────────────── */
.privacy-page { max-width: 680px; margin: 0 auto; padding: 32px 0 16px; }
.privacy-page h1 { font-size: 1.7rem; letter-spacing: -.02em; margin-bottom: 6px; }
.privacy-page > .muted { margin-bottom: 28px; }
.privacy-page h2 { font-size: 1.15rem; letter-spacing: -.01em; margin: 32px 0 10px; }
.privacy-page p { margin-bottom: 14px; }
.privacy-page ul { margin: 0 0 14px; padding-left: 22px; }
.privacy-page li { margin-bottom: 10px; }
.privacy-page li:last-child { margin-bottom: 0; }
.privacy-page a { text-decoration: underline; }
.privacy-page code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px; font-size: .9em;
}

/* ── Auth pages ───────────────────────────────────────────────── */
/* 16px on top of main.container's own 16px baseline — same deliberate
   extra as .premium-page, see there. */
.auth-page { max-width: 420px; margin: 0 auto; padding-top: 16px; }
.auth-page h1 { font-size: 1.7rem; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-page > .muted { margin-bottom: 24px; }
.auth-page h2 {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); margin: 28px 0 12px;
}

.auth-form { margin-top: 18px; }

.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }

.form-field-checkbox label {
  display: flex; align-items: flex-start; gap: 8px;
  font-weight: 400; font-size: .85rem; color: var(--text);
}
.form-field-checkbox input[type="checkbox"] {
  width: auto; margin-top: 3px; accent-color: var(--accent-fill);
}

.auth-form input, .auth-form select, .auth-form textarea {
  width: 100%;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font: inherit; font-size: 1rem;
}
.auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus {
  outline: none; border-color: var(--accent);
}
/* Overrides the 100%-width rule above for a bare checkbox rendered
   straight from the generic {% for field in form %} loop (e.g.
   Profile.discoverable) — without this it stretches into a full-width
   bar instead of a normal small checkbox. */
.auth-form input[type="checkbox"] { width: auto; accent-color: var(--accent-fill); }
.auth-form textarea { resize: vertical; min-height: 90px; }
/* Without this, native <select> chrome adds its own inset padding on top
   of the explicit padding above, so select text sits visibly further
   right than input text — replaced with a matching custom arrow so the
   dropdown affordance isn't lost. */
.auth-form select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a98da0' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.field-error { color: var(--accent); font-size: .82rem; margin-top: 5px; }

/* Django's CheckboxSelectMultiple renders as nested <div>s here, not
   <ul>/<li> — targeting the actual #id_tags wrapper rather than assuming
   a list structure that doesn't exist in this Django version's markup. */
.tag-checkboxes #id_tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-checkboxes label {
  /* inline-flex, not flex: a chip must size to its own content, not
     stretch to fill its parent block — that's what made every tag render
     as a full-width bar instead of a compact pill. */
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.tag-checkboxes input[type="checkbox"] { width: auto; accent-color: var(--accent-fill); }

.auth-form .helptext { display: none; }

.auth-switch { text-align: center; margin-top: 22px; color: var(--text-muted); }

/* ── File upload ──────────────────────────────────────────────── */
.upload-form { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 24px; }

/* The native file input's own "Choose File" / "No file chosen" chrome is
   browser-locale text, not page content — it can't be translated via CSS
   (::file-selector-button has no `content` override), so it's kept
   functional but visually hidden, with a real <label for> standing in as
   the visible, Finnish-labelled trigger and a JS-updated span showing the
   chosen filename. */
.file-field { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-field-input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.file-field-input:focus-visible + .file-field-label {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.file-field-label {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 16px; font-weight: 600; cursor: pointer;
}
.file-field-label:hover { background: var(--surface); }
.file-field-name { color: var(--text-muted); font-size: .9rem; }

/* ── Photos page ──────────────────────────────────────────────── */
.photos-page { max-width: 560px; margin: 0 auto; }
.photos-page h1 { font-size: 1.6rem; letter-spacing: -.02em; margin-bottom: 20px; }

.photo-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.photo-list-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
}

.existing-picker { margin-bottom: 14px; }
.existing-picker summary {
  cursor: pointer; color: var(--text-muted); font-size: .9rem; margin-bottom: 10px;
}
.existing-picker .photo-list { margin-bottom: 4px; }

.photo-thumb {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 12px;
  object-fit: cover;
}
.photo-thumb-pending {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: 1.4rem;
}

.photo-name {
  flex: 1; min-width: 0; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-status { font-weight: 600; color: var(--text-muted); }
.photo-status-pending, .photo-status-in_review { color: var(--gold); }
.photo-status-approved { color: var(--online-text); }
.photo-status-rejected, .photo-status-hard_blocked { color: var(--accent); }

.photo-empty { color: var(--text-muted); text-align: center; padding: 32px 0; }

/* Reuses .photo-status's colors on my_posts.html's feed cards (posts/
   templates/posts/my_posts.html) — same "pending/rejected" meaning, just
   for a Post instead of a Photo. */
.my-post-status { display: block; padding: 8px 10px; font-size: .85rem; }

.photo-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.badge-gallery {
  margin-left: 6px; font-size: .75rem; font-weight: 700; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; padding: 1px 8px;
}

/* ── Profile photo gallery ────────────────────────────────────── */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (min-width: 640px) { .photo-gallery { grid-template-columns: repeat(4, 1fr); gap: 10px; } }

.gallery-thumb-btn {
  display: block; padding: 0; border: none; cursor: pointer;
  background: var(--surface); border-radius: 10px; overflow: hidden;
  aspect-ratio: 1;
  /* Without this, a grid item's automatic min-width falls back to its
     content's intrinsic size — for an <img width:100%> that's the photo's
     full natural pixel width (up to 2000px), blowing out the grid track
     and the whole page into horizontal scroll. */
  min-width: 0;
}

.gallery-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }

.gallery-lightbox {
  border: none; background: transparent; padding: 0; max-width: 90vw; max-height: 90vh;
  /* The global `* { margin: 0 }` reset cancels the browser's own
     `dialog { margin: auto }` rule, which is what centers a modal dialog
     in the viewport — without this it anchors to the inset edges
     (top-left) instead. */
  margin: auto;
}
.gallery-lightbox::backdrop { background: rgba(0, 0, 0, .8); }
.gallery-lightbox img { display: block; max-width: 90vw; max-height: 90vh; border-radius: 12px; }

.gallery-lightbox-close {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  /* Floats over the lightbox's own dark photo-viewer backdrop (kept dark
     regardless of theme, like a camera-roll viewer), not the page — so
     this stays a light-on-dark control, not var(--text). */
  background: rgba(18, 7, 15, .8); color: #fff; font-size: 1.1rem;
}

/* ── Flash messages ───────────────────────────────────────────── */
.flash {
  margin: 14px 0; padding: 12px 16px;
  border-radius: 10px; font-size: .92rem;
  background: var(--surface-2); border: 1px solid var(--border);
}
.flash-success { border-color: var(--online-text); }
.flash-info { border-color: var(--gold); }
.flash-error { border-color: var(--accent); }

/* ── Footer ───────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 32px; text-align: center;
  font-size: .85rem; color: var(--text-muted);
}
/* .sticky-cta (home page, logged-out only) is position:fixed and covers
   whatever's at the very bottom of the viewport regardless of DOM nesting —
   without this, the footer's privacy-policy link is unreachable when it's
   present. Scoped via :has() so other pages keep the normal, smaller
   footer padding. */
body:has(.sticky-cta) .site-footer {
  padding-bottom: 100px;
}

/* ── Age gate ─────────────────────────────────────────────────── */
.age-gate {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 3, 8, .96);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.age-gate-card {
  max-width: 380px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px 28px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}

.age-gate-logo { font-size: 1.6rem; }
.age-gate-card p { color: var(--text-muted); font-size: .95rem; }

/* ── Inbox ────────────────────────────────────────────────────── */
.inbox-page { max-width: 560px; margin: 0 auto; }

.inbox-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.inbox-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; color: var(--text);
}
.inbox-row-waiting { border-color: var(--gold); }

.inbox-avatar {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: rgba(255, 255, 255, .85);
  background: linear-gradient(135deg,
    hsl(var(--hue), 55%, 38%),
    hsl(calc(var(--hue) + 40), 60%, 24%));
}

.inbox-name { font-weight: 700; }
.inbox-status { font-size: .82rem; color: var(--text-muted); }
.inbox-status-waiting { color: var(--gold); font-weight: 600; }

/* ── Chat ─────────────────────────────────────────────────────── */
.chat-page { display: flex; flex-direction: column; height: calc(100vh - 180px); max-width: 640px; }

.chat-messages {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 12px 4px; margin-bottom: 12px;
}

.chat-bubble {
  max-width: 75%; padding: 10px 14px; border-radius: 16px;
  font-size: .95rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word;
}

.chat-bubble-own {
  align-self: flex-end; background: var(--accent-fill); color: #fff; border-bottom-right-radius: 4px;
}

.chat-bubble-peer {
  align-self: flex-start; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-bottom-left-radius: 4px;
}

.chat-compose { display: flex; gap: 8px; }

.chat-compose input {
  flex: 1; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px; padding: 10px 16px;
  font: inherit; font-size: 1rem;
}

.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.chat-header .back-link { margin-bottom: 0; }

.verify-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; text-align: center;
}

.verify-emoji {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 16px;
  margin: 16px 0;
}

.verify-emoji-cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 72px;
}
.verify-emoji-glyph { font-size: 2rem; }
.verify-emoji-label { font-size: .75rem; color: var(--text-muted); }

.verify-actions { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }

/* ── Gallery feed ─────────────────────────────────────────────── */
.gallery-title { font-size: 1.6rem; letter-spacing: -.02em; margin-bottom: 20px; }

/* Masonry via CSS columns rather than a fixed-aspect grid — photos keep
   their real proportions (no cropping) while still packing tightly and
   staying column-aligned. width/height attrs on the <img> (from
   Photo.width/height) reserve the right box before the image loads, so
   columns don't jump around as images resolve their aspect ratio. */
.gallery-masonry { column-count: 2; column-gap: 12px; }
@media (min-width: 640px) { .gallery-masonry { column-count: 3; column-gap: 16px; } }
@media (min-width: 900px) { .gallery-masonry { column-count: 4; } }
/* .empty-state's grid-column:1/-1 is a no-op here (this is a multi-column
   container, not a grid) — without column-span the text itself gets split
   across the column break. */
.gallery-masonry .empty-state { column-span: all; }

.gallery-item {
  break-inside: avoid; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  /* Lets .gallery-item-photo's `cqw` max-height below read "% of this
     card's own width", not the viewport's — see that rule for why. */
  container-type: inline-size;
}
/* width:100%/height:auto (not object-fit:contain in a fixed box) is the
   point: the image sizes itself off its own real aspect ratio, so a
   normal photo just looks normal and a caption-only post never reserves
   photo space at all. The one thing that needs a limit is an extreme
   aspect ratio (someone's 10×1000 screenshot) — uncapped, that would
   make one masonry card (or the whole single-post page) absurdly tall.
   Real feeds don't show those uncropped either — Instagram crops
   anything outside ~1.91:1–4:5, Facebook/Twitter/LinkedIn all cap and
   crop the same way — so 125cqw (a 4:5 portrait's height:width ratio)
   is that same cap: photos within it render in full, anything taller
   gets center-cropped down to it instead of blowing out the layout. */
.gallery-item-photo {
  display: block; width: 100%; height: auto;
  max-height: 125cqw; object-fit: cover;
}

.gallery-item-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px;
}

.like-form { flex: 0 0 auto; }

.like-btn {
  background: none; border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 10px; color: var(--text-muted); font-size: .85rem; cursor: pointer;
}
.like-btn-active { color: var(--accent); border-color: var(--accent); }

.pagination {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 20px;
}
.pagination-status { color: var(--text-muted); font-size: .85rem; }

/* ── Gallery post detail ──────────────────────────────────────── */
/* Plain top-to-bottom flow (back-link, then the card, sized off its own
   content — an image at its real aspect ratio, or just text with no
   reserved photo space at all), not a viewport-filling box: this page
   can hold text, a photo, or both, plus a comment thread below, so
   nothing here should assume "exactly one image, nothing else". */
.gallery-post-page {
  /* Bottom only — the top 16px now comes from main.container's shared
     baseline, so setting it here too would double it up. */
  max-width: 640px; width: 100%; margin: 0 auto; padding: 0 0 16px;
  display: flex; flex-direction: column; gap: 12px;
}

/* Same chrome as a feed .gallery-item (reused directly, not duplicated)
   — image (if any) on top, text (if any), then the name/like footer,
   stacked in normal flow. */
.gallery-post-card {
  margin-bottom: 0;
  display: flex; flex-direction: column;
}

.gallery-post-image {
  display: block; width: 100%; height: auto;
  max-height: 125cqw; object-fit: cover;
}

/* ── Feed compose + text posts + comments ────────────────────────── */
.compose-form {
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
}
.compose-textarea {
  width: 100%; min-height: 70px; resize: vertical;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 10px; font: inherit;
}
.compose-textarea:focus-visible { outline: none; border-color: var(--accent); }
.compose-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.compose-community-label { font-size: .85rem; color: var(--text-muted); }
.compose-community-select {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text); padding: 4px 10px; font: inherit; font-size: .85rem;
}

/* ── Communities (sub-feeds) ──────────────────────────────────────── */
.community-chips {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}
.community-chip {
  flex: 0 0 auto; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-size: .85rem; color: var(--text-muted);
}
.community-chip-active { color: var(--text); border-color: var(--accent); }
.community-chip-muted { color: var(--text-muted); border-style: dashed; }

.community-banner { margin-bottom: 16px; }
.community-description { color: var(--text-muted); font-size: .9rem; }
.community-banner-meta { display: flex; align-items: center; gap: 12px; margin-top: 8px; }

.community-badge {
  display: inline-block; margin: 10px 10px 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 10px; font-size: .78rem; color: var(--text-muted);
}

.community-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.community-list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px;
}
.community-list-link { display: flex; align-items: center; gap: 12px; color: var(--text); }
.community-list-icon { font-size: 1.4rem; }
.community-list-meta { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.feed-item-text {
  display: block; padding: 10px; color: var(--text); white-space: pre-wrap;
}
.feed-post-text { padding: 12px; }

/* Width/spacing come from the .gallery-post-page flex column it's
   nested in, not from here — this section matches the card above it. */
.comments { width: 100%; }
.comment-form { display: flex; gap: 8px; margin-bottom: 16px; }
.comment-input {
  flex: 1 1 auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text); padding: 8px 14px; font: inherit;
}
.comment-input:focus-visible { outline: none; border-color: var(--accent); }
.comment-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.comment-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px;
}
.comment-body { display: block; color: var(--text); margin-top: 2px; }
