/* PRD BRD-1 brand (design/brand/palette.md): night plum and orchid, light and dark.
   Dark follows the app's splash and icon (Deep Plum, night glow); light is Soft Lilac with Deep Plum ink.
   System fonts only: nothing loads from elsewhere. Story gradients and kind chips match mobile/src/theme.ts. */
:root {
  color-scheme: dark;
  --bg: #1A0A25;
  --bg-glow: #46195F;
  --surface: #2B1036;
  --surface-alt: #3A1A4A;
  --border: rgba(244, 240, 247, 0.16);
  --text: #F4F0F7;          /* 16:1 on --bg */
  --heading: #FFFFFF;
  --muted: #CDB8D8;         /* 10:1 on --bg, 9:1 on --surface */
  --word: #FFFFFF;
  --hangout: #FF6FBF;       /* Orchid Light: 6.8:1 on dark */
  --link: #FF6FBF;
  --btn-a: #D61F86;         /* Orchid Deep: white text 4.8:1 */
  --btn-b: #6E25E0;         /* Violet Deep: white text 7.0:1 */
  --outline: #A66BFF;       /* Violet Light: 5.0:1 on dark */
  --outline-text: #F4F0F7;
  --focus: #FFC83D;
  --shadow: rgba(0, 0, 0, 0.45);
  --skeleton-a: #2B1036; --skeleton-b: #3A1A4A;
  --action: #66377D; --event: #B0457E; --promo: #A85D17;
  --story-a: #7A3F93; --story-b: #251827;
  --event-a: #C24F8C; --event-b: #3A1838;
  --promo-a: #E39A45; --promo-b: #5A2A1F;
  --radius: 20px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #FAF6FC;
    --bg-glow: #E9DDF3;
    --surface: #FFFFFF;
    --surface-alt: #F4F0F7;
    --border: #E6DDEE;
    --text: #2B1036;        /* 16:1 on --bg */
    --heading: #2B1036;
    --muted: #5E4B6B;       /* 7.9:1 on --bg */
    --word: #2B1036;
    --hangout: #D61F86;     /* Orchid Deep: 4.8:1 on white */
    --link: #6E25E0;        /* Violet Deep: 6.6:1 on --bg */
    --outline: #6E25E0;
    --outline-text: #6E25E0;
    --focus: #6E25E0;
        --shadow: rgba(43, 16, 54, 0.14);
    --skeleton-a: #F4F0F7; --skeleton-b: #E9DDF3;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 60% at 50% 0%, var(--bg-glow), var(--bg) 70%) var(--bg) no-repeat;
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
a { color: var(--link); }

/* W4 lockup: the mascot head and "NextHangout" in heavy type, "Hangout" in orchid. */
.brand {
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.brand-link { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; min-height: 48px; border-radius: 12px; }
.brand-link img { width: 38px; height: 38px; margin-left: -4px; }
.word { font-weight: 900; font-size: 1.4rem; letter-spacing: -0.02em; color: var(--word); line-height: 1; }
.word b { font-weight: 900; color: var(--hangout); }

main {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px 8px;
}

h1 { font-size: 1.6rem; line-height: 1.25; margin: 16px 0 8px; color: var(--heading); }
p { margin: 0; }
.hint { color: var(--muted); font-size: 0.9rem; text-align: center; margin-top: 12px; }

/* Story preview */
.story { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 28px var(--shadow); }
.media {
  position: relative;
  aspect-ratio: 4 / 5;
  max-height: 58vh;
  width: 100%;
  background: linear-gradient(160deg, var(--story-a), var(--story-b));
  display: flex; align-items: center; justify-content: center;
}
.media[data-kind="event"] { background: linear-gradient(160deg, var(--event-a), var(--event-b)); }
.media[data-kind="promo"] { background: linear-gradient(160deg, var(--promo-a), var(--promo-b)); }
.media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.textcard {
  padding: 32px 24px;
  color: #FFFFFF;
  font-size: clamp(1.3rem, 5.5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.chip, .timeleft {
  position: absolute; top: 12px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700;
}
.chip { left: 12px; background: var(--action); color: #FFFFFF; }
.media[data-kind="event"] .chip { background: var(--event); }
.media[data-kind="promo"] .chip { background: var(--promo); }
.timeleft { right: 12px; background: rgba(37, 24, 39, 0.85); color: #FFFFFF; }

.meta { padding: 14px 16px 16px; }
.author { display: flex; align-items: center; gap: 12px; }
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--action); color: #FFFFFF; font-weight: 700; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border: 2px solid var(--hangout);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.name { font-weight: 700; color: var(--heading); }
.place { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.caption { margin-top: 12px; color: var(--text); overflow-wrap: anywhere; white-space: pre-line; }
.likes { margin-top: 10px; color: var(--muted); font-size: 0.9rem; }

/* Profile pages (/u/<id>) */
.profile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 28px var(--shadow); padding: 24px 16px 20px; text-align: center; }
.profile-photo { display: block; margin: 0 auto; width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 3px solid var(--hangout); background: var(--action); }
.mascot-avatar { object-fit: contain; padding: 12px; }
.profile-name { margin: 14px 0 4px; overflow-wrap: anywhere; }
.category { color: var(--muted); font-weight: 700; }
.verified, .curator { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 12px; border-radius: 999px; background: var(--surface-alt); color: var(--heading); font-size: 0.9rem; font-weight: 700; }
.tick { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); color: #FFFFFF; font-size: 0.75rem; }
.bio { margin-top: 12px; color: var(--text); overflow-wrap: anywhere; white-space: pre-line; }
.contact { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.contact .btn { flex: 1 1 96px; min-height: 48px; padding: 10px 16px; }

/* Loading, ended and error states */
.state { text-align: center; padding: 8px 4px 0; }
.state p { color: var(--muted); }
.mascot { display: block; margin: 8px auto 0; width: 136px; height: 136px; }
.skeleton { aspect-ratio: 4 / 5; max-height: 58vh; border-radius: var(--radius); background: linear-gradient(100deg, var(--skeleton-a) 30%, var(--skeleton-b) 50%, var(--skeleton-a) 70%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Buttons: at least 48px tall (Android touch targets) */
.actions { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.btn {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 52px; padding: 12px 20px; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn-primary { background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); color: #FFFFFF; font-size: 1.1rem; border: 0; box-shadow: 0 6px 20px rgba(214, 31, 134, 0.3); }
.btn-secondary { background: transparent; color: var(--outline-text); border: 2px solid var(--outline); }
.state .btn { margin: 16px auto 0; }
.btn:focus-visible, .contact a:focus-visible, .brand-link:focus-visible, .footer a:focus-visible, .prose a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Community rules */
.prose { max-width: 640px; }
.prose h1 { margin-top: 8px; }
.prose h2 { font-size: 1.15rem; color: var(--heading); margin: 28px 0 8px; }
.prose p, .prose li { color: var(--text); }
.prose p + p { margin-top: 12px; }
.prose ul { margin: 0; padding-left: 1.25rem; }
.prose li + li { margin-top: 6px; }
.prose .byline { color: var(--muted); font-size: 0.9rem; margin-bottom: 16px; }

/* Privacy policy: subheadings and the processors table (scrolls sideways on its own on a narrow phone) */
.prose h3 { font-size: 1rem; color: var(--heading); margin: 20px 0 6px; }
.prose ul + p, .prose p + ul, .table-wrap + p { margin-top: 10px; }
.table-wrap { overflow-x: auto; margin-top: 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.prose table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 0.9rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px; color: var(--text); border-top: 1px solid var(--border); }
.prose thead th { border-top: 0; color: var(--heading); background: var(--surface-alt); }
.prose tbody th { font-weight: 400; }

/* Footer */
.footer { padding: 24px 16px; padding-bottom: max(24px, env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 0.85rem; }
.footer p + p, .footer nav + p { margin-top: 6px; }
.footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 10px; }
.footer nav a { display: inline-flex; align-items: center; min-height: 48px; font-weight: 700; color: var(--link); overflow-wrap: anywhere; }
.noscript { text-align: center; padding: 16px; color: var(--heading); }

@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
