/* bltn.club · phone layer
   Loaded after app.css. Everything here is phone-first polish: app-style tab bar,
   sticky actions, bottom sheets, 44px touch targets, no iOS input zoom, safe areas. */

:root { --tabbar-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px); }

html { -webkit-text-size-adjust: 100%; }
a, button, summary, label, .chip { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* touch feedback instead of hover lifts on touch devices */
@media (hover: none) {
  .ev:hover, .feat:hover, .btn:hover, .chip:hover, .ev-row:hover, .tpl:hover, .board .note:hover { transform: none; box-shadow: inherit; }
  .ev:active, .feat:active { transform: scale(.985); transition: transform .12s; }
  .btn:active, .chip:active, .social:active { transform: scale(.96); }
}

/* bottom tab bar + event action bar: hidden on desktop */
.tabbar, .actionbar { display: none; }

@media (max-width: 760px) {
  body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); background-attachment: scroll; }
  .wrap, .wrap-mid, .wrap-narrow { width: calc(100% - 32px); }

  /* ---------- header ---------- */
  :root { --nav-h: 60px; }
  .nav .wrap { gap: 12px; }
  .brand { font-size: 23px; }
  .brand .mark { width: 28px; height: 28px; }
  .nav-right .btn.sm { min-height: 40px; }
  .nav-links { top: var(--nav-h); padding: 10px 16px 16px; gap: 2px; }
  .nav-links a { padding: 13px 14px; font-size: 16px; border-radius: 14px; }

  /* ---------- tab bar ---------- */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding: 0 6px var(--safe-b);
    background: rgba(246,241,232,.9); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid rgba(27,26,31,.08);
  }
  .tabbar a { height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--ink-3); }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a.on { color: var(--ink); }
  .tabbar a.on svg { stroke-width: 2.4; }
  .tabbar .avatar { width: 26px; height: 26px; font-size: 10px; }
  .tabbar a.on .avatar { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
  .tabbar .tab-post span.plus { width: 50px; height: 50px; margin-top: -18px; border-radius: 18px; display: grid; place-items: center; background: var(--splash); color: #fff; box-shadow: 0 8px 20px rgba(255,90,90,.4); }
  .tabbar .tab-post span.plus svg { width: 24px; height: 24px; }
  .tabbar .tab-post { color: var(--ink); gap: 4px; }

  /* ---------- touch targets + inputs ---------- */
  .btn { min-height: 46px; }
  .btn.sm { min-height: 40px; padding: 9px 15px; font-size: 14px; }
  .btn.icon { width: 46px; height: 46px; }
  .btn.lg { min-height: 54px; }
  input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search],
  input[type=datetime-local], input[type=date], select, textarea { font-size: 16px !important; min-height: 48px; }
  textarea { min-height: 110px; }
  .check input { width: 22px; height: 22px; }
  .switch { padding: 16px 0; }

  /* ---------- flash messages as a top toast ---------- */
  .flashes { left: 12px; right: 12px; max-width: none; top: calc(var(--nav-h) + 8px); }
  .flash { font-size: 15px; padding: 14px 16px; }

  /* ---------- typography + sections ---------- */
  .section { padding: 28px 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
  .section-head h2 { font-size: 27px; }
  .page-title { padding: 24px 0 6px; }
  .page-title h1 { font-size: 34px; }
  .page-title p { font-size: 15.5px; }
  .card.pad-lg { padding: 22px; }
  .card.pad { padding: 20px; }
  .stack-m { grid-template-columns: 1fr !important; gap: 18px !important; }
  .stack-m .btn { width: 100%; white-space: normal; }

  /* ---------- home ---------- */
  .hero { padding: 26px 0 8px; }
  .hero h1 { font-size: clamp(44px, 13vw, 58px); }
  .hero .lede { font-size: 16.5px; margin: 16px 0 22px; }
  .searchbar { padding: 5px 5px 5px 16px; }
  .searchbar .btn { min-height: 44px; padding: 10px 16px; }
  .searchbar input { min-height: 0; border: 0; padding: 8px 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 16px -16px 0; padding: 2px 16px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 10px 15px; font-size: 14px; scroll-snap-align: start; }
  .stats { gap: 22px; margin-top: 24px; }
  .stats div b { font-size: 26px; }
  .scroller { grid-auto-columns: 82%; gap: 14px; margin: 0 -16px; padding: 4px 16px 18px; scroll-padding: 0 16px; }
  .feat { border-radius: 24px; }
  .feat-body h2 { font-size: 28px; }
  .feat-body .btn { width: 100%; }
  .ev-grid { gap: 16px; }
  .pillars { gap: 14px; }
  .pillar { padding: 22px; }

  /* ---------- event cards ---------- */
  .ev h3 { font-size: 20px; }
  .ev .body { padding: 15px 16px 16px; }

  /* ---------- event rows: whole row is tappable ---------- */
  .ev-row { position: relative; grid-template-columns: 58px 1fr; gap: 14px; padding: 14px; border-radius: 18px; }
  .ev-row .day { padding: 9px 0; }
  .ev-row .day b { font-size: 24px; }
  .ev-row h3 { font-size: 17px; line-height: 1.25; }
  .ev-row h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
  .ev-row .meta { font-size: 13px; gap: 4px 12px; }
  .ev-row .meta span:nth-child(4) { display: none; }
  .ev-row .acts { position: relative; z-index: 2; grid-column: 1 / -1; }
  .ev-row .acts:has(> a.btn.soft:only-child) { display: none !important; }
  .ev-row .acts .btn { flex: 1; }
  .daygroup h2 { font-size: 16px; }

  /* ---------- events filters: one swipeable row ---------- */
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 14px -16px 22px; padding: 2px 16px 8px; scrollbar-width: none; gap: 8px; }
  .filters::-webkit-scrollbar { display: none; }
  .filters > * { flex: none; }
  .filters .searchbar { width: 72vw; max-width: none; }
  .filters .seg a { padding: 10px 14px; }
  .filters select { min-height: 44px; }

  /* ---------- calendar ---------- */
  .cal-head { margin: 0 0 14px; }
  .cal-head h1 { font-size: 28px; }
  .cal-nav { width: 100%; }
  .cal-nav .btn.splash { margin-left: auto; }
  .range-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
  .range-bar input[type=date] { width: 100%; }
  .range-bar > .btn { grid-column: 1 / -1; }
  .range-bar .quick { grid-column: 1 / -1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .range-bar .quick .chip { flex: none; }
  .cal { border-radius: 18px; }
  .cal .dow div { padding: 10px 0; text-align: center; font-size: 11px; letter-spacing: .04em; }
  .cal.dots .day { min-height: 58px; }
  .cal.dots .day.has::after { content: ""; position: absolute; inset: 3px; border-radius: 10px; background: color-mix(in srgb, var(--tangerine) 7%, transparent); pointer-events: none; }
  .legend { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 12px -16px 0; padding: 0 16px 4px; }
  .legend span { flex: none; }
  .agenda { margin-top: 28px; }
  .agenda-tabs { display: flex; width: 100%; }
  .agenda-tabs button { flex: 1; justify-content: center; padding: 11px 10px; font-size: 16px; }
  .sync-box { padding: 18px; }
  .sync-box .feed { width: 100%; justify-content: space-between; }

  /* day popup becomes a bottom sheet */
  .daypop { place-items: end stretch; padding: 0; }
  .daypop-card { width: 100%; max-height: 82vh; border-radius: 26px 26px 0 0; padding-bottom: var(--safe-b); animation: sheet .26s cubic-bezier(.2,.8,.2,1); }
  .daypop-card::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 99px; background: rgba(27,26,31,.18); margin: 10px auto 0; }
  .daypop-head { padding: 14px 18px 12px; }
  .daypop-head h2 { font-size: 24px; }
  .daypop-list { padding: 0 12px 16px; }
  .dp-ev { padding: 14px 14px 14px 0; }

  /* ---------- event page ---------- */
  .ev-hero { padding-top: 18px; gap: 22px; }
  .ev-hero > div:first-child { order: 2; }
  .ev-hero > .ev-poster { order: 1; border-radius: 22px; margin: 0 -4px; }
  .ev-hero h1 { font-size: 32px; margin: 10px 0 12px; }
  .ev-hero .actions { display: none; }
  .fact { padding: 13px 14px; }
  .fact a.map { display: inline-block; padding: 8px 0 2px; font-size: 14px; }
  .ev-body { padding: 24px 0 30px; gap: 24px; }
  .prose { font-size: 16px; }
  .host-tools .btn { flex: 1 1 auto; }
  .share-grid .social { min-height: 46px; }
  details.report summary { padding: 12px 0; font-size: 14px; }

  /* sticky action bar replaces the tab bar on event pages */
  body.has-actionbar { padding-bottom: calc(84px + var(--safe-b)); }
  .actionbar {
    display: flex; gap: 10px; align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 12px 14px calc(12px + var(--safe-b));
    background: rgba(255,255,255,.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(27,26,31,.08); box-shadow: 0 -10px 30px rgba(27,26,31,.08);
  }
  .actionbar form, .actionbar .grow { flex: 1; }
  .actionbar .btn.lg { width: 100%; min-height: 54px; }
  .actionbar .btn.icon { width: 54px; height: 54px; border-radius: 18px; flex: none; }
  .actionbar .btn.icon svg { width: 21px; height: 21px; }
  .actionbar .note { flex: 1; font-size: 14px; font-weight: 700; color: var(--ink-2); }
  .actionbar details.menu { position: static; }
  .actionbar details.menu[open]::before { content: ""; position: fixed; inset: 0; background: rgba(27,26,31,.4); z-index: -1; }
  .actionbar .menu-list { position: fixed; left: 10px; right: 10px; top: auto; bottom: calc(90px + var(--safe-b)); min-width: 0; border-radius: 22px; padding: 8px; animation: sheet .22s cubic-bezier(.2,.8,.2,1); }
  .actionbar .menu-list a { padding: 15px 14px; font-size: 16px; }

  /* ---------- profile / dashboard / attendees / admin ---------- */
  .prof-head { padding: 26px 20px; gap: 14px; }
  .prof-head::before { height: 6px; }
  .avatar.xl { width: 96px; height: 96px; font-size: 34px; }
  .prof-head .socials { justify-content: center; }
  .prof-head > div:last-child { width: 100%; }
  .prof-head > div:last-child .btn { width: 100%; }
  .kpis, .kpis[style] { grid-template-columns: repeat(3, 1fr) !important; gap: 8px; }
  .kpi { padding: 14px; border-radius: 16px; }
  .kpi b { font-size: 24px; }
  .kpi span { font-size: 11.5px; line-height: 1.25; display: block; }
  .dash-grid { gap: 24px; }
  .person { padding: 14px; }
  .arow .acts { flex-wrap: wrap; }
  .arow .acts form { flex: 1; }
  .arow .acts .btn { width: 100%; }

  /* ---------- auth ---------- */
  .auth { min-height: 0; }
  .auth .art { min-height: 0; padding: 30px 22px 28px; }
  .auth .art h2 { font-size: 34px; }
  .auth .art p { font-size: 15px; margin-top: 10px; }
  .auth .form { padding: 26px 16px 36px; }
  .auth h1 { font-size: 30px; }
  .roles { gap: 10px; }
  .role div { padding: 14px; }
  .role b { font-size: 16px; }

  /* ---------- forms ---------- */
  #eventForm .btn.lg, #eventForm .btn { flex: 1 1 100%; }
  .poster-pick { grid-template-columns: repeat(3, 1fr); }

  /* ---------- footer ---------- */
  .footer { margin-top: 36px; padding: 36px 0 30px; }
  .footer-grid { gap: 24px 16px; }
  .footer nav { gap: 12px; }
}

@keyframes sheet { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* very small phones */
@media (max-width: 360px) {
  .hero h1 { font-size: 40px; }
  .tabbar a { font-size: 10px; }
  .kpi b { font-size: 20px; }
}

/* grid/flex children must be allowed to shrink so swipe rows scroll instead of widening the page */
.hero-grid > *, .ev-hero > *, .ev-body > *, .dash-grid > *, .split > *, .feat > *, .auth > *, .footer-grid > * { min-width: 0; }
@media (max-width: 760px) { html, body { overflow-x: clip; } }

.pill { white-space: nowrap; }
@media (max-width: 760px) {
  .range-bar label { min-width: 0; }
  .range-bar input[type=date] { min-width: 0; width: 100%; padding: 10px 12px; }
  .chips { scroll-snap-type: none; }
  .stats div span { font-size: 12px; }
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .footer-brand { grid-column: 1 / -1; }
  .footer nav b { margin: 0 0 2px; }
  .footer nav a { padding: 3px 0; }
  .prof-head .pill { font-size: 12px; }
}
@media (max-width: 760px) {
  .field input[type=file] { min-height: 0; }
  form.card > div[style*="display:flex;gap:20px"] { flex-wrap: wrap; }
  form.card > div[style*="display:flex;gap:20px"] .field { min-width: 0; flex: 1 1 180px; }
}
@media (max-width: 760px) {
  .actionbar details.menu[open]::before { display: none; }
  .actionbar .menu-list { box-shadow: 0 -4px 40px rgba(27,26,31,.28), 0 0 0 1px rgba(27,26,31,.06); background: #fff; }
}
@media (max-width: 420px) { .range-bar { grid-template-columns: 1fr; } }
