/* ============================================================
   Delusion Index — Layout
   ------------------------------------------------------------
   Page-level structure: sticky header, masthead, app shell,
   filter row, detail view. Feed-first, mobile-first.
   ============================================================ */

.app {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 18px 120px;
}

@media (min-width: 768px) {
  .app { padding: 0 var(--s-6) 140px; }
}

/* ---------- Header ---------- */
header.bar {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(255, 244, 236, .78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(212, 38, 126, .14);
}

.bar-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.wordmark {
  font-family: var(--font-header);
  font-size: 26px;
  letter-spacing: .5px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.wordmark b { color: var(--pink-deep); font-weight: 400; font-family: var(--font-header); }
.wordmark sup {
  font-family: var(--font-accent);
  font-size: 13px;
  color: var(--coral);
  margin-left: 6px;
  letter-spacing: 0;
}

.spacer { flex: 1; }

/* CTA copy collapses on narrow viewports */
.cta-text { display: inline; }
.cta-mini { display: none; }
@media (max-width: 560px) {
  .cta-text { display: none; }
  .cta-mini { display: inline; }
}

/* Bell + avatar visibility is driven by body.logged-in */
.bell {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--r-pill);
  border: 1.5px solid rgba(212, 38, 126, .25);
  background: rgba(255, 255, 255, .7);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .15s, border-color .2s;
}
.bell:hover { border-color: var(--pink); transform: translateY(-1px); }
.bell svg { width: 19px; height: 19px; stroke: var(--pink-deep); fill: none; stroke-width: 1.8; }
.bell .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  background: var(--pink-deep);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--r-pill);
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--grad-delulu);
  color: #fff;
  font-family: var(--font-display);
  font-size: 16px;
  box-shadow: 0 6px 16px rgba(255, 79, 163, .4);
  cursor: default;
}

body.logged-in .bell,
body.logged-in .avatar { display: flex; }
body.logged-in .signin { display: none; }

/* ---------- Masthead ---------- */
.masthead { padding: 30px 4px 18px; text-align: center; }

.kicker {
  font-family: var(--font-accent);
  font-size: 20px;
  color: var(--coral);
  letter-spacing: .5px;
}

.masthead h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 9vw, 60px);
  line-height: .96;
  letter-spacing: -1px;
  margin: 6px 0 8px;
}
.masthead h1 em { font-style: normal; color: var(--pink-deep); }

.dek {
  color: var(--ink-soft);
  font-size: var(--t-sm);
  max-width: 440px;
  margin: 0 auto;
}

.issue-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0 6px;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-weight: 700;
}
.issue-rule::before,
.issue-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 38, 126, .4), transparent);
}

/* ---------- Filter chip row ---------- */
.filters {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 6px 2px 14px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

/* ---------- Feed list ---------- */
.feed { display: flex; flex-direction: column; gap: var(--s-5); }

/* ---------- Detail view ---------- */
#detail { display: none; }
.app.detail-on .feed-view { display: none; }
.app.detail-on #detail    { display: block; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--t-xs);
  color: var(--pink-deep);
  padding: 22px 0 6px;
}
.back-btn:hover { color: var(--pink); }

/* ============================================================
   MOBILE OVERRIDES (≤ 480px)
   Additive overrides only — nothing above is restructured.
   Goal: comfortable one-thumb use on a 375–430px phone.
   ============================================================ */
@media (max-width: 480px) {

  /* --- Header: tighter so it doesn't eat screen space --- */
  .bar-in {
    padding: 10px 14px;
    gap: var(--s-2);
  }

  .wordmark { font-size: 20px; }

  /* Hide the "Confess a delusion" text label; keep the button tiny */
  .cta-text { display: none; }
  .cta-mini { display: inline; }

  /* Bell and avatar slightly smaller */
  .bell, .avatar { width: 36px; height: 36px; }
  .bell svg      { width: 17px; height: 17px; }
  .avatar        { font-size: 14px; }

  /* --- Masthead: less vertical padding, smaller headline --- */
  .masthead { padding: 20px 4px 14px; }

  .masthead h1 {
    font-size: clamp(32px, 9vw, 52px);
  }

  .kicker { font-size: 17px; }

  .dek { padding: 0 4px; font-size: 14px; }

  .issue-rule { margin: 12px 0 4px; }

  /* --- App shell: less side-padding on phones --- */
  .app { padding: 0 14px 120px; }

  /* --- Filter chips: slightly tighter --- */
  .filters { gap: 6px; }

}
