/* =====================================================================
   Pollr — app.css
   A poll-first social network. Warm light theme, ink type, coral accent,
   ballot-green result bars. Bricolage Grotesque (display) + Hanken
   Grotesk (body). Mobile-first; centered feed column with side rails.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --ink:     #15140f;
  --paper:   #ffffff;
  --bg:      #f6f3ec;
  --muted:   #746e62;
  --line:    #e6e0d4;
  --accent:  #ff5436;   /* brand / actions */
  --accent-d:#e23c20;
  --green:   #1f9d5b;   /* result bars / positive */
  --green-l: #dcf2e6;
  --chip:    #efeadf;
  --radius:  16px;
  --shadow:  0 1px 2px rgba(21,20,15,.06), 0 6px 20px rgba(21,20,15,.05);
  --fd: 'Bricolage Grotesque', system-ui, sans-serif;
  --fb: 'Hanken Grotesk', system-ui, sans-serif;
  --maxw: 600px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--fb);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 64px; /* room for mobile tabbar */
}
a { color: inherit; }
button, input, textarea { font-family: inherit; }

/* ---------------- top nav ---------------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(246,243,236,.85);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 980px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 11px 18px;
}
.brand {
  font-family: var(--fd); font-weight: 800; font-size: 21px;
  letter-spacing: -.03em; text-decoration: none; flex: none;
}
.brand span { color: var(--accent); }
.search-wrap { flex: 1; max-width: 420px; }
.search-wrap input {
  width: 100%; border: 1.5px solid var(--line); background: var(--paper);
  border-radius: 99px; padding: 9px 16px; font-size: 14px; color: var(--ink);
}
.search-wrap input:focus { outline: none; border-color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------------- buttons ---------------- */
.btn {
  font-family: var(--fd); font-weight: 700; font-size: 14px; cursor: pointer;
  border: none; border-radius: 99px; padding: 9px 17px;
  background: var(--accent); color: #fff; transition: transform .08s, filter .12s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--ink); filter: none; }
.btn.green { background: var(--green); }
.btn.sm { padding: 6px 13px; font-size: 13px; }
.btn.full { width: 100%; }
.btn.subtle { background: var(--chip); color: var(--ink); }

/* ---------------- view container ---------------- */
.view { max-width: var(--maxw); margin: 0 auto; padding: 20px 16px 40px; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }
.feed-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 99px; padding: 4px; box-shadow: var(--shadow); }
.feed-tabs button {
  flex: 1; border: none; background: none; cursor: pointer; border-radius: 99px;
  padding: 8px 0; font-family: var(--fd); font-weight: 700; font-size: 13.5px; color: var(--muted);
}
.feed-tabs button.active { background: var(--ink); color: #fff; }

/* ---------------- avatar ---------------- */
.av {
  flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-family: var(--fd); font-weight: 800;
  overflow: hidden; user-select: none;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.s { width: 40px; height: 40px; font-size: 16px; }
.av.xs { width: 30px; height: 30px; font-size: 13px; }
.av.lg { width: 76px; height: 76px; font-size: 30px; border-radius: 22px; }

/* ---------------- poll card ---------------- */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 16px 14px; margin-bottom: 14px;
}
.poll-head { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.poll-head .who { line-height: 1.2; }
.poll-head .who b { font-family: var(--fd); font-weight: 700; font-size: 14.5px; }
.poll-head .who .sub { font-size: 12.5px; color: var(--muted); }
.poll-head .who a { text-decoration: none; }
.poll-head .who a:hover b { text-decoration: underline; }
.poll-head .menu { margin-left: auto; }

.q { font-family: var(--fd); font-weight: 700; font-size: 18px; letter-spacing: -.02em;
  line-height: 1.25; cursor: pointer; }
.q:hover { color: var(--accent-d); }
.note { font-size: 12.5px; color: var(--muted); margin: 3px 0 12px; }

.opts { display: flex; flex-direction: column; gap: 9px; }

/* voting state */
.opt {
  cursor: pointer; user-select: none; border: 1.5px solid var(--line);
  border-radius: 12px; padding: 12px 14px; background: var(--paper);
  display: flex; align-items: center; gap: 11px; font-weight: 600; font-size: 14.5px;
  transition: border-color .1s, background .1s;
}
.opt:hover { border-color: var(--ink); }
.opt .box { width: 20px; height: 20px; flex: none; border: 2px solid var(--muted);
  border-radius: 6px; display: grid; place-items: center; }
.opt.round .box { border-radius: 50%; }
.opt.on { border-color: var(--accent); background: #fff5f2; }
.opt.on .box { background: var(--accent); border-color: var(--accent); }
.opt.on .box::after { content: '✓'; color: #fff; font-size: 12px; font-weight: 800; }

/* results state */
.res { position: relative; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 14px; overflow: hidden; font-weight: 600; font-size: 14px; background: var(--paper); }
.res .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--green-l);
  transition: width .9s cubic-bezier(.2,.8,.2,1); z-index: 0; }
.res.mine .bar { background: #ffe3db; }
.res .row { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 10px; }
.res .nm { display: flex; align-items: center; gap: 7px; }
.res.mine .nm::before { content: '✓'; color: var(--accent); font-weight: 800; }
.res .pct { font-family: var(--fd); font-weight: 800; }

.poll-foot { display: flex; align-items: center; gap: 16px; margin-top: 13px;
  font-size: 13px; color: var(--muted); }
.poll-foot .act { display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  background: none; border: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.poll-foot .act:hover { color: var(--accent); }
.tag-closed { font-family: var(--fd); font-weight: 800; font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase; background: var(--ink); color: #fff; padding: 2px 8px; border-radius: 99px; }

/* ---------------- composer / forms ---------------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.input, .textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper);
  padding: 11px 13px; font-size: 15px; color: var(--ink);
}
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); }
.textarea { resize: vertical; min-height: 70px; }
.opt-edit { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-edit .input { flex: 1; }
.x { cursor: pointer; border: 1.5px solid var(--line); background: var(--paper);
  width: 38px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center; }
.x:hover { border-color: var(--accent); color: var(--accent); }
.checkrow { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px;
  cursor: pointer; margin: 4px 0 14px; }
.checkrow input { width: 18px; height: 18px; }

/* ---------------- auth / centered cards ---------------- */
.center-card { max-width: 380px; margin: 30px auto; }
.center-card h1 { font-family: var(--fd); font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.center-card .sub { color: var(--muted); font-size: 14px; margin: 6px 0 20px; }
.switch { text-align: center; font-size: 14px; color: var(--muted); margin-top: 16px; }
.switch a { color: var(--accent); font-weight: 700; text-decoration: none; cursor: pointer; }

/* ---------------- profile header ---------------- */
.phead { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 8px; }
.phead .info { flex: 1; }
.phead h1 { font-family: var(--fd); font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.phead .handle { color: var(--muted); font-size: 14px; }
.phead .bio { margin-top: 8px; font-size: 14.5px; }
.stats { display: flex; gap: 18px; margin: 14px 0 6px; font-size: 14px; }
.stats b { font-family: var(--fd); font-weight: 800; }
.section-label { font-family: var(--fd); font-weight: 800; font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin: 22px 0 12px; }

/* ---------------- comments ---------------- */
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment .body b { font-family: var(--fd); font-size: 14px; }
.comment .body .meta { font-size: 12px; color: var(--muted); margin-left: 6px; }
.comment .body p { font-size: 14.5px; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.comment-box { display: flex; gap: 10px; margin: 14px 0 20px; align-items: flex-start; }
.comment-box .textarea { min-height: 44px; }

/* ---------------- misc ---------------- */
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty .big { font-size: 34px; }
.empty p { margin-top: 8px; }
.results-group { margin-bottom: 26px; }
.menu-pop { position: absolute; right: 0; top: 26px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
  z-index: 10; min-width: 140px; }
.menu-pop button { display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 8px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; color: var(--ink); }
.menu-pop button:hover { background: var(--chip); }
.menu-pop button.danger { color: var(--accent-d); }
.iconbtn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 18px;
  width: 30px; height: 30px; border-radius: 50%; }
.iconbtn:hover { background: var(--chip); color: var(--ink); }

/* entrance animation */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card, .center-card { animation: rise .35s ease both; }

/* ---------------- mobile tabbar ---------------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); display: none;
  justify-content: space-around; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
.tabbar a { text-decoration: none; color: var(--muted); font-size: 22px; padding: 4px 18px; border-radius: 12px; }
.tabbar a.active { color: var(--accent); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(14px);
  background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; padding: 11px 18px;
  border-radius: 99px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 60; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 620px) {
  .search-wrap { display: none; }
  .tabbar { display: flex; }
  .nav-inner { padding: 10px 14px; }
}
@media (min-width: 900px) {
  .view { max-width: 620px; }
}
