/* HeyWYD: a feed that reads like a group text reacting to you.
   Palette: lilac paper, plum ink, one electric violet for "you", each friend brings their own color. */
:root {
  --paper: #F1EEF9; --surface: #FFFFFF; --ink: #1D1733; --muted: #6A6385;
  --you: #5A3BF0; --you-ink: #FFFFFF; --sun: #FFC83A; --line: #DAD4EC;
  --display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #15112A; --surface: #211B40; --ink: #EFECFA; --muted: #A39DBF; --line: #362E5C; --you: #7C63FF; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--body); }
main { max-width: 38rem; margin: 0 auto; padding: 1rem 1rem 4rem; }
a { color: inherit; text-underline-offset: 0.15em; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1 { font: 800 2rem/1.1 var(--display); letter-spacing: -0.02em; margin: 1.5rem 0 0.75rem; }
.lede { font-size: 1.125rem; max-width: 34rem; }
.lede.small { font-size: 1rem; color: var(--muted); }
.fine { font-size: 0.875rem; color: var(--muted); max-width: 34rem; }

.top { max-width: 38rem; margin: 0 auto; padding: 0.875rem 1rem; display: flex; justify-content: space-between; align-items: baseline; }
.brand { font: 800 1.375rem/1 var(--display); letter-spacing: -0.03em; text-decoration: none; }
.top nav a { margin-left: 1rem; font-weight: 500; text-decoration: none; }
.top nav a:hover { text-decoration: underline; }
.foot { text-align: center; color: var(--muted); font-size: 0.8125rem; padding: 0 1rem 2rem; }

.btn { display: inline-block; font: 600 1rem/1 var(--body); padding: 0.8rem 1.25rem; border-radius: 999px; border: 2px solid var(--you);
       background: var(--you); color: var(--you-ink); text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn:hover { filter: brightness(1.08); }

.flash, .error, .support { padding: 0.75rem 1rem; border-radius: 0.75rem; margin: 0.75rem 0; }
.flash { background: var(--surface); border: 1px solid var(--line); }
.error { background: #FFE3E0; color: #7A1D12; }
.support { background: var(--sun); color: #2A2100; font-size: 0.9375rem; }
.support a { font-weight: 600; }

/* forms */
.stack { display: grid; gap: 1rem; max-width: 24rem; margin-bottom: 1.5rem; }
.stack label { display: grid; gap: 0.3rem; font-weight: 500; }
.stack .check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=date], input:not([type]), textarea {
  font: inherit; color: inherit; background: var(--surface); border: 1.5px solid var(--line); border-radius: 0.75rem; padding: 0.7rem 0.85rem; width: 100%; }
textarea { resize: vertical; }

/* landing: the one orchestrated moment. Dots type, then the message lands. */
.hero { padding-top: 12vh; }
.hero-chat { position: relative; height: 9rem; margin-bottom: 1.5rem; }
.hero .hero-bubble { border-left: 0; position: absolute; left: 0; bottom: 0; font: 800 clamp(3rem, 14vw, 5.5rem)/1 var(--display); letter-spacing: -0.04em;
  background: var(--you); color: var(--you-ink); padding: 0.35em 0.5em 0.42em; border-radius: 0.55em 0.55em 0.55em 0.12em;
  animation: land 0.35s 1.5s cubic-bezier(.2,1.4,.4,1) both; transform-origin: 0 100%; }
.hero-typing { position: absolute; left: 0; bottom: 0; animation: leave 0.15s 1.45s both; }
@keyframes land { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes leave { to { opacity: 0; visibility: hidden; } }
.cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1.5rem 0; }

/* composer */
.composer { display: flex; gap: 0.6rem; align-items: flex-end; margin: 0.5rem 0 2rem; }
.composer textarea { font-size: 1.125rem; border-radius: 1.25rem; }

/* the feed */
.post { margin: 0 0 2.75rem; }
.msg { display: flex; gap: 0.6rem; align-items: flex-start; }
.post.mine > .msg { justify-content: flex-end; }
.post.mine > .msg .bubble-wrap { align-items: flex-end; }
.bubble-wrap { display: flex; flex-direction: column; align-items: flex-start; max-width: 85%; min-width: 0; }
.by { font-size: 0.8125rem; color: var(--muted); margin: 0 0.5rem 0.2rem; }
.by a { color: var(--ink); font-weight: 600; text-decoration: none; }
.by a:hover { text-decoration: underline; }
.by time { margin-left: 0.25rem; }
.ai { font-size: 0.6875rem; font-weight: 600; border: 1px solid currentColor; border-radius: 0.3rem; padding: 0 0.25rem; color: var(--muted); vertical-align: 0.08em; }

.bubble { background: var(--surface); padding: 0.6rem 0.9rem; border-radius: 1.15rem 1.15rem 1.15rem 0.3rem; overflow-wrap: anywhere;
          border-left: 3px solid var(--c, var(--line)); }
.bubble.big { font-size: 1.1875rem; line-height: 1.4; padding: 0.85rem 1.1rem; }
.post.mine > .msg .bubble, .msg.me .bubble { background: var(--you); color: var(--you-ink); border-left: 0; border-radius: 1.15rem 1.15rem 0.3rem 1.15rem; }
.msg.me { justify-content: flex-end; }
.msg.me .bubble-wrap { align-items: flex-end; }
.likes { font-size: 0.8125rem; color: var(--muted); margin: 0.3rem 0.5rem 0; }

.av { flex: none; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--c, var(--muted)); color: #fff;
      display: grid; place-items: center; font: 700 0.8125rem/1 var(--display); margin-top: 1.2rem; }
.avlink { text-decoration: none; flex: none; }

.thread { margin-top: 0.9rem; display: grid; gap: 0.7rem; }
.post.mine .thread { padding-left: 0; }
.msg.child { margin-left: 2.85rem; }
.msg.c .av { width: 1.9rem; height: 1.9rem; font-size: 0.6875rem; }
.replybtn, .cancelreply { background: none; border: 0; padding: 0.2rem 0.5rem; font: 500 0.8125rem var(--body); color: var(--muted); cursor: pointer; }
.replybtn:hover, .cancelreply:hover { color: var(--ink); text-decoration: underline; }

.typing { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--muted); }
.dots { display: inline-flex; gap: 0.25rem; background: var(--surface); padding: 0.6rem 0.75rem; border-radius: 1rem 1rem 1rem 0.3rem; }
.dots i { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--muted); animation: bob 1.1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; } .dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bob { 0%, 60%, 100% { transform: none; opacity: 0.45; } 30% { transform: translateY(-0.25rem); opacity: 1; } }

.cform { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; margin-top: 0.3rem; }
.cform textarea { flex: 1 1 12rem; border-radius: 1.15rem; padding: 0.5rem 0.85rem; min-height: 2.5rem; }
.cform button[type=submit] { font: 600 0.9375rem var(--body); background: none; border: 0; color: var(--you); cursor: pointer; padding: 0.6rem 0.4rem; }
.replying { flex-basis: 100%; margin: 0; font-size: 0.8125rem; color: var(--muted); }
.empty { color: var(--muted); padding: 2rem 0; }

/* friend picker */
.cast { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 0.5rem; }
.cast label { display: flex; gap: 0.75rem; align-items: center; background: var(--surface); border: 2px solid transparent; border-radius: 1rem; padding: 0.75rem 1rem; cursor: pointer; }
.cast label:has(input:checked) { border-color: var(--you); }
.cast .av { margin-top: 0; }
.cast input { width: 1.15rem; height: 1.15rem; accent-color: var(--you); flex: none; }
.cast .tag { color: var(--muted); font-size: 0.9375rem; }
.cast .temper { font-size: 0.8125rem; font-weight: 600; }
.sticky { position: sticky; bottom: 0; background: var(--paper); padding: 0.75rem 0; display: flex; justify-content: space-between; align-items: center; margin: 0; }

.profile .av { width: 4.5rem; height: 4.5rem; font-size: 1.5rem; margin: 1.5rem 0 0; }
.profile h1 { margin-top: 0.75rem; } .profile h1 .ai { font-size: 0.875rem; vertical-align: 0.5em; }
.handle { color: var(--muted); margin: -0.5rem 0 1rem; }
.profile dt { font-weight: 600; margin-top: 0.75rem; } .profile dd { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .hero-bubble, .hero-typing, .dots i { animation: none; }
  .hero-typing { display: none; }
}

/* ---- milestones 2 to 4 ---- */
h2 { font: 700 1.25rem/1.2 var(--display); letter-spacing: -0.01em; margin: 2.25rem 0 0.75rem; }
.av { overflow: hidden; background: var(--line); display: block; }
.av svg { width: 100%; height: 100%; display: block; }
.av.lg { width: 3.5rem; height: 3.5rem; margin-top: 0; }
.av.xl { width: 6rem; height: 6rem; margin: 1.5rem 0 0; }
.cast .av.lg { margin-top: 0; }
.badge { display: inline-block; min-width: 1.15rem; margin-left: 0.3rem; padding: 0 0.3rem; border-radius: 999px; background: var(--sun); color: #2A2100; font-size: 0.75rem; font-weight: 600; text-align: center; }
.badge[hidden] { display: none; }
.top nav a { margin-left: 0.85rem; }
.cacts { display: flex; gap: 0.25rem; align-items: center; }
.reportlink, .mini { font-size: 0.8125rem; color: var(--muted); padding: 0.2rem 0.5rem; }
.linkbtn { background: none; border: 0; padding: 0.2rem 0; font: 500 0.9375rem var(--body); color: var(--you); cursor: pointer; text-decoration: underline; }
.danger { color: #B3261E; } .btn.danger { background: #B3261E; border-color: #B3261E; color: #fff; }
.makeown { margin: 1rem 0; color: var(--muted); }
.stack.wide { max-width: 32rem; }
select { font: inherit; color: inherit; background: var(--surface); border: 1.5px solid var(--line); border-radius: 0.75rem; padding: 0.6rem 0.7rem; width: 100%; }
fieldset.lookbox { border: 1.5px solid var(--line); border-radius: 1rem; padding: 1rem; margin: 0; display: grid; gap: 1rem; grid-template-columns: auto 1fr; align-items: start; }
fieldset.lookbox legend { font-weight: 600; padding: 0 0.4rem; }
.preview { width: 7rem; height: 7rem; border-radius: 50%; position: sticky; top: 1rem; }
.lookgrid { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.lookgrid label { font-size: 0.875rem; }
@media (max-width: 26rem) { fieldset.lookbox { grid-template-columns: 1fr; justify-items: center; } .lookgrid { width: 100%; } }

.notifs { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; }
.notifs li { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.7rem 0.75rem; border-radius: 0.9rem; }
.notifs li.new { background: var(--surface); }
.notifs .av { margin-top: 0.1rem; }
.notifs a { text-decoration: none; flex: 1; }
.notifs .snip { display: block; color: var(--muted); font-size: 0.9375rem; }
.notifs time { display: block; color: var(--muted); font-size: 0.8125rem; }

.mem { background: var(--surface); border-radius: 1rem; padding: 0.9rem 1rem; margin: 0.6rem 0; }
.mem .av { float: left; margin: 0 0.6rem 0 0; width: 1.9rem; height: 1.9rem; }
.mem p { margin: 0.4rem 0; clear: both; }
details summary { cursor: pointer; font-weight: 500; margin: 0.5rem 0 1rem; }

.plans { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin: 1rem 0; }
.plan { background: var(--surface); border: 2px solid transparent; border-radius: 1.25rem; padding: 1.25rem; }
.plan.current { border-color: var(--you); }
.plan h2 { margin-top: 0; } .plan ul { padding-left: 1.1rem; margin: 0.75rem 0; }
.price { font: 700 1.5rem/1 var(--display); margin: 0; }

.tabs { display: flex; gap: 0.25rem; margin: 0 0 1.25rem; flex-wrap: wrap; }
.tabs a { padding: 0.45rem 0.9rem; border-radius: 999px; text-decoration: none; font-weight: 500; }
.tabs a[aria-current] { background: var(--ink); color: var(--paper); }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem 1rem; }
.stats dt { color: var(--muted); } .stats dd { margin: 0; font-weight: 600; text-align: right; }
.scroll { overflow-x: auto; } table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; } th { color: var(--muted); font-weight: 500; }
form.inline { display: flex; gap: 0.5rem; align-items: center; margin: 0 0 1rem; } td form.inline { margin: 0; } td select { padding: 0.3rem 0.4rem; width: auto; }
a.plain { text-decoration: none; }
.profile .bubble { margin: 0.5rem 0; max-width: 100%; }
.profile form { margin: 1rem 0; }
.top { gap: 0.75rem; flex-wrap: nowrap; }
.brand, .top nav { white-space: nowrap; }
.top nav a { margin-left: 0.7rem; font-size: 0.9375rem; }
.top nav a:first-child { margin-left: 0; }
input[type=number], input[type=search] { font: inherit; color: inherit; background: var(--surface); border: 1.5px solid var(--line); border-radius: 0.75rem; padding: 0.7rem 0.85rem; width: 100%; }
@media (max-width: 22rem) { .brand { font-size: 1.15rem; } .top nav a { margin-left: 0.5rem; font-size: 0.875rem; } }
