/* Gabzy HQ on a phone (10/11/2026): an installable web app that feels native on an iPhone.
   A tab bar for the places used every day plus More (the whole menu as a bottom sheet), a large serif title that
   folds into the top bar, the home reordered for the thumb (the move of the day first, the figures you swipe,
   the curve you scrub with a finger), safe areas for the notch and the home bar.
   Loaded last. Nothing here changes the desktop. */

:root { --tabbar-h: 58px; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
.tabbar, .tb-trial { display: none; }

@media (max-width: 900px) {
  /* ------------------------------------------------------------ tab bar */
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 32; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
    background: rgba(14, 13, 11, 0.76); backdrop-filter: blur(26px) saturate(1.6); -webkit-backdrop-filter: blur(26px) saturate(1.6);
    border-top: 1px solid rgba(239, 230, 214, 0.07); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  .tabbar > a, .tabbar > button { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    height: var(--tabbar-h); padding: 0; border: 0; background: none; color: var(--ink-3); font: 500 10.5px/1 var(--font); letter-spacing: 0.01em; transition: color 0.25s; }
  .tabbar .i { width: 23px; height: 23px; stroke-width: 1.7; transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s; }
  .tabbar [aria-current="page"] { color: var(--cream); font-weight: 600; }
  .tabbar [aria-current="page"] .i { color: #E2B88A; transform: translateY(-1px); }
  .tabbar > :active .i { transform: scale(0.86); }
  .tb-ind { position: absolute; z-index: 0; top: 6px; left: max(6px, env(safe-area-inset-left)); height: 32px; pointer-events: none; display: flex; justify-content: center;
    width: calc((100% - max(6px, env(safe-area-inset-left)) - max(6px, env(safe-area-inset-right))) / 5);
    transform: translateX(calc(var(--i, 0) * 100%)); transition: transform 0.55s cubic-bezier(0.2, 0.9, 0.2, 1); }
  .tb-ind::before { content: ""; width: 58px; height: 32px; border-radius: 999px;
    background: radial-gradient(70% 100% at 50% 35%, rgba(201, 146, 95, 0.36), rgba(201, 146, 95, 0.07) 72%, transparent);
    box-shadow: inset 0 0 0 1px rgba(226, 184, 138, 0.17), 0 6px 18px -8px rgba(201, 146, 95, 0.8); }
  .tb-n { position: absolute; top: 5px; left: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center;
    font: 700 10.5px/1 var(--font); color: #1A110A; background: linear-gradient(180deg, #E9C79E, #B98252); box-shadow: 0 0 0 2px rgba(14, 13, 11, 0.95); font-variant-numeric: tabular-nums; }
  [data-theme="light"] .tabbar { background: rgba(250, 248, 244, 0.84); border-top-color: var(--line); }
  [data-theme="light"] .tabbar [aria-current="page"] { color: var(--ink); }
  [data-theme="light"] .tabbar [aria-current="page"] .i { color: #8A5A38; }
  [data-theme="light"] .tb-n { box-shadow: 0 0 0 2px #FAF8F4; }

  /* room for the tab bar under every page */
  #view { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .content { padding: 18px max(16px, env(safe-area-inset-right)) 36px max(16px, env(safe-area-inset-left)); }
  #toast { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
  .cx .player { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); }
  .tr-chip { display: none !important; }

  /* ------------------------------------------------------------ top bar: clear at the top, glass once you scroll */
  .top { gap: 2px; padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    transition: background-color 0.3s, border-color 0.3s; }
  .top .menu-btn { display: none !important; }
  .top .crumbs { flex: 1; min-width: 0; transition: opacity 0.25s, transform 0.4s cubic-bezier(0.2, 0.9, 0.2, 1); }
  .top .crumbs b { font-size: 16.5px; font-weight: 650; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.big-title:not(.scrolled) .top .crumbs { opacity: 0; transform: translateY(8px); }
  html[data-theme="dark"]:not(.scrolled) .top { background: transparent; border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  html[data-theme="dark"].scrolled .top { background: rgba(11, 10, 9, 0.74); backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5); border-bottom-color: rgba(239, 230, 214, 0.06); }
  .top .btn.icon { width: 40px; height: 40px; }
  .top .btn[data-a="ask"] { width: 40px; height: 40px; padding: 0; margin-left: 4px; justify-content: center; border-radius: 999px; color: #F1D3B0;
    background: radial-gradient(circle at 50% 28%, rgba(226, 184, 138, 0.34), rgba(201, 146, 95, 0.1)); border: 1px solid rgba(226, 184, 138, 0.28); box-shadow: 0 8px 22px -12px rgba(201, 146, 95, 0.9); }
  [data-theme="light"] .top .btn[data-a="ask"] { color: #6E452A; }

  /* ------------------------------------------------------------ More: the whole menu as a bottom sheet */
  .side { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: auto; max-height: min(86vh, 780px); z-index: 45;
    border-radius: 26px 26px 0 0; transform: translateY(104%); transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.2, 1);
    padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.6); }
  [data-theme="dark"] .side { background: rgba(20, 18, 16, 0.94); border-right: 0; border-top: 1px solid rgba(239, 230, 214, 0.09); }
  .side.open { transform: none; }
  .side.drag { transition: none; }
  .side::before { content: ""; flex: none; display: block; width: 38px; height: 5px; margin: 9px auto 2px; border-radius: 3px; background: rgba(239, 230, 214, 0.24); }
  [data-theme="light"] .side::before { background: var(--line); }
  .side-top { padding: 8px 12px 6px; }
  .side-top .ws { display: none; }
  .side-top .search-btn { height: 44px; border-radius: 12px; font-size: 15px; }
  .side-top .search-btn .kbd { display: none; }
  .side .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 10px; }
  .side .nav-g { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; margin-bottom: 14px; }
  .side .nav-h { grid-column: 1 / -1; margin: 2px 4px 1px; padding: 0; }
  .side .nav a { min-height: 54px; margin: 0; padding: 8px 10px; gap: 10px; border-radius: 15px; font-size: 14.5px;
    background: rgba(239, 230, 214, 0.035); border: 1px solid rgba(239, 230, 214, 0.06); }
  [data-theme="light"] .side .nav a { background: var(--surface-2); border-color: var(--line-2); }
  .side .nav a .grow { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side .nav a:active { transform: scale(0.97); }
  .side-foot { padding: 10px 16px 12px; }
  .tb-trial { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--edge, var(--line)); background: rgba(239, 230, 214, 0.03);
    font: 400 13px/1.4 var(--font); color: var(--ink-3); }
  .tb-trial b { color: var(--ink); font-weight: 600; }

  /* ------------------------------------------------------------ Ask HQ: a sheet from the bottom */
  .drawer { top: calc(env(safe-area-inset-top) + 10px); width: 100vw; border-left: 0; border-radius: 22px 22px 0 0; overflow: hidden; animation: phoneSheet 0.45s cubic-bezier(0.2, 0.9, 0.2, 1); }
  .tr-log { left: 12px !important; right: 12px !important; width: auto !important; max-height: 70vh; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px) !important; }

  /* ------------------------------------------------------------ section pages */
  .sect-ph h1, .ph h1 { font-size: 34px; }
  .stabs { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
  .stabs::-webkit-scrollbar { display: none; }
}
@keyframes phoneSheet { from { transform: translateY(100%); } to { transform: none; } }

/* ------------------------------------------------------------ the home, held in one hand */
@media (max-width: 720px) {
  .dn { display: flex; flex-direction: column; gap: 12px; }
  .dn > * { margin: 0 !important; }
  .dn-r1 { display: contents; }
  .dn-h { order: 0; display: block; padding: 4px 0 6px; }
  .dn-next { order: 1; }
  .dn-kpis { order: 2; }
  .dn-r1 > .dn-card:not(.dn-next) { order: 3; }
  .dn-r2 { order: 4; }
  .dn-r3 { order: 5; }
  .dn-foot { order: 6; justify-content: center; padding-top: 4px; }
  .dn-row { gap: 12px; }

  .dn-h h1 { font-size: 42px; line-height: 0.98; letter-spacing: -0.01em; }
  .dn-h p { font-size: 15px; line-height: 1.5; margin-top: 10px; }
  .dn-h-r { margin-top: 14px; }
  .dn-h-r .btn { display: none; }

  /* the figures: swipe them, the next one peeks */
  .dn > .dn-kpis { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; overscroll-behavior-x: contain;
    margin: 0 -16px !important; padding: 2px 16px 4px; scrollbar-width: none; }
  .dn-kpis::-webkit-scrollbar { display: none; }
  .dn-kpi { flex: 0 0 min(78%, 310px); scroll-snap-align: start; border-radius: 20px; padding: 16px 16px 15px; }
  .dn-kv { font-size: 32px; }

  .dn-card { border-radius: 20px; padding: 16px; }
  .dn-big b { font-size: 28px; }
  .dn-ax { font-size: 11.5px; }
  .dn-plot { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
  .dn-tip { min-width: 140px; }

  .dn-next { padding: 20px 18px 18px; border-radius: 22px; }
  .dn-q { font-size: 31px; margin: 14px 0 10px; }
  .dn-angle { font-size: 14.5px; }
  .dn-acts { gap: 8px; padding-top: 18px; }
  .dn-acts .btn { flex: 1 1 0; justify-content: center; height: 44px; }
  .dn-acts .btn.pri { flex: 1 1 100%; height: 50px; font-size: 15.5px; border-radius: 14px; }

  .dn-li { min-height: 44px; padding: 9px 8px; font-size: 14px; }
  .dn-bl { font-size: 14px; }
  .dn-hero { font-size: 48px; }
}

/* ------------------------------------------------------------ touch */
@media (hover: none) {
  .btn:active, a.dn-li:active, .dn-kpi:active, .dn-office:active { transform: scale(0.97); transition: transform 0.12s; }
}
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="number"]), textarea, select { font-size: max(16px, 1rem) !important; }
  .cx .money input { font-size: 44px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .tb-ind, .side, .tabbar .i, .top .crumbs { transition: none; }
  .drawer { animation: none; }
}
/* a finger needs about 44 px: on a touch screen every button keeps its look, and its touch area grows around it */
@media (max-width: 900px) and (pointer: coarse) {
  :where(.btn, .seg > button) { position: relative; }   /* :where weighs nothing: a button placed elsewhere keeps its own position */
  .btn::before, .seg > button::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: max(100%, 44px); transform: translateY(-50%); }
}
