/* =====================================================================================
   v3: refreshed blue, motion, experts, people, mobile (hamburger, bottom tab bar,
   stacked tables). Loaded after main.css and apple.css.
   ===================================================================================== */
:root {
  --blue: #155eef;
  --blue-600: #1150d6;
  --blue-700: #0b3fae;
  --blue-900: #0a2463;
  --blue-50: #eef4ff;
  --blue-100: #dce7ff;
  --blue-200: #b8ceff;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --tabbar-h: 0px;
}
::selection { background: var(--blue-100); color: var(--ink); }
.btn { transition: background .2s, border-color .2s, color .2s, transform .15s var(--ease), box-shadow .2s; }
.btn:active { transform: scale(.97); }
.btn.arrow::after { transition: transform .2s var(--ease); display: inline-block; }
.btn.arrow:hover::after { transform: translateX(4px); }

/* ---------------------------------------------------------------- hamburger (3 lines → X) */
.burger { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: var(--bg-soft); cursor: pointer;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.burger span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--ink); transition: transform .25s var(--ease), opacity .2s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.site-header.scrolled { box-shadow: 0 6px 24px -12px rgba(10, 36, 99, .25); }

/* ---------------------------------------------------------------- motion */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes sheen { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
.hero h1, .hero .lede, .hero .actions, .hero .trust, .page-hero h1, .page-hero .lede, .page-hero .crumb { animation: rise .8s var(--ease) both; }
.hero .lede, .page-hero .lede { animation-delay: .08s; }
.hero .actions { animation-delay: .16s; }
.hero .trust { animation-delay: .24s; }
.hero-visual { animation: rise .9s .2s var(--ease) both; }
.hero-visual .float-card { animation: floaty 6s ease-in-out infinite; }
.hero-visual .float-card.a { animation-delay: -3s; }
.hero, .cta { background-size: 160% 160%; animation: sheen 14s ease-in-out infinite alternate; }
.reveal.pending { opacity: 0; transform: translateY(24px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: var(--d, 0s); }
a.card, .xcard, .step, .stat { transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; }
.step:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.content > * { animation: rise .45s var(--ease) both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.alert { animation: pop .35s var(--ease) both; }
.meter { height: 8px; border-radius: 999px; background: #eceef3; overflow: hidden; margin: 14px 0 8px; }
.meter i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--blue), #5b8cff); transition: width .9s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal.pending { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- experts on the website */
.xgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.xcard { display: flex; flex-direction: column; background: #fff; border: 1px solid rgba(0,0,0,.06); border-radius: 22px; overflow: hidden; text-decoration: none; color: var(--text); }
.xcard:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--blue-200); color: var(--text); }
.xphoto { display: block; aspect-ratio: 1 / 1; background: linear-gradient(140deg, var(--blue-50), var(--blue-100)); overflow: hidden; }
.xphoto img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease); }
.xcard:hover .xphoto img { transform: scale(1.04); }
.xinit { display: grid; place-items: center; width: 100%; height: 100%; font: 700 3.4rem var(--display); color: var(--blue); }
.xbody { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 22px; }
.xbody strong { color: var(--ink); font-size: 1.08rem; letter-spacing: -0.015em; }
.xhead { font-size: .9rem; color: var(--muted); line-height: 1.45; }
.xtags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.xtags span { font-size: .75rem; font-weight: 500; padding: 5px 10px; border-radius: 999px; background: var(--blue-50); color: var(--blue-700); }
.xprofile { display: grid; grid-template-columns: 220px 1fr; gap: 44px; align-items: center; }
.xphoto.lg { border-radius: 28px; box-shadow: var(--shadow-lg); animation: pop .7s var(--ease) both; }
.xprofile h1 { margin: 4px 0 10px; }
.xfacts { list-style: none; padding: 0; margin: 18px 0; display: flex; flex-wrap: wrap; gap: 10px 22px; color: var(--text); font-size: .95rem; }
.xfacts li { display: flex; align-items: center; gap: 8px; }
.xfacts svg { width: 18px; height: 18px; color: var(--blue); }
.xlinks { display: flex; gap: 8px; flex-wrap: wrap; }
.xdetail { display: grid; grid-template-columns: 1fr 340px; gap: 48px; align-items: start; }
.xdetail aside { display: grid; gap: 16px; position: sticky; top: 100px; }
.xdetail p { color: var(--text); line-height: 1.7; }
.xpubs { padding-left: 20px; display: grid; gap: 16px; }
.xpubs li { padding-left: 6px; }
.xpubs strong { display: block; color: var(--ink); line-height: 1.45; }
.xpubs span { font-size: .9rem; color: var(--muted); }

/* ---------------------------------------------------------------- people + expert workspace */
.person { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person > div { flex: 1; min-width: 0; }
.person .t { font-weight: 600; color: var(--ink); font-size: .93rem; }
.person .t a { color: var(--ink); text-decoration: none; }
.person .t a:hover { color: var(--blue); }
.person .m { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--bg-soft); color: var(--ink); display: grid; place-items: center; font: 600 .95rem var(--display); overflow: hidden; }
.avatar.expert { background: var(--blue-50); color: var(--blue); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xl { width: 96px; height: 96px; font-size: 2.2rem; margin: 0 auto 12px; background: linear-gradient(140deg, var(--blue-50), var(--blue-100)); color: var(--blue); }
.expert-preview { text-align: center; }
.expert-preview h3 { margin: 0 0 4px; }
.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row select { flex: 1; min-width: 0; }
fieldset.pick { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px 6px; margin: 0 0 18px; }
fieldset.pick legend { padding: 0 6px; font-weight: 600; font-size: .9rem; color: var(--ink); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 16px; max-height: 220px; overflow-y: auto; }
.pub.row { display: flex; gap: 12px; align-items: flex-start; }
.pub.row > div { flex: 1; }
.narrow { max-width: 820px; }

/* ---------------------------------------------------------------- app chrome: scrim + bottom tab bar */
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(10, 20, 40, .32); backdrop-filter: blur(2px); animation: fade .2s both; }
.tabbar { display: none; }

/* ================================================================ tablet + phone */
@media (max-width: 860px) {
  .burger { display: flex; }
  .nav-toggle { display: flex; background: var(--bg-soft); padding: 0; }
  .site-nav { top: 100%; border-radius: 0 0 22px 22px; padding: 10px 16px 20px; gap: 2px; }
  .site-nav.open { display: flex; animation: rise .28s var(--ease) both; }
  .site-nav a { padding: 13px 14px; border-radius: 12px; font-size: 1.02rem; }
  .site-nav .nav-cta .btn { justify-content: center; }
  .xprofile { grid-template-columns: 1fr; gap: 24px; justify-items: start; }
  .xphoto.lg { width: 160px; }
  .xdetail { grid-template-columns: 1fr; gap: 28px; }
  .xdetail aside { position: static; }

  /* app shell */
  .mobile-bar { position: sticky; top: 0; z-index: 50; padding: 10px 14px 10px 18px; padding-top: max(10px, env(safe-area-inset-top)); }
  .mobile-bar img { height: 28px; }
  .mobile-bar .burger { display: flex; }
  .sidebar { width: min(300px, 86vw); box-shadow: var(--shadow-lg); transition: transform .3s var(--ease); }
  .scrim:not([hidden]) { display: block; }
  :root { --tabbar-h: 84px; }
  .main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; z-index: 45; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.86); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px);
    border: 1px solid rgba(0,0,0,.06); border-radius: 26px; padding: 6px; box-shadow: 0 10px 34px -10px rgba(10, 36, 99, .28);
    justify-content: space-around; animation: rise .4s var(--ease) both; }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 7px; border-radius: 20px;
    color: var(--muted); text-decoration: none; font: 500 .7rem var(--font); background: none; border: 0; cursor: pointer; transition: background .2s, color .2s; }
  .tabbar svg { width: 23px; height: 23px; transition: transform .25s var(--spring); }
  .tabbar a.on, .tabbar button.on { color: var(--blue); background: var(--blue-50); }
  .tabbar a.on svg { transform: translateY(-1px) scale(1.06); }
  .tabbar a:active svg, .tabbar button:active svg { transform: scale(.88); }

  .topbar { padding-top: 20px; gap: 10px; }
  .topbar h1 { font-size: 1.55rem; }
  .topbar .acts { flex-wrap: wrap; }
  .content { padding-top: 14px; padding-bottom: 28px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .kpi { padding: 14px 16px; }
  .kpi .v { font-size: 1.4rem; }
  .kpi .s { font-size: .74rem; }
  .panel { margin-bottom: 14px; border-radius: 18px; }
  .panel-head { padding: 14px 16px; flex-wrap: wrap; }
  .panel-head form, .panel-head form input { width: 100%; }
  .panel-body { padding: 16px; }
  .proj-card, .pub, .doc, .ms, .person, .ledger, .doc-group { padding-left: 16px; padding-right: 16px; }
  details.inline > summary { padding: 14px 16px; }
  details.inline .form-inner { padding: 0 16px 16px; }
  .doc { grid-template-columns: 38px 1fr; }
  .doc .acts { grid-column: 1 / -1; flex-wrap: wrap; }
  .thread { max-height: 60vh; padding: 14px 16px; }
  .msg { max-width: 88%; }
  .composer { padding: 10px 12px; }
  .toolbar input, .toolbar form { width: 100%; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -18px; margin-right: -18px; padding: 0 18px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; }
  .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .seg a { white-space: nowrap; }
  input, select, textarea { font-size: 16px; } /* stops iOS zooming into fields */
  dl.facts { grid-template-columns: 96px 1fr; }

  /* tables become cards (labels added by main.js from the header row) */
  table.data th:nth-child(n+4), table.data td:nth-child(n+4) { display: table-cell; }
  table.data.stacked, table.data.stacked tbody, table.data.stacked tr, table.data.stacked td { display: block; width: 100%; }
  table.data.stacked thead { display: none; }
  table.data.stacked tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.data.stacked tr:last-child { border-bottom: 0; }
  table.data.stacked td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 5px 0; border: 0; text-align: right; }
  table.data.stacked td:first-child { display: block; text-align: left; padding-bottom: 8px; }
  table.data.stacked td[data-label]:not(:first-child)::before { content: attr(data-label); flex: none; color: var(--muted); font-size: .8rem; font-weight: 500; text-align: left; }
  table.data.stacked td:empty { display: none; }
  table.data.stacked td.num-col { white-space: normal; }
  table.data.stacked tr.click:hover td { background: none; }
}
@media (max-width: 600px) {
  .xgrid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .xbody { padding: 12px 14px 16px; }
  .xbody strong { font-size: .95rem; }
  .xhead { font-size: .8rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .xcard .xtags { display: none; }
  .fin-mini { grid-template-columns: 1fr 1fr; }
  .inline-row { flex-direction: column; align-items: stretch; }
  .wa-float { width: 52px; height: 52px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .page-hero { padding: 56px 0 40px; }
  .auth-card { padding: 30px 22px; }
}
@media print { .tabbar, .scrim { display: none !important; } }
.mobile-bar .burger { padding: 0; border-radius: 12px; width: 44px; height: 44px; }
/* grid columns may shrink below their content's width (long titles, emails, nowrap rows) */
.grid-2 > *, .xdetail > *, .kpis > * { min-width: 0; }
.panel-head h2 { min-width: 0; overflow-wrap: anywhere; }
.proj-card h3, .pub .t, .doc .t { overflow-wrap: anywhere; }
