/* OnlyShows 0.12.3: readable activity calendar and calmer mobile chrome. */

.profile-activity-calendar {
  width: 100%;
  min-width: 0;
}

.profile-activity-months,
.profile-activity-grid {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(var(--activity-weeks, 53), minmax(9px, 1fr));
  column-gap: 3px;
}

.profile-activity-months {
  height: 16px;
  margin-bottom: 6px;
  align-items: start;
  color: var(--on-surface-variant);
  font: 600 10px/1 var(--font-ui);
  white-space: nowrap;
}

.profile-activity-months span {
  grid-row: 1;
  justify-self: start;
}

.profile-activity-grid {
  grid-template-rows: repeat(7, 9px);
  grid-auto-flow: column;
  grid-auto-columns: unset;
  row-gap: 3px;
}

.profile-activity-scroll {
  box-sizing: border-box;
  padding-right: 0;
}

.personalize-dialog :is(.personalize-hint, .background-intro) {
  color: var(--on-surface-variant) !important;
  opacity: 1 !important;
}

.app-solid-icon {
  display: block;
  width: 1em;
  height: 1em;
  fill: currentColor;
}

@media (max-width: 719px) {
  :root {
    --mobile-nav-row-height: 58px;
    --mobile-database-row-height: 52px;
  }

  /* The calendar keeps useful square sizes on phones and scrolls as one unit. */
  .profile-activity-calendar {
    width: var(--activity-mobile-width, 475px);
    min-width: var(--activity-mobile-width, 475px);
  }

  .profile-activity-months,
  .profile-activity-grid {
    grid-template-columns: repeat(var(--activity-weeks, 53), 7px);
    column-gap: 2px;
  }

  .profile-activity-months {
    height: 15px;
    margin-bottom: 6px;
    font-size: 9px;
  }

  .profile-activity-grid {
    grid-template-rows: repeat(7, 7px);
    row-gap: 2px;
  }

  /* Home filters mirror the database filters: centered words, no glyph row. */
  .mobile-home-dock .mobile-filter-row > button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    text-align: center !important;
  }

  /* A single, solid bottom cut replaces the glassy floating web toolbar. */
  html body > .mobile-bottom-shell {
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    grid-template-rows: 0 var(--mobile-nav-row-height) !important;
    overflow: hidden !important;
    border: 0 !important;
    border-top: 1px solid color-mix(in srgb, var(--outline-variant) 72%, transparent) !important;
    border-radius: 22px 22px 0 0 !important;
    background: color-mix(in srgb, var(--surface-container-high) 94%, var(--primary) 6%) !important;
    box-shadow: 0 -8px 22px rgb(0 0 0 / 8%) !important;
    transform: translateY(0);
    opacity: 1;
    transition:
      transform 260ms cubic-bezier(.2, .8, .2, 1),
      opacity 180ms ease,
      grid-template-rows 280ms cubic-bezier(.2, .8, .2, 1) !important;
    will-change: transform;
  }

  html body.mobile-database-tab > .mobile-bottom-shell {
    grid-template-rows: var(--mobile-database-row-height) var(--mobile-nav-row-height) !important;
  }

  html body .mobile-bottom-shell .mobile-bottom-nav,
  html body .mobile-bottom-shell .mobile-bottom-nav.is-scroll-hidden,
  html[data-background="prism-mono"] body .mobile-bottom-shell .mobile-bottom-nav,
  html[data-background="prism-violet"] body .mobile-bottom-shell .mobile-bottom-nav {
    height: var(--mobile-nav-row-height) !important;
    min-height: var(--mobile-nav-row-height) !important;
    padding: 3px 8px 4px !important;
    gap: 4px !important;
    border: 0 !important;
    border-radius: 22px 22px 0 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html body.mobile-database-tab .mobile-bottom-shell .mobile-database-actions {
    min-height: var(--mobile-database-row-height) !important;
    padding: 5px 8px 2px !important;
    background: transparent !important;
  }

  .mobile-bottom-tab,
  .mobile-bottom-tab.active {
    height: 50px !important;
    min-height: 50px !important;
    padding: 3px 4px 4px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    border: 0 !important;
    border-radius: 16px !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: 0 !important;
    color: var(--on-surface-variant) !important;
    transform: translateY(-1px);
  }

  .mobile-tab-indicator,
  .mobile-bottom-tab.active .mobile-tab-indicator,
  .mobile-bottom-tab.is-active .mobile-tab-indicator,
  .mobile-bottom-tab[aria-current="page"] .mobile-tab-indicator {
    display: grid !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 24px !important;
    min-height: 24px !important;
    border-radius: 999px !important;
    place-items: center !important;
    background: transparent !important;
    color: inherit !important;
    transition: background-color 180ms ease, color 180ms ease !important;
  }

  .mobile-bottom-tab.active .mobile-tab-indicator,
  .mobile-bottom-tab[aria-current="page"] .mobile-tab-indicator {
    background: color-mix(in srgb, var(--primary) 16%, transparent) !important;
    color: var(--primary) !important;
  }

  .mobile-tab-indicator .app-solid-icon {
    width: 18px;
    height: 18px;
  }

  .mobile-tab-label {
    display: block !important;
    font-size: 10px !important;
    font-weight: 650 !important;
    line-height: 11px !important;
  }

  #mobileWorkspaceDock {
    bottom: calc(64px + env(safe-area-inset-bottom)) !important;
    transition: transform 260ms cubic-bezier(.2, .8, .2, 1), opacity 180ms ease !important;
    will-change: transform;
  }

  body.mobile-database-tab #mobileWorkspaceDock {
    bottom: calc(116px + env(safe-area-inset-bottom)) !important;
  }

  /* Keep scroll geometry immutable while the overlaid chrome moves. */
  body:not(.mobile-profile-tab) .library:not([hidden]) {
    bottom: 0 !important;
  }

  /* Profile is one stable surface; its settings live in one inset native card. */
  body.mobile-profile-tab .profile-dialog.mobile-tab-page[open],
  body.mobile-profile-tab .profile-dialog.mobile-tab-page[open] .insights-head,
  body.mobile-profile-tab .profile-dialog.mobile-tab-page[open] .insights-scroll {
    background: var(--surface) !important;
    animation: none !important;
    transition: none !important;
  }

  body.mobile-profile-tab .profile-dialog.mobile-tab-page[open]::after {
    content: none !important;
    display: none !important;
  }

  .profile-dialog .mobile-profile-hub {
    margin: 8px 0 22px !important;
    padding: 0 14px !important;
    overflow: hidden !important;
    border: 1px solid color-mix(in srgb, var(--outline-variant) 82%, transparent) !important;
    border-radius: 22px !important;
    background: var(--surface-container-low) !important;
  }

  .profile-dialog .mobile-profile-account,
  .profile-dialog .mobile-profile-actions button {
    min-height: 62px !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 78%, transparent) !important;
  }

  .profile-dialog .mobile-profile-actions {
    margin: 0 !important;
  }

  .profile-dialog .mobile-profile-actions button:last-child {
    border-bottom: 0 !important;
  }

  /* Inverse list direction: chrome leaves while browsing older cards. */
  body:not(.mobile-profile-tab) :is(.topbar, .hero, .mobile-workspace-heading),
  body.mobile-profile-tab .profile-dialog.mobile-tab-page .insights-head {
    transition: transform 260ms cubic-bezier(.2, .8, .2, 1), opacity 180ms ease !important;
    will-change: transform;
  }

  body.mobile-chrome-hidden > .mobile-bottom-shell {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(calc(100% + 8px)) !important;
  }

  body.mobile-chrome-hidden #mobileWorkspaceDock {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(150px) !important;
  }

  body.mobile-chrome-hidden:not(.mobile-profile-tab) :is(.topbar, .hero, .mobile-workspace-heading),
  body.mobile-chrome-hidden.mobile-profile-tab .profile-dialog.mobile-tab-page .insights-head {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-70px) !important;
  }

  html body.mobile-chrome-hidden:not(.mobile-profile-tab) #showGrid {
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-bottom-shell,
  #mobileWorkspaceDock,
  body :is(.topbar, .hero, .mobile-workspace-heading, .insights-head) {
    transition: none !important;
  }
}
